JS: make JS parser to store function's name in AST. See KT-15475
This commit is contained in:
@@ -570,7 +570,7 @@ public class JsAstMapper {
|
|||||||
//
|
//
|
||||||
String fnNameIdent = fromFnNameNode.getString();
|
String fnNameIdent = fromFnNameNode.getString();
|
||||||
if (fnNameIdent != null && fnNameIdent.length() > 0) {
|
if (fnNameIdent != null && fnNameIdent.length() > 0) {
|
||||||
scopeContext.globalNameFor(fnNameIdent);
|
toFn.setName(scopeContext.globalNameFor(fnNameIdent));
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fromParamNode != null) {
|
while (fromParamNode != null) {
|
||||||
|
|||||||
@@ -4967,6 +4967,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
|||||||
doTest(fileName);
|
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")
|
@TestMetadata("if.kt")
|
||||||
public void testIf() throws Exception {
|
public void testIf() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/if.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/if.kt");
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fun box(): String {
|
||||||
|
return js("""
|
||||||
|
function foo() {
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
foo();
|
||||||
|
""")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user