Commit 8b74716
committed
fix(extractor): restore class expression handling and use method kind for static blocks
Two regressions introduced during merge conflict resolution in 6e72569:
1. `walkJavaScriptNode` lost the `case 'class':` branch that was responsible
for extracting extends relationships from named class expressions
(e.g. `const Foo = class Child extends Parent { ... }`). This caused
`ctx.classes` to miss named class expressions, breaking super-dispatch
resolution for class expression patterns.
2. `handleStaticBlock` emitted `kind: 'function'` instead of `kind: 'method'`
for `ClassName.<static>` synthetic definitions. Static blocks are logically
method-scoped — they run as part of class initialization in the context of
the class, and CHA dispatch requires a method-kind node to walk up the
parent class for `super.method()` resolution.
Update the "extracts static blocks as function definitions" test to reflect
the correct `kind: 'method'` behavior.
Impact: 2 functions changed, 17 affected1 parent 95d8ba8 commit 8b74716
2 files changed
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
734 | 734 | | |
735 | 735 | | |
736 | 736 | | |
| 737 | + | |
| 738 | + | |
737 | 739 | | |
738 | 740 | | |
739 | 741 | | |
| |||
874 | 876 | | |
875 | 877 | | |
876 | 878 | | |
877 | | - | |
| 879 | + | |
878 | 880 | | |
879 | 881 | | |
880 | 882 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
| 112 | + | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
0 commit comments