mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
refactor(ast)!: Change order of fields in CallExpression (#4859)
fix: #4821 --------- Co-authored-by: Dunqing <dengqing0821@gmail.com>
This commit is contained in:
parent
38d4434473
commit
f88970bc79
27 changed files with 2301 additions and 2225 deletions
|
|
@ -606,9 +606,9 @@ pub struct PrivateFieldExpression<'a> {
|
|||
pub struct CallExpression<'a> {
|
||||
#[serde(flatten)]
|
||||
pub span: Span,
|
||||
pub arguments: Vec<'a, Argument<'a>>,
|
||||
pub callee: Expression<'a>,
|
||||
pub type_parameters: Option<Box<'a, TSTypeParameterInstantiation<'a>>>,
|
||||
pub arguments: Vec<'a, Argument<'a>>,
|
||||
pub optional: bool, // for optional chaining
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -178,9 +178,9 @@ const _: () = {
|
|||
assert!(size_of::<CallExpression>() == 72usize);
|
||||
assert!(align_of::<CallExpression>() == 8usize);
|
||||
assert!(offset_of!(CallExpression, span) == 0usize);
|
||||
assert!(offset_of!(CallExpression, arguments) == 8usize);
|
||||
assert!(offset_of!(CallExpression, callee) == 40usize);
|
||||
assert!(offset_of!(CallExpression, type_parameters) == 56usize);
|
||||
assert!(offset_of!(CallExpression, callee) == 8usize);
|
||||
assert!(offset_of!(CallExpression, type_parameters) == 24usize);
|
||||
assert!(offset_of!(CallExpression, arguments) == 32usize);
|
||||
assert!(offset_of!(CallExpression, optional) == 64usize);
|
||||
|
||||
assert!(size_of::<NewExpression>() == 64usize);
|
||||
|
|
@ -1583,9 +1583,9 @@ const _: () = {
|
|||
assert!(size_of::<CallExpression>() == 40usize);
|
||||
assert!(align_of::<CallExpression>() == 4usize);
|
||||
assert!(offset_of!(CallExpression, span) == 0usize);
|
||||
assert!(offset_of!(CallExpression, arguments) == 8usize);
|
||||
assert!(offset_of!(CallExpression, callee) == 24usize);
|
||||
assert!(offset_of!(CallExpression, type_parameters) == 32usize);
|
||||
assert!(offset_of!(CallExpression, callee) == 8usize);
|
||||
assert!(offset_of!(CallExpression, type_parameters) == 16usize);
|
||||
assert!(offset_of!(CallExpression, arguments) == 20usize);
|
||||
assert!(offset_of!(CallExpression, optional) == 36usize);
|
||||
|
||||
assert!(size_of::<NewExpression>() == 36usize);
|
||||
|
|
|
|||
|
|
@ -680,17 +680,17 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - arguments
|
||||
/// - callee
|
||||
/// - type_parameters
|
||||
/// - arguments
|
||||
/// - optional
|
||||
#[inline]
|
||||
pub fn expression_call<T1>(
|
||||
self,
|
||||
span: Span,
|
||||
arguments: Vec<'a, Argument<'a>>,
|
||||
callee: Expression<'a>,
|
||||
type_parameters: T1,
|
||||
arguments: Vec<'a, Argument<'a>>,
|
||||
optional: bool,
|
||||
) -> Expression<'a>
|
||||
where
|
||||
|
|
@ -698,9 +698,9 @@ impl<'a> AstBuilder<'a> {
|
|||
{
|
||||
Expression::CallExpression(self.alloc(self.call_expression(
|
||||
span,
|
||||
arguments,
|
||||
callee,
|
||||
type_parameters,
|
||||
arguments,
|
||||
optional,
|
||||
)))
|
||||
}
|
||||
|
|
@ -2295,17 +2295,17 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - arguments
|
||||
/// - callee
|
||||
/// - type_parameters
|
||||
/// - arguments
|
||||
/// - optional
|
||||
#[inline]
|
||||
pub fn call_expression<T1>(
|
||||
self,
|
||||
span: Span,
|
||||
arguments: Vec<'a, Argument<'a>>,
|
||||
callee: Expression<'a>,
|
||||
type_parameters: T1,
|
||||
arguments: Vec<'a, Argument<'a>>,
|
||||
optional: bool,
|
||||
) -> CallExpression<'a>
|
||||
where
|
||||
|
|
@ -2313,9 +2313,9 @@ impl<'a> AstBuilder<'a> {
|
|||
{
|
||||
CallExpression {
|
||||
span,
|
||||
arguments,
|
||||
callee,
|
||||
type_parameters: type_parameters.into_in(self.allocator),
|
||||
arguments,
|
||||
optional,
|
||||
}
|
||||
}
|
||||
|
|
@ -2326,24 +2326,24 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - arguments
|
||||
/// - callee
|
||||
/// - type_parameters
|
||||
/// - arguments
|
||||
/// - optional
|
||||
#[inline]
|
||||
pub fn alloc_call_expression<T1>(
|
||||
self,
|
||||
span: Span,
|
||||
arguments: Vec<'a, Argument<'a>>,
|
||||
callee: Expression<'a>,
|
||||
type_parameters: T1,
|
||||
arguments: Vec<'a, Argument<'a>>,
|
||||
optional: bool,
|
||||
) -> Box<'a, CallExpression<'a>>
|
||||
where
|
||||
T1: IntoIn<'a, Option<Box<'a, TSTypeParameterInstantiation<'a>>>>,
|
||||
{
|
||||
Box::new_in(
|
||||
self.call_expression(span, arguments, callee, type_parameters, optional),
|
||||
self.call_expression(span, callee, type_parameters, arguments, optional),
|
||||
self.allocator,
|
||||
)
|
||||
}
|
||||
|
|
@ -3497,17 +3497,17 @@ impl<'a> AstBuilder<'a> {
|
|||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - arguments
|
||||
/// - callee
|
||||
/// - type_parameters
|
||||
/// - arguments
|
||||
/// - optional
|
||||
#[inline]
|
||||
pub fn chain_element_call_expression<T1>(
|
||||
self,
|
||||
span: Span,
|
||||
arguments: Vec<'a, Argument<'a>>,
|
||||
callee: Expression<'a>,
|
||||
type_parameters: T1,
|
||||
arguments: Vec<'a, Argument<'a>>,
|
||||
optional: bool,
|
||||
) -> ChainElement<'a>
|
||||
where
|
||||
|
|
@ -3515,9 +3515,9 @@ impl<'a> AstBuilder<'a> {
|
|||
{
|
||||
ChainElement::CallExpression(self.alloc(self.call_expression(
|
||||
span,
|
||||
arguments,
|
||||
callee,
|
||||
type_parameters,
|
||||
arguments,
|
||||
optional,
|
||||
)))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -582,9 +582,9 @@ impl<'old_alloc, 'new_alloc> CloneIn<'new_alloc> for CallExpression<'old_alloc>
|
|||
fn clone_in(&self, allocator: &'new_alloc Allocator) -> Self::Cloned {
|
||||
CallExpression {
|
||||
span: self.span.clone_in(allocator),
|
||||
arguments: self.arguments.clone_in(allocator),
|
||||
callee: self.callee.clone_in(allocator),
|
||||
type_parameters: self.type_parameters.clone_in(allocator),
|
||||
arguments: self.arguments.clone_in(allocator),
|
||||
optional: self.optional.clone_in(allocator),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2900,11 +2900,11 @@ pub mod walk {
|
|||
pub fn walk_call_expression<'a, V: Visit<'a>>(visitor: &mut V, it: &CallExpression<'a>) {
|
||||
let kind = AstKind::CallExpression(visitor.alloc(it));
|
||||
visitor.enter_node(kind);
|
||||
visitor.visit_arguments(&it.arguments);
|
||||
visitor.visit_expression(&it.callee);
|
||||
if let Some(type_parameters) = &it.type_parameters {
|
||||
visitor.visit_ts_type_parameter_instantiation(type_parameters);
|
||||
}
|
||||
visitor.visit_arguments(&it.arguments);
|
||||
visitor.leave_node(kind);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3024,11 +3024,11 @@ pub mod walk_mut {
|
|||
pub fn walk_call_expression<'a, V: VisitMut<'a>>(visitor: &mut V, it: &mut CallExpression<'a>) {
|
||||
let kind = AstType::CallExpression;
|
||||
visitor.enter_node(kind);
|
||||
visitor.visit_arguments(&mut it.arguments);
|
||||
visitor.visit_expression(&mut it.callee);
|
||||
if let Some(type_parameters) = &mut it.type_parameters {
|
||||
visitor.visit_ts_type_parameter_instantiation(type_parameters);
|
||||
}
|
||||
visitor.visit_arguments(&mut it.arguments);
|
||||
visitor.leave_node(kind);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use oxc_ast::{
|
||||
ast::{Expression, MethodDefinitionKind},
|
||||
ast::{Argument, Expression, MethodDefinitionKind},
|
||||
AstKind,
|
||||
};
|
||||
use oxc_cfg::{
|
||||
|
|
@ -73,11 +73,13 @@ impl Rule for NoThisBeforeSuper {
|
|||
AstKind::Super(_) => {
|
||||
let basic_block_id = node.cfg_id();
|
||||
if let Some(parent) = semantic.nodes().parent_node(node.id()) {
|
||||
if let AstKind::CallExpression(_) = parent.kind() {
|
||||
// Note: we don't need to worry about also having invalid
|
||||
// usage in the same callexpression, because arguments are visited
|
||||
// before the callee in generating the semantic nodes.
|
||||
basic_blocks_with_super_called.insert(basic_block_id);
|
||||
if let AstKind::CallExpression(call_expr) = parent.kind() {
|
||||
let has_this_or_super_in_args =
|
||||
Self::contains_this_or_super_in_args(&call_expr.arguments);
|
||||
|
||||
if !has_this_or_super_in_args {
|
||||
basic_blocks_with_super_called.insert(basic_block_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if !basic_blocks_with_super_called.contains(&basic_block_id) {
|
||||
|
|
@ -246,6 +248,27 @@ impl NoThisBeforeSuper {
|
|||
}),
|
||||
})
|
||||
}
|
||||
|
||||
fn contains_this_or_super(arg: &Argument) -> bool {
|
||||
match arg {
|
||||
Argument::Super(_) | Argument::ThisExpression(_) => true,
|
||||
Argument::CallExpression(call_expr) => {
|
||||
matches!(&call_expr.callee, Expression::Super(_) | Expression::ThisExpression(_))
|
||||
|| matches!(&call_expr.callee,
|
||||
Expression::StaticMemberExpression(static_member) if
|
||||
matches!(static_member.object, Expression::Super(_) | Expression::ThisExpression(_)))
|
||||
|| Self::contains_this_or_super_in_args(&call_expr.arguments)
|
||||
}
|
||||
Argument::StaticMemberExpression(call_expr) => {
|
||||
matches!(&call_expr.object, Expression::Super(_) | Expression::ThisExpression(_))
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn contains_this_or_super_in_args(args: &[Argument]) -> bool {
|
||||
args.iter().any(|arg| Self::contains_this_or_super(arg))
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -382,8 +405,11 @@ fn test() {
|
|||
("class A extends B { constructor() { this.c(); super(); } }", None),
|
||||
("class A extends B { constructor() { super.c(); super(); } }", None),
|
||||
// disallows `this`/`super` in arguments of `super()`.
|
||||
("class A extends B { constructor() { super(this); } }", None),
|
||||
("class A extends B { constructor() { super(this.c); } }", None),
|
||||
("class A extends B { constructor() { super(a(b(this.c))); } }", None),
|
||||
("class A extends B { constructor() { super(this.c()); } }", None),
|
||||
("class A extends B { constructor() { super(super.c); } }", None),
|
||||
("class A extends B { constructor() { super(super.c()); } }", None),
|
||||
// // even if is nested, reports correctly.
|
||||
(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
source: crates/oxc_linter/src/tester.rs
|
||||
assertion_line: 216
|
||||
---
|
||||
⚠ eslint-plugin-vitest(no-conditional-expect): Unexpected conditional expect
|
||||
╭─[no_conditional_expect.tsx:3:34]
|
||||
|
|
@ -327,12 +326,12 @@ assertion_line: 216
|
|||
help: Avoid calling `expect` conditionally`
|
||||
|
||||
⚠ eslint-plugin-vitest(no-conditional-expect): Unexpected conditional expect
|
||||
╭─[no_conditional_expect.tsx:9:37]
|
||||
8 │ .then(() => { throw new Error('oh noes!'); })
|
||||
9 │ .catch(error => expect(error).toBeInstanceOf(Error));
|
||||
· ──────
|
||||
10 │ });
|
||||
╰────
|
||||
╭─[no_conditional_expect.tsx:5:37]
|
||||
4 │ .then(() => { throw new Error('oh noes!'); })
|
||||
5 │ .catch(error => expect(error).toBeInstanceOf(Error))
|
||||
· ──────
|
||||
6 │ .then(() => { throw new Error('oh noes!'); })
|
||||
╰────
|
||||
help: Avoid calling `expect` conditionally`
|
||||
|
||||
⚠ eslint-plugin-vitest(no-conditional-expect): Unexpected conditional expect
|
||||
|
|
@ -345,20 +344,20 @@ assertion_line: 216
|
|||
help: Avoid calling `expect` conditionally`
|
||||
|
||||
⚠ eslint-plugin-vitest(no-conditional-expect): Unexpected conditional expect
|
||||
╭─[no_conditional_expect.tsx:5:37]
|
||||
4 │ .then(() => { throw new Error('oh noes!'); })
|
||||
5 │ .catch(error => expect(error).toBeInstanceOf(Error))
|
||||
· ──────
|
||||
6 │ .then(() => { throw new Error('oh noes!'); })
|
||||
╰────
|
||||
╭─[no_conditional_expect.tsx:9:37]
|
||||
8 │ .then(() => { throw new Error('oh noes!'); })
|
||||
9 │ .catch(error => expect(error).toBeInstanceOf(Error));
|
||||
· ──────
|
||||
10 │ });
|
||||
╰────
|
||||
help: Avoid calling `expect` conditionally`
|
||||
|
||||
⚠ eslint-plugin-vitest(no-conditional-expect): Unexpected conditional expect
|
||||
╭─[no_conditional_expect.tsx:6:32]
|
||||
5 │ .catch(error => expect(error).toBeInstanceOf(Error))
|
||||
6 │ .catch(error => expect(error).toBeInstanceOf(Error));
|
||||
╭─[no_conditional_expect.tsx:4:32]
|
||||
3 │ await Promise.resolve()
|
||||
4 │ .catch(error => expect(error).toBeInstanceOf(Error))
|
||||
· ──────
|
||||
7 │ });
|
||||
5 │ .catch(error => expect(error).toBeInstanceOf(Error))
|
||||
╰────
|
||||
help: Avoid calling `expect` conditionally`
|
||||
|
||||
|
|
@ -372,11 +371,11 @@ assertion_line: 216
|
|||
help: Avoid calling `expect` conditionally`
|
||||
|
||||
⚠ eslint-plugin-vitest(no-conditional-expect): Unexpected conditional expect
|
||||
╭─[no_conditional_expect.tsx:4:32]
|
||||
3 │ await Promise.resolve()
|
||||
4 │ .catch(error => expect(error).toBeInstanceOf(Error))
|
||||
· ──────
|
||||
╭─[no_conditional_expect.tsx:6:32]
|
||||
5 │ .catch(error => expect(error).toBeInstanceOf(Error))
|
||||
6 │ .catch(error => expect(error).toBeInstanceOf(Error));
|
||||
· ──────
|
||||
7 │ });
|
||||
╰────
|
||||
help: Avoid calling `expect` conditionally`
|
||||
|
||||
|
|
|
|||
|
|
@ -17,14 +17,6 @@ source: crates/oxc_linter/src/tester.rs
|
|||
11 │
|
||||
╰────
|
||||
|
||||
⚠ eslint-plugin-jest(no-confusing-set-timeout): `jest.setTimeout` should be placed before any other jest methods
|
||||
╭─[no_confusing_set_timeout.tsx:10:17]
|
||||
9 │ });
|
||||
10 │ jest.setTimeout(800);
|
||||
· ───────────────
|
||||
11 │
|
||||
╰────
|
||||
|
||||
⚠ eslint-plugin-jest(no-confusing-set-timeout): Do not call `jest.setTimeout` multiple times
|
||||
╭─[no_confusing_set_timeout.tsx:10:17]
|
||||
9 │ });
|
||||
|
|
@ -42,7 +34,15 @@ source: crates/oxc_linter/src/tester.rs
|
|||
11 │
|
||||
╰────
|
||||
|
||||
⚠ eslint-plugin-jest(no-confusing-set-timeout): `jest.setTimeout` should be call in `global` scope
|
||||
⚠ eslint-plugin-jest(no-confusing-set-timeout): `jest.setTimeout` should be placed before any other jest methods
|
||||
╭─[no_confusing_set_timeout.tsx:10:17]
|
||||
9 │ });
|
||||
10 │ jest.setTimeout(800);
|
||||
· ───────────────
|
||||
11 │
|
||||
╰────
|
||||
|
||||
⚠ eslint-plugin-jest(no-confusing-set-timeout): `jest.setTimeout` should be placed before any other jest methods
|
||||
╭─[no_confusing_set_timeout.tsx:3:21]
|
||||
2 │ describe('A', () => {
|
||||
3 │ jest.setTimeout(800);
|
||||
|
|
@ -51,6 +51,14 @@ source: crates/oxc_linter/src/tester.rs
|
|||
╰────
|
||||
|
||||
⚠ eslint-plugin-jest(no-confusing-set-timeout): `jest.setTimeout` should be call in `global` scope
|
||||
╭─[no_confusing_set_timeout.tsx:3:21]
|
||||
2 │ describe('A', () => {
|
||||
3 │ jest.setTimeout(800);
|
||||
· ───────────────
|
||||
4 │ beforeEach(async () => { await new Promise(resolve => { setTimeout(resolve, 10000).unref(); });});
|
||||
╰────
|
||||
|
||||
⚠ eslint-plugin-jest(no-confusing-set-timeout): `jest.setTimeout` should be placed before any other jest methods
|
||||
╭─[no_confusing_set_timeout.tsx:5:25]
|
||||
4 │ await new Promise((resolve) => {
|
||||
5 │ jest.setTimeout(1000);
|
||||
|
|
@ -58,6 +66,30 @@ source: crates/oxc_linter/src/tester.rs
|
|||
6 │ setTimeout(resolve, 10000).unref();
|
||||
╰────
|
||||
|
||||
⚠ eslint-plugin-jest(no-confusing-set-timeout): `jest.setTimeout` should be placed before any other jest methods
|
||||
╭─[no_confusing_set_timeout.tsx:5:25]
|
||||
4 │ await new Promise((resolve) => {
|
||||
5 │ jest.setTimeout(1000);
|
||||
· ───────────────
|
||||
6 │ setTimeout(resolve, 10000).unref();
|
||||
╰────
|
||||
|
||||
⚠ eslint-plugin-jest(no-confusing-set-timeout): `jest.setTimeout` should be call in `global` scope
|
||||
╭─[no_confusing_set_timeout.tsx:5:25]
|
||||
4 │ await new Promise((resolve) => {
|
||||
5 │ jest.setTimeout(1000);
|
||||
· ───────────────
|
||||
6 │ setTimeout(resolve, 10000).unref();
|
||||
╰────
|
||||
|
||||
⚠ eslint-plugin-jest(no-confusing-set-timeout): `jest.setTimeout` should be placed before any other jest methods
|
||||
╭─[no_confusing_set_timeout.tsx:3:21]
|
||||
2 │ test('test-suite', () => {
|
||||
3 │ jest.setTimeout(1000);
|
||||
· ───────────────
|
||||
4 │ });
|
||||
╰────
|
||||
|
||||
⚠ eslint-plugin-jest(no-confusing-set-timeout): `jest.setTimeout` should be call in `global` scope
|
||||
╭─[no_confusing_set_timeout.tsx:3:21]
|
||||
2 │ test('test-suite', () => {
|
||||
|
|
|
|||
|
|
@ -165,16 +165,16 @@ source: crates/oxc_linter/src/tester.rs
|
|||
help: Replace the `null` literal with `undefined`.
|
||||
|
||||
⚠ eslint-plugin-unicorn(no-null): Disallow the use of the `null` literal
|
||||
╭─[no_null.tsx:1:14]
|
||||
╭─[no_null.tsx:1:8]
|
||||
1 │ Object[null](null)
|
||||
· ────
|
||||
· ────
|
||||
╰────
|
||||
help: Replace the `null` literal with `undefined`.
|
||||
|
||||
⚠ eslint-plugin-unicorn(no-null): Disallow the use of the `null` literal
|
||||
╭─[no_null.tsx:1:8]
|
||||
╭─[no_null.tsx:1:14]
|
||||
1 │ Object[null](null)
|
||||
· ────
|
||||
· ────
|
||||
╰────
|
||||
help: Replace the `null` literal with `undefined`.
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,13 @@ source: crates/oxc_linter/src/tester.rs
|
|||
╰────
|
||||
help: Call super() before this/super property access.
|
||||
|
||||
⚠ eslint(no-this-before-super): Expected to always call super() before this/super property access.
|
||||
╭─[no_this_before_super.tsx:1:21]
|
||||
1 │ class A extends B { constructor() { super(this); } }
|
||||
· ──────────────────────────────
|
||||
╰────
|
||||
help: Call super() before this/super property access.
|
||||
|
||||
⚠ eslint(no-this-before-super): Expected to always call super() before this/super property access.
|
||||
╭─[no_this_before_super.tsx:1:21]
|
||||
1 │ class A extends B { constructor() { super(this.c); } }
|
||||
|
|
@ -50,6 +57,13 @@ source: crates/oxc_linter/src/tester.rs
|
|||
╰────
|
||||
help: Call super() before this/super property access.
|
||||
|
||||
⚠ eslint(no-this-before-super): Expected to always call super() before this/super property access.
|
||||
╭─[no_this_before_super.tsx:1:21]
|
||||
1 │ class A extends B { constructor() { super(a(b(this.c))); } }
|
||||
· ──────────────────────────────────────
|
||||
╰────
|
||||
help: Call super() before this/super property access.
|
||||
|
||||
⚠ eslint(no-this-before-super): Expected to always call super() before this/super property access.
|
||||
╭─[no_this_before_super.tsx:1:21]
|
||||
1 │ class A extends B { constructor() { super(this.c()); } }
|
||||
|
|
@ -57,6 +71,13 @@ source: crates/oxc_linter/src/tester.rs
|
|||
╰────
|
||||
help: Call super() before this/super property access.
|
||||
|
||||
⚠ eslint(no-this-before-super): Expected to always call super() before this/super property access.
|
||||
╭─[no_this_before_super.tsx:1:21]
|
||||
1 │ class A extends B { constructor() { super(super.c); } }
|
||||
· ─────────────────────────────────
|
||||
╰────
|
||||
help: Call super() before this/super property access.
|
||||
|
||||
⚠ eslint(no-this-before-super): Expected to always call super() before this/super property access.
|
||||
╭─[no_this_before_super.tsx:1:21]
|
||||
1 │ class A extends B { constructor() { super(super.c()); } }
|
||||
|
|
|
|||
|
|
@ -223,15 +223,6 @@ source: crates/oxc_linter/src/tester.rs
|
|||
╰────
|
||||
help: `"Does things"`s should begin with lowercase
|
||||
|
||||
⚠ eslint-plugin-jest(prefer-lowercase-title): Enforce lowercase test names
|
||||
╭─[prefer_lowercase_title.tsx:3:30]
|
||||
2 │ describe('MyClass', () => {
|
||||
3 │ describe('MyMethod', () => {
|
||||
· ──────────
|
||||
4 │ it('Does things', () => {
|
||||
╰────
|
||||
help: `"MyMethod"`s should begin with lowercase
|
||||
|
||||
⚠ eslint-plugin-jest(prefer-lowercase-title): Enforce lowercase test names
|
||||
╭─[prefer_lowercase_title.tsx:2:26]
|
||||
1 │
|
||||
|
|
@ -240,3 +231,12 @@ source: crates/oxc_linter/src/tester.rs
|
|||
3 │ describe('MyMethod', () => {
|
||||
╰────
|
||||
help: `"MyClass"`s should begin with lowercase
|
||||
|
||||
⚠ eslint-plugin-jest(prefer-lowercase-title): Enforce lowercase test names
|
||||
╭─[prefer_lowercase_title.tsx:3:30]
|
||||
2 │ describe('MyClass', () => {
|
||||
3 │ describe('MyMethod', () => {
|
||||
· ──────────
|
||||
4 │ it('Does things', () => {
|
||||
╰────
|
||||
help: `"MyMethod"`s should begin with lowercase
|
||||
|
|
|
|||
|
|
@ -161,18 +161,6 @@ source: crates/oxc_linter/src/tester.rs
|
|||
╰────
|
||||
help: Remove return statement in your describe callback
|
||||
|
||||
⚠ eslint-plugin-vitest(valid-describe-callback): Unexpected return statement in describe callback
|
||||
╭─[valid_describe_callback.tsx:9:21]
|
||||
8 │ describe('nested', () => {
|
||||
9 │ ╭─▶ return Promise.resolve().then(() => {
|
||||
10 │ │ it('breaks', () => {
|
||||
11 │ │ throw new Error('Fail')
|
||||
12 │ │ })
|
||||
13 │ ╰─▶ })
|
||||
14 │ })
|
||||
╰────
|
||||
help: Remove return statement in your describe callback
|
||||
|
||||
⚠ eslint-plugin-vitest(valid-describe-callback): Unexpected return statement in describe callback
|
||||
╭─[valid_describe_callback.tsx:3:17]
|
||||
2 │ describe('foo', () => {
|
||||
|
|
@ -186,14 +174,14 @@ source: crates/oxc_linter/src/tester.rs
|
|||
help: Remove return statement in your describe callback
|
||||
|
||||
⚠ eslint-plugin-vitest(valid-describe-callback): Unexpected return statement in describe callback
|
||||
╭─[valid_describe_callback.tsx:6:21]
|
||||
5 │ describe('nested', () => {
|
||||
6 │ ╭─▶ return Promise.resolve().then(() => {
|
||||
7 │ │ it('breaks', () => {
|
||||
8 │ │ throw new Error('Fail')
|
||||
9 │ │ })
|
||||
10 │ ╰─▶ })
|
||||
11 │ })
|
||||
╭─[valid_describe_callback.tsx:9:21]
|
||||
8 │ describe('nested', () => {
|
||||
9 │ ╭─▶ return Promise.resolve().then(() => {
|
||||
10 │ │ it('breaks', () => {
|
||||
11 │ │ throw new Error('Fail')
|
||||
12 │ │ })
|
||||
13 │ ╰─▶ })
|
||||
14 │ })
|
||||
╰────
|
||||
help: Remove return statement in your describe callback
|
||||
|
||||
|
|
@ -215,6 +203,18 @@ source: crates/oxc_linter/src/tester.rs
|
|||
╰────
|
||||
help: Remove `async` keyword
|
||||
|
||||
⚠ eslint-plugin-vitest(valid-describe-callback): Unexpected return statement in describe callback
|
||||
╭─[valid_describe_callback.tsx:6:21]
|
||||
5 │ describe('nested', () => {
|
||||
6 │ ╭─▶ return Promise.resolve().then(() => {
|
||||
7 │ │ it('breaks', () => {
|
||||
8 │ │ throw new Error('Fail')
|
||||
9 │ │ })
|
||||
10 │ ╰─▶ })
|
||||
11 │ })
|
||||
╰────
|
||||
help: Remove return statement in your describe callback
|
||||
|
||||
⚠ eslint-plugin-vitest(valid-describe-callback): Unexpected return statement in describe callback
|
||||
╭─[valid_describe_callback.tsx:1:23]
|
||||
1 │ describe('foo', () => test('bar', () => {}))
|
||||
|
|
@ -408,18 +408,6 @@ source: crates/oxc_linter/src/tester.rs
|
|||
╰────
|
||||
help: Remove return statement in your describe callback
|
||||
|
||||
⚠ eslint-plugin-vitest(valid-describe-callback): Unexpected return statement in describe callback
|
||||
╭─[valid_describe_callback.tsx:9:25]
|
||||
8 │ describe('nested', () => {
|
||||
9 │ ╭─▶ return Promise.resolve().then(() => {
|
||||
10 │ │ it('breaks', () => {
|
||||
11 │ │ throw new Error('Fail')
|
||||
12 │ │ })
|
||||
13 │ ╰─▶ })
|
||||
14 │ })
|
||||
╰────
|
||||
help: Remove return statement in your describe callback
|
||||
|
||||
⚠ eslint-plugin-vitest(valid-describe-callback): Unexpected return statement in describe callback
|
||||
╭─[valid_describe_callback.tsx:3:21]
|
||||
2 │ describe('foo', () => {
|
||||
|
|
@ -433,14 +421,14 @@ source: crates/oxc_linter/src/tester.rs
|
|||
help: Remove return statement in your describe callback
|
||||
|
||||
⚠ eslint-plugin-vitest(valid-describe-callback): Unexpected return statement in describe callback
|
||||
╭─[valid_describe_callback.tsx:6:25]
|
||||
5 │ describe('nested', () => {
|
||||
6 │ ╭─▶ return Promise.resolve().then(() => {
|
||||
7 │ │ it('breaks', () => {
|
||||
8 │ │ throw new Error('Fail')
|
||||
9 │ │ })
|
||||
10 │ ╰─▶ })
|
||||
11 │ })
|
||||
╭─[valid_describe_callback.tsx:9:25]
|
||||
8 │ describe('nested', () => {
|
||||
9 │ ╭─▶ return Promise.resolve().then(() => {
|
||||
10 │ │ it('breaks', () => {
|
||||
11 │ │ throw new Error('Fail')
|
||||
12 │ │ })
|
||||
13 │ ╰─▶ })
|
||||
14 │ })
|
||||
╰────
|
||||
help: Remove return statement in your describe callback
|
||||
|
||||
|
|
@ -462,6 +450,18 @@ source: crates/oxc_linter/src/tester.rs
|
|||
╰────
|
||||
help: Remove `async` keyword
|
||||
|
||||
⚠ eslint-plugin-vitest(valid-describe-callback): Unexpected return statement in describe callback
|
||||
╭─[valid_describe_callback.tsx:6:25]
|
||||
5 │ describe('nested', () => {
|
||||
6 │ ╭─▶ return Promise.resolve().then(() => {
|
||||
7 │ │ it('breaks', () => {
|
||||
8 │ │ throw new Error('Fail')
|
||||
9 │ │ })
|
||||
10 │ ╰─▶ })
|
||||
11 │ })
|
||||
╰────
|
||||
help: Remove return statement in your describe callback
|
||||
|
||||
⚠ eslint-plugin-vitest(valid-describe-callback): Unexpected return statement in describe callback
|
||||
╭─[valid_describe_callback.tsx:3:21]
|
||||
2 │ describe('foo', () =>
|
||||
|
|
|
|||
|
|
@ -804,9 +804,9 @@ impl<'a> ParserImpl<'a> {
|
|||
self.expect(Kind::RParen)?;
|
||||
Ok(self.ast.expression_call(
|
||||
self.end_span(lhs_span),
|
||||
call_arguments,
|
||||
lhs,
|
||||
type_parameters,
|
||||
call_arguments,
|
||||
optional,
|
||||
))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,15 +25,15 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/call-expression
|
|||
"references": [
|
||||
{
|
||||
"flag": "ReferenceFlag(Read)",
|
||||
"id": 1,
|
||||
"id": 0,
|
||||
"name": "foo",
|
||||
"node_id": 15
|
||||
"node_id": 13
|
||||
},
|
||||
{
|
||||
"flag": "ReferenceFlag(Read)",
|
||||
"id": 3,
|
||||
"id": 2,
|
||||
"name": "foo",
|
||||
"node_id": 21
|
||||
"node_id": 19
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -45,15 +45,15 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/call-expression
|
|||
"references": [
|
||||
{
|
||||
"flag": "ReferenceFlag(Read)",
|
||||
"id": 0,
|
||||
"id": 1,
|
||||
"name": "a",
|
||||
"node_id": 14
|
||||
"node_id": 15
|
||||
},
|
||||
{
|
||||
"flag": "ReferenceFlag(Read)",
|
||||
"id": 2,
|
||||
"id": 3,
|
||||
"name": "a",
|
||||
"node_id": 20
|
||||
"node_id": 21
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/class/declarati
|
|||
"flag": "ReferenceFlag(Read)",
|
||||
"id": 1,
|
||||
"name": "printerName",
|
||||
"node_id": 35
|
||||
"node_id": 40
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,9 +127,9 @@ impl<'a> ExponentiationOperator<'a> {
|
|||
arguments.push(Argument::from(right));
|
||||
ctx.ast.expression_call(
|
||||
SPAN,
|
||||
arguments,
|
||||
callee,
|
||||
None::<TSTypeParameterInstantiation<'_>>,
|
||||
arguments,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,9 +162,9 @@ impl<'a> Traverse<'a> for NullishCoalescingOperator<'a> {
|
|||
// `(x) => x;` -> `((x) => x)();`
|
||||
new_expr = ctx.ast.expression_call(
|
||||
SPAN,
|
||||
ctx.ast.vec(),
|
||||
arrow_function,
|
||||
None::<TSTypeParameterInstantiation>,
|
||||
ctx.ast.vec(),
|
||||
false,
|
||||
);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -146,9 +146,9 @@ impl<'a> ModuleImports<'a> {
|
|||
let decl = {
|
||||
let init = self.ast.expression_call(
|
||||
SPAN,
|
||||
args,
|
||||
callee,
|
||||
Option::<TSTypeParameterInstantiation>::None,
|
||||
args,
|
||||
false,
|
||||
);
|
||||
let decl = self.ast.variable_declarator(SPAN, var_kind, id, Some(init), false);
|
||||
|
|
|
|||
|
|
@ -690,9 +690,9 @@ impl<'a> ReactJsx<'a> {
|
|||
let callee = self.get_create_element(has_key_after_props_spread, need_jsxs, ctx);
|
||||
self.ast().expression_call(
|
||||
e.span(),
|
||||
arguments,
|
||||
callee,
|
||||
Option::<TSTypeParameterInstantiation>::None,
|
||||
arguments,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,9 +206,9 @@ impl<'a> ReactRefresh<'a> {
|
|||
SPAN,
|
||||
ctx.ast.expression_call(
|
||||
SPAN,
|
||||
ctx.ast.vec(),
|
||||
Self::create_identifier_reference_from_binding_identifier(&binding_identifier, ctx),
|
||||
Option::<TSTypeParameterInstantiation>::None,
|
||||
ctx.ast.vec(),
|
||||
false,
|
||||
),
|
||||
);
|
||||
|
|
@ -226,9 +226,9 @@ impl<'a> ReactRefresh<'a> {
|
|||
),
|
||||
Some(ctx.ast.expression_call(
|
||||
SPAN,
|
||||
ctx.ast.vec(),
|
||||
ctx.ast.expression_from_identifier_reference(sig_identifier_reference.clone()),
|
||||
Option::<TSTypeParameterInstantiation>::None,
|
||||
ctx.ast.vec(),
|
||||
false,
|
||||
)),
|
||||
false,
|
||||
|
|
@ -439,9 +439,9 @@ impl<'a> ReactRefresh<'a> {
|
|||
SPAN,
|
||||
ctx.ast.expression_call(
|
||||
SPAN,
|
||||
arguments,
|
||||
Self::create_identifier_reference_from_binding_identifier(&binding_identifier, ctx),
|
||||
Option::<TSTypeParameterInstantiation>::None,
|
||||
arguments,
|
||||
false,
|
||||
),
|
||||
))
|
||||
|
|
@ -509,12 +509,12 @@ impl<'a> ReactRefresh<'a> {
|
|||
SPAN,
|
||||
ctx.ast.expression_call(
|
||||
SPAN,
|
||||
arguments,
|
||||
Self::create_identifier_reference_from_binding_identifier(
|
||||
&binding_identifier,
|
||||
ctx,
|
||||
),
|
||||
Option::<TSTypeParameterInstantiation>::None,
|
||||
arguments,
|
||||
false,
|
||||
),
|
||||
))
|
||||
|
|
@ -626,9 +626,9 @@ impl<'a> ReactRefresh<'a> {
|
|||
SPAN,
|
||||
ctx.ast.expression_call(
|
||||
SPAN,
|
||||
arguments,
|
||||
callee,
|
||||
Option::<TSTypeParameterInstantiation>::None,
|
||||
arguments,
|
||||
false,
|
||||
),
|
||||
));
|
||||
|
|
@ -800,9 +800,9 @@ impl<'a> ReactRefresh<'a> {
|
|||
arguments.insert(0, Argument::from(ctx.ast.move_expression(expr)));
|
||||
*expr = self.ctx.ast.expression_call(
|
||||
SPAN,
|
||||
arguments,
|
||||
Self::create_identifier_reference_from_binding_identifier(&binding_identifier, ctx),
|
||||
Option::<TSTypeParameterInstantiation>::None,
|
||||
arguments,
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,9 +144,9 @@ impl<'a> TypeScriptEnum<'a> {
|
|||
|
||||
let call_expression = ast.expression_call(
|
||||
SPAN,
|
||||
arguments,
|
||||
callee,
|
||||
Option::<TSTypeParameterInstantiation>::None,
|
||||
arguments,
|
||||
false,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,9 +59,9 @@ impl<'a> TypeScript<'a> {
|
|||
));
|
||||
self.ctx.ast.expression_call(
|
||||
SPAN,
|
||||
arguments,
|
||||
callee,
|
||||
Option::<TSTypeParameterInstantiation>::None,
|
||||
arguments,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -402,9 +402,9 @@ impl<'a> TypeScript<'a> {
|
|||
|
||||
let expr = self.ctx.ast.expression_call(
|
||||
SPAN,
|
||||
arguments,
|
||||
callee,
|
||||
Option::<TSTypeParameterInstantiation>::None,
|
||||
arguments,
|
||||
false,
|
||||
);
|
||||
self.ctx.ast.statement_expression(SPAN, expr)
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ pub(crate) enum AncestorType {
|
|||
StaticMemberExpressionProperty = 17,
|
||||
PrivateFieldExpressionObject = 18,
|
||||
PrivateFieldExpressionField = 19,
|
||||
CallExpressionArguments = 20,
|
||||
CallExpressionCallee = 21,
|
||||
CallExpressionTypeParameters = 22,
|
||||
CallExpressionCallee = 20,
|
||||
CallExpressionTypeParameters = 21,
|
||||
CallExpressionArguments = 22,
|
||||
NewExpressionCallee = 23,
|
||||
NewExpressionArguments = 24,
|
||||
NewExpressionTypeParameters = 25,
|
||||
|
|
@ -376,12 +376,12 @@ pub enum Ancestor<'a> {
|
|||
AncestorType::PrivateFieldExpressionObject as u16,
|
||||
PrivateFieldExpressionField(PrivateFieldExpressionWithoutField<'a>) =
|
||||
AncestorType::PrivateFieldExpressionField as u16,
|
||||
CallExpressionArguments(CallExpressionWithoutArguments<'a>) =
|
||||
AncestorType::CallExpressionArguments as u16,
|
||||
CallExpressionCallee(CallExpressionWithoutCallee<'a>) =
|
||||
AncestorType::CallExpressionCallee as u16,
|
||||
CallExpressionTypeParameters(CallExpressionWithoutTypeParameters<'a>) =
|
||||
AncestorType::CallExpressionTypeParameters as u16,
|
||||
CallExpressionArguments(CallExpressionWithoutArguments<'a>) =
|
||||
AncestorType::CallExpressionArguments as u16,
|
||||
NewExpressionCallee(NewExpressionWithoutCallee<'a>) = AncestorType::NewExpressionCallee as u16,
|
||||
NewExpressionArguments(NewExpressionWithoutArguments<'a>) =
|
||||
AncestorType::NewExpressionArguments as u16,
|
||||
|
|
@ -936,9 +936,9 @@ impl<'a> Ancestor<'a> {
|
|||
pub fn is_call_expression(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Self::CallExpressionArguments(_)
|
||||
| Self::CallExpressionCallee(_)
|
||||
Self::CallExpressionCallee(_)
|
||||
| Self::CallExpressionTypeParameters(_)
|
||||
| Self::CallExpressionArguments(_)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -2838,12 +2838,75 @@ impl<'a> PrivateFieldExpressionWithoutField<'a> {
|
|||
}
|
||||
|
||||
pub(crate) const OFFSET_CALL_EXPRESSION_SPAN: usize = offset_of!(CallExpression, span);
|
||||
pub(crate) const OFFSET_CALL_EXPRESSION_ARGUMENTS: usize = offset_of!(CallExpression, arguments);
|
||||
pub(crate) const OFFSET_CALL_EXPRESSION_CALLEE: usize = offset_of!(CallExpression, callee);
|
||||
pub(crate) const OFFSET_CALL_EXPRESSION_TYPE_PARAMETERS: usize =
|
||||
offset_of!(CallExpression, type_parameters);
|
||||
pub(crate) const OFFSET_CALL_EXPRESSION_ARGUMENTS: usize = offset_of!(CallExpression, arguments);
|
||||
pub(crate) const OFFSET_CALL_EXPRESSION_OPTIONAL: usize = offset_of!(CallExpression, optional);
|
||||
|
||||
#[repr(transparent)]
|
||||
#[derive(Debug)]
|
||||
pub struct CallExpressionWithoutCallee<'a>(pub(crate) *const CallExpression<'a>);
|
||||
|
||||
impl<'a> CallExpressionWithoutCallee<'a> {
|
||||
#[inline]
|
||||
pub fn span(&self) -> &Span {
|
||||
unsafe { &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_SPAN) as *const Span) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn type_parameters(&self) -> &Option<Box<'a, TSTypeParameterInstantiation<'a>>> {
|
||||
unsafe {
|
||||
&*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_TYPE_PARAMETERS)
|
||||
as *const Option<Box<'a, TSTypeParameterInstantiation<'a>>>)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn arguments(&self) -> &Vec<'a, Argument<'a>> {
|
||||
unsafe {
|
||||
&*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_ARGUMENTS)
|
||||
as *const Vec<'a, Argument<'a>>)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn optional(&self) -> &bool {
|
||||
unsafe { &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_OPTIONAL) as *const bool) }
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(transparent)]
|
||||
#[derive(Debug)]
|
||||
pub struct CallExpressionWithoutTypeParameters<'a>(pub(crate) *const CallExpression<'a>);
|
||||
|
||||
impl<'a> CallExpressionWithoutTypeParameters<'a> {
|
||||
#[inline]
|
||||
pub fn span(&self) -> &Span {
|
||||
unsafe { &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_SPAN) as *const Span) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn callee(&self) -> &Expression<'a> {
|
||||
unsafe {
|
||||
&*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_CALLEE) as *const Expression<'a>)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn arguments(&self) -> &Vec<'a, Argument<'a>> {
|
||||
unsafe {
|
||||
&*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_ARGUMENTS)
|
||||
as *const Vec<'a, Argument<'a>>)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn optional(&self) -> &bool {
|
||||
unsafe { &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_OPTIONAL) as *const bool) }
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(transparent)]
|
||||
#[derive(Debug)]
|
||||
pub struct CallExpressionWithoutArguments<'a>(pub(crate) *const CallExpression<'a>);
|
||||
|
|
@ -2875,69 +2938,6 @@ impl<'a> CallExpressionWithoutArguments<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[repr(transparent)]
|
||||
#[derive(Debug)]
|
||||
pub struct CallExpressionWithoutCallee<'a>(pub(crate) *const CallExpression<'a>);
|
||||
|
||||
impl<'a> CallExpressionWithoutCallee<'a> {
|
||||
#[inline]
|
||||
pub fn span(&self) -> &Span {
|
||||
unsafe { &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_SPAN) as *const Span) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn arguments(&self) -> &Vec<'a, Argument<'a>> {
|
||||
unsafe {
|
||||
&*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_ARGUMENTS)
|
||||
as *const Vec<'a, Argument<'a>>)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn type_parameters(&self) -> &Option<Box<'a, TSTypeParameterInstantiation<'a>>> {
|
||||
unsafe {
|
||||
&*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_TYPE_PARAMETERS)
|
||||
as *const Option<Box<'a, TSTypeParameterInstantiation<'a>>>)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn optional(&self) -> &bool {
|
||||
unsafe { &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_OPTIONAL) as *const bool) }
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(transparent)]
|
||||
#[derive(Debug)]
|
||||
pub struct CallExpressionWithoutTypeParameters<'a>(pub(crate) *const CallExpression<'a>);
|
||||
|
||||
impl<'a> CallExpressionWithoutTypeParameters<'a> {
|
||||
#[inline]
|
||||
pub fn span(&self) -> &Span {
|
||||
unsafe { &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_SPAN) as *const Span) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn arguments(&self) -> &Vec<'a, Argument<'a>> {
|
||||
unsafe {
|
||||
&*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_ARGUMENTS)
|
||||
as *const Vec<'a, Argument<'a>>)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn callee(&self) -> &Expression<'a> {
|
||||
unsafe {
|
||||
&*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_CALLEE) as *const Expression<'a>)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn optional(&self) -> &bool {
|
||||
unsafe { &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_OPTIONAL) as *const bool) }
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) const OFFSET_NEW_EXPRESSION_SPAN: usize = offset_of!(NewExpression, span);
|
||||
pub(crate) const OFFSET_NEW_EXPRESSION_CALLEE: usize = offset_of!(NewExpression, callee);
|
||||
pub(crate) const OFFSET_NEW_EXPRESSION_ARGUMENTS: usize = offset_of!(NewExpression, arguments);
|
||||
|
|
|
|||
|
|
@ -604,16 +604,7 @@ pub(crate) unsafe fn walk_call_expression<'a, Tr: Traverse<'a>>(
|
|||
ctx: &mut TraverseCtx<'a>,
|
||||
) {
|
||||
traverser.enter_call_expression(&mut *node, ctx);
|
||||
ctx.push_stack(Ancestor::CallExpressionArguments(ancestor::CallExpressionWithoutArguments(
|
||||
node,
|
||||
)));
|
||||
for item in (*((node as *mut u8).add(ancestor::OFFSET_CALL_EXPRESSION_ARGUMENTS)
|
||||
as *mut Vec<Argument>))
|
||||
.iter_mut()
|
||||
{
|
||||
walk_argument(traverser, item as *mut _, ctx);
|
||||
}
|
||||
ctx.retag_stack(AncestorType::CallExpressionCallee);
|
||||
ctx.push_stack(Ancestor::CallExpressionCallee(ancestor::CallExpressionWithoutCallee(node)));
|
||||
walk_expression(
|
||||
traverser,
|
||||
(node as *mut u8).add(ancestor::OFFSET_CALL_EXPRESSION_CALLEE) as *mut Expression,
|
||||
|
|
@ -626,6 +617,13 @@ pub(crate) unsafe fn walk_call_expression<'a, Tr: Traverse<'a>>(
|
|||
ctx.retag_stack(AncestorType::CallExpressionTypeParameters);
|
||||
walk_ts_type_parameter_instantiation(traverser, (&mut **field) as *mut _, ctx);
|
||||
}
|
||||
ctx.retag_stack(AncestorType::CallExpressionArguments);
|
||||
for item in (*((node as *mut u8).add(ancestor::OFFSET_CALL_EXPRESSION_ARGUMENTS)
|
||||
as *mut Vec<Argument>))
|
||||
.iter_mut()
|
||||
{
|
||||
walk_argument(traverser, item as *mut _, ctx);
|
||||
}
|
||||
ctx.pop_stack();
|
||||
traverser.exit_call_expression(&mut *node, ctx);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue