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

refactor: Move AST types to rome_rowan #2372

Merged
merged 12 commits into from Apr 8, 2022
Merged

Conversation

Copy link
Contributor

@MichaReiser MichaReiser commented Apr 7, 2022

Summary

This PR parametrizes the Ast traits with a Language type and moves them to the rome_rowan crate so that they can be shared between rome_js_syntax and rome_css_syntax (and potential future crates).

Other changes:

  • Renames the JS/CSS Syntax* aliases to JsSyntax* and CssSyntax. For example: type SyntaxNode = rome_rowan::SyntaxNode<JsLanguage> is now called JsSyntaxNode. I believe this helps understanding the difference between the different nodes and aligns the naming with the kind types (that are called JsSyntaxKind and CssSyntaxKind
  • Moved most util methods to the SyntaxNode struct.
  • Renamed cast to try_cast and move the SyntaxNodeExt::to to method to AstNode with the name cast.

Test Plan

cargo test

@github-actions
Copy link

@github-actions github-actions bot commented Apr 7, 2022

Parser conformance results on ubuntu-latest

js/262

Test result main count This PR count Difference
Total 45250 45250 0
Passed 44310 44310 0
Failed 940 940 0
Panics 0 0 0
Coverage 97.92% 97.92% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 39 39 0
Passed 36 36 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.31% 92.31% 0.00%

ts/babel

Test result main count This PR count Difference
Total 584 584 0
Passed 508 508 0
Failed 76 76 0
Panics 0 0 0
Coverage 86.99% 86.99% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 15983 15983 0
Passed 12167 12167 0
Failed 3816 3816 0
Panics 0 0 0
Coverage 76.12% 76.12% 0.00%

@cloudflare-pages
Copy link

@cloudflare-pages cloudflare-pages bot commented Apr 7, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5243119
Status:⚡️  Build in progress...

View logs

@MichaReiser MichaReiser force-pushed the refactor/move-ast-nodes-to-rowan branch from de245f1 to 1025226 Compare Apr 7, 2022
@MichaReiser MichaReiser changed the title Refactor/move ast nodes to rowan refactor: Move AST types to rome_rowan Apr 7, 2022
@MichaReiser MichaReiser requested review from ematipico and leops Apr 7, 2022
@MichaReiser MichaReiser marked this pull request as ready for review Apr 7, 2022
Copy link
Collaborator

@ematipico ematipico left a comment

This is a great change! I will need it for the formatter too :)

.gitattributes Outdated Show resolved Hide resolved
crates/rome_rowan/src/ast/mod.rs Outdated Show resolved Hide resolved
@MichaReiser MichaReiser merged commit 5c27113 into main Apr 8, 2022
5 of 6 checks passed
@MichaReiser MichaReiser deleted the refactor/move-ast-nodes-to-rowan branch Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants