JS: make JS parser to store function's name in AST. See KT-15475

This commit is contained in:
Alexey Andreev
2017-01-11 15:04:37 +03:00
parent a016147a79
commit f33d421bab
3 changed files with 15 additions and 1 deletions
@@ -570,7 +570,7 @@ public class JsAstMapper {
//
String fnNameIdent = fromFnNameNode.getString();
if (fnNameIdent != null && fnNameIdent.length() > 0) {
scopeContext.globalNameFor(fnNameIdent);
toFn.setName(scopeContext.globalNameFor(fnNameIdent));
}
while (fromParamNode != null) {
@@ -4967,6 +4967,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
doTest(fileName);
}
@TestMetadata("functionName.kt")
public void testFunctionName() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/functionName.kt");
doTest(fileName);
}
@TestMetadata("if.kt")
public void testIf() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/if.kt");
+8
View File
@@ -0,0 +1,8 @@
fun box(): String {
return js("""
function foo() {
return "OK";
}
foo();
""")
}