diff options
| author | 2026-10-14 15:54:04 +0330 | |
|---|---|---|
| committer | 2026-10-14 15:54:04 +0330 | |
| commit | 0879d0a42d137054057cd2a1e37437e6be78ed0b (patch) | |
| tree | fcb16d3185c1f80fae8d54cd9062bd68d6c0c88d /src/compiler/decl.zc | |
| parent | merge spec conformance suite (diff) | |
| parent | merge main into work/line-tables (diff) | |
merge line tables
Diffstat (limited to 'src/compiler/decl.zc')
| -rw-r--r-- | src/compiler/decl.zc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/compiler/decl.zc b/src/compiler/decl.zc index 19b1811..cc84603 100644 --- a/src/compiler/decl.zc +++ b/src/compiler/decl.zc @@ -280,7 +280,7 @@ int body() { // into stype, checked against any earlier prototype or prescan result, and // where the o3 region for an o3 function is handed to the core) int fndef(int chk, int rty, int ret, int n) { - int s, np = 0, tags = 0, t, sig, i; char*[24] pn; word[24] pt; word[24] pty; int typed = 0, ft, explicit_rty = !!rty, o3f = o3nxt, lo, hi, pk; + int s, np = 0, tags = 0, t, sig, i; char*[24] pn; word[24] pt; word[24] pty; int typed = 0, ft, explicit_rty = !!rty, o3f = o3nxt, lo, hi, pk, lt, lend, lfl = tline; o3nxt = 0; if (rty || ntp) typed = 1; if (!dnm) dnm = n; @@ -365,6 +365,7 @@ int fndef(int chk, int rty, int ret, int n) { sflag[s] = sflag[s] | F_DEF; fixall(sfix[s], here); sfix[s] = 0; fn_begin(chk, ret); + lt = lt_begin(sval[s], sname[s], lfl); finsym = s; finfer = !ret; effect_current = effect_record(s); rt.fill_w(effect_current, 0, 50); effect_current[0] = 1; if (!chk || stubgen) effect_current[0] = 2; effect_current[1] = np; i = 0; while (i < np) { if (pt[i] == 2) { effect_current[2 + i] = EF_CONSUME; effect_current[26 + i] = EF_CONSUME; } i++; } @@ -397,6 +398,7 @@ int fndef(int chk, int rty, int ret, int n) { } hi = here; epilogue(); + lend = here; if (o3f) { o3on = 0; o3fs = fslots; @@ -405,6 +407,7 @@ int fndef(int chk, int rty, int ret, int n) { o3region(lo, hi, o3sl, o3rg, no3sl); } o3flush(); + lt_end(lt, lend); ntp = 0; ifcur = 0; fn_remember(s, n); return s; @@ -567,7 +570,7 @@ int topsync() { if (is_op(s_lb)) depth++; else if (is_op(s_rb)) { depth--; if (depth < 0) depth = 0; } else if (!depth && tk == T_ID && (tv == s_fn || tv == s_var || tv == s_const || tv == s_struct || tv == s_type || tv == s_typedef - || tv == s_enhance || tv == s_typecheck || tv == s_docs || tv == s_unchecked || tv == s_immediate || tv == s_o3 + || tv == s_enhance || tv == s_typecheck || tv == s_docs || tv == s_lines || tv == s_unchecked || tv == s_immediate || tv == s_o3 || tv == s_memdebug || tv == s_enum || tv == s_include)) break; next(); } @@ -628,6 +631,7 @@ int fndone(int s, int imm) { // ( or < means function, otherwise a global. int topitem0() { int r, i; + lt_apply_marks(); dsn = 0; dnm = 0; if (docs_on && dn && dline == tline && !ginst) { if (dn > docsnapcap) { docsnapcap = dn; dsnap = chk_resize(dsnap, 0, docsnapcap); } @@ -679,6 +683,7 @@ int topitem1() { if (typedef_ahead()) return kw_typedef(); if (is_id(s_typecheck)) return kw_typecheck(); if (is_id(s_docs)) return kw_docs(); + if (is_id(s_lines)) { peek(); if (pk_tk == T_ID && (pk_tv == s_on || pk_tv == s_off)) return kw_lines(); } if (is_id(s_memdebug)) return kw_memdebug(); if (is_id(s_enum)) return kw_enum(); if (is_id(s_include)) return kw_include(); @@ -1334,7 +1339,7 @@ int unit_end(int from) { // way is emitted behind a jump when another function is being compiled, so // compile() works inside a parse word.) int compile_list_context(int q, int top, char* module, word imports) { - int hop = -1, entry = 0, from = nsym; + int hop = -1, entry = 0, from = nsym, lt = 0 - 1; ctx_push(); ifcur = 0; ifcall = -1; effect_floor = from; module_name = module; module_imports = imports; if (infn) { hop = hole(); op(O_JMP); } if (top) prescan(1, q); @@ -1344,12 +1349,14 @@ int compile_list_context(int q, int top, char* module, word imports) { else { entry = here; fn_begin(1, 0); + lt = lt_begin(entry, "<eval>", tline); prologue(); borrow_prologue(); borrow_begin(); while (tk != T_EOF) stmt(); defer_run(1, 1); unused_check(lbase); if (fchk && live) exit_vars(1, 1); epilogue(); + lt_end(lt, here); } src_pop(); unit_end(from); |
