Improve core:odin/ast ast.Range_Stmt to use generic number of vals rather than the fixed two to aid with parsing errors

This commit is contained in:
gingerBill
2021-03-24 12:34:06 +00:00
parent d969d0b264
commit bec42e8dd3
4 changed files with 8 additions and 23 deletions
+1 -2
View File
@@ -402,8 +402,7 @@ Range_Stmt :: struct {
using node: Stmt,
label: ^Expr,
for_pos: tokenizer.Pos,
val0: ^Expr,
val1: ^Expr,
vals: []^Expr,
in_pos: tokenizer.Pos,
expr: ^Expr,
body: ^Stmt,
+1 -2
View File
@@ -192,8 +192,7 @@ clone_node :: proc(node: ^Node) -> ^Node {
r.body = clone(r.body);
case Range_Stmt:
r.label = auto_cast clone(r.label);
r.val0 = clone(r.val0);
r.val1 = clone(r.val1);
r.vals = clone(r.vals);
r.expr = clone(r.expr);
r.body = clone(r.body);
case Case_Clause:
+4 -5
View File
@@ -209,11 +209,10 @@ walk :: proc(v: ^Visitor, node: ^Node) {
if n.label != nil {
walk(v, n.label);
}
if n.val0 != nil {
walk(v, n.val0);
}
if n.val1 != nil {
walk(v, n.val1);
for val in n.vals {
if val != nil {
walk(v, val);
}
}
walk(v, n.expr);
walk(v, n.body);