Closed Type1J closed 9 years ago
Hey, I'm using hscript 2.0.3 and latest dconsole repo, can you give me an example on how this happens?
I just tried the version in git, and there were no problems. I do have some comments, though:
The problem would have occurred in DCCommand.hx on line 89. It doesn't occur because this line has been changed to use execute() instead of exprReturn() I assume that the internal state reset is no longer a problem. However, as you can see, the comment on line 88 doesn't reflect this change:
// using exprReturn instead of execute to skip interp internal state reset.
var result = hScriptInterp.execute(program);
Also, due to this change, I think that you might be able to remove line 29:
@:access(hscript.Interp)
The version in git has a version number of 4.4.1, but the last haxelib release was 4.2.0, and that version has the crash when using hscript 2.0.3, so please release to haxelib soon.
By the way, thanks for making this great library!
Okay, I'll pack the haxelib version until monday, thanks for the heads-up. And yes, execute is used and works well since hscript 2.0.3, @7-by found it.
Because the private function exprReturn() is used, internal state to hscript.Interp is never initialized.
To fix this problem, DConsole must call execute() on the hscript.Interp at least once before calling exprReturn().
A function that doesn't reset the internal state of hscript.Interp may be exposed soon due to https://github.com/HaxeFoundation/hscript/issues/18 , but calling execute() at least once will fix DConsole for newer versions of hscript in the meantime.