diff --git a/codeCore/src/prog8/code/ast/AstBase.kt b/codeCore/src/prog8/code/ast/AstBase.kt index df78f7667..9cc9a2bac 100644 --- a/codeCore/src/prog8/code/ast/AstBase.kt +++ b/codeCore/src/prog8/code/ast/AstBase.kt @@ -103,6 +103,14 @@ class PtProgram( children.forEach { transformBinExprToRPN(it, this) } binaryExpressionsAreRPN = true + + // extra check to see that all PtBinaryExpressions have been transformed + fun binExprCheck(node: PtNode) { + if(node is PtBinaryExpression) + throw IllegalArgumentException("still got binexpr $node ${node.position}") + node.children.forEach { binExprCheck(it) } + } + binExprCheck(this) } }