From 665e8723c0bdc06a80835a2163339ee226203aeb Mon Sep 17 00:00:00 2001 From: Boshen Date: Mon, 27 Feb 2023 23:13:51 +0800 Subject: [PATCH] refactor(ast): remove acorn feature This is a left over from where I tried to be compatible with estree, but the implementation deviated from estree. --- crates/oxc_ast/src/ast/js.rs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/crates/oxc_ast/src/ast/js.rs b/crates/oxc_ast/src/ast/js.rs index 030b5be28..93cfa042f 100644 --- a/crates/oxc_ast/src/ast/js.rs +++ b/crates/oxc_ast/src/ast/js.rs @@ -168,7 +168,6 @@ impl<'a> Expression<'a> { /// Section 12.6 `IdentifierName` #[derive(Debug, Clone, Serialize, PartialEq, Eq, Hash)] #[serde(tag = "type")] -#[cfg_attr(feature = "acorn", serde(rename = "Identifier"))] pub struct IdentifierName { #[serde(flatten)] pub span: Span, @@ -178,7 +177,6 @@ pub struct IdentifierName { /// Section 13.1 `IdentifierReference` #[derive(Debug, Clone, Serialize, PartialEq, Hash, Eq)] #[serde(tag = "type")] -#[cfg_attr(feature = "acorn", serde(rename = "Identifier"))] pub struct IdentifierReference { #[serde(flatten)] pub span: Span, @@ -188,7 +186,6 @@ pub struct IdentifierReference { /// Section 13.1 `BindingIdentifier` #[derive(Debug, Clone, Serialize, PartialEq, Eq, Hash)] #[serde(tag = "type")] -#[cfg_attr(feature = "acorn", serde(rename = "Identifier"))] pub struct BindingIdentifier { #[serde(flatten)] pub span: Span, @@ -198,7 +195,6 @@ pub struct BindingIdentifier { /// Section 13.1 `LabelIdentifier` #[derive(Debug, Clone, Serialize, PartialEq, Eq, Hash)] #[serde(tag = "type")] -#[cfg_attr(feature = "acorn", serde(rename = "Identifier"))] pub struct LabelIdentifier { #[serde(flatten)] pub span: Span, @@ -220,7 +216,6 @@ pub struct ArrayExpression<'a> { #[serde(flatten)] pub span: Span, pub elements: Vec<'a, Option>>, - #[cfg_attr(feature = "acorn", serde(skip))] pub trailing_comma: Option, } @@ -231,7 +226,6 @@ pub struct ObjectExpression<'a> { #[serde(flatten)] pub span: Span, pub properties: Vec<'a, ObjectProperty<'a>>, - #[cfg_attr(feature = "acorn", serde(skip))] pub trailing_comma: Option, } @@ -560,7 +554,6 @@ pub struct BinaryExpression<'a> { /// [+In] `PrivateIdentifier` in `ShiftExpression`[?Yield, ?Await] #[derive(Debug, Serialize, PartialEq, Hash)] #[serde(tag = "type")] -#[cfg_attr(feature = "acorn", serde(rename = "BinaryExpression"))] pub struct PrivateInExpression<'a> { #[serde(flatten)] pub span: Span, @@ -1554,7 +1547,6 @@ pub struct ImportExpression<'a> { #[serde(flatten)] pub span: Span, pub source: Expression<'a>, - #[cfg_attr(feature = "acorn", serde(skip_serializing_if = "Vec::is_empty"))] pub arguments: Vec<'a, Expression<'a>>, } @@ -1563,10 +1555,8 @@ pub struct ImportExpression<'a> { pub struct ImportDeclaration<'a> { pub specifiers: Vec<'a, ImportDeclarationSpecifier>, pub source: StringLiteral, - #[cfg_attr(feature = "acorn", serde(skip_serializing_if = "Option::is_none"))] pub assertions: Option>, // Some(vec![]) for empty assertion - #[cfg_attr(feature = "acorn", serde(skip_serializing_if = "Option::is_none"))] - pub import_kind: Option, // `import type { foo } from 'bar'` + pub import_kind: Option, // `import type { foo } from 'bar'` } #[derive(Debug, Serialize, PartialEq, Eq, Hash)] @@ -1640,7 +1630,6 @@ pub struct ExportNamedDeclaration<'a> { pub declaration: Option>, pub specifiers: Vec<'a, ExportSpecifier>, pub source: Option, - #[cfg_attr(feature = "acorn", serde(skip_serializing_if = "Option::is_none"))] pub export_kind: Option, // `export type { foo }` } @@ -1656,7 +1645,6 @@ impl<'a> ExportNamedDeclaration<'a> { #[serde(tag = "type")] pub struct ExportDefaultDeclaration<'a> { pub declaration: ExportDefaultDeclarationKind<'a>, - #[cfg_attr(feature = "acorn", serde(skip))] pub exported: ModuleExportName, // `default` } @@ -1665,9 +1653,8 @@ pub struct ExportDefaultDeclaration<'a> { pub struct ExportAllDeclaration<'a> { pub exported: Option, pub source: StringLiteral, - #[cfg_attr(feature = "acorn", serde(skip_serializing_if = "Option::is_none"))] pub assertions: Option>, // Some(vec![]) for empty assertion - pub export_kind: Option, // `export type *` + pub export_kind: Option, // `export type *` } #[derive(Debug, Serialize, PartialEq, Eq, Hash)]