mirror of https://github.com/tbklang/tlang.git
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:
parent
d4fc2904fb
commit
b5e8ba0b31
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue