1
0

CALL命令を省略可能な引数を持った組み込み関数に使うとスタックがおかしくなる問題を修正,CALL命令がcase insensitiveになった

This commit is contained in:
otya128
2016-09-02 16:24:41 +09:00
parent 7cb0b26880
commit f27d5b820e

View File

@@ -1250,14 +1250,7 @@ class CallFunctionS : Code
result = newarg; result = newarg;
} }
func.func(vm.petitcomputer, arg, result); func.func(vm.petitcomputer, arg, result);
if(func.variadic) vm.stacki -= argCount;
{
vm.stacki -= argCount;
}
else
{
vm.stacki -= func.argments.length;// - outcount;
}
////vm.stacki += outcount; ////vm.stacki += outcount;
//vm.stacki = old; //vm.stacki = old;
for(int i = 0; i < outArgCount; i++) for(int i = 0; i < outArgCount; i++)
@@ -1299,7 +1292,7 @@ class CallFunctionS : Code
{ {
throw new TypeMismatch(); throw new TypeMismatch();
} }
auto name = vname.castString; auto name = vname.castString.toUpper;
Function func = vm.currentSlot.functions.get(name, null); Function func = vm.currentSlot.functions.get(name, null);
if(!func) if(!func)
{ {
@@ -1310,14 +1303,6 @@ class CallFunctionS : Code
} }
auto bfunc = bfuncs.overloadResolution(argCount, outArgCount); auto bfunc = bfuncs.overloadResolution(argCount, outArgCount);
/* if(bfunc.argments.length >= argCount)
{
auto k = bfunc.argments.length - argCount;
foreach(l;0..k)
{
vm.push(Value(ValueType.Void));
}
}*/
callBuintinFunc(bfunc, vm); callBuintinFunc(bfunc, vm);
return; return;
} }