summaryrefslogtreecommitdiff
path: root/parse/node.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-01-01 01:05:50 -0800
committerOri Bernstein <ori@eigenstate.org>2016-01-01 01:05:50 -0800
commitffc55ee721c02d1caede8d7fbad9e8b687f01306 (patch)
tree5ebf03f748eea405339fc1e013675cb3f35442d4 /parse/node.c
parent7ef2abad32fe3b273f16eeb28d63a63229dca3a6 (diff)
downloadmc-ffc55ee721c02d1caede8d7fbad9e8b687f01306.tar.gz
Actually check array sizes when inferring.
Diffstat (limited to 'parse/node.c')
-rw-r--r--parse/node.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/parse/node.c b/parse/node.c
index 63d26c2..309cca8 100644
--- a/parse/node.c
+++ b/parse/node.c
@@ -429,11 +429,14 @@ Type *nodetype(Node *n)
int liteq(Node *a, Node *b)
{
+ return litvaleq(a, b) && tyeq(a->lit.type, b->lit.type);
+}
+
+int litvaleq(Node *a, Node *b)
+{
assert(a->type == Nlit && b->type == Nlit);
if (a->lit.littype != b->lit.littype)
return 0;
- 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;