moonsharp-devs / moonsharp

An interpreter for the Lua language, written entirely in C# for the .NET, Mono, Xamarin and Unity3D platforms, including handy remote debugger facilities.
http://www.moonsharp.org
Other
1.41k stars 213 forks source link

local variables without assignment are initialized by latest stack values #278

Closed Aberro closed 4 years ago

Aberro commented 4 years ago

This will output current value from the stack, while it should be nil value. `local x print(x)'

AssignmentStatement.Compile tells SymbolRefExpression to emit OpCode.StoreLcl with stackofs=0 and tupleidx=1 and this makes no sense in given context.

Aberro commented 4 years ago

Duplicate of https://github.com/moonsharp-devs/moonsharp/issues/263