aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-19 12:53:37 +0200
committerlemon <lsof@mailbox.org>2022-08-19 12:53:37 +0200
commit9b456aaff9d423e000c1afe537591497962029df (patch)
tree5f052b386e73a3563fd61e8bef19aaf8c4bfe5a1 /src
parent5f1827beb3199a9f4cec44de5001d599be55cfc8 (diff)
#tag lvalue
Diffstat (limited to 'src')
-rw-r--r--src/parse.cff5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/parse.cff b/src/parse.cff
index 4f78b21..5caa998 100644
--- a/src/parse.cff
+++ b/src/parse.cff
@@ -1044,6 +1044,8 @@ fn islvalue(ex Expr) bool {
return #t;
case Dot;
return #t;
+ case EUTag;
+ return #t;
}
return #f;
}
@@ -1556,7 +1558,8 @@ fn pexpostfix(P *Parser) Expr {
if !ty->is(:Agg) or ty.u.Agg.kind != :EUnion {
fatal(P, ex.loc, "invalid operand to #tag (%t)", ex.ty);
}
- ex = { tok.loc, ty.u.Agg.enumty, :EUTag(exprdup(P.alloc, ex)) };
+ let enumty = ty.u.Agg.enumty;
+ ex = { tok.loc, ty.konst ? constify(enumty) : enumty, :EUTag(exprdup(P.alloc, ex)) };
case else;
lexexpects(P, :ident, "field name");