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

Commit

Permalink
feat: 🎸 checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
IWANABETHATGUY committed Sep 11, 2022
1 parent 91de3db commit f45c26f
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/rome_js_factory/src/generated/node_factory.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/rome_js_factory/src/generated/syntax_factory.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions crates/rome_js_formatter/src/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11983,6 +11983,31 @@ impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::TsAnyTemplateElement
)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::JsLeftHandSideExpression {
type Format = FormatRefWithRule<
'a,
rome_js_syntax::JsLeftHandSideExpression,
crate::js::any::left_hand_side_expression::FormatJsLeftHandSideExpression,
>;
fn format(&'a self) -> Self::Format {
FormatRefWithRule::new(
self,
crate::js::any::left_hand_side_expression::FormatJsLeftHandSideExpression::default(),
)
}
}
impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::JsLeftHandSideExpression {
type Format = FormatOwnedWithRule<
rome_js_syntax::JsLeftHandSideExpression,
crate::js::any::left_hand_side_expression::FormatJsLeftHandSideExpression,
>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(
self,
crate::js::any::left_hand_side_expression::FormatJsLeftHandSideExpression::default(),
)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::JsxAnyTag {
type Format =
FormatRefWithRule<'a, rome_js_syntax::JsxAnyTag, crate::jsx::any::tag::FormatJsxAnyTag>;
Expand Down
20 changes: 20 additions & 0 deletions crates/rome_js_formatter/src/js/any/left_hand_side_expression.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//! Generated file, do not edit by hand, see `xtask/codegen`

use crate::prelude::*;
use rome_js_syntax::JsLeftHandSideExpression;
#[derive(Debug, Clone, Default)]
pub struct FormatJsLeftHandSideExpression;
impl FormatRule<JsLeftHandSideExpression> for FormatJsLeftHandSideExpression {
type Context = JsFormatContext;
fn fmt(&self, node: &JsLeftHandSideExpression, f: &mut JsFormatter) -> FormatResult<()> {
match node {
JsLeftHandSideExpression::JsParenthesizedExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsStaticMemberExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsComputedMemberExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::JsIdentifierExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::TsNonNullAssertionExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::TsTypeAssertionExpression(node) => node.format().fmt(f),
JsLeftHandSideExpression::TsAsExpression(node) => node.format().fmt(f),
}
}
}
1 change: 1 addition & 0 deletions crates/rome_js_formatter/src/js/any/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub(crate) mod function_body;
pub(crate) mod import_assertion_entry;
pub(crate) mod import_clause;
pub(crate) mod in_property;
pub(crate) mod left_hand_side_expression;
pub(crate) mod literal_expression;
pub(crate) mod method_modifier;
pub(crate) mod module_item;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{parentheses::NeedsParentheses, prelude::*};
use crate::{parentheses::{NeedsParentheses, unary_like_expression_needs_parentheses}, prelude::*};
use rome_formatter::write;
use rome_js_syntax::{TsInstantiationExpression, TsInstantiationExpressionFields};
#[derive(Debug, Clone, Default)]
Expand All @@ -19,7 +19,7 @@ impl FormatNodeRule<TsInstantiationExpression> for FormatTsInstantiationExpressi
}

impl NeedsParentheses for TsInstantiationExpression {
fn needs_parentheses_with_parent(&self, _: &rome_js_syntax::JsSyntaxNode) -> bool {
false
fn needs_parentheses_with_parent(&self, parent: &rome_js_syntax::JsSyntaxNode) -> bool {
unary_like_expression_needs_parentheses(self.syntax(), parent)
}
}
212 changes: 210 additions & 2 deletions crates/rome_js_syntax/src/generated/nodes.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/rome_js_syntax/src/generated/nodes_mut.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion xtask/codegen/js.ungram
Original file line number Diff line number Diff line change
Expand Up @@ -2111,9 +2111,17 @@ TsTypeAssertionExpression =
'>'
expression: JsAnyExpression

JsLeftHandSideExpression =
JsParenthesizedExpression
| JsStaticMemberExpression
| JsComputedMemberExpression
| JsIdentifierExpression
| TsNonNullAssertionExpression
| TsTypeAssertionExpression
| TsAsExpression
// This `SyntaxKind` is related to `ExpressionWithTypeArguments` in Typescript
TsInstantiationExpression =
expression: JsAnyExpression
expression: JsLeftHandSideExpression
arguments: TsTypeArguments

TsAsExpression =
Expand Down

0 comments on commit f45c26f

Please sign in to comment.