Binary operator expressions now work

constants
parent 6222aabc8b
commit ba63f85df9

@ -311,6 +311,21 @@ public final class TypeChecker
Type vRhsType = popType(); Type vRhsType = popType();
Type vLhsType = popType(); Type vLhsType = popType();
/**
* TODO:
* Types must either BE THE SAME or BE COMPATIBLE
*/
if(isSameType(vLhsType, vRhsType))
{
/* Left type + Right type = left/right type (just use left - it doesn't matter) */
addType(vLhsType);
}
else
{
gprintln("Binary operator expression requires both types be same, but got '"~vRhsType.toString()~"' and '"~vLhsType.toString()~"'", DebugType.ERROR);
assert(false);
}
/** /**
* Codegen * Codegen

@ -1,6 +1,7 @@
module simple; module simple;
int j = 1+func(2,test()); int j = 1+func(2,test());
j = 2+func(2,test());
int func(int x1, byte x2) int func(int x1, byte x2)
{ {

@ -21,13 +21,6 @@ asm
asm asm
{ {
mov RSP, R15; mov R13B, 65;
} }
int h = -1;
h = *((&h)-4);
import std.stdio;
writeln(h);
}

Loading…
Cancel
Save