いらないコードを削除
This commit is contained in:
@@ -1375,90 +1375,6 @@ class CallBuiltinFunction : Code
|
||||
return "callbuiltin " ~ func.name.to!string;
|
||||
}
|
||||
}
|
||||
class IncCodeG : Code
|
||||
{
|
||||
int var;
|
||||
this(int var)
|
||||
{
|
||||
this.var = var;
|
||||
}
|
||||
//TODO:文字列INCの挙動
|
||||
override void execute(VM vm)
|
||||
{
|
||||
Value v;
|
||||
Value g = vm.currentSlot.global[var];
|
||||
vm.pop(v);
|
||||
if(!g.isNumber() && g.type != ValueType.String)
|
||||
{
|
||||
throw new TypeMismatch();
|
||||
}
|
||||
if((!g.isNumber() || !v.isNumber()) && g.type != v.type)
|
||||
{
|
||||
throw new TypeMismatch();
|
||||
}
|
||||
if(g.isNumber())
|
||||
{
|
||||
double l = g.castDouble;
|
||||
double r = v.castDouble;
|
||||
if(v.type == ValueType.Double)
|
||||
vm.currentSlot.global[var] = Value(l + r);
|
||||
else
|
||||
vm.currentSlot.global[var] = Value(cast(int)(l + r));
|
||||
}
|
||||
else
|
||||
{
|
||||
wstring l = g.stringValue;
|
||||
wstring r = v.stringValue;
|
||||
vm.currentSlot.global[var] = Value(l ~ r);
|
||||
}
|
||||
}
|
||||
override string toString(VM vm)
|
||||
{
|
||||
return "incglobal " ~ var.to!string;
|
||||
}
|
||||
}
|
||||
class IncCodeL : Code
|
||||
{
|
||||
int var;
|
||||
this(int var)
|
||||
{
|
||||
this.var = var;
|
||||
}
|
||||
//TODO:文字列INCの挙動
|
||||
override void execute(VM vm)
|
||||
{
|
||||
Value v;
|
||||
Value* g = &vm.stack[vm.bp + var];
|
||||
vm.pop(v);
|
||||
if(!g.isNumber() && g.type != ValueType.String)
|
||||
{
|
||||
throw new TypeMismatch();
|
||||
}
|
||||
if((!g.isNumber() || !v.isNumber()) && g.type != v.type)
|
||||
{
|
||||
throw new TypeMismatch();
|
||||
}
|
||||
if(g.isNumber())
|
||||
{
|
||||
double l = g.castDouble;
|
||||
double r = v.castDouble;
|
||||
if(v.type == ValueType.Double)
|
||||
*g = Value(l + r);
|
||||
else
|
||||
*g = Value(cast(int)(l + r));
|
||||
}
|
||||
else
|
||||
{
|
||||
wstring l = g.stringValue;
|
||||
wstring r = v.stringValue;
|
||||
*g = Value(l ~ r);
|
||||
}
|
||||
}
|
||||
override string toString(VM vm)
|
||||
{
|
||||
return "inclocal " ~ var.to!string;
|
||||
}
|
||||
}
|
||||
class OnBase : Code
|
||||
{
|
||||
int[] labels;
|
||||
|
||||
Reference in New Issue
Block a user