17th loop of "let foo = '';" throws ReferenceError

Jesse Schulman jesse at dreamtsoft.com
Fri Mar 23 21:48:43 UTC 2018


This has been tested and is happening on java 9 and 10, to reproduce:

import jdk.nashorn.api.scripting.NashornScriptEngine;
import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
import jdk.nashorn.api.scripting.ScriptObjectMirror;

public class LetReproducer {

    public static void main(String[] args) {
        NashornScriptEngineFactory factory = new
NashornScriptEngineFactory();
        NashornScriptEngine engine = (NashornScriptEngine)
factory.getScriptEngine(new String[]{"--no-java", "-strict",
                 "--language=es6"});
        ScriptObjectMirror bindings = (ScriptObjectMirror)
engine.createBindings();
        for (int i = 0; i < 17; i++) {
            try {
                bindings.eval("let foo = '';\n");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}


Thanks,
Jesse


More information about the nashorn-dev mailing list