Commit 37bb91a
committed
fix(wasm): port computed methods, class expressions, array destructuring, prototype params to JS extractor
Closes #1471
Four extraction gaps in the WASM JS extractor caused 25 node diffs
against the native engine in the jelly-micro parity fixture:
1. Computed property method names (e.g. `['property7']`): the query
patterns in both parser.ts and wasm-worker-entry.ts only matched
`property_identifier` and `private_property_identifier` as the
`name` field of `method_definition`; add a third pattern for
`computed_property_name`.
2. Class expressions inside functions (`return class PostMixin …`):
wasm-worker-entry.ts JS_CLASS_PATTERN was a single string matching
only `class_declaration`; rename to JS_CLASS_PATTERNS array and add
the `(class name: …)` pattern for anonymous class-expression nodes.
Also add the matching `(class name: (type_identifier) …)` pattern
to TS_EXTRA_PATTERNS so TS class expressions are covered too.
3. Array destructuring constants (`const [x, y] = …`): both
`extractDestructuredBindingsWalk` (query path) and
`handleVariableDecl` (walk path) only handled `object_pattern`; add
an `array_pattern` branch that emits a single `constant` node whose
name is the full array pattern text — matching native behaviour.
4. Parameters of prototype arrow/function methods
(`Arit.prototype.sum = (x, y) => …`): `emitPrototypeMethod` emitted
the definition node without calling `extractParameters`, so children
were always absent; add the call and wire the result through.
After this fix `parity-compare.mjs --langs jelly-micro` reports
0 node diffs (was 25). 22 pre-existing edge diffs remain (tracked
in #1506) — those are out of scope.1 parent d87c1ee commit 37bb91a
4 files changed
Lines changed: 145 additions & 2 deletions
File tree
- src
- domain
- extractors
- tests/parsers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
| |||
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
129 | 134 | | |
130 | 135 | | |
131 | 136 | | |
132 | 137 | | |
| 138 | + | |
| 139 | + | |
133 | 140 | | |
134 | 141 | | |
135 | 142 | | |
| |||
433 | 440 | | |
434 | 441 | | |
435 | 442 | | |
436 | | - | |
| 443 | + | |
437 | 444 | | |
438 | 445 | | |
439 | 446 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
510 | 519 | | |
511 | 520 | | |
512 | 521 | | |
| |||
1017 | 1026 | | |
1018 | 1027 | | |
1019 | 1028 | | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
1020 | 1039 | | |
1021 | 1040 | | |
1022 | 1041 | | |
| |||
3359 | 3378 | | |
3360 | 3379 | | |
3361 | 3380 | | |
| 3381 | + | |
3362 | 3382 | | |
3363 | 3383 | | |
3364 | 3384 | | |
3365 | 3385 | | |
3366 | 3386 | | |
| 3387 | + | |
3367 | 3388 | | |
3368 | 3389 | | |
3369 | 3390 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1265 | 1265 | | |
1266 | 1266 | | |
1267 | 1267 | | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
1268 | 1382 | | |
0 commit comments