Commit fb05774
committed
fix(native): prefer bare name over qualified in span-tie caller attribution
When an object-literal method (`const o1 = { f() { this.g() } }`) is
parsed, the Rust extractor emits two definitions at the same line and
span: `o1.f(function)` from `extract_object_literal_functions` (called
eagerly inside `handle_var_decl`) and `f(method)` from `handle_method_def`
(visited later during the AST child walk). The WASM extractor emits
`f(method)` first (query captures run before the walk-phase helper), so
its strict-`<` tie-break naturally picks the bare name. Native iterated
them in the opposite order and therefore chose `o1.f`.
Align `find_enclosing_caller` in the native engine with WASM by adding a
tie-break: when two callable definitions have identical span, prefer the
bare (unqualified) name over the dot-containing qualified one. Names with
angle brackets (static-block synthetics like `B.<static:36:2>`) are
excluded from this preference so they are never incorrectly preferred.
Fixes the parity divergence reported in issue #1510 where native produced
`o1.f(function) → g` while WASM produced `f(method) → g` for the
receiver-callee-mixup jelly-micro fixture.
Closes #15101 parent 6d242b4 commit fb05774
1 file changed
Lines changed: 24 additions & 2 deletions
Lines changed: 24 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
669 | 669 | | |
670 | 670 | | |
671 | 671 | | |
672 | | - | |
| 672 | + | |
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
677 | 677 | | |
678 | 678 | | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
679 | 692 | | |
680 | 693 | | |
681 | 694 | | |
| |||
698 | 711 | | |
699 | 712 | | |
700 | 713 | | |
701 | | - | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
702 | 724 | | |
703 | 725 | | |
704 | 726 | | |
| |||
0 commit comments