Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

refactor: Move AST types to rome_rowan #2372

Merged
merged 12 commits into from
Apr 8, 2022

Conversation

MichaReiser
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 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-workers-and-pages
Copy link

cloudflare-workers-and-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 April 7, 2022 15:20
@MichaReiser MichaReiser changed the title Refactor/move ast nodes to rowan refactor: Move AST types to rome_rowan Apr 7, 2022
@MichaReiser MichaReiser marked this pull request as ready for review April 7, 2022 15:31
Copy link
Contributor

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

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
@MichaReiser MichaReiser deleted the refactor/move-ast-nodes-to-rowan branch April 8, 2022 13:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants