ericmckean / traceur-compiler

Automatically exported from code.google.com/p/traceur-compiler
Apache License 2.0
0 stars 0 forks source link

inheriting from a later declared class throws generic TypeError #197

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Go to the online repl: http://traceur-compiler.googlecode.com/

Insert this:

let A = class extends C {

}

and traceur will not compile it, complaining that 'C is not defined', which is 
fine.

But if you insert this instead and reload to clear the environment

let A = class extends C {

}

let C = class {}

traceur will compile it without warnings, and executing the script will result 
in a generic TypeError with no description. I guess from javascript semantics 
this is a correct behaviour but at least some more info in the TypeError would 
help tracking the problem.

What version of the product are you using? On what operating system?

Ubuntu 12.04, Chromium 23.0.1271.97

Original issue reported on code.google.com by david.le...@gmail.com on 4 Feb 2013 at 6:42

GoogleCodeExporter commented 9 years ago
It is correct that this should not work but the error should really be a 
reference error but without better let support that is not going to work.

In Chrome you can enable let by visiting chrome://flags and turn on 
"Experimental JavaScript". After that you can try the following in the repl:

// Options: --block-binding=parse

'use strict';

let D = class extends C {}
let C = class {}

Now you will get a "ReferenceError: C is not defined"

Original comment by arv@google.com on 4 Feb 2013 at 2:27

GoogleCodeExporter commented 9 years ago
Also see bug 198 which is really the cause of this bug.

Original comment by arv@google.com on 4 Feb 2013 at 2:30