diff options
| author | 2026-10-14 16:03:48 +0330 | |
|---|---|---|
| committer | 2026-10-14 16:03:48 +0330 | |
| commit | 29eb9e50d33d417035e133dcebb7111074a23b24 (patch) | |
| tree | da4a1614bae228dc0b7675b287643c64e8720530 /src/compiler/expr.zc | |
| parent | merge: llvm auto-build (opt-in on x86-64), mode stamp (diff) | |
| parent | conformance: b.2.8 is documented behavior; keep the conformance run out of te... (diff) | |
merge: seven self-hosted compiler fixes from conformance
Diffstat (limited to 'src/compiler/expr.zc')
| -rw-r--r-- | src/compiler/expr.zc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/compiler/expr.zc b/src/compiler/expr.zc index f41109e..3d63e4b 100644 --- a/src/compiler/expr.zc +++ b/src/compiler/expr.zc @@ -538,7 +538,7 @@ int enhcall(int s) { // scan with the compiler lexer, restoring its source and lookahead. only functions containing a closure // need cells; their scalars get cells from declaration time, so loop back edges and earlier references agree. int capture_scan() { - word old, f; int depth = 1, found = 0, docs = docs_on, record = grec; + word old, f; int depth = 1, found = 0, docs = docs_on, record = grec, sp = panic; if (isp < 0 || R_SRC[isp * 32] == 0 || !is_op(s_lb)) return 0; old = R_SRC + isp * 32; src_push(1, capture_dummy, 0, 0); old = R_SRC + (isp - 1) * 32; f = R_SRC + isp * 32; @@ -550,7 +550,7 @@ int capture_scan() { else if (is_op(s_rb)) depth--; else if (is_id(s_fn)) { peek(); if (pk_tk == T_OP && (pk_tv == s_lp || pk_tv == s_colon)) found = 1; } } - dry--; src_pop(); docs_on = docs; grec = record; return found; + dry--; src_pop(); docs_on = docs; grec = record; panic = sp; return found; // a lexer error in the dry scan must not leave panic set for the real parse } int capture_cell(int i, int copy) { if (!capture_enabled || o3on || (ltag[i] & 16) || larr[i] || local_cell[i]) return 0; @@ -1512,7 +1512,7 @@ int postfix_tail(int c) { // --, and any unary operator a program added (- ! ~ built in). int unary() { int c, un, t, place, constant, value; word storage, dependency; - if (tk == T_ID && (tv == s_u || tv == s_m || tv == s_d)) { // u*x, d*x, m*x: recast only when * is glued + if (tk == T_ID && (tv == s_u || tv == s_m || tv == s_d) && findloc(tv) < 0) { // u*x, d*x, m*x: recast only when * is glued and the tag is not a local's name peek(); if (pk_tk == T_OP && pk_tv == s_star && pq_gl[0]) { t = S_M; if (tv == s_u) t = S_U; if (tv == s_d) t = S_D; @@ -1536,6 +1536,7 @@ int unary() { else if (xfloat && isnum(t)) { op(OP_F2I); xfloat = 0; } else xfloat = 0; if (tbytes(t) && !samesz(t, xty)) { tnorm(t); xconst = 0; } // (u8)x cuts the value to size + xstr = t == tbstr; // (int*)s is a word pointer, not a byte string if_value = 0; xty = t; lv = 0; lvk = LV_NONE; xzero = 0; xbor = -1; return C_PLAIN; |
