Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(parser): Generate Serialize impls in ast_tools #6404

Merged
merged 35 commits into from
Oct 19, 2024

Conversation

ottomated
Copy link
Contributor

Beginning of #6347. Instead of using serde-derive, we generate Serialize impls manually.

Copy link

graphite-app bot commented Oct 9, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@github-actions github-actions bot added A-ast Area - AST A-ast-tools Area - AST tools labels Oct 9, 2024
@Boshen
Copy link
Member

Boshen commented Oct 10, 2024

Nice, I believe this'll make compilation faster as well, because serde no longer runs syn.

@ottomated
Copy link
Contributor Author

ottomated commented Oct 10, 2024

Tested on checker.ts. Diff below. The only changes are in regex serialization which is incorrect anyway so shouldn't be an issue.

--- a/expected.json
+++ b/actual.json
@@ -20457,11 +20457,9 @@
             "type": "RegExpLiteral",
             "start": 29848,
             "end": 29856,
-            "value": null,
+            "value": {},
             "regex": {
-              "pattern": {
-                "Raw": "^\".+\"$"
-              },
+              "pattern": "^\".+\"$",
               "flags": ""
             }
           },
@@ -247915,11 +247913,9 @@
                                                                     "type": "RegExpLiteral",
                                                                     "start": 404540,
                                                                     "end": 404545,
-                                                                    "value": null,
+                                                                    "value": {},
                                                                     "regex": {
-                                                                      "pattern": {
-                                                                        "Raw": "\\n"
-                                                                      },
+                                                                      "pattern": "\\n",
                                                                       "flags": "g"
                                                                     }
                                                                   },
@@ -256454,11 +256450,9 @@
                                                   "type": "RegExpLiteral",
                                                   "start": 417226,
                                                   "end": 417238,
-                                                  "value": null,
+                                                  "value": {},
                                                   "regex": {
-                                                    "pattern": {
-                                                      "Raw": "\\r\\n|\\n|\\r"
-                                                    },
+                                                    "pattern": "\\r\\n|\\n|\\r",
                                                     "flags": ""
                                                   }
                                                 }
@@ -256546,11 +256540,9 @@
                                                           "type": "RegExpLiteral",
                                                           "start": 417265,
                                                           "end": 417271,
-                                                          "value": null,
+                                                          "value": {},
                                                           "regex": {
-                                                            "pattern": {
-                                                              "Raw": "^\\s+"
-                                                            },
+                                                            "pattern": "^\\s+",
                                                             "flags": ""
                                                           }
                                                         },
@@ -287745,11 +287737,9 @@
                                                         "type": "RegExpLiteral",
                                                         "start": 470730,
                                                         "end": 470736,
-                                                        "value": null,
+                                                        "value": {},
                                                         "regex": {
-                                                          "pattern": {
-                                                            "Raw": "\\\\."
-                                                          },
+                                                          "pattern": "\\\\.",
                                                           "flags": "g"
                                                         }
                                                       },
@@ -321794,11 +321784,9 @@
                                                               "type": "RegExpLiteral",
                                                               "start": 536344,
                                                               "end": 536349,
-                                                              "value": null,
+                                                              "value": {},
                                                               "regex": {
-                                                                "pattern": {
-                                                                  "Raw": "\\n"
-                                                                },
+                                                                "pattern": "\\n",
                                                                 "flags": "g"
                                                               }
                                                             },
@@ -358021,11 +358009,9 @@
                                             "type": "RegExpLiteral",
                                             "start": 606654,
                                             "end": 606667,
-                                            "value": null,
+                                            "value": {},
                                             "regex": {
-                                              "pattern": {
-                                                "Raw": "[^a-z0-9]"
-                                              },
+                                              "pattern": "[^a-z0-9]",
                                               "flags": "gi"
                                             }
                                           },
@@ -1212733,11 +1212719,9 @@
                                             "type": "RegExpLiteral",
                                             "start": 2037983,
                                             "end": 2038033,
-                                            "value": null,
+                                            "value": {},
                                             "regex": {
-                                              "pattern": {
-                                                "Raw": "^(?:EventTarget|Node|(?:HTML[a-zA-Z]*)?Element)$"
-                                              },
+                                              "pattern": "^(?:EventTarget|Node|(?:HTML[a-zA-Z]*)?Element)$",
                                               "flags": ""
                                             }
                                           },

