Fix using local variable from direct mode
This commit is contained in:
@@ -1276,7 +1276,11 @@ class Compiler
|
|||||||
Scope globalScope;
|
Scope globalScope;
|
||||||
Code[] compileProgram()
|
Code[] compileProgram()
|
||||||
{
|
{
|
||||||
Scope s = globalScope = new Scope();
|
return compileProgram(new Scope());
|
||||||
|
}
|
||||||
|
Code[] compileProgram(Scope scope_)
|
||||||
|
{
|
||||||
|
Scope s = globalScope = scope_;
|
||||||
foreach(Statement i ; statements.statements)
|
foreach(Statement i ; statements.statements)
|
||||||
{
|
{
|
||||||
if(i.type == NodeType.DefineFunction)
|
if(i.type == NodeType.DefineFunction)
|
||||||
@@ -1381,6 +1385,13 @@ class Compiler
|
|||||||
this.code = vm.currentSlot.code;
|
this.code = vm.currentSlot.code;
|
||||||
globalIndex = cast(int)vm.currentSlot.global.length;
|
globalIndex = cast(int)vm.currentSlot.global.length;
|
||||||
functions = vm.currentSlot.functions;
|
functions = vm.currentSlot.functions;
|
||||||
|
if (vm.currentFunction)
|
||||||
|
{
|
||||||
|
auto sc = new Scope(vm.currentFunction);
|
||||||
|
sc.data = vm.currentData.table;
|
||||||
|
compileProgram(sc);
|
||||||
|
}
|
||||||
|
else
|
||||||
compileProgram();
|
compileProgram();
|
||||||
registerSystemVariable(vm);
|
registerSystemVariable(vm);
|
||||||
vm.directSlot(start, code, globalIndex + 1, global, functions, globalScope.data, globalLabel, debugInfo);
|
vm.directSlot(start, code, globalIndex + 1, global, functions, globalScope.data, globalLabel, debugInfo);
|
||||||
|
|||||||
Reference in New Issue
Block a user