google / traceur-compiler

Traceur is a JavaScript.next-to-JavaScript-of-today compiler
Apache License 2.0
8.17k stars 578 forks source link

Cannot read property 'reportError' of null due to VariableBinder #2081

Open guybedford opened 8 years ago

guybedford commented 8 years ago

This is a bit of an obscure error, but in the name of debugging experience worth mentioning.

Instead of getting a code error, the error thrown is Cannot read property 'reportError' of null on this line - https://github.com/google/traceur-compiler/blob/master/src/semantics/Scope.js#L24

I'm not sure what the underlying error was for this, but it is because a null argument is passed in https://github.com/google/traceur-compiler/blob/master/src/semantics/VariableBinder.js#L45 instead of a valid reporter.

arv commented 8 years ago

Did you try with --validate? When turned on it validated the parse tree after each transformation. It seems likely that one of the transformations generates an invalid tree.