diff options
| author | 2026-10-14 16:48:18 +0330 | |
|---|---|---|
| committer | 2026-10-14 16:48:18 +0330 | |
| commit | 37faa46eff8210365b144ccb4758dc3967b68b48 (patch) | |
| tree | a7352e8e6dd6563146444bf4859c831a26894a32 /src/compiler/expr.zc | |
| parent | Merge branch 'main' into work/spec (diff) | |
enum: a member is defined as soon as it is declared, so later values can name it (appendix b.2.2)
Diffstat (limited to 'src/compiler/expr.zc')
| -rw-r--r-- | src/compiler/expr.zc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/expr.zc b/src/compiler/expr.zc index 230a2d3..e449508 100644 --- a/src/compiler/expr.zc +++ b/src/compiler/expr.zc @@ -1959,6 +1959,10 @@ word cprim() { } } } + if (tk == T_ID && enum_open >= 0) { // an earlier member of the enum being read (spec 2.8.1) + mc = npm - 1; + while (mc > enum_open) { mc--; if (pm_name[mc] == tv && !pm_nf[mc]) { next(); return pm_val[mc]; } } + } die("expected a constant"); return 0; } |
