Typechecker

- When handling `BinaryOperatorExpression` call `attemptPointerAriehmeticCoercion(Value, Value)` with both `(vLhsInstr, vRhsInstr)` before we call `vLhsInstr.getInstrType()` and `vRhsInstr.getInstrType()` before `isSameType(vLhsType, vRhsType)`. By doing so we attempt to coerce the types of both instructions if one is a pointer and another is an integer, else do nothing
This commit is contained in:
Tristan B. Velloza Kildaire 2023-04-13 14:03:56 +02:00
parent d4fc2904fb
commit b5e8ba0b31
1 changed files with 7 additions and 5 deletions

View File

@ -899,15 +899,17 @@ public final class TypeChecker
Value vRhsInstr = cast(Value)popInstr();
Value vLhsInstr = cast(Value)popInstr();
/**
* Attempt to coerce the types of both instructions if one is
* a pointer and another is an integer, else do nothing
*/
attemptPointerAriehmeticCoercion(vLhsInstr, vRhsInstr);
Type vRhsType = vRhsInstr.getInstrType();
Type vLhsType = vLhsInstr.getInstrType();
// TODO: Hoist up and document
// TODO: Call this before the `isSameType()` check and before we do
// ... `vRhsType` and `vLhsType` above, we want toe most updated types (if any)
/**
* TODO