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 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue