functioncall in stacktrace missing

Issue #16 resolved
Fabian Maurer created an issue

Using MT 0.3.3. Following code:

function func1()
    return func2();
end

function func2()
    nothing = nothing + 1;
end

func1();

throws the following error:

Exception: attempt to perform arithmetic on a nil value
[00:55:46 INFO]: Client> Stack traceback:
[00:55:46 INFO]: Client>   ..\..\..\..\Mobtalker\Scripts-Own\darkshadow44\Creeper\Cupa\Cupa.script:999: in function 'func2'
[00:55:46 INFO]: Client>   ..\..\..\..\Mobtalker\Scripts-Own\darkshadow44\Creeper\Cupa\Cupa.script:1002: in function 'main'
[00:55:46 INFO]: Client>    at mobtalkerscript.v2.instruction.MtsArithmeticInstruction.coerce(Unknown Source)
[00:55:46 INFO]: Client>    at mobtalkerscript.v2.instruction.MtsArithmeticInstruction.execute(Unknown Source)
...

func1 is not included in the stacktrace, but it should be.

Comments (5)

  1. Chimaine

    This is actually caused by the tailcall optimization the compiler performs (return f()). func1 gets pulled into func2 in this case, effectively eliminating func1. I'm not sure if and how I would solve func1 not appearing in the stack trace...

  2. Log in to comment