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

Commit

Permalink
chore: 🤖 rename ExpressionWithArguments to TsInstantiationExpr
Browse files Browse the repository at this point in the history
  • Loading branch information
IWANABETHATGUY committed Sep 10, 2022
1 parent 7defc3f commit 5279313
Show file tree
Hide file tree
Showing 15 changed files with 199 additions and 202 deletions.
24 changes: 12 additions & 12 deletions 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.

52 changes: 26 additions & 26 deletions 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.

24 changes: 12 additions & 12 deletions crates/rome_js_formatter/src/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2786,36 +2786,36 @@ impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::TsNonNullAssertionEx
FormatOwnedWithRule :: new (self , crate :: ts :: expressions :: non_null_assertion_expression :: FormatTsNonNullAssertionExpression :: default ())
}
}
impl FormatRule<rome_js_syntax::TsExpressionWithTypeArguments>
for crate::ts::expressions::expression_with_type_arguments::FormatTsExpressionWithTypeArguments
impl FormatRule<rome_js_syntax::TsInstantiationExpression>
for crate::ts::expressions::instantiation_expression::FormatTsInstantiationExpression
{
type Context = JsFormatContext;
#[inline(always)]
fn fmt(
&self,
node: &rome_js_syntax::TsExpressionWithTypeArguments,
node: &rome_js_syntax::TsInstantiationExpression,
f: &mut JsFormatter,
) -> FormatResult<()> {
FormatNodeRule::<rome_js_syntax::TsExpressionWithTypeArguments>::fmt(self, node, f)
FormatNodeRule::<rome_js_syntax::TsInstantiationExpression>::fmt(self, node, f)
}
}
impl<'a> AsFormat<'a> for rome_js_syntax::TsExpressionWithTypeArguments {
impl<'a> AsFormat<'a> for rome_js_syntax::TsInstantiationExpression {
type Format = FormatRefWithRule<
'a,
rome_js_syntax::TsExpressionWithTypeArguments,
crate::ts::expressions::expression_with_type_arguments::FormatTsExpressionWithTypeArguments,
rome_js_syntax::TsInstantiationExpression,
crate::ts::expressions::instantiation_expression::FormatTsInstantiationExpression,
>;
fn format(&'a self) -> Self::Format {
FormatRefWithRule :: new (self , crate :: ts :: expressions :: expression_with_type_arguments :: FormatTsExpressionWithTypeArguments :: default ())
FormatRefWithRule :: new (self , crate :: ts :: expressions :: instantiation_expression :: FormatTsInstantiationExpression :: default ())
}
}
impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::TsExpressionWithTypeArguments {
impl IntoFormat<crate::JsFormatContext> for rome_js_syntax::TsInstantiationExpression {
type Format = FormatOwnedWithRule<
rome_js_syntax::TsExpressionWithTypeArguments,
crate::ts::expressions::expression_with_type_arguments::FormatTsExpressionWithTypeArguments,
rome_js_syntax::TsInstantiationExpression,
crate::ts::expressions::instantiation_expression::FormatTsInstantiationExpression,
>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule :: new (self , crate :: ts :: expressions :: expression_with_type_arguments :: FormatTsExpressionWithTypeArguments :: default ())
FormatOwnedWithRule :: new (self , crate :: ts :: expressions :: instantiation_expression :: FormatTsInstantiationExpression :: default ())
}
}
impl FormatRule<rome_js_syntax::JsxTagExpression>
Expand Down
2 changes: 1 addition & 1 deletion crates/rome_js_formatter/src/js/any/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl FormatRule<JsAnyExpression> for FormatJsAnyExpression {
JsAnyExpression::TsTypeAssertionExpression(node) => node.format().fmt(f),
JsAnyExpression::TsAsExpression(node) => node.format().fmt(f),
JsAnyExpression::TsNonNullAssertionExpression(node) => node.format().fmt(f),
JsAnyExpression::TsExpressionWithTypeArguments(node) => node.format().fmt(f),
JsAnyExpression::TsInstantiationExpression(node) => node.format().fmt(f),
JsAnyExpression::JsxTagExpression(node) => node.format().fmt(f),
}
}
Expand Down
6 changes: 2 additions & 4 deletions crates/rome_js_formatter/src/parentheses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ impl NeedsParentheses for JsAnyExpression {
JsAnyExpression::TsTypeAssertionExpression(type_assertion) => {
type_assertion.needs_parentheses()
}
JsAnyExpression::TsExpressionWithTypeArguments(arguments) => {
arguments.needs_parentheses()
}
JsAnyExpression::TsInstantiationExpression(arguments) => arguments.needs_parentheses(),
}
}

