Closed Mikolaj closed 7 years ago
let
is a reserved word in strict mode: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar
The error is correct (though not the most helpful).
@ChadKillingsworth: either I don't understand or you don't. If let
is a reserved word, then why ccjs used it in its output? Remember, I'm compiling ccjs's output with ccjs.
This depends on input/output language levels. You'd also need to dig through and find out what the original input looked like. If the compiler is renaming to a reserved keyword, that would be a bug. If the original input uses a function parameter named let
that's a very different issue.
It's entirely possible for a previous compilation to be invalid input for a subsequent one depending on flags and language levels.
OK, I see. Both compilations were with exactly the same parameters --- as shown above. So the original files could not contain the same kind of error, or it would be caught already in the first compilation. But if an error of one kind, more benign (so benign that --jscomp_off="*"
supresses it successfully and also the code runs fine), may be transformed to a parsing error in the resulting JS, then indeed, that would explain the issue and I would be to blame for compiling an erroneous code to being with. But can a non-parsing error be transformed to a parsing error? And even if it is, is that a sensible behaviour?
But can a non-parsing error be transformed to a parsing error? And even if it is, is that a sensible behaviour?
Yes is the answer to both questions. Optimizations can transform code in non-trivial ways. So definitely suppressing an error could cause this.
OK, I trust you. Thank you.
The file for which the error manifests is this https://github.com/LambdaHack/lambdahack.github.io/releases/download/newestJS/all.ccbug.js
Commandline and log:
Compiler version is latest from yesterday.
The original file, before the first application of ccjs, is the output of ghcjs --- a compiler of Haskell to JS and the Haskell project is https://github.com/LambdaHack/LambdaHack/commit/4d84a69e1e734ce00bd3cff64cb889d1f9160e2a