JS: fix crash when js function contains assignment with bad LHS

Fix KT-20905
This commit is contained in:
Alexey Andreev
2017-10-23 16:07:26 +03:00
parent a11cf253df
commit a6e98c30d7
4 changed files with 14 additions and 7 deletions
@@ -341,18 +341,12 @@ public class IRFactory {
default:
// TODO: This should be a ReferenceError--but that's a runtime
// exception. Should we compile an exception into the code?
reportError("msg.bad.lhs.assign");
ts.reportSyntaxError("msg.bad.lhs.assign", null);
}
return new Node(TokenStream.ASSIGN, left, right, nodeOp, location);
}
private void reportError(String msgResource) {
String message = Context.getMessage0(msgResource);
ts.reportSyntaxError(message, null);
}
// Only needed to get file/line information. Could create an interface
// that TokenStream implements if we want to make the connection less
// direct.