diff options
| -rw-r--r-- | src/cffc.hff | 2 | ||||
| -rw-r--r-- | src/parse.cff | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/cffc.hff b/src/cffc.hff index 7338b8a..135e8d8 100644 --- a/src/cffc.hff +++ b/src/cffc.hff @@ -395,7 +395,7 @@ struct Targ { } // parse.cff -extern static keyword2str [NUM_KEYWORDS]*const u8; +extern static const keyword2str [NUM_KEYWORDS]*const u8; extern fn parser_init(*Parser, path *const u8) void; extern fn parse(*Parser) [#]Decl; diff --git a/src/parse.cff b/src/parse.cff index d1027da..f5beb23 100644 --- a/src/parse.cff +++ b/src/parse.cff @@ -140,7 +140,7 @@ fn eatspaces(P *Parser) void { } // !sorted -extern static keyword2str [NUM_KEYWORDS]*const u8 = { +extern static const keyword2str [NUM_KEYWORDS]*const u8 = { "alignof", "and", "as", "bitfield", "break", "case", "const", "continue", "def", "defer", "defmacro", "do", "else", "enum", "extern", "fn", @@ -1710,7 +1710,11 @@ fn pexpostfix(P *Parser) Expr { ex = { tok.loc, mkslicetype(childtype(lhs.ty)), .u: :Slice { lhs, rhs, end }}; } else { lexexpect(P, ']'); - ex = { tok.loc, childtype(lhs.ty), .u: :Index { lhs, rhs }}; + let ty = childtype(lhs.ty); + if lhs.ty->is(:Arr) and lhs.ty.konst { + ty = constify(ty); + } + ex = { tok.loc, ty, .u: :Index { lhs, rhs }}; } case lexmatch(P, &tok, '++') or lexmatch(P, &tok, '--'); if !isnumtype(ex.ty) and !ex.ty->is(:Ptr) { |