google / traceur-compiler

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

Bug updating from 0.0.88 #1952

Closed guybedford closed 9 years ago

guybedford commented 9 years ago

I've just updated from 0.0.88 to 0.0.89 / 0.0.90 and am getting the following bug when parsing ES5:

TypeError: Cannot read property 'reportError' of null
    at reportDuplicateVar (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:5628:13)
    at Scope.addVar (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:5650:11)
    at Scope.addBinding (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:5642:16)
      at ScopeChainBuilder.declareVariable (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:6018:20)
      at ScopeChainBuilder.visitBindingIdentifier (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:5955:14)
      at BindingIdentifier.visit (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:6898:17)
      at ScopeChainBuilder.ParseTreeVisitor.visitAny (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:4853:22)
      at ScopeChainBuilder.ParseTreeVisitor.visitVariableDeclaration (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:5244:14)
      at VariableDeclaration.visit (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:8761:17)
      at ScopeChainBuilder.ParseTreeVisitor.visitAny (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:4853:22)
      at ScopeChainBuilder.ParseTreeVisitor.visitList (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:4861:18)
      at ScopeChainBuilder.ParseTreeVisitor.visitVariableDeclarationList (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:5249:14)
      at ScopeChainBuilder.visitVariableDeclarationList (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:5952:101)
      at VariableDeclarationList.visit (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:8780:17)
      at ScopeChainBuilder.ParseTreeVisitor.visitAny (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:4853:22)
      at ScopeChainBuilder.ParseTreeVisitor.visitVariableStatement (/Users/guybedford/Projects/traceur-compiler/bin/traceur.js:5252:14)
...

I will follow-up here soon when I've traced down the exact statement causing the issue. But if you have any ideas in the mean time do let me know.

arv commented 9 years ago

Looks like the error reporter is null. We mad some changes to the transformer to always pass the options object into the constructor and that lead to some changes which might have cause your existing code to no longer pass the right arguments.

guybedford commented 9 years ago

Right, yes so it was a bug in the error reporter combined with a bug in the code. Fixed and working now, although would be good to know how to avoid the error reporter issue.