JS: do not generate break for top level return during inline
This commit is contained in:
+6
@@ -35,6 +35,12 @@ public class InlineSizeReductionTestGenerated extends AbstractInlineSizeReductio
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/inlineSizeReduction/cases"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("lastBreak.kt")
|
||||
public void testLastBreak() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/inlineSizeReduction/cases/lastBreak.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("oneTopLevelReturn.kt")
|
||||
public void testOneTopLevelReturn() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("js/js.translator/testData/inlineSizeReduction/cases/oneTopLevelReturn.kt");
|
||||
|
||||
@@ -104,8 +104,8 @@ public class DirectiveTestUtils {
|
||||
String countStr = arguments.getNamedArgument("count");
|
||||
int expectedCount = Integer.valueOf(countStr);
|
||||
|
||||
JsNode scope = AstSearchUtil.getFunction(ast, functionName);
|
||||
List<T> nodes = collectInstances(klass, scope);
|
||||
JsFunction function = AstSearchUtil.getFunction(ast, functionName);
|
||||
List<T> nodes = collectInstances(klass, function.getBody());
|
||||
int actualCount = 0;
|
||||
|
||||
for (T node : nodes) {
|
||||
@@ -138,6 +138,8 @@ public class DirectiveTestUtils {
|
||||
|
||||
private static final DirectiveHandler COUNT_VARS = new CountNodesDirective<JsVars.JsVar>("CHECK_VARS_COUNT", JsVars.JsVar.class);
|
||||
|
||||
private static final DirectiveHandler COUNT_BREAKS = new CountNodesDirective<JsBreak>("CHECK_BREAKS_COUNT", JsBreak.class);
|
||||
|
||||
private static final DirectiveHandler HAS_INLINE_METADATA = new DirectiveHandler("CHECK_HAS_INLINE_METADATA") {
|
||||
@Override
|
||||
void processEntry(@NotNull JsNode ast, @NotNull ArgumentsHelper arguments) throws Exception {
|
||||
@@ -166,6 +168,7 @@ public class DirectiveTestUtils {
|
||||
FUNCTIONS_HAVE_SAME_LINES,
|
||||
COUNT_LABELS,
|
||||
COUNT_VARS,
|
||||
COUNT_BREAKS,
|
||||
HAS_INLINE_METADATA,
|
||||
HAS_NO_INLINE_METADATA
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user