mirror of
https://github.com/Noratrieb/riverdelta.git
synced 2026-01-15 00:45:04 +01:00
small improvements
This commit is contained in:
parent
3270e6b501
commit
f0227af982
4 changed files with 36 additions and 32 deletions
|
|
@ -641,23 +641,6 @@ export function checkBody(
|
|||
}
|
||||
|
||||
function checkBinary(expr: Expr & ExprBinary): Expr {
|
||||
const checkPrecedence = (inner: Expr, side: string) => {
|
||||
if (inner.kind === "binary") {
|
||||
const ourClass = binaryExprPrecedenceClass(expr.binaryKind);
|
||||
const innerClass = binaryExprPrecedenceClass(inner.binaryKind);
|
||||
|
||||
if (ourClass !== innerClass) {
|
||||
throw new CompilerError(
|
||||
`mixing operators without parentheses is not allowed. ${side} is ${inner.binaryKind}, which is different from ${expr.binaryKind}`,
|
||||
expr.span
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
checkPrecedence(expr.lhs, "left");
|
||||
checkPrecedence(expr.rhs, "right");
|
||||
|
||||
let lhsTy = expr.lhs.ty!;
|
||||
let rhsTy = expr.rhs.ty!;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue