aboutsummaryrefslogtreecommitdiff
path: root/src/ast.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast.c')
-rw-r--r--src/ast.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ast.c b/src/ast.c
index d7d97e0..4573d3e 100644
--- a/src/ast.c
+++ b/src/ast.c
@@ -123,6 +123,8 @@ struct ast *gen_ast(enum ast_kind kind,
n->s = s;
n->v = v;
n->d = d;
+ n->or = NULL;
+ n->ol = NULL;
n->loc = loc;
return n;
}
@@ -139,6 +141,7 @@ struct type *tgen_type(enum type_kind kind,
n->k = kind;
n->t0 = t0;
n->id = id;
+ n->or = NULL;
n->loc = loc;
return n;
}
@@ -378,6 +381,7 @@ struct type *clone_type(struct type *type)
if (type->t0)
new->t0 = clone_type_list(type->t0);
+ new->or = type->or;
new->group = type->group;
new->loc = type->loc;
return new;
@@ -752,3 +756,11 @@ void opt_group(struct ast *a, struct ast *b)
a->or = b;
b->ol = a;
}
+
+void own_type_group(struct type *owner, struct type *sub)
+{
+ /* sub does not get a reference to owner so if owner is moved, only the
+ * sub is marked as used. sub is still allowed to be passed around
+ * freely */
+ owner->or = sub;
+}