mirror of
https://github.com/hanzoai/swc.git
synced 2026-10-30 19:42:53 +00:00
**Description:** This PR completes Flow strip/parser parity work against Hermes Flow corpus from `facebook/hermes` `main`. - Add Hermes corpus sync pipeline for `crates/swc_ecma_parser/tests/flow-hermes/corpus`. - Add generated manifests: - `expected-errors.txt` (error-presence expectation) - `known-fail.txt` (experimental syntax buckets) - `metadata.json` (upstream snapshot metadata) - Add new parity test: `crates/swc_ecma_parser/tests/flow_hermes.rs`. - Runs all 1,493 Hermes Flow cases. - Enforces error-presence parity for core cases. - Keeps experimental syntax in known-fail management. - Fix parser behavior to remove panic and align Flow parsing/error boundaries with Hermes parity for core cases, including: - Flow enum parsing/validation and EOF boundaries. - Flow import/export/type syntax edge cases. - Flow-specific ambiguity/error-boundary handling in expressions/classes/patterns/statements. **BREAKING CHANGE:** None. **Related issue (if exists):** None. ## Verification - `cargo test -p swc_ecma_parser --test flow_hermes --features flow` - `cargo test -p swc_ecma_parser --features flow` - `cargo test -p swc --test flow_strip_correctness --features flow` - `cargo fmt --all` - `cargo clippy --all --all-targets -- -D warnings` - `cargo test -p swc_ecma_parser`
207 lines
4.5 KiB
JSON
207 lines
4.5 KiB
JSON
{
|
|
"type": "Script",
|
|
"span": {
|
|
"start": 1,
|
|
"end": 99
|
|
},
|
|
"body": [
|
|
{
|
|
"type": "TsTypeAliasDeclaration",
|
|
"span": {
|
|
"start": 1,
|
|
"end": 35
|
|
},
|
|
"declare": false,
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 6,
|
|
"end": 13
|
|
},
|
|
"ctxt": 0,
|
|
"value": "Inexact",
|
|
"optional": false
|
|
},
|
|
"typeParams": null,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeLiteral",
|
|
"span": {
|
|
"start": 16,
|
|
"end": 34
|
|
},
|
|
"members": [
|
|
{
|
|
"type": "TsPropertySignature",
|
|
"span": {
|
|
"start": 18,
|
|
"end": 28
|
|
},
|
|
"readonly": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 18,
|
|
"end": 19
|
|
},
|
|
"ctxt": 0,
|
|
"value": "a",
|
|
"optional": false
|
|
},
|
|
"computed": false,
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 19,
|
|
"end": 27
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 21,
|
|
"end": 27
|
|
},
|
|
"kind": "number"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "TsPropertySignature",
|
|
"span": {
|
|
"start": 29,
|
|
"end": 32
|
|
},
|
|
"readonly": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 29,
|
|
"end": 32
|
|
},
|
|
"ctxt": 0,
|
|
"value": "__flow_spread",
|
|
"optional": false
|
|
},
|
|
"computed": false,
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "TsTypeAliasDeclaration",
|
|
"span": {
|
|
"start": 36,
|
|
"end": 69
|
|
},
|
|
"declare": false,
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 41,
|
|
"end": 58
|
|
},
|
|
"ctxt": 0,
|
|
"value": "InexactOnlySpread",
|
|
"optional": false
|
|
},
|
|
"typeParams": null,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeLiteral",
|
|
"span": {
|
|
"start": 61,
|
|
"end": 68
|
|
},
|
|
"members": [
|
|
{
|
|
"type": "TsPropertySignature",
|
|
"span": {
|
|
"start": 63,
|
|
"end": 66
|
|
},
|
|
"readonly": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 63,
|
|
"end": 66
|
|
},
|
|
"ctxt": 0,
|
|
"value": "__flow_spread",
|
|
"optional": false
|
|
},
|
|
"computed": false,
|
|
"optional": false,
|
|
"typeAnnotation": null
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "TsTypeAliasDeclaration",
|
|
"span": {
|
|
"start": 70,
|
|
"end": 99
|
|
},
|
|
"declare": false,
|
|
"id": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 75,
|
|
"end": 80
|
|
},
|
|
"ctxt": 0,
|
|
"value": "Exact",
|
|
"optional": false
|
|
},
|
|
"typeParams": null,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeLiteral",
|
|
"span": {
|
|
"start": 83,
|
|
"end": 98
|
|
},
|
|
"members": [
|
|
{
|
|
"type": "TsPropertySignature",
|
|
"span": {
|
|
"start": 86,
|
|
"end": 95
|
|
},
|
|
"readonly": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"span": {
|
|
"start": 86,
|
|
"end": 87
|
|
},
|
|
"ctxt": 0,
|
|
"value": "a",
|
|
"optional": false
|
|
},
|
|
"computed": false,
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "TsTypeAnnotation",
|
|
"span": {
|
|
"start": 87,
|
|
"end": 95
|
|
},
|
|
"typeAnnotation": {
|
|
"type": "TsKeywordType",
|
|
"span": {
|
|
"start": 89,
|
|
"end": 95
|
|
},
|
|
"kind": "number"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"interpreter": null
|
|
}
|