aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2025-06-22 19:30:05 +0200
committerDanielGavin <danielgavin5@hotmail.com>2025-06-22 19:30:05 +0200
commit94f9dc27b9718c9aeeb4653cfa6933d100e47455 (patch)
tree392af167745b663ca345a5c2e3386f6cb01d5e2a /src/server
parent02658e0ea297f5f906acd2b887def53deac3698e (diff)
Add support for unary expression in when resolve
Diffstat (limited to 'src/server')
-rw-r--r--src/server/when.odin9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/server/when.odin b/src/server/when.odin
index dc06c4f..cf31bf0 100644
--- a/src/server/when.odin
+++ b/src/server/when.odin
@@ -41,7 +41,8 @@ resolve_when_ident :: proc(when_expr_map: map[string]When_Expr, ident: string) -
return v, true
}
- return ident, true
+ //If nothing is found we return it as false boolean
+ return false, true
}
resolve_when_expr :: proc(
@@ -67,6 +68,12 @@ resolve_when_expr :: proc(
return resolve_when_ident(when_expr_map, odin_expr.tok.text)
case ^ast.Implicit_Selector_Expr:
return odin_expr.field.name, true
+ case ^ast.Unary_Expr:
+ if odin_expr.op.kind == .Not {
+ expr := resolve_when_expr(when_expr_map, odin_expr.expr) or_return
+ b := expr.(bool) or_return
+ return !b, true
+ }
case ^ast.Binary_Expr:
lhs := resolve_when_expr(when_expr_map, odin_expr.left) or_return
rhs := resolve_when_expr(when_expr_map, odin_expr.right) or_return