diff --git a/source/compiler/codegen/expression/precedence.ts b/source/compiler/codegen/expression/precedence.ts index eaeb469..bb1fbc0 100644 --- a/source/compiler/codegen/expression/precedence.ts +++ b/source/compiler/codegen/expression/precedence.ts @@ -63,6 +63,7 @@ export function ApplyPrecedence(syntax: Term_Expr) { rpn.push(op_stack.pop()!); } + // This could probably be optimised in the future to not use a stack, and just manipulate a raw root node const stack = new Array(); while (rpn.length > 0) { const token = rpn.shift()!; @@ -85,8 +86,8 @@ export function ApplyPrecedence(syntax: Term_Expr) { } const root = stack.pop()!; - assert(typeof root === "string", "Expression somehow has no arguments during precedence calculation"); - assert(stack.length != 0, "Expression somehow has only operators during precedence calculation"); + assert(typeof root !== "string", "Expression somehow has no arguments during precedence calculation"); + assert(stack.length == 0, "Expression somehow has only operators during precedence calculation"); return root; }