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

Commit

Permalink
Rename CallExpr to JsCallExpression and NewExpr to `JsNewExpres…
Browse files Browse the repository at this point in the history
…sion`
  • Loading branch information
MichaReiser committed Dec 23, 2021
1 parent 4fd4e7c commit 9ee137e
Show file tree
Hide file tree
Showing 38 changed files with 365 additions and 367 deletions.
6 changes: 3 additions & 3 deletions crates/rome_formatter/src/cst.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{FormatElement, FormatResult, Formatter, ToFormatElement};
use rslint_parser::ast::{
CallExpr, JsArrayBindingPattern, JsArrayExpression, JsArrowFunctionExpression,
JsBlockStatement, JsBooleanLiteralExpression, JsCallArguments, JsCaseClause, JsCatchClause,
JsArrayBindingPattern, JsArrayExpression, JsArrowFunctionExpression, JsBlockStatement,
JsBooleanLiteralExpression, JsCallArguments, JsCallExpression, JsCaseClause, JsCatchClause,
JsClassDeclaration, JsConstructorParameters, JsContinueStatement, JsDebuggerStatement,
JsDefaultClause, JsDoWhileStatement, JsEmptyStatement, JsExpressionStatement, JsFinallyClause,
JsForInStatement, JsForStatement, JsFunctionDeclaration, JsGetterClassMember,
Expand Down Expand Up @@ -138,7 +138,7 @@ impl ToFormatElement for SyntaxNode {
JsSyntaxKind::JS_ARRAY_BINDING_PATTERN => JsArrayBindingPattern::cast(self.clone())
.unwrap()
.to_format_element(formatter),
JsSyntaxKind::CALL_EXPR => CallExpr::cast(self.clone())
JsSyntaxKind::JS_CALL_EXPRESSION => JsCallExpression::cast(self.clone())
.unwrap()
.to_format_element(formatter),
JsSyntaxKind::JS_CALL_ARGUMENTS => JsCallArguments::cast(self.clone())
Expand Down
4 changes: 2 additions & 2 deletions crates/rome_formatter/src/ts/expressions/call_expression.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{format_elements, FormatElement, FormatResult, Formatter, ToFormatElement};
use rslint_parser::ast::CallExpr;
use rslint_parser::ast::JsCallExpression;

impl ToFormatElement for CallExpr {
impl ToFormatElement for JsCallExpression {
fn to_format_element(&self, formatter: &Formatter) -> FormatResult<FormatElement> {
let name = formatter.format_node(self.callee()?)?;
let arguments = formatter.format_node(self.arguments()?)?;
Expand Down
13 changes: 6 additions & 7 deletions crates/rome_formatter/src/ts/expressions/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ use crate::{
};
use rslint_parser::ast::{
JsAnyExpression, JsAssignmentExpression, JsAwaitExpression, JsBinaryExpression,
JsComputedMemberExpression, JsConditionalExpression, JsLogicalExpression,
JsParenthesizedExpression, JsThisExpression, JsUnaryExpression, JsYieldExpression, NewExpr,
NewTarget,
JsComputedMemberExpression, JsConditionalExpression, JsLogicalExpression, JsNewExpression,
JsParenthesizedExpression, JsThisExpression, JsUnaryExpression, JsYieldExpression, NewTarget,
};
use rslint_parser::{token_set, TokenSet, T};

Expand Down Expand Up @@ -39,8 +38,8 @@ impl ToFormatElement for JsAnyExpression {
JsAnyExpression::JsStaticMemberExpression(static_member_expression) => {
static_member_expression.to_format_element(formatter)
}
JsAnyExpression::NewExpr(new_expr) => new_expr.to_format_element(formatter),
JsAnyExpression::CallExpr(call_expression) => {
JsAnyExpression::JsNewExpression(new_expr) => new_expr.to_format_element(formatter),
JsAnyExpression::JsCallExpression(call_expression) => {
call_expression.to_format_element(formatter)
}
JsAnyExpression::JsUnaryExpression(unary_expression) => {
Expand Down Expand Up @@ -125,7 +124,7 @@ impl ToFormatElement for JsComputedMemberExpression {
}
}

impl ToFormatElement for NewExpr {
impl ToFormatElement for JsNewExpression {
fn to_format_element(&self, formatter: &Formatter) -> FormatResult<FormatElement> {
let arguments = if let Some(arguments) = self.arguments() {
formatter.format_node(arguments)?
Expand All @@ -137,7 +136,7 @@ impl ToFormatElement for NewExpr {
formatter.format_token(&self.new_token()?)?,
// TODO handle TsTypeArgs
space_token(),
formatter.format_node(self.object()?)?,
formatter.format_node(self.callee()?)?,
arguments,
])
}
Expand Down
9 changes: 0 additions & 9 deletions crates/rslint_parser/src/ast/expr_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,6 @@ impl Template {
}
}

impl CallExpr {
pub fn opt_chain_token(&self) -> Option<SyntaxToken> {
self.syntax()
.children_with_tokens()
.filter_map(|child| child.into_token())
.find(|tok| tok.kind() == QUESTIONDOT)
}
}

/// A simple macro for making assign, binop, or unary operators
#[macro_export]
macro_rules! op {
Expand Down
Loading

0 comments on commit 9ee137e

Please sign in to comment.