(node: ASTNode)
| 64 | |
| 65 | /** Type guard for runtime expression nodes that survive parser lowering. */ |
| 66 | export function isRuntimeExpr(node: ASTNode): node is RuntimeExprNode { |
| 67 | switch (node.k) { |
| 68 | case "StateRef": |
| 69 | case "RuntimeRef": |
| 70 | case "BinOp": |
| 71 | case "UnaryOp": |
| 72 | case "Ternary": |
| 73 | case "Member": |
| 74 | case "Index": |
| 75 | case "Assign": |
| 76 | return true; |
| 77 | default: |
| 78 | return false; |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | /** Valid AST discriminant values. */ |
| 83 | const AST_KINDS = new Set([ |