summaryrefslogtreecommitdiff
path: root/parse/node.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-12-14 23:27:06 -0800
committerOri Bernstein <ori@eigenstate.org>2015-12-14 23:27:06 -0800
commitf5a1454387098fa3abb7bf95f4123e1fac85cb7d (patch)
treec5410430516ebf119d8139c8b599732cbd545d51 /parse/node.c
parent607b2662bc1093833bfea0c49236f098271cf348 (diff)
downloadmc-f5a1454387098fa3abb7bf95f4123e1fac85cb7d.tar.gz
Initial support for void as an expression.
Diffstat (limited to 'parse/node.c')
-rw-r--r--parse/node.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/parse/node.c b/parse/node.c
index 62be764..8d0decf 100644
--- a/parse/node.c
+++ b/parse/node.c
@@ -374,6 +374,15 @@ Node *mkbool(Srcloc loc, int val)
return n;
}
+Node *mkvoid(Srcloc loc)
+{
+ Node *n;
+
+ n = mknode(loc, Nlit);
+ n->lit.littype = Lvoid;
+ return n;
+}
+
char *declname(Node *n)
{
Node *name;
@@ -413,6 +422,7 @@ int liteq(Node *a, Node *b)
if (!tyeq(a->lit.type, b->lit.type))
return 0;
switch (a->lit.littype) {
+ case Lvoid: return 1;
case Lchr: return a->lit.chrval == b->lit.chrval;
case Lbool: return a->lit.boolval == b->lit.boolval;
case Lint: return a->lit.intval == b->lit.intval;