[js] Variable with same name as package, bug

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[js] Variable with same name as package, bug

Viktor Hesselbom-2
If you, when targeting the JavaScript-target, create a local variable with the same name as the package it will compile but generate an error on runtime. This might be expected but then shouldn't the compiler complain?

test/Main.hx:
package test;
class Main
{
static function method ()
{
var test = Main.method2 ();
}
static function method2 ()
return 0
static function main ()
method ()
}

Compile with:
haxe -js bin.js -main test.Main -debug

The compiled line where the error appears looks like this:
var test = test.Main.method2();

And the error I get is "Script error."

Best,
Viktor

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [js] Variable with same name as package, bug

Nicolas Cannasse
Le 12/09/2011 23:35, Viktor Hesselbom a écrit :
> If you, when targeting the JavaScript-target, create a local variable
> with the same name as the package it will compile but generate an error
> on runtime. This might be expected but then shouldn't the compiler complain?

Ouch, this is not supposed to happen. Please submit it on
http://code.google.com/p/haxe/issues so it gets fixed quickly.

Best,
Nicolas

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [js] Variable with same name as package, bug

Quickform | Marcus Bergstrom
In reply to this post by Viktor Hesselbom-2
Wow, nice find!

Marcus Bergstrom
[hidden email]

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [js] Variable with same name as package, bug

Viktor Hesselbom-2
Reported! http://code.google.com/p/haxe/issues/detail?id=498 :)

Best,
Viktor

--
haXe - an open source web programming language
http://haxe.org