Skip to content

Comments

feat(ast_codegen): add visit generator#3954

Merged
graphite-app[bot] merged 1 commit intomainfrom
06-28-feat_ast_codegen_generate_visit.rs_
Jul 2, 2024
Merged

feat(ast_codegen): add visit generator#3954
graphite-app[bot] merged 1 commit intomainfrom
06-28-feat_ast_codegen_generate_visit.rs_

Conversation

@rzvxa
Copy link
Contributor

@rzvxa rzvxa commented Jun 28, 2024

The generated code is only here for the sake of my own comparison (instead of manually keeping a backup of the old generated file). I would clean this up as soon as it is ready, submit some parts of it as the down stack, and stack the actual generated code on top of this. So please don't let the huge diff distract you, It won't have many conflicts since almost all of these are the generated visit code, which is completely contained to its own module(other than some minor renaming refactors).

The order of function definitions is a bit different, I've used a depth-first search, We can switch to a breadth-first one to align functions more closely to the original.

@graphite-app
Copy link
Contributor

graphite-app bot commented Jun 28, 2024

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

Add the label “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 the A-ast Area - AST label Jun 28, 2024
@Boshen Boshen force-pushed the 06-26-improvement_ast_codegen_better_output_formatting branch from 0bd52d0 to 71c07c5 Compare June 29, 2024 05:37
@Boshen Boshen changed the base branch from 06-26-improvement_ast_codegen_better_output_formatting to main June 29, 2024 05:41
@Boshen Boshen force-pushed the 06-28-feat_ast_codegen_generate_visit.rs_ branch from fb2dfc5 to 7473cac Compare June 29, 2024 05:42
@rzvxa rzvxa force-pushed the 06-28-feat_ast_codegen_generate_visit.rs_ branch 2 times, most recently from 1eed4e1 to 4489d53 Compare June 29, 2024 15:28
@github-actions github-actions bot added A-semantic Area - Semantic A-isolated-declarations Isolated Declarations A-linter Area - Linter labels Jun 29, 2024
@rzvxa rzvxa changed the title feat(ast_codegen): generate visit.rs feat(ast_codegen): add visit generator Jun 29, 2024
@codspeed-hq
Copy link

codspeed-hq bot commented Jun 30, 2024

CodSpeed Performance Report

Merging #3954 will create unknown performance changes

Comparing 06-28-feat_ast_codegen_generate_visit.rs_ (7538af1) with main (4a0eaa0)

Summary

🆕 28 new benchmarks

Benchmarks breakdown

Benchmark main 06-28-feat_ast_codegen_generate_visit.rs_ Change
🆕 codegen_sourcemap[cal.com.tsx] N/A 35.6 ms N/A
🆕 lexer[RadixUIAdoptionSection.jsx] N/A 22.6 µs N/A
🆕 lexer[antd.js] N/A 20.1 ms N/A
🆕 lexer[cal.com.tsx] N/A 5 ms N/A
🆕 lexer[checker.ts] N/A 12 ms N/A
🆕 lexer[pdf.mjs] N/A 3.2 ms N/A
🆕 linter[cal.com.tsx] N/A 720.2 ms N/A
🆕 linter[checker.ts] N/A 1.3 s N/A
🆕 minifier[react.development.js] N/A 1.6 ms N/A
🆕 minifier[typescript.js] N/A 262 ms N/A
🆕 prepass[react.development.js] N/A 198.2 µs N/A
🆕 prepass[typescript.js] N/A 26.2 ms N/A
🆕 parser[RadixUIAdoptionSection.jsx] N/A 76 µs N/A
🆕 parser[antd.js] N/A 104.1 ms N/A
🆕 parser[cal.com.tsx] N/A 23.7 ms N/A
🆕 parser[checker.ts] N/A 52.5 ms N/A
🆕 parser[pdf.mjs] N/A 17.1 ms N/A
🆕 semantic[RadixUIAdoptionSection.jsx] N/A 120.9 µs N/A
🆕 semantic[antd.js] N/A 194.3 ms N/A
🆕 semantic[cal.com.tsx] N/A 53.9 ms N/A
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