@ottomated
Copy link
Contributor Author

Important changes:

  • #[derive(Serialize)] -> #[generate_derive(ESTree)]
  • #[serde(...)] -> #[estree(...)]
    • Supported on fields: skip, flatten, rename
    • Supported on enums: rename_all, untagged (in the future, I propose renaming this to something like #[estree(transparent)] for untagged enums, and maybe #[estree(type_enum)] for enums that shouldn't be camelCase)
    • Supported on structs: type = "Identifier", no_type (for things that aren't really AST nodes and don't need a "type" field on the JSON
  • By default, structs get the "type" field from the following (prioritized in this order):
  1. #[estree(type = "X")] / #[estree(no_type)]
  2. If the struct has an r#type field, it'll use that as the value
  3. The name of the struct
    Therefore, no need for tag = "type".
  • Struct fields are converted to camelCase by default. I verified that any struct missing rename_all = "camelCase" already had all its fields in camelCase format so this should not change anything.
  • New oxc_estree crate that currently only contains an empty trait. I envision this being used for custom serialization and type generation in the future, but maybe a different approach is warranted.

@ottomated ottomated marked this pull request as ready for review October 10, 2024 23:12
Copy link

codspeed-hq bot commented Oct 10, 2024

CodSpeed Performance Report

Merging #6404 will not alter performance

Comparing ottomated:manual-serialize (7639831) with main (b0b6ac7)

Summary

✅ 30 untouched benchmarks

Copy link
Member

@Boshen Boshen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the direction this is going, good job 👍

@overlookmotel
Copy link
Collaborator

overlookmotel commented Oct 14, 2024

Sorry it's taken me a while to get to reviewing this.

Excellent work. Really pleased to see this moving forwards. Thank you.

All looks good with the serialized output. As you say, the output changing for RegExp doesn't matter.

However, we do have one problem: The TS type defs generated for WASM are now inaccurate, because Tsify derive macro relies on #[serde] attrs, and they've been replaced with #[estree], which Tsify doesn't understand.

Old TS def:

export interface NumericLiteral extends Span {
    type: "NumericLiteral";
    value: number;
    raw: string;
}

After this PR:

export interface NumericLiteral {
    span: Span;
    value: number;
    raw: string;
    base: NumberBase;
}

To see the generated TS types:

cd wasm/parser
pnpm install
pnpm run build

Type defs are generated at npm/parser-wasm/node/oxc_parser_wasm.d.ts.

I can see 2 ways to solve this:

1. Go back to #[serde]

Scale back the scope of this PR a little. Revert #[estree] to #[serde].

Unfortunately this would also involve reverting the way type is dealt with, which is definitely an improvement, but is not compatible with Tsify.

We'd then try to replace Tsify as the next step, and then bring in #[estree] again.

2. Replace Tsify as well now

Replace Tsify and generate type defs in oxc_ast_tools instead.

I'm not sure how much work this would be. It's definitely not trivial, but maybe it's less hard than it initially looks.

Tsify derive macro produces a lot of code, but as we don't use wasm-bindgen for transferring these types to JS, I think the only part of Tsify's output that we actually need is:

#[wasm_bindgen(typescript_custom_section)]
const TS_APPEND_CONTENT: &'static str =
    "export interface NumericLiteral extends Span {\n    value: number;\n    raw: string;\n}";

Which?

Usually we try to keep PRs small and work incrementally, rather than long-lived branches which tend to acquire merge conflicts, and are hard to review. So that would point more towards approach (1), and that'd be my preference. However, @ottomated if you feel that 2nd approach is less work and you'd prefer to go that way, happy to go with that.

What do you think?

@ottomated
Copy link
Contributor Author

@overlookmotel yep, already noticed this and started work on replacing tsify. I was wondering, however, if anything's actually depending on the wasm types right now — are they published, could they be temporarily disabled? I should have the new type generation work done this week.

Copy link
Collaborator

@overlookmotel overlookmotel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed a few more commits. @ottomated I hope you don't mind. It took me most of yesterday to review this PR, so I didn't want to request changes and end up going through the whole diff again to re-review. If anything you disagree with, feel free to open additional PRs to revert my changes.

Most are cosmetic. The ones which aren't are:

  • fix: type field in TS defs on structs with #[estree(custom_serialize)] attr

TS type defs were missing the type field for ArrayAssignmentTarget etc.

Note: I checked all the type defs. These were the only significant errors I found (comparing to the old .d.ts). Will submit separate PRs to fix another couple of less important differences.

  • fix: restore features = ["derive"] for serde in oxc_ast crate

We still have some #[derive(Serialize)] usage in oxc_ast/src/serialize.rs. Surprised Rust didn't complain. I guess it worked because oxc_span still had the feature enabled and oxc_ast depends on oxc_span.

  • refactor: remove unused TypescriptGenerator
  • refactor: revert GeneratorOutput

I removed these to reduce the diff. I'll resubmit those changes as separate PRs.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Oct 19, 2024
Copy link
Collaborator

overlookmotel commented Oct 19, 2024

Merge activity

  • Oct 19, 4:26 AM EDT: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Oct 19, 4:27 AM EDT: A user added this pull request to the Graphite merge queue.
  • Oct 19, 4:27 AM EDT: The Graphite merge queue couldn't merge this PR because it failed for an unknown reason (Stack merges are not currently supported for forked repositories. Please create a branch in the target repository in order to merge).

@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 19, 2024
@overlookmotel overlookmotel merged commit e310e52 into oxc-project:main Oct 19, 2024
28 checks passed
overlookmotel added a commit that referenced this pull request Oct 19, 2024
Follow-on after #6404. Nit. Group optional dependencies together.
Boshen added a commit that referenced this pull request Oct 19, 2024
## [0.32.0] - 2024-10-19

- c0e9d7e codegen: [**BREAKING**] `Codegen::into_source_text` consume
`Codegen` (#6539) (overlookmotel)

- 782f0a7 codegen: [**BREAKING**] Rename `print_char` method to
`print_ascii_byte` (#6512) (overlookmotel)

- 91c87dd codegen: [**BREAKING**] Remove `Codegen::enableSourceMap` API
(#6452) (Boshen)

- 7645e5c codegen: [**BREAKING**] Remove CommentOptions API (#6451)
(Boshen)

- 5200960 oxc: [**BREAKING**] Remove passing `Trivias` around (#6446)
(Boshen)

- 2808973 ast: [**BREAKING**] Add `Program::comments` (#6445) (Boshen)

### Features

- 5ee1ef3 allocator: Add `Vec::into_boxed_slice` (#6195) (DonIsaac)
- d9718ad ast_tools: Support `#[scope(exit_before)]` (#6350) (DonIsaac)
- e5ed6a5 codegen: Print negative numbers (#6624) (Boshen)
- 15c04e5 ecmascript: Add feature flag for constant evaluation (Boshen)
- d11770d ecmascript: Add `StringToNumber` (#6576) (Boshen)
- e561880 ecmascript: Add constant_evaluation and side_effects code
(#6550) (Boshen)
- 3556062 ecmascript: Add `ConstantEvaluation` (#6549) (Boshen)
- 39c2e66 ecmascript: Add `ToBigInt` and `StringToBigInt` (#6508)
(Boshen)
- 6f22538 ecmascript: Add `ToBoolean`, `ToNumber`, `ToString` (#6502)
(Boshen)
- 15dfc1d isolated-declarations: Impl `Default` for options (#6372)
(DonIsaac)
- 071e564 minifier: Finish implementing folding object expressions
(#6586) (camc314)
- 590925a minifier: Finish implementing folding array expressions
(#6575) (camc314)
- ef237cf minifier: Complete implementation of statement fusion (#6566)
(camc314)
- 97c8a36 minifier: Implement `collapse-variable-declarations` (#6464)
(dalaoshu)
- 096e590 minifier: Implement folding `charAt` string fns (#6436)
(camc314)
- e5a6f5d minifier: Implement converting template literals to strings
(#6486) (camc314)
- 14d0590 minifier: Implement folding of simple function calls
(`Boolean`) (#6484) (camc314)
- 7fbc7b6 minifier: Implement folding of simple function calls
(`String`) (#6483) (camc314)
- a4f57a4 minifier: Implement folding `indexOf` and `lastIndexOf` string
fns (#6435) (camc314)
- 3677ef8 minifier: Dce ExpressionStatements with no side effect (#6457)
(7086cmd)
- 06ea121 minifier: Fold for statement (#6450) (7086cmd)
- a9544ae minifier: Partially implement minification for some known
string methods (#6424) (camc314)
- 9dc4ee9 minifier: Implement block stmt support for `StatementFusion`
(#6422) (camc314)
- ebbf77d minifier: Implement calculations for NumberValue (#6419)
(7086cmd)
- 97ac179 minifier: Arithmetic operations for infinity. (#6332)
(7086cmd)
- 13b0b0b minifier: Fold literal object constructors on window (#6379)
(dalaoshu)
- e310e52 parser: Generate `Serialize` impls in ast_tools (#6404)
(ottomated)
- 58467a5 parser: Better handling of invalid modifiers (#6482)
(DonIsaac)
- 8ea6b72 parser: Better errors for reserved words used as identifier
names (#6478) (DonIsaac)
- b5b0af9 regular_expression: Support RegExp Modifiers (#6410)
(leaysgur)
- a01a5df transformer: Pass TransformerCtx to async-to-generator plugin
(#6633) (Dunqing)
- a9260cf transformer: `async-to-generator` plugin. (#5590) (Ethan Goh)
- 8fe1b0a transformer: Support helper loader (#6162) (Dunqing)
- ab51c2a transformer: Support `DefaultImport` in `ModuleImports`
(#6434) (Dunqing)
- a3dea9c transformer/async-to-generator: Handle arrow-function
correctly (#6640) (Dunqing)
- 41c8675 transformer/object-rest-spread: Using helper loader (#6449)
(Dunqing)

### Bug Fixes

- ba385fc codegen: Panic occurred when printing the comment of the right
parenthesis (#6593) (Dunqing)
- 02bfbfe codegen: Preserve parenthesis for `ChainExpression` (#6430)
(Dunqing)
- 2ade16e codegen: Invalid codegen when `in` inside bin expr in or loop
(#6431) (camc314)
- 6896efc codegen: Fix `in` in sequence expr in for loops (#6428)
(camc314)
- 7cc05f1 data_structures: Fix compilation failure on older Rust
versions (#6526) (overlookmotel)
- 2ce3e5f identifier: Add `ZWSP` to `is_irregular_whitespace` (#6662)
(Boshen)
- 2673397 isolated_declarations: Fix potential memory leak (#6622)
(overlookmotel)
- 389d261 minifier: `~~` operator should only work on numbers (#6598)
(Boshen)
- 16bea12 minifier: Use `to_js_string()` instead of `fs64::to_string`
(#6597) (Boshen)
- a71e8a0 minifier: Preserve init variable declarations when removing
`for` statements during DCE (#6551) (magic-akari)
- 721cf0f parser: Should be treated comments where after `(` as leading
comments of next token (#6588) (Dunqing)
- b1bf12c parser: Do not parse `as` and `satisfies` expression in
javascript (#6442) (Boshen)
- 9f9057b regular_expression: Fixed control Y regular expression (#6524)
(Tapan Prakash)
- c822b48 regular_expression: Fix CharacterClass negative codegen
(#6415) (leaysgur)
- 384d5be regular_expression: Flatten Spans on regex AST nodes (#6396)
(ottomated)
- 834ee2a semantic: `TSConditionalType` scope enter/exit locations
(#6351) (DonIsaac)
- 1d3d256 transformer: Correctly trim JSX (#6639) (magic-akari)
- c6f2b5f transformer: `HelperLoader` common transform: do not assume
`babelHelpers` is global (#6569) (overlookmotel)
- 85d93ed transformer: Arrow function transform: correctly resolve
`this` in class accessor properties (#6386) (overlookmotel)

### Performance

- 77f3a1a codegen: Check last char with byte methods (#6509)
(overlookmotel)
- 18b68ff codegen: Optimize `CodeBuffer::print_ascii_byte` (#6516)
(overlookmotel)
- 4d8bc8c parser: Precompute `is_typescript` (#6443) (Boshen)
- 7c20056 regex: Reduce string allocations in `Display` impls (#6528)
(DonIsaac)
- f70a413 transformer: Object spread transform: do not lookup `Object`
binding if not needed (#6570) (overlookmotel)
- ac77c87 traverse: Optimize `TraverseScoping::generate_uid_name`
(#6663) (overlookmotel)

### Documentation

- 9f555d7 allocator: Clarify docs for `Box` (#6625) (overlookmotel)
- 06e75b0 allocator: Enable lint warnings on missing docs, and add
missing doc comments (#6613) (DonIsaac)
- 7e909a7 codegen: Fix example for `CodeBuffer::print_ascii_bytes`
(#6535) (overlookmotel)
- 235d357 codegen: Improve doc comments for `CodeBuffer` (#6511)
(overlookmotel)
- c8fa2eb codegen: Correct and reformat doc comments for `CodeBuffer`
(#6504) (overlookmotel)
- 40d1ee4 codegen: Fix and reformat `CodeBuffer` examples (#6499)
(overlookmotel)
- de22b81 data-structures: Enable lint warnings on missing docs, and add
missing doc comments (#6612) (DonIsaac)
- 9e9fa9e span: Enable lint warnings on missing docs (#6617)
(overlookmotel)
- 6a194f9 span: Document validity of `ModuleKind::Unambiguous` (#6423)
(Boshen)
- 335b7f2 syntax: Enable lint warnings on missing docs, and add a lot of
documentation (#6611) (DonIsaac)
- f3451d7 transformer/async-to-generator: Remove empty lines from doc
comment (#6642) (overlookmotel)
- 448388a transformer/module_imports: Update outdated comments (#6574)
(Dunqing)

### Refactor

- 073b02a ast: Type params field before params in TS function
declaration types (#6391) (overlookmotel)
- 458f8f3 ast_tools: Consistent comments on `AstBuilder` methods (#6664)
(overlookmotel)
- 51fc63d codegen: Rename `CodeBuffer::print_bytes_unchecked` method
(#6517) (overlookmotel)
- 05a2ebd codegen: Reorder dependencies in `Cargo.toml` (#6514)
(overlookmotel)
- e7f3e28 codegen: Rename var in `CodeBuffer` (#6510) (overlookmotel)
- 1bbd383 codegen: Rename `CodeBuffer::print_ascii_bytes` method (#6507)
(overlookmotel)
- cd9fe9e codegen: Rename vars in `CodeBuffer` methods (#6506)
(overlookmotel)
- fc536a5 codegen: Inline `CodeBuffer` methods (#6501) (overlookmotel)
- 7420620 codegen: Add `CodeBuffer::as_bytes` method (#6498)
(overlookmotel)
- 8ae174b codegen: Rename `CodeBuffer::print_byte_unchecked` method
(#6496) (overlookmotel)
- 5843e01 codegen: Shorten `CodeBuffer::take_source_text` (#6495)
(overlookmotel)
- 951def6 codegen: Clarify safety comments in `CodeBuffer` (#6494)
(overlookmotel)
- 84a51ee codegen: Rename vars in `CodeBuffer` (#6493) (overlookmotel)
- 05bd616 codegen: Add line break (#6492) (overlookmotel)
- 204bf55 codegen: Add `CodeBuffer` to fix soundness hole (#6148)
(DonIsaac)
- 702b574 codegen: Only print necessary parentheses in TSAsExpression
(#6429) (Dunqing)
- aa6ba24 ecmascript: Improve string to number conversion (#6577)
(magic-akari)
- 6d041fb ecmascript: Remove `NumberValue` (#6519) (Boshen)
- 856cab5 ecmascript: Move ToInt32 from `oxc_syntax` to `oxc_ecmascript`
(#6471) (Boshen)
- 1ba2a24 ecmascript: Remove `HasProto` which is not part of the spec
(#6470) (Boshen)
- a504f96 isolated-declarations: Mark return struct as non exhaustive
(#6374) (DonIsaac)
- f4cdc56 minifier: Use constant folding unary expression from
`oxc_ecmascript` (#6647) (Boshen)
- 67ad08a minifier: Unify `ValueType` (#6545) (Boshen)
- bbca743 minifier: Move string methods to `oxc_ecmascript` (#6472)
(Boshen)
- 702c049 minifier: Move compress block to dce (#6468) (7086cmd)
- 46a38c6 minifier: Remove allow `clippy::unused_self` (#6441) (Boshen)
- 994b60b minifier: Use builtin get_number_value. (#6335) (7086cmd)
- 435a89c oxc: Remove useless `allocator.alloc(program)` calls (#6571)
(Boshen)
- c45723b parser: Fix typo in var name (#6500) (overlookmotel)
- 1a90ec4 rust: Backport v1.82.0 changes to main branch first (#6690)
(Boshen)
- 3faee66 span: Remove unused `ContentHash::content_hash_slice` (#6609)
(DonIsaac)
- 9281234 transformer: Shorten imports (#6643) (overlookmotel)
- 3af0840 transformer: `HelperLoader`: add import immediately (#6601)
(overlookmotel)
- f81aa7f transformer: `HelperLoader` common transform: comments (#6599)
(overlookmotel)
- 679cc68 transformer: `HelperLoader` common transform: construct string
directly in arena (#6596) (overlookmotel)
- c346ebb transformer: `HelperLoader` common transform: `Helper` enum
(#6595) (overlookmotel)
- 7a028b3 transformer: Remove unnecessary `#![warn]` attr (#6585)
(overlookmotel)
- 8c6afe0 transformer: Reorder imports (#6582) (overlookmotel)
- 779ff46 transformer: `HelperLoader` common transform: `Helper` struct
(#6568) (overlookmotel)
- bc24a24 transformer: `HelperLoader` common transform: use hashmap
`Entry` API (#6567) (overlookmotel)
- 9f02fc7 transformer: `HelperLoader` common transform: re-order fields
(#6565) (overlookmotel)
- 50ecade transformer: `HelperLoader` common transform: remove `Rc`s
(#6564) (overlookmotel)
- 1c1e9fc transformer: `HelperLoader` common transform: reorder methods
(#6563) (overlookmotel)
- c9054c8 transformer: Rename `ImportKind` to `Import` (#6561)
(overlookmotel)
- 9542c4e transformer: Add more specific methods to `ModuleImportsStore`
(#6560) (overlookmotel)
- 7e57a1d transformer: `ImportKind` use `BoundIdentifier` (#6559)
(overlookmotel)
- 602df9d transformer: Re-order fields of `Common` and `TransformCtx`
(#6562) (overlookmotel)
- 390abca transformer/async-to-generator: Use `helper_call_expr` (#6634)
(Dunqing)
- 2ff917f transformer/async-to-generator: Move internal methods below
entry points (#6632) (Dunqing)

### Styling

- fb916b2 regular_expression: Re-order dependencies in `Cargo.toml`
(#6672) (overlookmotel)
- 9d43a11 transformer: Re-order dependencies (#6659) (overlookmotel)

### Testing

- e7c89a5 codegen: Uncomment passed tests that are related to trailing
comments (#6589) (Dunqing)
- d816b0b codegen: Add test for `CodeBuffer::print_byte_unchecked`
(#6497) (overlookmotel)
- c5deb32 minifier: Port the rest of tests (#6420) (7086cmd)
- e59da61 minifier: Add all test cases for
`collapse_variable_declarations` (#6421) (dalaoshu)
- 73d6a4a minifier: Port all replace_known_methods tests. (#6418)
(7086cmd)

---------

Co-authored-by: Boshen <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
overlookmotel added a commit that referenced this pull request Oct 19, 2024
…hes (#6675)

Follow-on after #6404.

Shorten generated code for deriving `ESTree` by avoiding `ref` in matches.
overlookmotel added a commit that referenced this pull request Oct 19, 2024
Follow-on after #6404. Pure refactor. Rename `type_def` to `ts_type_def` to clarify that it's not an instance of `TypeDef` type.
overlookmotel added a commit that referenced this pull request Oct 19, 2024
Follow-on after #6404. Pure refactor. Shorten code for deriving `ESTree` by reducing repetition.
overlookmotel added a commit that referenced this pull request Oct 19, 2024
…6679)

Follow-on after #6404. Shorten generated code for `impl Serialize` by moving `#[allow]` attrs to top of file.
overlookmotel added a commit that referenced this pull request Oct 19, 2024
Follow-on after #6404. Shorten generated code for `impl Serialize`.
overlookmotel added a commit that referenced this pull request Oct 19, 2024
…erive (#6680)

Follow-on after #6404. Style nit. Add line breaks to generated code, to make it easier to read.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ast Area - AST A-ast-tools Area - AST tools A-semantic Area - Semantic C-enhancement Category - New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants