[bug] Accessing Map with hscript from neko

62 views
Skip to first unread message

tecteun

unread,
Mar 9, 2015, 10:06:05 AM3/9/15
to haxe...@googlegroups.com
Hi all,

Found a possible bug in hscript/neko, 

It doesn't seem to be possible to access a Map<Type> object exposed through hscript on the neko platform.

static function main() 
{
var s:StringMap<String> = new StringMap<String>();
s.set("monkey", "banana");
//Works:
trace("neko only:");
trace(s.get("monkey"));
var interp = new Interp();
interp.variables.set("Reflect", Reflect );
interp.variables.set("trace", function(d) { trace(d); } );
interp.variables.set("s", s);
var parser:Parser = new Parser();
var program = parser.parseString("trace('neko from hscript:'); trace(s.get('monkey'));");
//Doesnt work:
interp.execute(program);
}

Anyone came across this one? Or maybe someone knows a good workaround for the issue?
Anyway, I've already tried using arrayaccess using [] square brackets, to no success.

Thanks for helping,

Regards

 

Nicolas Cannasse

unread,
Mar 9, 2015, 10:24:43 AM3/9/15
to haxe...@googlegroups.com
Le 09/03/2015 15:06, tecteun a écrit :
> Hi all,
>
> Found a possible bug in hscript/neko,
>
> It doesn't seem to be possible to access a Map<Type> object exposed
> through hscript on the neko platform.

Try compiling with -dce no

Best,
Nicolas

tecteun

unread,
Mar 9, 2015, 10:53:32 AM3/9/15
to haxe...@googlegroups.com
Yep, that works. I'm seriously having a deja-vu on this one ;)

I did not take into account that dce would strip the non referenced code.

Is there any other way to make the compiler force inclusion of the required code, using for example Compiler.include ?

Nicolas Cannasse

unread,
Mar 9, 2015, 1:00:37 PM3/9/15
to haxe...@googlegroups.com
Le 09/03/2015 15:53, tecteun a écrit :
> Yep, that works. I'm seriously having a deja-vu on this one ;)
>
> I did not take into account that dce would strip the non referenced code.
>
> Is there any other way to make the compiler force inclusion of the
> required code, using for example Compiler.include ?

By definition the compiler can't tell what will be used in your script.
So make sure to compile everything and use -dce no

Best,
Nicolas

Reply all
Reply to author
Forward
0 new messages