Fix translation of labels with non-identifier names in JS BE

See KT-18027
This commit is contained in:
Alexey Andreev
2017-05-25 16:20:32 +03:00
parent 9375a1d984
commit 4bb1130f3f
7 changed files with 37 additions and 22 deletions
@@ -665,7 +665,7 @@ public class JsAstMapper {
private JsLabel mapLabel(Node labelNode) throws JsParserException {
String fromName = labelNode.getFirstChild().getString();
JsName toName = scopeContext.enterLabel(fromName);
JsName toName = scopeContext.enterLabel(fromName, fromName);
Node fromStmt = labelNode.getFirstChild().getNext();
JsLabel toLabel = new JsLabel(toName);
@@ -49,8 +49,8 @@ class ScopeContext(scope: JsScope) {
exitScope()
}
fun enterLabel(ident: String): JsName =
(currentScope as JsDeclarationScope).enterLabel(ident)
fun enterLabel(ident: String, outputName: String): JsName =
(currentScope as JsDeclarationScope).enterLabel(ident, outputName)
fun exitLabel() =
(currentScope as JsDeclarationScope).exitLabel()