@rzvxa rzvxa force-pushed the 06-28-feat_ast_codegen_generate_visit.rs_ branch 3 times, most recently from d1bc354 to c3e7710 Compare July 1, 2024 14:14
@rzvxa rzvxa changed the base branch from main to 07-01-refactor_ast_reorder_fields_to_reflect_their_visit_order July 1, 2024 14:14
@rzvxa rzvxa force-pushed the 06-28-feat_ast_codegen_generate_visit.rs_ branch from c3e7710 to 35ac9d7 Compare July 1, 2024 14:27
@rzvxa rzvxa changed the base branch from 07-01-refactor_ast_reorder_fields_to_reflect_their_visit_order to 07-01-refactor_ast_rename_arrow_expression_to_arrow_function_expression_ July 1, 2024 14:27
@rzvxa rzvxa force-pushed the 06-28-feat_ast_codegen_generate_visit.rs_ branch from 35ac9d7 to dfd94b9 Compare July 1, 2024 14:31
@rzvxa rzvxa changed the base branch from 07-01-refactor_ast_rename_arrow_expression_to_arrow_function_expression_ to 07-01-refactor_ast_rename_visit_enum_to_visit_ts_enum_declaration_ July 1, 2024 14:31
@rzvxa rzvxa force-pushed the 06-28-feat_ast_codegen_generate_visit.rs_ branch from dfd94b9 to 38939d3 Compare July 1, 2024 14:41
@rzvxa rzvxa changed the base branch from 07-01-refactor_ast_rename_visit_enum_to_visit_ts_enum_declaration_ to 07-01-refactor_ast_rename_visit_enum_memeber_to_visit_ts_enum_member_ July 1, 2024 14:41
@rzvxa rzvxa force-pushed the 06-28-feat_ast_codegen_generate_visit.rs_ branch from 826b3a4 to 684107f Compare July 1, 2024 16:43
@rzvxa rzvxa marked this pull request as ready for review July 1, 2024 16:52
@rzvxa rzvxa requested review from Boshen and overlookmotel July 1, 2024 16:58
@rzvxa rzvxa force-pushed the 07-01-refactor_ast_rename_visit_enum_memeber_to_visit_ts_enum_member_ branch from dcbcb58 to 03d7237 Compare July 2, 2024 08:55
@rzvxa rzvxa force-pushed the 06-28-feat_ast_codegen_generate_visit.rs_ branch from 684107f to e48dcda Compare July 2, 2024 08:56
@rzvxa rzvxa force-pushed the 07-01-refactor_ast_rename_visit_enum_memeber_to_visit_ts_enum_member_ branch from 03d7237 to 6a98d54 Compare July 2, 2024 08:59
@rzvxa rzvxa force-pushed the 06-28-feat_ast_codegen_generate_visit.rs_ branch from e48dcda to 6945378 Compare July 2, 2024 09:00
@rzvxa rzvxa force-pushed the 07-01-refactor_ast_rename_visit_enum_memeber_to_visit_ts_enum_member_ branch from 6a98d54 to 11196b8 Compare July 2, 2024 09:03
@rzvxa rzvxa force-pushed the 06-28-feat_ast_codegen_generate_visit.rs_ branch from 6945378 to e621e99 Compare July 2, 2024 09:03
@Boshen Boshen force-pushed the 07-01-refactor_ast_rename_visit_enum_memeber_to_visit_ts_enum_member_ branch from 11196b8 to 3d6f9bb Compare July 2, 2024 09:21
@rzvxa rzvxa force-pushed the 07-01-refactor_ast_rename_visit_enum_memeber_to_visit_ts_enum_member_ branch from 3d6f9bb to 354a28e Compare July 2, 2024 09:52
@rzvxa rzvxa force-pushed the 06-28-feat_ast_codegen_generate_visit.rs_ branch from e621e99 to c9cbb2f Compare July 2, 2024 09:52
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Jul 2, 2024 — with Graphite App
@rzvxa rzvxa force-pushed the 07-01-refactor_ast_rename_visit_enum_memeber_to_visit_ts_enum_member_ branch from 354a28e to 1df6ac0 Compare July 2, 2024 10:05
@rzvxa rzvxa force-pushed the 06-28-feat_ast_codegen_generate_visit.rs_ branch from c9cbb2f to 2b20de5 Compare July 2, 2024 10:06
@graphite-app
Copy link
Contributor

