Skip to content

Commit 74198ca

Browse files
committed
refactor(show): remove dead 2-arg setUpCalleeData match arm
K semantics only defines the 3-arg variant; the 2-arg label never appears in K terms. Removing it also eliminates the span-None path, setup_call_labels set, and associated scaffolding.
1 parent ffc6a71 commit 74198ca

1 file changed

Lines changed: 4 additions & 21 deletions

File tree

kmir/src/kmir/utils.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -294,18 +294,14 @@ def _annotate_nobody_function(k_cell: KInner, smir_info: SMIRInfo) -> list[str]:
294294
from .alloc import Allocation, AllocId, AllocInfo, Memory
295295
from .linker import _demangle
296296

297-
setup_call_labels = {
298-
'#setUpCalleeData(_,_,_)_KMIR-CONTROL-FLOW_KItem_MonoItemKind_Operands_Span',
299-
'#setUpCalleeData(_,_)_KMIR-CONTROL-FLOW_KItem_MonoItemKind_Operands',
300-
}
297+
setup_call_label = '#setUpCalleeData(_,_,_)_KMIR-CONTROL-FLOW_KItem_MonoItemKind_Operands_Span'
301298

302299
annotations: list[str] = []
303-
span: int | None = None
304300

305301
match k_cell:
306302
case KSequence(items=(KApply(label=KLabel(name=label_name), args=args), *_)) | KApply(
307303
label=KLabel(name=label_name), args=args
308-
) if (label_name in setup_call_labels):
304+
) if (label_name == setup_call_label):
309305
match args:
310306
case [
311307
KApply(
@@ -319,26 +315,13 @@ def _annotate_nobody_function(k_cell: KInner, smir_info: SMIRInfo) -> list[str]:
319315
operands,
320316
KApply(label=KLabel(name='span'), args=[KToken(token=span_str)]),
321317
]:
318+
def_id = int(def_id_str)
322319
span = int(span_str)
323-
case [
324-
KApply(
325-
label=KLabel(name='MonoItemKind::MonoItemFn'),
326-
args=[
327-
KApply(args=[KToken()]),
328-
KApply(label=KLabel(name='defId(_)_BODY_DefId_Int'), args=[KToken(token=def_id_str)]),
329-
KApply(label=KLabel(name='noBody_BODY_MaybeBody'), args=[]),
330-
],
331-
),
332-
operands,
333-
]:
334-
pass
335320
case _:
336321
return []
337322
case _:
338323
return []
339324

340-
def_id = int(def_id_str)
341-
342325
# Use extracted DefId for function name
343326
func_sym = smir_info.function_symbols.get(def_id, {})
344327
if name := func_sym.get('NormalSym') or func_sym.get('IntrinsicSym'):
@@ -349,7 +332,7 @@ def _annotate_nobody_function(k_cell: KInner, smir_info: SMIRInfo) -> list[str]:
349332
annotations.append(f' >> function: {name}')
350333

351334
# Use extracted Span for call site
352-
if span is not None and span in smir_info.spans:
335+
if span in smir_info.spans:
353336
path, start_row, start_col, _, _ = smir_info.spans[span]
354337
annotations.append(f' >> call span: {path}:{start_row}:{start_col}')
355338

0 commit comments

Comments
 (0)