aboutsummaryrefslogtreecommitdiff
path: root/src/ast.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast.c')
-rw-r--r--src/ast.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ast.c b/src/ast.c
index 81fa0b3..acada6f 100644
--- a/src/ast.c
+++ b/src/ast.c
@@ -296,6 +296,8 @@ struct ast *clone_ast(struct ast *n)
if (n->a3)
new->a3 = clone_ast_list(n->a3);
+ /** @todo rebuild opt group? */
+
return new;
}
@@ -331,6 +333,7 @@ struct type *clone_type(struct type *type)
if (type->t0 && !(new->t0 = clone_type_list(type->t0)))
return NULL;
+ new->group = type->group;
return new;
}
@@ -542,7 +545,10 @@ void fix_closures(struct ast *root)
}
struct ast *next = root->n;
- struct ast *block = gen_block(next, next->loc);
+ if (!next)
+ next = gen_empty(root->loc);
+
+ struct ast *block = gen_block(next, root->loc);
closure_body(arg) = block;
root->n = NULL;
root = next;
@@ -648,3 +654,9 @@ const char *ast_str(enum ast_kind k)
return "UNKNOWN";
}
+
+void opt_group(struct ast *a, struct ast *b)
+{
+ a->or = b;
+ b->ol = a;
+}