graphite-app bot commented Jul 2, 2024

Merge activity

@Boshen Boshen changed the base branch from 07-01-refactor_ast_rename_visit_enum_memeber_to_visit_ts_enum_member_ to main July 2, 2024 10:17
~~The generated code is only here for the sake of my own comparison (instead of manually keeping a backup of the old generated file). I would clean this up as soon as it is ready, submit some parts of it as the down stack, and stack the actual generated code on top of this. So please don't let the huge diff distract you, It won't have many conflicts since almost all of these are the generated visit code, which is completely contained to its own module(other than some minor renaming refactors).~~

The order of function definitions is a bit different, I've used a depth-first search, We can switch to a breadth-first one to align functions more closely to the original.
@Boshen Boshen force-pushed the 06-28-feat_ast_codegen_generate_visit.rs_ branch from 2b20de5 to 7538af1 Compare July 2, 2024 10:19
@graphite-app graphite-app bot merged commit 7538af1 into main Jul 2, 2024
@graphite-app graphite-app bot deleted the 06-28-feat_ast_codegen_generate_visit.rs_ branch July 2, 2024 10:36
@github-actions github-actions bot mentioned this pull request Jul 5, 2024
Boshen added a commit that referenced this pull request Jul 5, 2024
## [0.17.0] - 2024-07-05

- e32b4bc ast: [**BREAKING**] Store trivia comments in a sorted slice
(#4045) (Luca Bruno)

- 1df6ac0 ast: [**BREAKING**] Rename `visit_enum_memeber` to
`visit_ts_enum_member`. (#4000) (rzvxa)

- 4a0eaa0 ast: [**BREAKING**] Rename `visit_enum` to
`visit_ts_enum_declaration`. (#3998) (rzvxa)

- c98d8aa ast: [**BREAKING**] Rename `visit_arrow_expression` to
`visit_arrow_function_expression`. (#3995) (rzvxa)

### Features

- 1854a52 ast_codegen: Introduce the `#[span]` hint. (#4012) (rzvxa)
- 7538af1 ast_codegen: Add visit generator (#3954) (rzvxa)
- 7768d23 isolated-declarations: Support optional class methods (#4035)
(Egor Blinov)
- 0da9dfb minifier: Add constant folding to remove dead code (#4058)
(Boshen)

### Bug Fixes

- aaac2d8 codegen: Preserve parentheses from AST instead calculating
from operator precedence (#4055) (Boshen)
- 5e5b1b1 codegen: Correct accessibility emit for class
formal-parameters/methods/properties (#4042) (Egor Blinov)
- 7844734 codegen: Missing const keyword in TSTypeParamter (#4022)
(Dunqing)
- 6254a41 codegen: Missing TypeParamters in TSCallSignature (#4021)
(Dunqing)
- 3d29e9c isolated-declarations: Eliminate imports incorrectly when they
are used in `TSInferType` (#4043) (Dunqing)
- 02ea19a isolated-declarations: Should emit `export {}` when only
having `ImportDeclaration` (#4026) (Dunqing)
- 7c915f4 isolated-declarations: Binding elements with export should
report an error (#4025) (Dunqing)
- 05a047c isolated-declarations: Method following an abstract method
gets dropped (#4024) (Dunqing)
- c043bec isolated_declarations: Add mapped-type constraint to the scope
(#4037) (Egor Blinov)
- b007553 isolated_declarations: Fix readonly specifier on class
constructor params (#4030) (Egor Blinov)
- da62839 isolated_declarations: Inferring literal types for readonly
class fileds (#4027) (Egor Blinov)

### Refactor

- b51f75b ast_codegen: No longer outputs discard variable for empty
visitors. (#4008) (rzvxa)
- edb557c minifier: Add a folder struct for constant folding (#4057)
(Boshen)
- 243c9f3 parser: Use function instead of trait to parse list with rest
element (#4028) (Boshen)
- 1dacb1f parser: Use function instead of trait to parse delimited lists
(#4014) (Boshen)

Co-authored-by: Boshen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0-merge Merge with Graphite Merge Queue A-ast Area - AST A-isolated-declarations Isolated Declarations A-linter Area - Linter A-semantic Area - Semantic

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants