diff --git a/goalc/compiler/compilation/Math.cpp b/goalc/compiler/compilation/Math.cpp index 0eca1167af..a7249bbced 100644 --- a/goalc/compiler/compilation/Math.cpp +++ b/goalc/compiler/compilation/Math.cpp @@ -321,15 +321,12 @@ Val* Compiler::compile_sub(const goos::Object& form, const goos::Object& rest, E auto result = compile_integer(0, env)->to_gpr(form, env); env->emit_ir( form, IntegerMathKind::SUB_64, result, - to_math_type(form, compile_error_guard(args.unnamed.at(0), env), math_type, env) - ->to_gpr(form, env)); + to_math_type(form, first_val, math_type, env)->to_gpr(form, env)); return result; } else { auto result = env->make_gpr(first_type); - env->emit_ir( - form, result, - to_math_type(form, compile_error_guard(args.unnamed.at(0), env), math_type, env) - ->to_gpr(form, env)); + env->emit_ir(form, result, + to_math_type(form, first_val, math_type, env)->to_gpr(form, env)); for (size_t i = 1; i < args.unnamed.size(); i++) { env->emit_ir( @@ -345,15 +342,12 @@ Val* Compiler::compile_sub(const goos::Object& form, const goos::Object& rest, E auto result = compile_float(0, env, env->function_env()->segment)->to_fpr(form, env); env->emit_ir( form, FloatMathKind::SUB_SS, result, - to_math_type(form, compile_error_guard(args.unnamed.at(0), env), math_type, env) - ->to_fpr(form, env)); + to_math_type(form, first_val, math_type, env)->to_fpr(form, env)); return result; } else { auto result = env->make_fpr(first_type); - env->emit_ir( - form, result, - to_math_type(form, compile_error_guard(args.unnamed.at(0), env), math_type, env) - ->to_fpr(form, env)); + env->emit_ir(form, result, + to_math_type(form, first_val, math_type, env)->to_fpr(form, env)); for (size_t i = 1; i < args.unnamed.size(); i++) { env->emit_ir(