public override int GenerateCode(int loc, IVirtualMachine vm, CheckerInformation info) { loc = Term.GenerateCode(loc, vm, info); loc = RepTerm.GenerateCode(loc, vm, info); var type = GetExpressionType(info); if (type == Type.INT32) { switch (Operator) { case Operators.PLUS: vm.IntAdd(loc++); break; case Operators.MINUS: vm.IntSub(loc++); break; default: throw new IVirtualMachine.InternalError( "There's an invalid operator in ASTAddOpr. Operator: " + Operator.ToString()); } } else if (type == Type.DECIMAL) { switch (Operator) { case Operators.PLUS: vm.DecimalAdd(loc++); break; case Operators.MINUS: vm.DecimalSub(loc++); break; default: throw new IVirtualMachine.InternalError( "There's an invalid operator in ASTAddOpr. Operator: " + Operator.ToString()); } } else { throw new IVirtualMachine.InternalError( "There's an invalid operand type in ASTAddOpr. type: " + type.ToString()); } return(loc); }