mozilla / rhino

Rhino is an open-source implementation of JavaScript written entirely in Java
https://rhino.github.io
Other
4.19k stars 851 forks source link

throws CodeGenerator NPE where I expected a JS ReferenceError #110

Open oberhamsi opened 11 years ago

oberhamsi commented 11 years ago

I'm running current git master. This is the simplest testcase I could find:

[foo.bar.id] = true

(I noticed that when I remove the last property access - [foo.bar] = true - I get a ReferenceError as expected)

~/rhino$ java -jar build/rhino1_7R5pre/js.jar -opt -1
Rhino 1.7 release 5 PRERELEASE 2013 02 26
js> [foo.bar.id] = true;
Exception in thread "main" java.lang.NullPointerException
at org.mozilla.javascript.CodeGenerator.visitExpression(CodeGenerator.java:497)
at org.mozilla.javascript.CodeGenerator.visitExpression(CodeGenerator.java:632)
at org.mozilla.javascript.CodeGenerator.visitExpression(CodeGenerator.java:704)
at org.mozilla.javascript.CodeGenerator.visitExpression(CodeGenerator.java:527)
at org.mozilla.javascript.CodeGenerator.visitExpression(CodeGenerator.java:959)
at org.mozilla.javascript.CodeGenerator.visitExpression(CodeGenerator.java:527)
at org.mozilla.javascript.CodeGenerator.visitExpression(CodeGenerator.java:959)
at org.mozilla.javascript.CodeGenerator.visitStatement(CodeGenerator.java:383)
at org.mozilla.javascript.CodeGenerator.visitStatement(CodeGenerator.java:276)
at org.mozilla.javascript.CodeGenerator.generateICodeFromTree(CodeGenerator.java:113)
at org.mozilla.javascript.CodeGenerator.compile(CodeGenerator.java:83)
at org.mozilla.javascript.Interpreter.compile(Interpreter.java:194)
at org.mozilla.javascript.Context.compileImpl(Context.java:2377)
at org.mozilla.javascript.Context.compileString(Context.java:1335)
at org.mozilla.javascript.Context.compileString(Context.java:1324)
at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:491)
at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:176)
at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:100)
at org.mozilla.javascript.Context.call(Context.java:489)
at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:504)
at org.mozilla.javascript.tools.shell.Main.exec(Main.java:158)
at org.mozilla.javascript.tools.shell.Main.main(Main.java:136)
p-bakker commented 3 years ago

Due to Cannot invoke "org.mozilla.javascript.Node.getType()" because "node" is null

Still happens on master