diff options
| author | 2026-10-14 10:42:28 +0000 | |
|---|---|---|
| committer | 2026-10-14 10:42:28 +0000 | |
| commit | ea052eab91b304459ddf64281fc93fc152597412 (patch) | |
| tree | 8dcd378d6634626dd2529c2aef684890999de963 /src/compiler/expr.zc | |
| parent | todo: the spec verifier restarted from the first agent's partial work (diff) | |
| parent | fix std hover, full capture terminator, bare static calls, void main in run-o... (diff) | |
Merge four small fixes: std hovers, capture terminator, bare static calls, void main; todo updated
Diffstat (limited to 'src/compiler/expr.zc')
| -rw-r--r-- | src/compiler/expr.zc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/expr.zc b/src/compiler/expr.zc index c6d29c6..40de6ef 100644 --- a/src/compiler/expr.zc +++ b/src/compiler/expr.zc @@ -1014,7 +1014,9 @@ int primary() { return C_PLAIN; } s = source_lookup(n); - if (mstruct && !ginst) { ms = lookup(methname(mstruct, n)); if (ms >= 0 && skind[ms] == K_CONST) s = ms; } + // in a method of a struct a bare name is that struct's own constant or static function first, so it + // wins over a global (a top-level function or constant) of the same name + if (mstruct && !ginst) { ms = lookup(methname(mstruct, n)); if (ms >= 0 && (skind[ms] == K_CONST || (skind[ms] == K_FN && (sflag[ms] & F_STATIC)))) s = ms; } if (s < 0 && rt.eq_w(n, "new")) s = source_lookup(s_new); if (s >= 0) rs_put(toff, RS_SYM, rs_sym(s), s); if (s >= 0 && skind[s] == K_KW) { |
