At 4/28/15 05:26 PM, Diki wrote:
Just noticed the C++ code is in your StackOverflow post. Derp. I'll take a look at it.
It seems like it boils down to having to clear() twice. The first time is inlined within the constructor, and that one creates an array I can't modify. The second clear is called the line after creating the stack, and at this point it works normally.
The cpp is the exact same at stack.push(0), so the issue is likely here (constructor + inline clear function):
Void Stack_obj::__construct()
{
{
Dynamic tmp = Dynamic( Array_obj<Dynamic>::__new());
this->arr = tmp;
this->length = (int)0;
}
;
return null();
}
//Stack_obj::~Stack_obj() { }
Dynamic Stack_obj::__CreateEmpty() { return new Stack_obj; }
hx::ObjectPtr< Stack_obj > Stack_obj::__new()
{ hx::ObjectPtr< Stack_obj > result = new Stack_obj();
result->__construct();
return result;}
Dynamic Stack_obj::__Create(hx::DynamicArray inArgs)
{ hx::ObjectPtr< Stack_obj > result = new Stack_obj();
result->__construct();
return result;}
Void Stack_obj::clear( ){
{
Dynamic tmp = Dynamic( Array_obj<Dynamic>::__new());
this->arr = tmp;
this->length = (int)0;
}
return null();
}
Edit: clear() is always inlined.