-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
tl,dr: I'm getting function let() in my advanced compilation output, which is breaking runtime on older browsers.
One of my project's target platform is an old browser not permitting the "let" keyword e.g. as a function name, and our build intermittently fails at runtime in this browser with "Unexpected strict mode reserved word".
The latest case was in this line of output:
...function let(e,R,Z,V){...
Here's how we're configuring the build (we use the Java API directly). I'm already trying to explicitly avoid let, having been unable to find a place in the Closure Compiler source where you already do this:
RandomNameGenerator rng = new RandomNameGenerator(new Random(buildRevision.hashCode()));
rng.reset(new HashSet<>(Arrays.asList("break", "case", "catch", "class", "const",
"continue", "debugger", "default", "delete", "do", "else", "export", "extends",
"finally", "for", "function", "if", "import", "in", "instanceof", "new", "return",
"super", "switch", "this", "throw", "try", "typeof", "var", "void", "while", "with",
"yield", "enum", "implements", "interface", "let", "package", "private",
"protected", "public", "static", "await", "abstract", "boolean", "byte", "char",
"double", "final", "float", "goto", "int", "long", "native", "short",
"synchronized", "throws", "transient", "volatile")), "", null);
options.setNameGenerator(rng);
I'm assuming that
NameGenerator.reset()
is being called somewhere, and my preferences are being overwritten/cleared.
Is there another way to prevent reserved words being used as names?
From https://groups.google.com/forum/#!topic/closure-compiler-discuss/QmKBuR2kJ6s