OUT関数を実装, 識別子に数字と_を認識するように修正

This commit is contained in:
otya128 committed 2015-06-14 11:13:19 +09:00
1 parent b8a063f0a5
commit c71e84a7fc
6 files changed
+187 -12

No files matched your search

+20
View File
@@ -770,6 +770,14 @@ class ReturnFunction : Code
{
vm.push(retexpr);
}
else
{
//OUTの実装
for(int i = 0; i < func.outArgCount; i++)
{
vm.push(vm.stack[vm.bp + i + 2]);
}
}
vm.pc = pc.integerValue;
vm.bp = bp.integerValue;
}
@@ -778,10 +786,18 @@ class CallFunctionCode : Code
{
wstring name;
int argCount;
int outArgCount;
this(wstring name, int argCount)
{
this.name = name;
this.argCount = argCount;
this.outArgCount = 1;
}
this(wstring name, int argCount, int outArgCount)
{
this.name = name;
this.argCount = argCount;
this.outArgCount = outArgCount;
}
override void execute(VM vm)
{
@@ -794,6 +810,10 @@ class CallFunctionCode : Code
{
throw new IllegalFunctionCall();
}
if(func.outArgCount != this.outArgCount)
{
throw new IllegalFunctionCall();
}
//TODO:args
auto bp = vm.stacki;
vm.push(Value(vm.bp));