1
0

演算子の実�

This commit is contained in:
otya128
2015-06-05 21:50:40 +09:00
parent a28ff352fa
commit 790d9a1873

View File

@@ -136,8 +136,27 @@ class Operate : Code
Value r;
vm.pop(l);
vm.pop(r);
double ld = l.integerValue;
double rd = r.integerValue;
//とりあえずInteger
l.integerValue += r.integerValue;
switch(operator)
{
case TokenType.Plus:
ld += rd;
break;
case TokenType.Minus:
ld -= rd;
break;
case TokenType.Mul:
ld *= rd;
break;
case TokenType.Div:
ld /= rd;
break;
default:
break;
}
l.integerValue = cast(int)ld;
vm.push(l);
}
}