deltaluca / nape

Haxe/AS3 Physics Engine
http://napephys.com
Other
542 stars 77 forks source link

Invalid null expression in Space#sleepArbiters() with latest Haxe #92

Closed Gama11 closed 9 years ago

Gama11 commented 9 years ago
/home/travis/haxe/lib/nape/2,0,16/zpp_nape/space/Space.hx:4815: characters 27-37 : Invalid null expression: null.begin
/home/travis/haxe/lib/nape/2,0,16/zpp_nape/space/Space.hx:4837: characters 35-45 : Invalid null expression: null.begin
/home/travis/haxe/lib/nape/2,0,16/zpp_nape/space/Space.hx:4849: characters 31-41 : Invalid null expression: null.begin
/home/travis/haxe/lib/nape/2,0,16/zpp_nape/space/Space.hx:4864: characters 27-37 : Invalid null expression: null.begin
/home/travis/haxe/lib/nape/2,0,16/zpp_nape/space/Space.hx:4886: characters 35-45 : Invalid null expression: null.begin
/home/travis/haxe/lib/nape/2,0,16/zpp_nape/space/Space.hx:4898: characters 31-41 : Invalid null expression: null.begin
/home/travis/haxe/lib/nape/2,0,16/zpp_nape/space/Space.hx:5564: characters 27-37 : Invalid null expression: null.begin
/home/travis/haxe/lib/nape/2,0,16/zpp_nape/space/Space.hx:5576: characters 35-45 : Invalid null expression: null.begin
/home/travis/haxe/lib/nape/2,0,16/zpp_nape/space/Space.hx:5588: characters 31-41 : Invalid null expression: null.begin
/home/travis/haxe/lib/nape/2,0,16/zpp_nape/space/Space.hx:5603: characters 27-37 : Invalid null expression: null.begin
/home/travis/haxe/lib/nape/2,0,16/zpp_nape/space/Space.hx:5615: characters 35-45 : Invalid null expression: null.begin
/home/travis/haxe/lib/nape/2,0,16/zpp_nape/space/Space.hx:5627: characters 31-41 : Invalid null expression: null.begin

There's several null.begin() calls in that function:

var fst=null!=null;
{
    if(fst&&arbite==null){
        fst=false;
        arbite=null.begin();
        arbs=null;
        pre=null;
    }
};

I'm surprised Haxe used to allow that.

deltaluca commented 9 years ago

blah, I don't want to have to think what might be involved to remove all these from the generated code. If you see, you'll notice the code in this if statement can never execute since fst is guaranteed to be false.

Gama11 commented 9 years ago

Yeah, it still makes sense that Haxe wouldn't allow this though.

A simple solution would be to remove the offending lines manually from the generated .hx source? It's just those few in Space.hx.

deltaluca commented 9 years ago

Meh, i'd rather not do that sort of patching.

However, i'm totally fine with adding a compile step that automatically comments that stuff out ;)

deltaluca commented 9 years ago

Hopefully fixed (haxelib updated).

Gama11 commented 9 years ago

Wow, that was quick. :+1:

Seems to be fixed now, yeah.

MSGhero commented 9 years ago

What did haxe do to make the source code change? Like right when I installed git haxe, nape's source changed.

deltaluca commented 9 years ago

It didn't. It's just that haxe used to allow it. (It's code which would obviously throw an exception at runtime, but was never executed since it's in an if (false) but haxe now prevents it being compiled at all).