Expand Down Expand Up @@ -255,7 +253,7 @@ impl NeedsParentheses for JsAnyExpression {
JsAnyExpression::TsTypeAssertionExpression(type_assertion) => {
type_assertion.needs_parentheses_with_parent(parent)
}
JsAnyExpression::TsExpressionWithTypeArguments(expr) => {
JsAnyExpression::TsInstantiationExpression(expr) => {
expr.needs_parentheses_with_parent(parent)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use crate::{parentheses::NeedsParentheses, prelude::*};
use rome_formatter::write;
use rome_js_syntax::{TsExpressionWithTypeArguments, TsExpressionWithTypeArgumentsFields};
use rome_js_syntax::{TsInstantiationExpression, TsInstantiationExpressionFields};
#[derive(Debug, Clone, Default)]
pub struct FormatTsExpressionWithTypeArguments;
impl FormatNodeRule<TsExpressionWithTypeArguments> for FormatTsExpressionWithTypeArguments {
pub struct FormatTsInstantiationExpression;
impl FormatNodeRule<TsInstantiationExpression> for FormatTsInstantiationExpression {
fn fmt_fields(
&self,
node: &TsExpressionWithTypeArguments,
node: &TsInstantiationExpression,
f: &mut JsFormatter,
) -> FormatResult<()> {
let TsExpressionWithTypeArgumentsFields {
let TsInstantiationExpressionFields {
expression,
arguments,
} = node.as_fields();
Expand All @@ -18,7 +18,7 @@ impl FormatNodeRule<TsExpressionWithTypeArguments> for FormatTsExpressionWithTyp
}
}

impl NeedsParentheses for TsExpressionWithTypeArguments {
impl NeedsParentheses for TsInstantiationExpression {
fn needs_parentheses_with_parent(&self, _: &rome_js_syntax::JsSyntaxNode) -> bool {
false
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rome_js_formatter/src/ts/expressions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Generated file, do not edit by hand, see `xtask/codegen`

pub(crate) mod as_expression;
pub(crate) mod expression_with_type_arguments;
pub(crate) mod instantiation_expression;
pub(crate) mod name_with_type_arguments;
pub(crate) mod non_null_assertion_expression;
pub(crate) mod template_chunk_element;
Expand Down
8 changes: 4 additions & 4 deletions crates/rome_js_parser/src/syntax/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ fn parse_member_expression_rest(
// test ts ts_optional_chain_call
// (<A, B>() => {})?.<A, B>();
let m = match lhs.kind() {
TS_EXPRESSION_WITH_TYPE_ARGUMENTS => lhs.undo_completion(p),
TS_INSTANTIATION_EXPRESSION => lhs.undo_completion(p),
_ => lhs.precede(p),
};
parse_template_literal(p, m, *in_optional_chain, true)
Expand All @@ -712,7 +712,7 @@ fn parse_member_expression_rest(
// only those two possible token in cur position `parse_ts_type_arguments_in_expression` could possibly return a `Present(_)`
if let Present(_) = parse_ts_type_arguments_in_expression(p) {
let new_marker = lhs.precede(p);
lhs = new_marker.complete(p, JsSyntaxKind::TS_EXPRESSION_WITH_TYPE_ARGUMENTS);
lhs = new_marker.complete(p, JsSyntaxKind::TS_INSTANTIATION_EXPRESSION);
continue;
};
break;
Expand Down Expand Up @@ -768,7 +768,7 @@ fn parse_new_expr(p: &mut Parser, context: ExpressionContext) -> ParsedSyntax {
.or_add_diagnostic(p, expected_expression)
.map(|expr| parse_member_expression_rest(p, expr, context, false, &mut false))
{
if let TS_EXPRESSION_WITH_TYPE_ARGUMENTS = lhs.kind() {
if let TS_INSTANTIATION_EXPRESSION = lhs.kind() {
lhs.undo_completion(p).abandon(p)
};
}
Expand Down Expand Up @@ -1669,7 +1669,7 @@ fn parse_call_expression_rest(
// Cloning here is necessary because parsing out the type arguments may rewind in which
// case we want to return the `lhs`.
let m = match lhs.kind() {
TS_EXPRESSION_WITH_TYPE_ARGUMENTS if !p.at(T![?.]) => lhs.clone().undo_completion(p),
TS_INSTANTIATION_EXPRESSION if !p.at(T![?.]) => lhs.clone().undo_completion(p),
_ => lhs.clone().precede(p),
};

Expand Down
Loading

0 comments on commit 5279313

Please sign in to comment.