Binary operator expressions now work
This commit is contained in:
parent
6222aabc8b
commit
ba63f85df9
|
@ -310,6 +310,21 @@ public final class TypeChecker
|
|||
*/
|
||||
Type vRhsType = 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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
module simple;
|
||||
|
||||
int j = 1+func(2,test());
|
||||
j = 2+func(2,test());
|
||||
|
||||
int func(int x1, byte x2)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue