mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
feat(ast)!: remove invalid expressions from TSEnumMemberName (#7219)
This commit is contained in:
parent
e536d47e56
commit
0e4adc15dd
33 changed files with 83 additions and 845 deletions
|
|
@ -16,7 +16,7 @@ use oxc_estree::ESTree;
|
|||
use oxc_span::{cmp::ContentEq, hash::ContentHash, Atom, GetSpan, GetSpanMut, Span};
|
||||
use oxc_syntax::scope::ScopeId;
|
||||
|
||||
use super::{inherit_variants, js::*, jsx::*, literal::*};
|
||||
use super::{inherit_variants, js::*, literal::*};
|
||||
|
||||
/// TypeScript `this` parameter
|
||||
///
|
||||
|
|
@ -115,12 +115,6 @@ inherit_variants! {
|
|||
pub enum TSEnumMemberName<'a> {
|
||||
StaticIdentifier(Box<'a, IdentifierName<'a>>) = 64,
|
||||
StaticStringLiteral(Box<'a, StringLiteral<'a>>) = 65,
|
||||
StaticTemplateLiteral(Box<'a, TemplateLiteral<'a>>) = 66,
|
||||
// Invalid Grammar `enum E { 1 }`
|
||||
StaticNumericLiteral(Box<'a, NumericLiteral<'a>>) = 67,
|
||||
// Invalid Grammar `enum E { [computed] }`
|
||||
// `Expression` variants added here by `inherit_variants!` macro
|
||||
@inherit Expression
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,14 +11,11 @@ use oxc_span::Atom;
|
|||
use crate::ast::*;
|
||||
|
||||
impl<'a> TSEnumMemberName<'a> {
|
||||
/// Get the name of this enum member if it can be determined statically.
|
||||
pub fn static_name(&self) -> Option<&'a str> {
|
||||
/// Get the name of this enum member.
|
||||
pub fn static_name(&self) -> Atom<'a> {
|
||||
match self {
|
||||
Self::StaticIdentifier(ident) => Some(ident.name.as_str()),
|
||||
Self::StaticStringLiteral(lit) => Some(lit.value.as_str()),
|
||||
Self::NumericLiteral(lit) => Some(lit.raw),
|
||||
Self::StaticTemplateLiteral(lit) => lit.quasi().map(Into::into),
|
||||
_ => None,
|
||||
Self::StaticIdentifier(ident) => ident.name.clone(),
|
||||
Self::StaticStringLiteral(lit) => lit.value.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7783,53 +7783,6 @@ impl<'a> AstBuilder<'a> {
|
|||
TSEnumMemberName::StaticStringLiteral(self.alloc(self.string_literal(span, value)))
|
||||
}
|
||||
|
||||
/// Build a [`TSEnumMemberName::StaticTemplateLiteral`]
|
||||
///
|
||||
/// This node contains a [`TemplateLiteral`] that will be stored in the memory arena.
|
||||
///
|
||||
/// ## Parameters
|
||||
/// - span: The [`Span`] covering this node
|
||||
/// - quasis
|
||||
/// - expressions
|
||||
#[inline]
|
||||
pub fn ts_enum_member_name_template_literal(
|
||||
self,
|
||||
span: Span,
|
||||
quasis: Vec<'a, TemplateElement<'a>>,
|
||||
expressions: Vec<'a, Expression<'a>>,
|
||||
) -> TSEnumMemberName<'a> {
|
||||
TSEnumMemberName::StaticTemplateLiteral(self.alloc(self.template_literal(
|
||||
span,
|
||||
quasis,
|
||||
expressions,
|
||||
)))
|
||||
}
|
||||
|
||||
/// Build a [`TSEnumMemberName::StaticNumericLiteral`]
|
||||
///
|
||||
/// This node contains a [`NumericLiteral`] that will be stored in the memory arena.
|
||||
///
|
||||
/// ## Parameters
|
||||
/// - span: Node location in source code
|
||||
/// - value: The value of the number, converted into base 10
|
||||
/// - raw: The number as it appears in source code
|
||||
/// - base: The base representation used by the literal in source code
|
||||
#[inline]
|
||||
pub fn ts_enum_member_name_numeric_literal<S>(
|
||||
self,
|
||||
span: Span,
|
||||
value: f64,
|
||||
raw: S,
|
||||
base: NumberBase,
|
||||
) -> TSEnumMemberName<'a>
|
||||
where
|
||||
S: IntoIn<'a, &'a str>,
|
||||
{
|
||||
TSEnumMemberName::StaticNumericLiteral(
|
||||
self.alloc(self.numeric_literal(span, value, raw, base)),
|
||||
)
|
||||
}
|
||||
|
||||
/// Build a [`TSTypeAnnotation`].
|
||||
///
|
||||
/// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_ts_type_annotation`] instead.
|
||||
|
|
|
|||
|
|
@ -2600,132 +2600,6 @@ impl<'old_alloc, 'new_alloc> CloneIn<'new_alloc> for TSEnumMemberName<'old_alloc
|
|||
Self::StaticStringLiteral(it) => {
|
||||
TSEnumMemberName::StaticStringLiteral(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::StaticTemplateLiteral(it) => {
|
||||
TSEnumMemberName::StaticTemplateLiteral(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::StaticNumericLiteral(it) => {
|
||||
TSEnumMemberName::StaticNumericLiteral(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::BooleanLiteral(it) => {
|
||||
TSEnumMemberName::BooleanLiteral(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::NullLiteral(it) => {
|
||||
TSEnumMemberName::NullLiteral(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::NumericLiteral(it) => {
|
||||
TSEnumMemberName::NumericLiteral(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::BigIntLiteral(it) => {
|
||||
TSEnumMemberName::BigIntLiteral(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::RegExpLiteral(it) => {
|
||||
TSEnumMemberName::RegExpLiteral(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::StringLiteral(it) => {
|
||||
TSEnumMemberName::StringLiteral(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::TemplateLiteral(it) => {
|
||||
TSEnumMemberName::TemplateLiteral(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::Identifier(it) => TSEnumMemberName::Identifier(CloneIn::clone_in(it, allocator)),
|
||||
Self::MetaProperty(it) => {
|
||||
TSEnumMemberName::MetaProperty(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::Super(it) => TSEnumMemberName::Super(CloneIn::clone_in(it, allocator)),
|
||||
Self::ArrayExpression(it) => {
|
||||
TSEnumMemberName::ArrayExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::ArrowFunctionExpression(it) => {
|
||||
TSEnumMemberName::ArrowFunctionExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::AssignmentExpression(it) => {
|
||||
TSEnumMemberName::AssignmentExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::AwaitExpression(it) => {
|
||||
TSEnumMemberName::AwaitExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::BinaryExpression(it) => {
|
||||
TSEnumMemberName::BinaryExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::CallExpression(it) => {
|
||||
TSEnumMemberName::CallExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::ChainExpression(it) => {
|
||||
TSEnumMemberName::ChainExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::ClassExpression(it) => {
|
||||
TSEnumMemberName::ClassExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::ConditionalExpression(it) => {
|
||||
TSEnumMemberName::ConditionalExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::FunctionExpression(it) => {
|
||||
TSEnumMemberName::FunctionExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::ImportExpression(it) => {
|
||||
TSEnumMemberName::ImportExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::LogicalExpression(it) => {
|
||||
TSEnumMemberName::LogicalExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::NewExpression(it) => {
|
||||
TSEnumMemberName::NewExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::ObjectExpression(it) => {
|
||||
TSEnumMemberName::ObjectExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::ParenthesizedExpression(it) => {
|
||||
TSEnumMemberName::ParenthesizedExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::SequenceExpression(it) => {
|
||||
TSEnumMemberName::SequenceExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::TaggedTemplateExpression(it) => {
|
||||
TSEnumMemberName::TaggedTemplateExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::ThisExpression(it) => {
|
||||
TSEnumMemberName::ThisExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::UnaryExpression(it) => {
|
||||
TSEnumMemberName::UnaryExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::UpdateExpression(it) => {
|
||||
TSEnumMemberName::UpdateExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::YieldExpression(it) => {
|
||||
TSEnumMemberName::YieldExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::PrivateInExpression(it) => {
|
||||
TSEnumMemberName::PrivateInExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::JSXElement(it) => TSEnumMemberName::JSXElement(CloneIn::clone_in(it, allocator)),
|
||||
Self::JSXFragment(it) => {
|
||||
TSEnumMemberName::JSXFragment(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::TSAsExpression(it) => {
|
||||
TSEnumMemberName::TSAsExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::TSSatisfiesExpression(it) => {
|
||||
TSEnumMemberName::TSSatisfiesExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::TSTypeAssertion(it) => {
|
||||
TSEnumMemberName::TSTypeAssertion(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::TSNonNullExpression(it) => {
|
||||
TSEnumMemberName::TSNonNullExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::TSInstantiationExpression(it) => {
|
||||
TSEnumMemberName::TSInstantiationExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::ComputedMemberExpression(it) => {
|
||||
TSEnumMemberName::ComputedMemberExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::StaticMemberExpression(it) => {
|
||||
TSEnumMemberName::StaticMemberExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
Self::PrivateFieldExpression(it) => {
|
||||
TSEnumMemberName::PrivateFieldExpression(CloneIn::clone_in(it, allocator))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2588,182 +2588,6 @@ impl<'a> ContentEq for TSEnumMemberName<'a> {
|
|||
Self::StaticStringLiteral(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::StaticTemplateLiteral(it) => match other {
|
||||
Self::StaticTemplateLiteral(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::StaticNumericLiteral(it) => match other {
|
||||
Self::StaticNumericLiteral(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::BooleanLiteral(it) => match other {
|
||||
Self::BooleanLiteral(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::NullLiteral(it) => match other {
|
||||
Self::NullLiteral(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::NumericLiteral(it) => match other {
|
||||
Self::NumericLiteral(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::BigIntLiteral(it) => match other {
|
||||
Self::BigIntLiteral(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::RegExpLiteral(it) => match other {
|
||||
Self::RegExpLiteral(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::StringLiteral(it) => match other {
|
||||
Self::StringLiteral(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::TemplateLiteral(it) => match other {
|
||||
Self::TemplateLiteral(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::Identifier(it) => match other {
|
||||
Self::Identifier(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::MetaProperty(it) => match other {
|
||||
Self::MetaProperty(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::Super(it) => match other {
|
||||
Self::Super(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::ArrayExpression(it) => match other {
|
||||
Self::ArrayExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::ArrowFunctionExpression(it) => match other {
|
||||
Self::ArrowFunctionExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::AssignmentExpression(it) => match other {
|
||||
Self::AssignmentExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::AwaitExpression(it) => match other {
|
||||
Self::AwaitExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::BinaryExpression(it) => match other {
|
||||
Self::BinaryExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::CallExpression(it) => match other {
|
||||
Self::CallExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::ChainExpression(it) => match other {
|
||||
Self::ChainExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::ClassExpression(it) => match other {
|
||||
Self::ClassExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::ConditionalExpression(it) => match other {
|
||||
Self::ConditionalExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::FunctionExpression(it) => match other {
|
||||
Self::FunctionExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::ImportExpression(it) => match other {
|
||||
Self::ImportExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::LogicalExpression(it) => match other {
|
||||
Self::LogicalExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::NewExpression(it) => match other {
|
||||
Self::NewExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::ObjectExpression(it) => match other {
|
||||
Self::ObjectExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::ParenthesizedExpression(it) => match other {
|
||||
Self::ParenthesizedExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::SequenceExpression(it) => match other {
|
||||
Self::SequenceExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::TaggedTemplateExpression(it) => match other {
|
||||
Self::TaggedTemplateExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::ThisExpression(it) => match other {
|
||||
Self::ThisExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::UnaryExpression(it) => match other {
|
||||
Self::UnaryExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::UpdateExpression(it) => match other {
|
||||
Self::UpdateExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::YieldExpression(it) => match other {
|
||||
Self::YieldExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::PrivateInExpression(it) => match other {
|
||||
Self::PrivateInExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::JSXElement(it) => match other {
|
||||
Self::JSXElement(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::JSXFragment(it) => match other {
|
||||
Self::JSXFragment(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::TSAsExpression(it) => match other {
|
||||
Self::TSAsExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::TSSatisfiesExpression(it) => match other {
|
||||
Self::TSSatisfiesExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::TSTypeAssertion(it) => match other {
|
||||
Self::TSTypeAssertion(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::TSNonNullExpression(it) => match other {
|
||||
Self::TSNonNullExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::TSInstantiationExpression(it) => match other {
|
||||
Self::TSInstantiationExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::ComputedMemberExpression(it) => match other {
|
||||
Self::ComputedMemberExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::StaticMemberExpression(it) => match other {
|
||||
Self::StaticMemberExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::PrivateFieldExpression(it) => match other {
|
||||
Self::PrivateFieldExpression(other) if ContentEq::content_eq(it, other) => true,
|
||||
_ => false,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1419,50 +1419,6 @@ impl<'a> ContentHash for TSEnumMemberName<'a> {
|
|||
match self {
|
||||
Self::StaticIdentifier(it) => ContentHash::content_hash(it, state),
|
||||
Self::StaticStringLiteral(it) => ContentHash::content_hash(it, state),
|
||||
Self::StaticTemplateLiteral(it) => ContentHash::content_hash(it, state),
|
||||
Self::StaticNumericLiteral(it) => ContentHash::content_hash(it, state),
|
||||
Self::BooleanLiteral(it) => ContentHash::content_hash(it, state),
|
||||
Self::NullLiteral(it) => ContentHash::content_hash(it, state),
|
||||
Self::NumericLiteral(it) => ContentHash::content_hash(it, state),
|
||||
Self::BigIntLiteral(it) => ContentHash::content_hash(it, state),
|
||||
Self::RegExpLiteral(it) => ContentHash::content_hash(it, state),
|
||||
Self::StringLiteral(it) => ContentHash::content_hash(it, state),
|
||||
Self::TemplateLiteral(it) => ContentHash::content_hash(it, state),
|
||||
Self::Identifier(it) => ContentHash::content_hash(it, state),
|
||||
Self::MetaProperty(it) => ContentHash::content_hash(it, state),
|
||||
Self::Super(it) => ContentHash::content_hash(it, state),
|
||||
Self::ArrayExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::ArrowFunctionExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::AssignmentExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::AwaitExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::BinaryExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::CallExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::ChainExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::ClassExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::ConditionalExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::FunctionExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::ImportExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::LogicalExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::NewExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::ObjectExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::ParenthesizedExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::SequenceExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::TaggedTemplateExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::ThisExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::UnaryExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::UpdateExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::YieldExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::PrivateInExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::JSXElement(it) => ContentHash::content_hash(it, state),
|
||||
Self::JSXFragment(it) => ContentHash::content_hash(it, state),
|
||||
Self::TSAsExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::TSSatisfiesExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::TSTypeAssertion(it) => ContentHash::content_hash(it, state),
|
||||
Self::TSNonNullExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::TSInstantiationExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::ComputedMemberExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::StaticMemberExpression(it) => ContentHash::content_hash(it, state),
|
||||
Self::PrivateFieldExpression(it) => ContentHash::content_hash(it, state),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1978,50 +1978,6 @@ impl<'a> Serialize for TSEnumMemberName<'a> {
|
|||
match self {
|
||||
TSEnumMemberName::StaticIdentifier(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::StaticStringLiteral(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::StaticTemplateLiteral(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::StaticNumericLiteral(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::BooleanLiteral(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::NullLiteral(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::NumericLiteral(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::BigIntLiteral(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::RegExpLiteral(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::StringLiteral(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::TemplateLiteral(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::Identifier(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::MetaProperty(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::Super(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::ArrayExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::ArrowFunctionExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::AssignmentExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::AwaitExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::BinaryExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::CallExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::ChainExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::ClassExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::ConditionalExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::FunctionExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::ImportExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::LogicalExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::NewExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::ObjectExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::ParenthesizedExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::SequenceExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::TaggedTemplateExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::ThisExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::UnaryExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::UpdateExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::YieldExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::PrivateInExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::JSXElement(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::JSXFragment(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::TSAsExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::TSSatisfiesExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::TSTypeAssertion(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::TSNonNullExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::TSInstantiationExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::ComputedMemberExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::StaticMemberExpression(x) => Serialize::serialize(x, serializer),
|
||||
TSEnumMemberName::PrivateFieldExpression(x) => Serialize::serialize(x, serializer),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1274,50 +1274,6 @@ impl<'a> GetSpan for TSEnumMemberName<'a> {
|
|||
match self {
|
||||
Self::StaticIdentifier(it) => GetSpan::span(it.as_ref()),
|
||||
Self::StaticStringLiteral(it) => GetSpan::span(it.as_ref()),
|
||||
Self::StaticTemplateLiteral(it) => GetSpan::span(it.as_ref()),
|
||||
Self::StaticNumericLiteral(it) => GetSpan::span(it.as_ref()),
|
||||
Self::BooleanLiteral(it) => GetSpan::span(it.as_ref()),
|
||||
Self::NullLiteral(it) => GetSpan::span(it.as_ref()),
|
||||
Self::NumericLiteral(it) => GetSpan::span(it.as_ref()),
|
||||
Self::BigIntLiteral(it) => GetSpan::span(it.as_ref()),
|
||||
Self::RegExpLiteral(it) => GetSpan::span(it.as_ref()),
|
||||
Self::StringLiteral(it) => GetSpan::span(it.as_ref()),
|
||||
Self::TemplateLiteral(it) => GetSpan::span(it.as_ref()),
|
||||
Self::Identifier(it) => GetSpan::span(it.as_ref()),
|
||||
Self::MetaProperty(it) => GetSpan::span(it.as_ref()),
|
||||
Self::Super(it) => GetSpan::span(it.as_ref()),
|
||||
Self::ArrayExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::ArrowFunctionExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::AssignmentExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::AwaitExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::BinaryExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::CallExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::ChainExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::ClassExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::ConditionalExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::FunctionExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::ImportExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::LogicalExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::NewExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::ObjectExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::ParenthesizedExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::SequenceExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::TaggedTemplateExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::ThisExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::UnaryExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::UpdateExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::YieldExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::PrivateInExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::JSXElement(it) => GetSpan::span(it.as_ref()),
|
||||
Self::JSXFragment(it) => GetSpan::span(it.as_ref()),
|
||||
Self::TSAsExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::TSSatisfiesExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::TSTypeAssertion(it) => GetSpan::span(it.as_ref()),
|
||||
Self::TSNonNullExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::TSInstantiationExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::ComputedMemberExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::StaticMemberExpression(it) => GetSpan::span(it.as_ref()),
|
||||
Self::PrivateFieldExpression(it) => GetSpan::span(it.as_ref()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1274,50 +1274,6 @@ impl<'a> GetSpanMut for TSEnumMemberName<'a> {
|
|||
match self {
|
||||
Self::StaticIdentifier(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::StaticStringLiteral(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::StaticTemplateLiteral(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::StaticNumericLiteral(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::BooleanLiteral(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::NullLiteral(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::NumericLiteral(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::BigIntLiteral(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::RegExpLiteral(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::StringLiteral(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::TemplateLiteral(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::Identifier(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::MetaProperty(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::Super(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::ArrayExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::ArrowFunctionExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::AssignmentExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::AwaitExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::BinaryExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::CallExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::ChainExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::ClassExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::ConditionalExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::FunctionExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::ImportExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::LogicalExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::NewExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::ObjectExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::ParenthesizedExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::SequenceExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::TaggedTemplateExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::ThisExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::UnaryExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::UpdateExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::YieldExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::PrivateInExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::JSXElement(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::JSXFragment(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::TSAsExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::TSSatisfiesExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::TSTypeAssertion(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::TSNonNullExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::TSInstantiationExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::ComputedMemberExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::StaticMemberExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
Self::PrivateFieldExpression(it) => GetSpanMut::span_mut(&mut **it),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3811,9 +3811,6 @@ pub mod walk {
|
|||
match it {
|
||||
TSEnumMemberName::StaticIdentifier(it) => visitor.visit_identifier_name(it),
|
||||
TSEnumMemberName::StaticStringLiteral(it) => visitor.visit_string_literal(it),
|
||||
TSEnumMemberName::StaticTemplateLiteral(it) => visitor.visit_template_literal(it),
|
||||
TSEnumMemberName::StaticNumericLiteral(it) => visitor.visit_numeric_literal(it),
|
||||
match_expression!(TSEnumMemberName) => visitor.visit_expression(it.to_expression()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4029,9 +4029,6 @@ pub mod walk_mut {
|
|||
match it {
|
||||
TSEnumMemberName::StaticIdentifier(it) => visitor.visit_identifier_name(it),
|
||||
TSEnumMemberName::StaticStringLiteral(it) => visitor.visit_string_literal(it),
|
||||
TSEnumMemberName::StaticTemplateLiteral(it) => visitor.visit_template_literal(it),
|
||||
TSEnumMemberName::StaticNumericLiteral(it) => visitor.visit_numeric_literal(it),
|
||||
match_expression!(TSEnumMemberName) => visitor.visit_expression(it.to_expression_mut()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3592,15 +3592,6 @@ impl<'a> Gen for TSEnumMember<'a> {
|
|||
match &self.id {
|
||||
TSEnumMemberName::StaticIdentifier(decl) => decl.print(p, ctx),
|
||||
TSEnumMemberName::StaticStringLiteral(decl) => decl.print(p, ctx),
|
||||
TSEnumMemberName::StaticTemplateLiteral(decl) => decl.print(p, ctx),
|
||||
TSEnumMemberName::StaticNumericLiteral(decl) => {
|
||||
decl.print_expr(p, Precedence::Lowest, ctx);
|
||||
}
|
||||
decl @ match_expression!(TSEnumMemberName) => {
|
||||
p.print_str("[");
|
||||
decl.to_expression().print_expr(p, Precedence::Lowest, ctx);
|
||||
p.print_str("]");
|
||||
}
|
||||
}
|
||||
if let Some(init) = &self.initializer {
|
||||
p.print_soft_space();
|
||||
|
|
|
|||
|
|
@ -48,14 +48,6 @@ impl<'a> IsolatedDeclarations<'a> {
|
|||
let member_name = match &member.id {
|
||||
TSEnumMemberName::StaticIdentifier(id) => &id.name,
|
||||
TSEnumMemberName::StaticStringLiteral(str) => &str.value,
|
||||
TSEnumMemberName::StaticTemplateLiteral(template) => {
|
||||
&template.quasi().expect("Template enum members cannot have substitutions.")
|
||||
}
|
||||
#[allow(clippy::unnested_or_patterns)] // Clippy is wrong
|
||||
TSEnumMemberName::StaticNumericLiteral(_)
|
||||
| match_expression!(TSEnumMemberName) => {
|
||||
unreachable!()
|
||||
}
|
||||
};
|
||||
prev_members.insert(member_name.clone(), value.clone());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ fn no_duplicate_enum_values_diagnostic(
|
|||
second_member: &TSEnumMember,
|
||||
value: &str,
|
||||
) -> OxcDiagnostic {
|
||||
let second_name = second_member.id.static_name().unwrap_or("the second member");
|
||||
let second_name = second_member.id.static_name();
|
||||
// Unwrap will never panic since violations are only reported for members
|
||||
// with initializers.
|
||||
let second_init_span = second_member.initializer.as_ref().map(GetSpan::span).unwrap();
|
||||
|
|
|
|||
|
|
@ -52,45 +52,40 @@ impl<'a> ParserImpl<'a> {
|
|||
pub(crate) fn parse_ts_enum_member(&mut self) -> Result<TSEnumMember<'a>> {
|
||||
let span = self.start_span();
|
||||
let id = self.parse_ts_enum_member_name()?;
|
||||
|
||||
let initializer = if self.eat(Kind::Eq) {
|
||||
Some(self.parse_assignment_expression_or_higher()?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let span = self.end_span(span);
|
||||
if initializer.is_some() && matches!(id, TSEnumMemberName::StaticTemplateLiteral(_)) {
|
||||
self.error(diagnostics::invalid_assignment(span));
|
||||
}
|
||||
|
||||
Ok(self.ast.ts_enum_member(span, id, initializer))
|
||||
Ok(self.ast.ts_enum_member(self.end_span(span), id, initializer))
|
||||
}
|
||||
|
||||
fn parse_ts_enum_member_name(&mut self) -> Result<TSEnumMemberName<'a>> {
|
||||
match self.cur_kind() {
|
||||
Kind::LBrack => {
|
||||
let node = self.parse_computed_property_name()?;
|
||||
self.check_invalid_ts_enum_computed_property(&node);
|
||||
Ok(TSEnumMemberName::from(node))
|
||||
}
|
||||
Kind::Str => {
|
||||
let literal = self.parse_literal_string()?;
|
||||
Ok(TSEnumMemberName::StaticStringLiteral(self.alloc(literal)))
|
||||
}
|
||||
Kind::NoSubstitutionTemplate | Kind::TemplateHead => {
|
||||
let literal = self.parse_template_literal(false)?;
|
||||
if !literal.expressions.is_empty() {
|
||||
self.error(diagnostics::computed_property_names_not_allowed_in_enums(
|
||||
literal.span(),
|
||||
));
|
||||
Kind::LBrack => match self.parse_computed_property_name()? {
|
||||
Expression::StringLiteral(literal) => {
|
||||
Ok(TSEnumMemberName::StaticStringLiteral(literal))
|
||||
}
|
||||
Ok(TSEnumMemberName::StaticTemplateLiteral(self.alloc(literal)))
|
||||
}
|
||||
Expression::TemplateLiteral(template) if template.is_no_substitution_template() => {
|
||||
Ok(self.ast.ts_enum_member_name_string_literal(
|
||||
template.span,
|
||||
template.quasi().unwrap(),
|
||||
))
|
||||
}
|
||||
Expression::NumericLiteral(literal) => {
|
||||
Err(diagnostics::enum_member_cannot_have_numeric_name(literal.span()))
|
||||
}
|
||||
expr => Err(diagnostics::computed_property_names_not_allowed_in_enums(expr.span())),
|
||||
},
|
||||
Kind::NoSubstitutionTemplate | Kind::TemplateHead => Err(
|
||||
diagnostics::computed_property_names_not_allowed_in_enums(self.cur_token().span()),
|
||||
),
|
||||
kind if kind.is_number() => {
|
||||
let literal = self.parse_literal_number()?;
|
||||
self.error(diagnostics::enum_member_cannot_have_numeric_name(literal.span()));
|
||||
Ok(TSEnumMemberName::StaticNumericLiteral(self.alloc(literal)))
|
||||
Err(diagnostics::enum_member_cannot_have_numeric_name(self.cur_token().span()))
|
||||
}
|
||||
_ => {
|
||||
let ident_name = self.parse_identifier_name()?;
|
||||
|
|
@ -99,18 +94,6 @@ impl<'a> ParserImpl<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_invalid_ts_enum_computed_property(&mut self, property: &Expression<'a>) {
|
||||
match property {
|
||||
Expression::StringLiteral(_) => {}
|
||||
Expression::TemplateLiteral(template) if template.expressions.is_empty() => {}
|
||||
Expression::NumericLiteral(_) => {
|
||||
self.error(diagnostics::enum_member_cannot_have_numeric_name(property.span()));
|
||||
}
|
||||
_ => self
|
||||
.error(diagnostics::computed_property_names_not_allowed_in_enums(property.span())),
|
||||
}
|
||||
}
|
||||
|
||||
/** ------------------- Annotation ----------------- */
|
||||
|
||||
pub(crate) fn parse_ts_type_annotation(
|
||||
|
|
|
|||
|
|
@ -1258,8 +1258,6 @@ impl<'a> Format<'a> for TSEnumMemberName<'a> {
|
|||
match self {
|
||||
TSEnumMemberName::StaticIdentifier(identifier) => identifier.format(p),
|
||||
TSEnumMemberName::StaticStringLiteral(string_literal) => string_literal.format(p),
|
||||
TSEnumMemberName::StaticTemplateLiteral(template_literal) => template_literal.format(p),
|
||||
name => array!(p, ss!("["), name.as_expression().unwrap().format(p), ss!("]")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//! Declare symbol for `BindingIdentifier`s
|
||||
|
||||
use std::{borrow::Cow, ptr};
|
||||
use std::ptr;
|
||||
|
||||
use oxc_ast::{ast::*, AstKind};
|
||||
use oxc_ecmascript::{BoundNames, IsSimpleParameterList};
|
||||
|
|
@ -383,22 +383,9 @@ impl<'a> Binder<'a> for TSEnumDeclaration<'a> {
|
|||
|
||||
impl<'a> Binder<'a> for TSEnumMember<'a> {
|
||||
fn bind(&self, builder: &mut SemanticBuilder) {
|
||||
// TODO: Perf
|
||||
if self.id.is_expression() {
|
||||
return;
|
||||
}
|
||||
let name = match &self.id {
|
||||
TSEnumMemberName::StaticIdentifier(id) => Cow::Borrowed(id.name.as_str()),
|
||||
TSEnumMemberName::StaticStringLiteral(s) => Cow::Borrowed(s.value.as_str()),
|
||||
TSEnumMemberName::StaticTemplateLiteral(s) => Cow::Borrowed(
|
||||
s.quasi().expect("Template enum members must have no substitutions.").as_str(),
|
||||
),
|
||||
TSEnumMemberName::StaticNumericLiteral(n) => Cow::Owned(n.value.to_string()),
|
||||
match_expression!(TSEnumMemberName) => panic!("TODO: implement"),
|
||||
};
|
||||
builder.declare_symbol(
|
||||
self.span,
|
||||
&name,
|
||||
self.id.static_name().as_str(),
|
||||
SymbolFlags::EnumMember,
|
||||
SymbolFlags::EnumMemberExcludes,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -162,9 +162,7 @@ impl<'a> Visit<'a> for Counter {
|
|||
|
||||
#[inline]
|
||||
fn visit_ts_enum_member_name(&mut self, it: &TSEnumMemberName<'a>) {
|
||||
if !it.is_expression() {
|
||||
self.stats.symbols += 1;
|
||||
}
|
||||
self.stats.symbols += 1;
|
||||
walk_ts_enum_member_name(self, it);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -194,17 +194,7 @@ impl<'a> TypeScriptEnum<'a> {
|
|||
for member in members.iter_mut() {
|
||||
let member_name: &Atom<'_> = match &member.id {
|
||||
TSEnumMemberName::StaticIdentifier(id) => &id.name,
|
||||
TSEnumMemberName::StaticStringLiteral(str)
|
||||
| TSEnumMemberName::StringLiteral(str) => &str.value,
|
||||
TSEnumMemberName::StaticTemplateLiteral(template)
|
||||
| TSEnumMemberName::TemplateLiteral(template) => {
|
||||
&template.quasi().expect("Template enum members cannot have substitutions.")
|
||||
}
|
||||
// parse error, but better than a panic
|
||||
TSEnumMemberName::StaticNumericLiteral(n) => &Atom::from(n.raw),
|
||||
match_expression!(TSEnumMemberName) => {
|
||||
unreachable!()
|
||||
}
|
||||
TSEnumMemberName::StaticStringLiteral(str) => &str.value,
|
||||
};
|
||||
|
||||
let init = if let Some(initializer) = &mut member.initializer {
|
||||
|
|
|
|||
|
|
@ -3727,56 +3727,6 @@ pub(crate) unsafe fn walk_ts_enum_member_name<'a, Tr: Traverse<'a>>(
|
|||
TSEnumMemberName::StaticStringLiteral(node) => {
|
||||
walk_string_literal(traverser, (&mut **node) as *mut _, ctx)
|
||||
}
|
||||
TSEnumMemberName::StaticTemplateLiteral(node) => {
|
||||
walk_template_literal(traverser, (&mut **node) as *mut _, ctx)
|
||||
}
|
||||
TSEnumMemberName::StaticNumericLiteral(node) => {
|
||||
walk_numeric_literal(traverser, (&mut **node) as *mut _, ctx)
|
||||
}
|
||||
TSEnumMemberName::BooleanLiteral(_)
|
||||
| TSEnumMemberName::NullLiteral(_)
|
||||
| TSEnumMemberName::NumericLiteral(_)
|
||||
| TSEnumMemberName::BigIntLiteral(_)
|
||||
| TSEnumMemberName::RegExpLiteral(_)
|
||||
| TSEnumMemberName::StringLiteral(_)
|
||||
| TSEnumMemberName::TemplateLiteral(_)
|
||||
| TSEnumMemberName::Identifier(_)
|
||||
| TSEnumMemberName::MetaProperty(_)
|
||||
| TSEnumMemberName::Super(_)
|
||||
| TSEnumMemberName::ArrayExpression(_)
|
||||
| TSEnumMemberName::ArrowFunctionExpression(_)
|
||||
| TSEnumMemberName::AssignmentExpression(_)
|
||||
| TSEnumMemberName::AwaitExpression(_)
|
||||
| TSEnumMemberName::BinaryExpression(_)
|
||||
| TSEnumMemberName::CallExpression(_)
|
||||
| TSEnumMemberName::ChainExpression(_)
|
||||
| TSEnumMemberName::ClassExpression(_)
|
||||
| TSEnumMemberName::ConditionalExpression(_)
|
||||
| TSEnumMemberName::FunctionExpression(_)
|
||||
| TSEnumMemberName::ImportExpression(_)
|
||||
| TSEnumMemberName::LogicalExpression(_)
|
||||
| TSEnumMemberName::NewExpression(_)
|
||||
| TSEnumMemberName::ObjectExpression(_)
|
||||
| TSEnumMemberName::ParenthesizedExpression(_)
|
||||
| TSEnumMemberName::SequenceExpression(_)
|
||||
| TSEnumMemberName::TaggedTemplateExpression(_)
|
||||
| TSEnumMemberName::ThisExpression(_)
|
||||
| TSEnumMemberName::UnaryExpression(_)
|
||||
| TSEnumMemberName::UpdateExpression(_)
|
||||
| TSEnumMemberName::YieldExpression(_)
|
||||
| TSEnumMemberName::PrivateInExpression(_)
|
||||
| TSEnumMemberName::JSXElement(_)
|
||||
| TSEnumMemberName::JSXFragment(_)
|
||||
| TSEnumMemberName::TSAsExpression(_)
|
||||
| TSEnumMemberName::TSSatisfiesExpression(_)
|
||||
| TSEnumMemberName::TSTypeAssertion(_)
|
||||
| TSEnumMemberName::TSNonNullExpression(_)
|
||||
| TSEnumMemberName::TSInstantiationExpression(_)
|
||||
| TSEnumMemberName::ComputedMemberExpression(_)
|
||||
| TSEnumMemberName::StaticMemberExpression(_)
|
||||
| TSEnumMemberName::PrivateFieldExpression(_) => {
|
||||
walk_expression(traverser, node as *mut _, ctx)
|
||||
}
|
||||
}
|
||||
traverser.exit_ts_enum_member_name(&mut *node, ctx);
|
||||
}
|
||||
|
|
|
|||
48
npm/oxc-types/types.d.ts
vendored
48
npm/oxc-types/types.d.ts
vendored
|
|
@ -1041,53 +1041,7 @@ export interface TSEnumMember extends Span {
|
|||
initializer: Expression | null;
|
||||
}
|
||||
|
||||
export type TSEnumMemberName =
|
||||
| IdentifierName
|
||||
| StringLiteral
|
||||
| TemplateLiteral
|
||||
| NumericLiteral
|
||||
| BooleanLiteral
|
||||
| NullLiteral
|
||||
| NumericLiteral
|
||||
| BigIntLiteral
|
||||
| RegExpLiteral
|
||||
| StringLiteral
|
||||
| TemplateLiteral
|
||||
| IdentifierReference
|
||||
| MetaProperty
|
||||
| Super
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
| AssignmentExpression
|
||||
| AwaitExpression
|
||||
| BinaryExpression
|
||||
| CallExpression
|
||||
| ChainExpression
|
||||
| Class
|
||||
| ConditionalExpression
|
||||
| Function
|
||||
| ImportExpression
|
||||
| LogicalExpression
|
||||
| NewExpression
|
||||
| ObjectExpression
|
||||
| ParenthesizedExpression
|
||||
| SequenceExpression
|
||||
| TaggedTemplateExpression
|
||||
| ThisExpression
|
||||
| UnaryExpression
|
||||
| UpdateExpression
|
||||
| YieldExpression
|
||||
| PrivateInExpression
|
||||
| JSXElement
|
||||
| JSXFragment
|
||||
| TSAsExpression
|
||||
| TSSatisfiesExpression
|
||||
| TSTypeAssertion
|
||||
| TSNonNullExpression
|
||||
| TSInstantiationExpression
|
||||
| ComputedMemberExpression
|
||||
| StaticMemberExpression
|
||||
| PrivateFieldExpression;
|
||||
export type TSEnumMemberName = IdentifierName | StringLiteral;
|
||||
|
||||
export interface TSTypeAnnotation extends Span {
|
||||
type: 'TSTypeAnnotation';
|
||||
|
|
|
|||
1
tasks/coverage/misc/fail/oxc-4449-1.ts
Normal file
1
tasks/coverage/misc/fail/oxc-4449-1.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
enum A { [foo] } // Computed property names are not allowed in enums
|
||||
1
tasks/coverage/misc/fail/oxc-4449-2.ts
Normal file
1
tasks/coverage/misc/fail/oxc-4449-2.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
enum B { [1] } // An enum member cannot have a numeric name.
|
||||
1
tasks/coverage/misc/fail/oxc-4449-3.ts
Normal file
1
tasks/coverage/misc/fail/oxc-4449-3.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
enum C { 1 } // An enum member cannot have a numeric name.
|
||||
1
tasks/coverage/misc/fail/oxc-4449-4.ts
Normal file
1
tasks/coverage/misc/fail/oxc-4449-4.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
enum D { [`test${foo}`] } // Computed property names are not allowed in enums.
|
||||
1
tasks/coverage/misc/fail/oxc-4449-5.ts
Normal file
1
tasks/coverage/misc/fail/oxc-4449-5.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
enum E { `baz` = 2 } // Enum member expected.
|
||||
1
tasks/coverage/misc/fail/oxc-4449-6.ts
Normal file
1
tasks/coverage/misc/fail/oxc-4449-6.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
enum F { ['baz' + 'baz'] // Computed property names are not allowed in enums.
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
// should fail
|
||||
enum A { [foo] } // Computed property names are not allowed in enums
|
||||
enum B { [1] } // An enum member cannot have a numeric name.
|
||||
enum C { 1 } // An enum member cannot have a numeric name.
|
||||
enum D { [`test${foo}`] } // Computed property names are not allowed in enums.
|
||||
enum E { `baz` = 2 } // Enum member expected.
|
||||
enum F { ['baz' + 'baz'] } // Computed property names are not allowed in enums.
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
// should work
|
||||
enum A { ['baz'] } // ❌ currently fails
|
||||
enum B { [`baz`] } // ❌ currently fails
|
||||
enum C { ['baz'] = 2 } // ❌ currently fails
|
||||
enum D { [`baz`] = 2 } // ❌ currently fails
|
||||
enum E { 'baz' } // 👍 work fine
|
||||
enum F { baz } // 👍 work fine
|
||||
enum G { 'baz' = 2 } // 👍 work fine
|
||||
enum H { baz = 2 } // 👍 work fine
|
||||
enum A { ['baz'] }
|
||||
enum B { [`baz`] }
|
||||
enum C { ['baz'] = 2 }
|
||||
enum D { [`baz`] = 2 }
|
||||
enum E { 'baz' }
|
||||
enum F { baz }
|
||||
enum G { 'baz' = 2 }
|
||||
enum H { baz = 2 }
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
parser_misc Summary:
|
||||
AST Parsed : 30/30 (100.00%)
|
||||
Positive Passed: 30/30 (100.00%)
|
||||
Negative Passed: 20/20 (100.00%)
|
||||
Negative Passed: 25/25 (100.00%)
|
||||
|
||||
× Unexpected token
|
||||
╭─[misc/fail/oxc-169.js:2:1]
|
||||
|
|
@ -180,49 +180,38 @@ Negative Passed: 20/20 (100.00%)
|
|||
help: Try insert a semicolon here
|
||||
|
||||
× TS(1164): Computed property names are not allowed in enums.
|
||||
╭─[misc/fail/oxc-4449.ts:2:11]
|
||||
1 │ // should fail
|
||||
2 │ enum A { [foo] } // Computed property names are not allowed in enums
|
||||
╭─[misc/fail/oxc-4449-1.ts:1:11]
|
||||
1 │ enum A { [foo] } // Computed property names are not allowed in enums
|
||||
· ───
|
||||
3 │ enum B { [1] } // An enum member cannot have a numeric name.
|
||||
╰────
|
||||
|
||||
× TS(2452): An enum member cannot have a numeric name.
|
||||
╭─[misc/fail/oxc-4449.ts:3:11]
|
||||
2 │ enum A { [foo] } // Computed property names are not allowed in enums
|
||||
3 │ enum B { [1] } // An enum member cannot have a numeric name.
|
||||
╭─[misc/fail/oxc-4449-2.ts:1:11]
|
||||
1 │ enum B { [1] } // An enum member cannot have a numeric name.
|
||||
· ─
|
||||
4 │ enum C { 1 } // An enum member cannot have a numeric name.
|
||||
╰────
|
||||
|
||||
× TS(2452): An enum member cannot have a numeric name.
|
||||
╭─[misc/fail/oxc-4449.ts:4:10]
|
||||
3 │ enum B { [1] } // An enum member cannot have a numeric name.
|
||||
4 │ enum C { 1 } // An enum member cannot have a numeric name.
|
||||
╭─[misc/fail/oxc-4449-3.ts:1:10]
|
||||
1 │ enum C { 1 } // An enum member cannot have a numeric name.
|
||||
· ─
|
||||
5 │ enum D { [`test${foo}`] } // Computed property names are not allowed in enums.
|
||||
╰────
|
||||
|
||||
× TS(1164): Computed property names are not allowed in enums.
|
||||
╭─[misc/fail/oxc-4449.ts:5:11]
|
||||
4 │ enum C { 1 } // An enum member cannot have a numeric name.
|
||||
5 │ enum D { [`test${foo}`] } // Computed property names are not allowed in enums.
|
||||
╭─[misc/fail/oxc-4449-4.ts:1:11]
|
||||
1 │ enum D { [`test${foo}`] } // Computed property names are not allowed in enums.
|
||||
· ────────────
|
||||
6 │ enum E { `baz` = 2 } // Enum member expected.
|
||||
╰────
|
||||
|
||||
× Cannot assign to this expression
|
||||
╭─[misc/fail/oxc-4449.ts:6:10]
|
||||
5 │ enum D { [`test${foo}`] } // Computed property names are not allowed in enums.
|
||||
6 │ enum E { `baz` = 2 } // Enum member expected.
|
||||
· ─────────
|
||||
7 │ enum F { ['baz' + 'baz'] } // Computed property names are not allowed in enums.
|
||||
╰────
|
||||
|
||||
× TS(1164): Computed property names are not allowed in enums.
|
||||
╭─[misc/fail/oxc-4449.ts:7:11]
|
||||
6 │ enum E { `baz` = 2 } // Enum member expected.
|
||||
7 │ enum F { ['baz' + 'baz'] } // Computed property names are not allowed in enums.
|
||||
╭─[misc/fail/oxc-4449-5.ts:1:10]
|
||||
1 │ enum E { `baz` = 2 } // Enum member expected.
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× TS(1164): Computed property names are not allowed in enums.
|
||||
╭─[misc/fail/oxc-4449-6.ts:1:11]
|
||||
1 │ enum F { ['baz' + 'baz'] // Computed property names are not allowed in enums.
|
||||
· ─────────────
|
||||
╰────
|
||||
|
||||
|
|
|
|||
|
|
@ -7450,30 +7450,6 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private
|
|||
3 │ 11e-1,
|
||||
╰────
|
||||
|
||||
× TS(2452): An enum member cannot have a numeric name.
|
||||
╭─[typescript/tests/cases/compiler/enumIdentifierLiterals.ts:3:5]
|
||||
2 │ 1.0,
|
||||
3 │ 11e-1,
|
||||
· ─────
|
||||
4 │ 0.12e1,
|
||||
╰────
|
||||
|
||||
× TS(2452): An enum member cannot have a numeric name.
|
||||
╭─[typescript/tests/cases/compiler/enumIdentifierLiterals.ts:4:5]
|
||||
3 │ 11e-1,
|
||||
4 │ 0.12e1,
|
||||
· ──────
|
||||
5 │ "13e-1",
|
||||
╰────
|
||||
|
||||
× TS(2452): An enum member cannot have a numeric name.
|
||||
╭─[typescript/tests/cases/compiler/enumIdentifierLiterals.ts:6:5]
|
||||
5 │ "13e-1",
|
||||
6 │ 0xF00D
|
||||
· ──────
|
||||
7 │ }
|
||||
╰────
|
||||
|
||||
× Expected a semicolon or an implicit semicolon after a statement, but found none
|
||||
╭─[typescript/tests/cases/compiler/enumMemberResolution.ts:5:4]
|
||||
4 │ var x = IgnoreRulesSpecific. // error
|
||||
|
|
@ -9139,14 +9115,6 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private
|
|||
40 │ [2] = 2,
|
||||
╰────
|
||||
|
||||
× TS(2452): An enum member cannot have a numeric name.
|
||||
╭─[typescript/tests/cases/compiler/literalsInComputedProperties1.ts:40:6]
|
||||
39 │ 1 = 1,
|
||||
40 │ [2] = 2,
|
||||
· ─
|
||||
41 │ "3" = 3,
|
||||
╰────
|
||||
|
||||
× Invalid Character `!`
|
||||
╭─[typescript/tests/cases/compiler/manyCompilerErrorsInTheTwoFiles.ts:1:13]
|
||||
1 │ const a =!@#!@$
|
||||
|
|
@ -20064,22 +20032,6 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private
|
|||
3 │ }
|
||||
╰────
|
||||
|
||||
× TS(2452): An enum member cannot have a numeric name.
|
||||
╭─[typescript/tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum7.ts:2:6]
|
||||
1 │ enum E {
|
||||
2 │ 1, 2, 3
|
||||
· ─
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× TS(2452): An enum member cannot have a numeric name.
|
||||
╭─[typescript/tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum7.ts:2:9]
|
||||
1 │ enum E {
|
||||
2 │ 1, 2, 3
|
||||
· ─
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× Identifier expected. 'void' is a reserved word that cannot be used here.
|
||||
╭─[typescript/tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnumDeclaration4.ts:1:6]
|
||||
1 │ enum void {
|
||||
|
|
@ -22207,15 +22159,6 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private
|
|||
4 │ [e2] = 1
|
||||
╰────
|
||||
|
||||
× Expected `,` but found `[`
|
||||
╭─[typescript/tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName30.ts:4:5]
|
||||
3 │ [e] = id++
|
||||
4 │ [e2] = 1
|
||||
· ┬
|
||||
· ╰── `,` expected
|
||||
5 │ }
|
||||
╰────
|
||||
|
||||
× Expected a semicolon or an implicit semicolon after a statement, but found none
|
||||
╭─[typescript/tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts:4:11]
|
||||
3 │ [e] = 0
|
||||
|
|
@ -22233,14 +22176,6 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private
|
|||
4 │ [e2] = 1
|
||||
╰────
|
||||
|
||||
× TS(1164): Computed property names are not allowed in enums.
|
||||
╭─[typescript/tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName34.ts:4:6]
|
||||
3 │ [e] = id++,
|
||||
4 │ [e2] = 1
|
||||
· ──
|
||||
5 │ }
|
||||
╰────
|
||||
|
||||
× Expected `]` but found `,`
|
||||
╭─[typescript/tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName35.ts:2:7]
|
||||
1 │ var x = {
|
||||
|
|
|
|||
|
|
@ -102,15 +102,27 @@ after transform: [ReferenceId(36), ReferenceId(39), ReferenceId(82), ReferenceId
|
|||
rebuilt : [ReferenceId(281)]
|
||||
|
||||
tasks/coverage/misc/pass/oxc-4449.ts
|
||||
semantic error: Scope flags mismatch:
|
||||
semantic error: Bindings mismatch:
|
||||
after transform: ScopeId(1): ["A", "baz"]
|
||||
rebuilt : ScopeId(1): ["A"]
|
||||
Scope flags mismatch:
|
||||
after transform: ScopeId(1): ScopeFlags(StrictMode)
|
||||
rebuilt : ScopeId(1): ScopeFlags(StrictMode | Function)
|
||||
Bindings mismatch:
|
||||
after transform: ScopeId(2): ["B", "baz"]
|
||||
rebuilt : ScopeId(2): ["B"]
|
||||
Scope flags mismatch:
|
||||
after transform: ScopeId(2): ScopeFlags(StrictMode)
|
||||
rebuilt : ScopeId(2): ScopeFlags(StrictMode | Function)
|
||||
Bindings mismatch:
|
||||
after transform: ScopeId(3): ["C", "baz"]
|
||||
rebuilt : ScopeId(3): ["C"]
|
||||
Scope flags mismatch:
|
||||
after transform: ScopeId(3): ScopeFlags(StrictMode)
|
||||
rebuilt : ScopeId(3): ScopeFlags(StrictMode | Function)
|
||||
Bindings mismatch:
|
||||
after transform: ScopeId(4): ["D", "baz"]
|
||||
rebuilt : ScopeId(4): ["D"]
|
||||
Scope flags mismatch:
|
||||
after transform: ScopeId(4): ScopeFlags(StrictMode)
|
||||
rebuilt : ScopeId(4): ScopeFlags(StrictMode | Function)
|
||||
|
|
@ -142,25 +154,25 @@ Symbol flags mismatch for "A":
|
|||
after transform: SymbolId(0): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(0): SymbolFlags(FunctionScopedVariable)
|
||||
Symbol flags mismatch for "B":
|
||||
after transform: SymbolId(1): SymbolFlags(RegularEnum)
|
||||
after transform: SymbolId(2): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(2): SymbolFlags(FunctionScopedVariable)
|
||||
Symbol flags mismatch for "C":
|
||||
after transform: SymbolId(2): SymbolFlags(RegularEnum)
|
||||
after transform: SymbolId(4): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(4): SymbolFlags(FunctionScopedVariable)
|
||||
Symbol flags mismatch for "D":
|
||||
after transform: SymbolId(3): SymbolFlags(RegularEnum)
|
||||
after transform: SymbolId(6): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(6): SymbolFlags(FunctionScopedVariable)
|
||||
Symbol flags mismatch for "E":
|
||||
after transform: SymbolId(4): SymbolFlags(RegularEnum)
|
||||
after transform: SymbolId(8): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(8): SymbolFlags(FunctionScopedVariable)
|
||||
Symbol flags mismatch for "F":
|
||||
after transform: SymbolId(6): SymbolFlags(RegularEnum)
|
||||
after transform: SymbolId(10): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(10): SymbolFlags(FunctionScopedVariable)
|
||||
Symbol flags mismatch for "G":
|
||||
after transform: SymbolId(8): SymbolFlags(RegularEnum)
|
||||
after transform: SymbolId(12): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(12): SymbolFlags(FunctionScopedVariable)
|
||||
Symbol flags mismatch for "H":
|
||||
after transform: SymbolId(10): SymbolFlags(RegularEnum)
|
||||
after transform: SymbolId(14): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(14): SymbolFlags(FunctionScopedVariable)
|
||||
|
||||
tasks/coverage/misc/pass/oxc-5177.ts
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ts compatibility: 185/526 (35.17%)
|
||||
ts compatibility: 184/526 (34.98%)
|
||||
|
||||
# Failed
|
||||
|
||||
|
|
@ -312,6 +312,7 @@ ts compatibility: 185/526 (35.17%)
|
|||
* end-of-line/multiline.ts
|
||||
|
||||
### enum
|
||||
* enum/computed-members.ts
|
||||
* enum/enum.ts
|
||||
|
||||
### error-recovery
|
||||
|
|
|
|||
Loading…
Reference in a new issue