mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
feat(ast, span, syntax, regular_expression)!: remove ContentHash (#8512)
#8483 removed codegen-ed impls of `ContentHash` for AST nodes, because `ContentHash` is not useful. Complete the removal by removing `ContentHash` trait definition, and all remaining references to it.
This commit is contained in:
parent
cfd783aa19
commit
7066d1cc4f
15 changed files with 294 additions and 454 deletions
|
|
@ -1,11 +1,11 @@
|
|||
#![warn(missing_docs)]
|
||||
use oxc_allocator::CloneIn;
|
||||
use oxc_ast_macros::ast;
|
||||
use oxc_span::{cmp::ContentEq, hash::ContentHash, Span};
|
||||
use oxc_span::{cmp::ContentEq, Span};
|
||||
|
||||
/// Indicates a line or block comment.
|
||||
#[ast]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash)]
|
||||
#[generate_derive(CloneIn, ContentEq)]
|
||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)]
|
||||
pub enum CommentKind {
|
||||
/// Line comment
|
||||
|
|
@ -17,7 +17,7 @@ pub enum CommentKind {
|
|||
|
||||
/// Information about a comment's position relative to a token.
|
||||
#[ast]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash)]
|
||||
#[generate_derive(CloneIn, ContentEq)]
|
||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)]
|
||||
pub enum CommentPosition {
|
||||
/// Comments prior to a token until another token or trailing comment.
|
||||
|
|
@ -40,7 +40,7 @@ pub enum CommentPosition {
|
|||
|
||||
/// A comment in source code.
|
||||
#[ast]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash)]
|
||||
#[generate_derive(CloneIn, ContentEq)]
|
||||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)]
|
||||
pub struct Comment {
|
||||
/// The span of the comment text, with leading and trailing delimiters.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -7,7 +7,7 @@
|
|||
use oxc_allocator::{Box, CloneIn, GetAddress, Vec};
|
||||
use oxc_ast_macros::ast;
|
||||
use oxc_estree::ESTree;
|
||||
use oxc_span::{cmp::ContentEq, hash::ContentHash, Atom, GetSpan, GetSpanMut, Span};
|
||||
use oxc_span::{cmp::ContentEq, Atom, GetSpan, GetSpanMut, Span};
|
||||
|
||||
use super::{inherit_variants, js::*, literal::*, ts::*};
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ use super::{inherit_variants, js::*, literal::*, ts::*};
|
|||
/// See: [JSX Syntax](https://facebook.github.io/jsx/)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXElement<'a> {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
@ -61,7 +61,7 @@ pub struct JSXElement<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXOpeningElement<'a> {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
@ -95,7 +95,7 @@ pub struct JSXOpeningElement<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXClosingElement<'a> {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
@ -113,7 +113,7 @@ pub struct JSXClosingElement<'a> {
|
|||
/// See: [`React.Fragment`](https://react.dev/reference/react/Fragment)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXFragment<'a> {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
@ -128,7 +128,7 @@ pub struct JSXFragment<'a> {
|
|||
/// JSX Opening Fragment (`<>`)
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXOpeningFragment {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
@ -137,7 +137,7 @@ pub struct JSXOpeningFragment {
|
|||
/// JSX Closing Fragment (`</>`)
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXClosingFragment {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
@ -146,7 +146,7 @@ pub struct JSXClosingFragment {
|
|||
/// JSX Element Name
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq)]
|
||||
pub enum JSXElementName<'a> {
|
||||
/// `<div />`
|
||||
Identifier(Box<'a, JSXIdentifier<'a>>) = 0,
|
||||
|
|
@ -169,7 +169,7 @@ pub enum JSXElementName<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXNamespacedName<'a> {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
@ -196,7 +196,7 @@ pub struct JSXNamespacedName<'a> {
|
|||
/// [`member expression`]: JSXMemberExpressionObject::MemberExpression
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXMemberExpression<'a> {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
@ -224,7 +224,7 @@ pub struct JSXMemberExpression<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq)]
|
||||
pub enum JSXMemberExpressionObject<'a> {
|
||||
/// `<Apple.Orange />`
|
||||
IdentifierReference(Box<'a, IdentifierReference<'a>>) = 0,
|
||||
|
|
@ -249,7 +249,7 @@ pub enum JSXMemberExpressionObject<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXExpressionContainer<'a> {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
@ -266,7 +266,7 @@ inherit_variants! {
|
|||
/// [`ast` module docs]: `super`
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub enum JSXExpression<'a> {
|
||||
/// An empty expression
|
||||
///
|
||||
|
|
@ -284,7 +284,7 @@ pub enum JSXExpression<'a> {
|
|||
/// An empty JSX expression (`{}`)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXEmptyExpression {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
@ -303,7 +303,7 @@ pub struct JSXEmptyExpression {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)]
|
||||
pub enum JSXAttributeItem<'a> {
|
||||
/// A `key="value"` attribute
|
||||
Attribute(Box<'a, JSXAttribute<'a>>) = 0,
|
||||
|
|
@ -324,7 +324,7 @@ pub enum JSXAttributeItem<'a> {
|
|||
/// // name ^^^ ^^^^ value
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXAttribute<'a> {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
@ -345,7 +345,7 @@ pub struct JSXAttribute<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXSpreadAttribute<'a> {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
@ -370,7 +370,7 @@ pub struct JSXSpreadAttribute<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)]
|
||||
pub enum JSXAttributeName<'a> {
|
||||
/// An attribute name without a namespace prefix, e.g. `foo` in `foo="bar"`.
|
||||
Identifier(Box<'a, JSXIdentifier<'a>>) = 0,
|
||||
|
|
@ -398,7 +398,7 @@ pub enum JSXAttributeName<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)]
|
||||
pub enum JSXAttributeValue<'a> {
|
||||
/// `<Component foo="bar" />`
|
||||
StringLiteral(Box<'a, StringLiteral<'a>>) = 0,
|
||||
|
|
@ -417,7 +417,7 @@ pub enum JSXAttributeValue<'a> {
|
|||
/// [`IdentifierName`]: super::IdentifierName
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXIdentifier<'a> {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
@ -432,7 +432,7 @@ pub struct JSXIdentifier<'a> {
|
|||
/// Part of a [`JSXElement`].
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)]
|
||||
pub enum JSXChild<'a> {
|
||||
/// `<Foo>Some Text</Foo>`
|
||||
Text(Box<'a, JSXText<'a>>) = 0,
|
||||
|
|
@ -451,7 +451,7 @@ pub enum JSXChild<'a> {
|
|||
/// Variant of [`JSXChild`] that represents an object spread (`{...expression}`).
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXSpreadChild<'a> {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
@ -471,7 +471,7 @@ pub struct JSXSpreadChild<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSXText<'a> {
|
||||
/// Node location in source code
|
||||
pub span: Span,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use oxc_allocator::{Box, CloneIn};
|
|||
use oxc_ast_macros::ast;
|
||||
use oxc_estree::ESTree;
|
||||
use oxc_regular_expression::ast::Pattern;
|
||||
use oxc_span::{cmp::ContentEq, hash::ContentHash, Atom, GetSpan, GetSpanMut, Span};
|
||||
use oxc_span::{cmp::ContentEq, Atom, GetSpan, GetSpanMut, Span};
|
||||
use oxc_syntax::number::{BigintBase, NumberBase};
|
||||
|
||||
/// Boolean literal
|
||||
|
|
@ -19,7 +19,7 @@ use oxc_syntax::number::{BigintBase, NumberBase};
|
|||
/// <https://tc39.es/ecma262/#prod-BooleanLiteral>
|
||||
#[ast(visit)]
|
||||
#[derive(Debug, Clone)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
#[estree(type = "Literal", via = crate::serialize::ESTreeLiteral, add_ts = "raw: string | null")]
|
||||
pub struct BooleanLiteral {
|
||||
/// Node location in source code
|
||||
|
|
@ -33,7 +33,7 @@ pub struct BooleanLiteral {
|
|||
/// <https://tc39.es/ecma262/#sec-null-literals>
|
||||
#[ast(visit)]
|
||||
#[derive(Debug, Clone)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
#[estree(type = "Literal", via = crate::serialize::ESTreeLiteral, add_ts = "value: null, raw: \"null\" | null")]
|
||||
pub struct NullLiteral {
|
||||
/// Node location in source code
|
||||
|
|
@ -127,7 +127,7 @@ pub struct RegExpLiteral<'a> {
|
|||
/// <https://tc39.es/ecma262/multipage/text-processing.html#sec-regexp-regular-expression-objects>
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
#[estree(no_type)]
|
||||
pub struct RegExp<'a> {
|
||||
/// The regex pattern between the slashes
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use std::cell::Cell;
|
|||
use oxc_allocator::{Box, CloneIn, GetAddress, Vec};
|
||||
use oxc_ast_macros::ast;
|
||||
use oxc_estree::ESTree;
|
||||
use oxc_span::{cmp::ContentEq, hash::ContentHash, Atom, GetSpan, GetSpanMut, Span};
|
||||
use oxc_span::{cmp::ContentEq, Atom, GetSpan, GetSpanMut, Span};
|
||||
use oxc_syntax::scope::ScopeId;
|
||||
|
||||
use super::{inherit_variants, js::*, literal::*};
|
||||
|
|
@ -30,7 +30,7 @@ use super::{inherit_variants, js::*, literal::*};
|
|||
/// * [TypeScript Handbook - `this` parameters](https://www.typescriptlang.org/docs/handbook/2/functions.html#this-parameters)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSThisParameter<'a> {
|
||||
pub span: Span,
|
||||
#[estree(skip)]
|
||||
|
|
@ -62,7 +62,7 @@ pub struct TSThisParameter<'a> {
|
|||
#[ast(visit)]
|
||||
#[scope]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSEnumDeclaration<'a> {
|
||||
pub span: Span,
|
||||
pub id: BindingIdentifier<'a>,
|
||||
|
|
@ -95,7 +95,7 @@ pub struct TSEnumDeclaration<'a> {
|
|||
/// * [TypeScript Handbook - Enums](https://www.typescriptlang.org/docs/handbook/enums.html)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSEnumMember<'a> {
|
||||
pub span: Span,
|
||||
pub id: TSEnumMemberName<'a>,
|
||||
|
|
@ -105,7 +105,7 @@ pub struct TSEnumMember<'a> {
|
|||
/// TS Enum Member Name
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)]
|
||||
pub enum TSEnumMemberName<'a> {
|
||||
Identifier(Box<'a, IdentifierName<'a>>) = 0,
|
||||
String(Box<'a, StringLiteral<'a>>) = 1,
|
||||
|
|
@ -125,7 +125,7 @@ pub enum TSEnumMemberName<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSTypeAnnotation<'a> {
|
||||
/// starts at the `:` token and ends at the end of the type annotation
|
||||
pub span: Span,
|
||||
|
|
@ -149,7 +149,7 @@ pub struct TSTypeAnnotation<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSLiteralType<'a> {
|
||||
pub span: Span,
|
||||
pub literal: TSLiteral<'a>,
|
||||
|
|
@ -158,7 +158,7 @@ pub struct TSLiteralType<'a> {
|
|||
/// A literal in a [`TSLiteralType`].
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)]
|
||||
pub enum TSLiteral<'a> {
|
||||
BooleanLiteral(Box<'a, BooleanLiteral>) = 0,
|
||||
NullLiteral(Box<'a, NullLiteral>) = 1,
|
||||
|
|
@ -183,7 +183,7 @@ pub enum TSLiteral<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)]
|
||||
pub enum TSType<'a> {
|
||||
// Keyword
|
||||
TSAnyKeyword(Box<'a, TSAnyKeyword>) = 0,
|
||||
|
|
@ -290,7 +290,7 @@ pub use match_ts_type;
|
|||
#[ast(visit)]
|
||||
#[scope]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSConditionalType<'a> {
|
||||
pub span: Span,
|
||||
/// The type before `extends` in the test expression.
|
||||
|
|
@ -319,7 +319,7 @@ pub struct TSConditionalType<'a> {
|
|||
/// * [TypeScript Handbook - Union Types](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes-func.html#unions)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSUnionType<'a> {
|
||||
pub span: Span,
|
||||
/// The types in the union.
|
||||
|
|
@ -341,7 +341,7 @@ pub struct TSUnionType<'a> {
|
|||
/// * [TypeScript Handbook - Intersection Types](https://www.typescriptlang.org/docs/handbook/2/objects.html#intersection-types)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSIntersectionType<'a> {
|
||||
pub span: Span,
|
||||
pub types: Vec<'a, TSType<'a>>,
|
||||
|
|
@ -358,7 +358,7 @@ pub struct TSIntersectionType<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSParenthesizedType<'a> {
|
||||
pub span: Span,
|
||||
pub type_annotation: TSType<'a>,
|
||||
|
|
@ -375,7 +375,7 @@ pub struct TSParenthesizedType<'a> {
|
|||
/// * [TypeScript Handbook - Keyof Types](https://www.typescriptlang.org/docs/handbook/2/keyof-types.html)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSTypeOperator<'a> {
|
||||
pub span: Span,
|
||||
pub operator: TSTypeOperatorOperator,
|
||||
|
|
@ -386,7 +386,7 @@ pub struct TSTypeOperator<'a> {
|
|||
/// Operator in a [`TSTypeOperator`].
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum TSTypeOperatorOperator {
|
||||
Keyof = 0,
|
||||
Unique = 1,
|
||||
|
|
@ -406,7 +406,7 @@ pub enum TSTypeOperatorOperator {
|
|||
/// <https://www.typescriptlang.org/docs/handbook/2/objects.html#the-array-type>
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSArrayType<'a> {
|
||||
pub span: Span,
|
||||
pub element_type: TSType<'a>,
|
||||
|
|
@ -425,7 +425,7 @@ pub struct TSArrayType<'a> {
|
|||
/// <https://www.typescriptlang.org/docs/handbook/2/indexed-access-types.html#handbook-content>
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSIndexedAccessType<'a> {
|
||||
pub span: Span,
|
||||
pub object_type: TSType<'a>,
|
||||
|
|
@ -443,7 +443,7 @@ pub struct TSIndexedAccessType<'a> {
|
|||
/// <https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types>
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSTupleType<'a> {
|
||||
pub span: Span,
|
||||
pub element_types: Vec<'a, TSTupleElement<'a>>,
|
||||
|
|
@ -461,7 +461,7 @@ pub struct TSTupleType<'a> {
|
|||
/// * [TypeScript Handbook - Tuple Types](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSNamedTupleMember<'a> {
|
||||
pub span: Span,
|
||||
pub element_type: TSTupleElement<'a>,
|
||||
|
|
@ -480,7 +480,7 @@ pub struct TSNamedTupleMember<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSOptionalType<'a> {
|
||||
pub span: Span,
|
||||
pub type_annotation: TSType<'a>,
|
||||
|
|
@ -496,7 +496,7 @@ pub struct TSOptionalType<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSRestType<'a> {
|
||||
pub span: Span,
|
||||
pub type_annotation: TSType<'a>,
|
||||
|
|
@ -512,7 +512,7 @@ inherit_variants! {
|
|||
/// [`ast` module docs]: `super`
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)]
|
||||
pub enum TSTupleElement<'a> {
|
||||
// Discriminants start at 64, so that `TSTupleElement::is_ts_type` is a single
|
||||
// bitwise AND operation on the discriminant (`discriminant & 63 != 0`).
|
||||
|
|
@ -534,7 +534,7 @@ pub enum TSTupleElement<'a> {
|
|||
/// * [TypeScript Handbook - Any Type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSAnyKeyword {
|
||||
pub span: Span,
|
||||
}
|
||||
|
|
@ -550,7 +550,7 @@ pub struct TSAnyKeyword {
|
|||
/// * [TypeScript Handbook - Everyday Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#the-primitives-string-number-and-boolean)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSStringKeyword {
|
||||
pub span: Span,
|
||||
}
|
||||
|
|
@ -566,7 +566,7 @@ pub struct TSStringKeyword {
|
|||
/// * [TypeScript Handbook - Everyday Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#the-primitives-string-number-and-boolean)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSBooleanKeyword {
|
||||
pub span: Span,
|
||||
}
|
||||
|
|
@ -582,7 +582,7 @@ pub struct TSBooleanKeyword {
|
|||
/// * [TypeScript Handbook - Everyday Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#the-primitives-string-number-and-boolean)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSNumberKeyword {
|
||||
pub span: Span,
|
||||
}
|
||||
|
|
@ -599,7 +599,7 @@ pub struct TSNumberKeyword {
|
|||
/// * [TypeScript Handbook - Advanced Topics](https://www.typescriptlang.org/docs/handbook/type-compatibility.html#advanced-topics)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSNeverKeyword {
|
||||
pub span: Span,
|
||||
}
|
||||
|
|
@ -616,7 +616,7 @@ pub struct TSNeverKeyword {
|
|||
/// * [microsoft/TypeScript #40580](https://github.com/microsoft/TypeScript/pull/40580)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSIntrinsicKeyword {
|
||||
pub span: Span,
|
||||
}
|
||||
|
|
@ -634,7 +634,7 @@ pub struct TSIntrinsicKeyword {
|
|||
/// * [TypeScript Handbook - Advanced Topics](https://www.typescriptlang.org/docs/handbook/type-compatibility.html#advanced-topics)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSUnknownKeyword {
|
||||
pub span: Span,
|
||||
}
|
||||
|
|
@ -651,7 +651,7 @@ pub struct TSUnknownKeyword {
|
|||
/// * [TypeScript Handbook - Everyday Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#null-and-undefined)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSNullKeyword {
|
||||
pub span: Span,
|
||||
}
|
||||
|
|
@ -670,42 +670,42 @@ pub struct TSNullKeyword {
|
|||
/// * [TypeScript Handbook - Everyday Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#null-and-undefined)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSUndefinedKeyword {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSVoidKeyword {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSSymbolKeyword {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSThisType {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSObjectKeyword {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSBigIntKeyword {
|
||||
pub span: Span,
|
||||
}
|
||||
|
|
@ -720,7 +720,7 @@ pub struct TSBigIntKeyword {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSTypeReference<'a> {
|
||||
pub span: Span,
|
||||
pub type_name: TSTypeName<'a>,
|
||||
|
|
@ -732,7 +732,7 @@ pub struct TSTypeReference<'a> {
|
|||
/// NamespaceName . IdentifierReference
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)]
|
||||
pub enum TSTypeName<'a> {
|
||||
IdentifierReference(Box<'a, IdentifierReference<'a>>) = 0,
|
||||
QualifiedName(Box<'a, TSQualifiedName<'a>>) = 1,
|
||||
|
|
@ -757,7 +757,7 @@ pub use match_ts_type_name;
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSQualifiedName<'a> {
|
||||
pub span: Span,
|
||||
pub left: TSTypeName<'a>,
|
||||
|
|
@ -766,7 +766,7 @@ pub struct TSQualifiedName<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSTypeParameterInstantiation<'a> {
|
||||
pub span: Span,
|
||||
pub params: Vec<'a, TSType<'a>>,
|
||||
|
|
@ -791,7 +791,7 @@ pub struct TSTypeParameterInstantiation<'a> {
|
|||
/// * [TypeScript Handbook - Variance Annotations](https://www.typescriptlang.org/docs/handbook/2/generics.html#variance-annotations)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSTypeParameter<'a> {
|
||||
pub span: Span,
|
||||
/// The name of the parameter, e.g. `T` in `type Foo<T> = ...`.
|
||||
|
|
@ -810,7 +810,7 @@ pub struct TSTypeParameter<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSTypeParameterDeclaration<'a> {
|
||||
pub span: Span,
|
||||
pub params: Vec<'a, TSTypeParameter<'a>>,
|
||||
|
|
@ -827,7 +827,7 @@ pub struct TSTypeParameterDeclaration<'a> {
|
|||
#[ast(visit)]
|
||||
#[scope]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSTypeAliasDeclaration<'a> {
|
||||
pub span: Span,
|
||||
/// Type alias's identifier, e.g. `Foo` in `type Foo = number`.
|
||||
|
|
@ -843,7 +843,7 @@ pub struct TSTypeAliasDeclaration<'a> {
|
|||
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum TSAccessibility {
|
||||
Private = 0,
|
||||
Protected = 1,
|
||||
|
|
@ -862,7 +862,7 @@ pub enum TSAccessibility {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSClassImplements<'a> {
|
||||
pub span: Span,
|
||||
pub expression: TSTypeName<'a>,
|
||||
|
|
@ -887,7 +887,7 @@ pub struct TSClassImplements<'a> {
|
|||
#[ast(visit)]
|
||||
#[scope]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSInterfaceDeclaration<'a> {
|
||||
pub span: Span,
|
||||
/// The identifier (name) of the interface.
|
||||
|
|
@ -908,7 +908,7 @@ pub struct TSInterfaceDeclaration<'a> {
|
|||
/// Body of a [`TSInterfaceDeclaration`].
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSInterfaceBody<'a> {
|
||||
pub span: Span,
|
||||
pub body: Vec<'a, TSSignature<'a>>,
|
||||
|
|
@ -931,7 +931,7 @@ pub struct TSInterfaceBody<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSPropertySignature<'a> {
|
||||
pub span: Span,
|
||||
pub computed: bool,
|
||||
|
|
@ -943,7 +943,7 @@ pub struct TSPropertySignature<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)]
|
||||
pub enum TSSignature<'a> {
|
||||
TSIndexSignature(Box<'a, TSIndexSignature<'a>>) = 0,
|
||||
TSPropertySignature(Box<'a, TSPropertySignature<'a>>) = 1,
|
||||
|
|
@ -965,7 +965,7 @@ pub enum TSSignature<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSIndexSignature<'a> {
|
||||
pub span: Span,
|
||||
pub parameters: Vec<'a, TSIndexSignatureName<'a>>,
|
||||
|
|
@ -976,7 +976,7 @@ pub struct TSIndexSignature<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSCallSignatureDeclaration<'a> {
|
||||
pub span: Span,
|
||||
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
|
||||
|
|
@ -987,7 +987,7 @@ pub struct TSCallSignatureDeclaration<'a> {
|
|||
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum TSMethodSignatureKind {
|
||||
Method = 0,
|
||||
Get = 1,
|
||||
|
|
@ -1008,7 +1008,7 @@ pub enum TSMethodSignatureKind {
|
|||
#[ast(visit)]
|
||||
#[scope]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSMethodSignature<'a> {
|
||||
pub span: Span,
|
||||
pub key: PropertyKey<'a>,
|
||||
|
|
@ -1028,7 +1028,7 @@ pub struct TSMethodSignature<'a> {
|
|||
#[ast(visit)]
|
||||
#[scope]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSConstructSignatureDeclaration<'a> {
|
||||
pub span: Span,
|
||||
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
|
||||
|
|
@ -1041,7 +1041,7 @@ pub struct TSConstructSignatureDeclaration<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
#[estree(type = "Identifier")]
|
||||
pub struct TSIndexSignatureName<'a> {
|
||||
pub span: Span,
|
||||
|
|
@ -1051,7 +1051,7 @@ pub struct TSIndexSignatureName<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSInterfaceHeritage<'a> {
|
||||
pub span: Span,
|
||||
pub expression: Expression<'a>,
|
||||
|
|
@ -1080,7 +1080,7 @@ pub struct TSInterfaceHeritage<'a> {
|
|||
/// * [TypeScript Handbook - Assertion Functions](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSTypePredicate<'a> {
|
||||
pub span: Span,
|
||||
/// The identifier the predicate operates on
|
||||
|
|
@ -1097,7 +1097,7 @@ pub struct TSTypePredicate<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub enum TSTypePredicateName<'a> {
|
||||
Identifier(Box<'a, IdentifierName<'a>>) = 0,
|
||||
This(TSThisType) = 1,
|
||||
|
|
@ -1135,7 +1135,7 @@ pub enum TSTypePredicateName<'a> {
|
|||
strict_if(self.body.as_ref().is_some_and(TSModuleDeclarationBody::has_use_strict_directive)),
|
||||
)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSModuleDeclaration<'a> {
|
||||
pub span: Span,
|
||||
/// The name of the module/namespace being declared.
|
||||
|
|
@ -1166,7 +1166,7 @@ pub struct TSModuleDeclaration<'a> {
|
|||
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum TSModuleDeclarationKind {
|
||||
/// `declare global {}`
|
||||
Global = 0,
|
||||
|
|
@ -1198,7 +1198,7 @@ pub enum TSModuleDeclarationKind {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub enum TSModuleDeclarationName<'a> {
|
||||
Identifier(BindingIdentifier<'a>) = 0,
|
||||
StringLiteral(StringLiteral<'a>) = 1,
|
||||
|
|
@ -1206,7 +1206,7 @@ pub enum TSModuleDeclarationName<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)]
|
||||
pub enum TSModuleDeclarationBody<'a> {
|
||||
TSModuleDeclaration(Box<'a, TSModuleDeclaration<'a>>) = 0,
|
||||
TSModuleBlock(Box<'a, TSModuleBlock<'a>>) = 1,
|
||||
|
|
@ -1215,7 +1215,7 @@ pub enum TSModuleDeclarationBody<'a> {
|
|||
// See serializer in serialize.rs
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
#[estree(custom_serialize)]
|
||||
pub struct TSModuleBlock<'a> {
|
||||
pub span: Span,
|
||||
|
|
@ -1226,7 +1226,7 @@ pub struct TSModuleBlock<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSTypeLiteral<'a> {
|
||||
pub span: Span,
|
||||
pub members: Vec<'a, TSSignature<'a>>,
|
||||
|
|
@ -1247,7 +1247,7 @@ pub struct TSTypeLiteral<'a> {
|
|||
/// * [TypeScript Handbook - Inferring With Conditional Types](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#inferring-within-conditional-types)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSInferType<'a> {
|
||||
pub span: Span,
|
||||
/// The type bound when the
|
||||
|
|
@ -1265,7 +1265,7 @@ pub struct TSInferType<'a> {
|
|||
/// * [TypeScript Handbook - Typeof Type Operator](https://www.typescriptlang.org/docs/handbook/2/typeof-types.html)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSTypeQuery<'a> {
|
||||
pub span: Span,
|
||||
pub expr_name: TSTypeQueryExprName<'a>,
|
||||
|
|
@ -1280,7 +1280,7 @@ inherit_variants! {
|
|||
/// [`ast` module docs]: `super`
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)]
|
||||
pub enum TSTypeQueryExprName<'a> {
|
||||
TSImportType(Box<'a, TSImportType<'a>>) = 2,
|
||||
// `TSTypeName` variants added here by `inherit_variants!` macro
|
||||
|
|
@ -1290,7 +1290,7 @@ pub enum TSTypeQueryExprName<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSImportType<'a> {
|
||||
pub span: Span,
|
||||
/// `true` for `typeof import("foo")`
|
||||
|
|
@ -1303,7 +1303,7 @@ pub struct TSImportType<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSImportAttributes<'a> {
|
||||
pub span: Span,
|
||||
pub attributes_keyword: IdentifierName<'a>, // `with` or `assert`
|
||||
|
|
@ -1312,7 +1312,7 @@ pub struct TSImportAttributes<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSImportAttribute<'a> {
|
||||
pub span: Span,
|
||||
pub name: TSImportAttributeName<'a>,
|
||||
|
|
@ -1321,7 +1321,7 @@ pub struct TSImportAttribute<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub enum TSImportAttributeName<'a> {
|
||||
Identifier(IdentifierName<'a>) = 0,
|
||||
StringLiteral(StringLiteral<'a>) = 1,
|
||||
|
|
@ -1337,7 +1337,7 @@ pub enum TSImportAttributeName<'a> {
|
|||
/// ```
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSFunctionType<'a> {
|
||||
pub span: Span,
|
||||
/// Generic type parameters
|
||||
|
|
@ -1366,7 +1366,7 @@ pub struct TSFunctionType<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSConstructorType<'a> {
|
||||
pub span: Span,
|
||||
pub r#abstract: bool,
|
||||
|
|
@ -1399,7 +1399,7 @@ pub struct TSConstructorType<'a> {
|
|||
#[ast(visit)]
|
||||
#[scope]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSMappedType<'a> {
|
||||
pub span: Span,
|
||||
/// Key type parameter, e.g. `P` in `[P in keyof T]`.
|
||||
|
|
@ -1437,7 +1437,7 @@ pub struct TSMappedType<'a> {
|
|||
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum TSMappedTypeModifierOperator {
|
||||
/// e.g. `?` in `{ [P in K]?: T }`
|
||||
True = 0,
|
||||
|
|
@ -1464,7 +1464,7 @@ pub enum TSMappedTypeModifierOperator {
|
|||
/// * [TypeScript Handbook - Template Literal Types](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#handbook-content)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSTemplateLiteralType<'a> {
|
||||
pub span: Span,
|
||||
/// The string parts of the template literal.
|
||||
|
|
@ -1475,7 +1475,7 @@ pub struct TSTemplateLiteralType<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSAsExpression<'a> {
|
||||
pub span: Span,
|
||||
pub expression: Expression<'a>,
|
||||
|
|
@ -1496,7 +1496,7 @@ pub struct TSAsExpression<'a> {
|
|||
/// * [TypeScript Handbook - The `satisfies` Operator](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-9.html#the-satisfies-operator)
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSSatisfiesExpression<'a> {
|
||||
pub span: Span,
|
||||
/// The value expression being constrained.
|
||||
|
|
@ -1507,7 +1507,7 @@ pub struct TSSatisfiesExpression<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSTypeAssertion<'a> {
|
||||
pub span: Span,
|
||||
pub expression: Expression<'a>,
|
||||
|
|
@ -1516,7 +1516,7 @@ pub struct TSTypeAssertion<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSImportEqualsDeclaration<'a> {
|
||||
pub span: Span,
|
||||
pub id: BindingIdentifier<'a>,
|
||||
|
|
@ -1532,7 +1532,7 @@ inherit_variants! {
|
|||
/// [`ast` module docs]: `super`
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)]
|
||||
pub enum TSModuleReference<'a> {
|
||||
ExternalModuleReference(Box<'a, TSExternalModuleReference<'a>>) = 2,
|
||||
// `TSTypeName` variants added here by `inherit_variants!` macro
|
||||
|
|
@ -1542,7 +1542,7 @@ pub enum TSModuleReference<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSExternalModuleReference<'a> {
|
||||
pub span: Span,
|
||||
pub expression: StringLiteral<'a>,
|
||||
|
|
@ -1550,7 +1550,7 @@ pub struct TSExternalModuleReference<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSNonNullExpression<'a> {
|
||||
pub span: Span,
|
||||
pub expression: Expression<'a>,
|
||||
|
|
@ -1582,7 +1582,7 @@ pub struct TSNonNullExpression<'a> {
|
|||
/// [`CallExpression`]: crate::ast::js::CallExpression
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct Decorator<'a> {
|
||||
pub span: Span,
|
||||
pub expression: Expression<'a>,
|
||||
|
|
@ -1593,7 +1593,7 @@ pub struct Decorator<'a> {
|
|||
/// `export = foo`
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSExportAssignment<'a> {
|
||||
pub span: Span,
|
||||
pub expression: Expression<'a>,
|
||||
|
|
@ -1604,7 +1604,7 @@ pub struct TSExportAssignment<'a> {
|
|||
/// `export as namespace foo`
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSNamespaceExportDeclaration<'a> {
|
||||
pub span: Span,
|
||||
pub id: IdentifierName<'a>,
|
||||
|
|
@ -1612,7 +1612,7 @@ pub struct TSNamespaceExportDeclaration<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct TSInstantiationExpression<'a> {
|
||||
pub span: Span,
|
||||
pub expression: Expression<'a>,
|
||||
|
|
@ -1622,7 +1622,7 @@ pub struct TSInstantiationExpression<'a> {
|
|||
/// See [TypeScript - Type-Only Imports and Exports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html)
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum ImportOrExportKind {
|
||||
/// `import { foo } from './foo'`;
|
||||
Value = 0,
|
||||
|
|
@ -1635,7 +1635,7 @@ pub enum ImportOrExportKind {
|
|||
/// `type foo = ty?` or `type foo = ?ty`
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSDocNullableType<'a> {
|
||||
pub span: Span,
|
||||
pub type_annotation: TSType<'a>,
|
||||
|
|
@ -1646,7 +1646,7 @@ pub struct JSDocNullableType<'a> {
|
|||
/// `type foo = ty!` or `type foo = !ty`
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSDocNonNullableType<'a> {
|
||||
pub span: Span,
|
||||
pub type_annotation: TSType<'a>,
|
||||
|
|
@ -1655,7 +1655,7 @@ pub struct JSDocNonNullableType<'a> {
|
|||
|
||||
#[ast(visit)]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
|
||||
pub struct JSDocUnknownType {
|
||||
pub span: Span,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
//! Literals
|
||||
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
fmt,
|
||||
hash::{Hash, Hasher},
|
||||
};
|
||||
use std::{borrow::Cow, fmt};
|
||||
|
||||
use oxc_allocator::CloneIn;
|
||||
use oxc_regular_expression::ast::Pattern;
|
||||
use oxc_span::{cmp::ContentEq, hash::ContentHash};
|
||||
use oxc_span::cmp::ContentEq;
|
||||
|
||||
use crate::ast::*;
|
||||
|
||||
|
|
@ -79,44 +75,10 @@ impl ContentEq for NumericLiteral<'_> {
|
|||
fn content_eq(&self, other: &Self) -> bool {
|
||||
// Note: `f64::content_eq` uses `==` equality.
|
||||
// `f64::NAN != f64::NAN` and `0.0 == -0.0`, so we follow the same here.
|
||||
// If we change that behavior, we should alter `content_hash` too.
|
||||
ContentEq::content_eq(&self.value, &other.value)
|
||||
}
|
||||
}
|
||||
|
||||
impl ContentHash for NumericLiteral<'_> {
|
||||
fn content_hash<H: Hasher>(&self, state: &mut H) {
|
||||
// `f64` does not implement `Hash` due to ambiguity over what is the right way to hash NaN
|
||||
// and +/- zero values.
|
||||
//
|
||||
// # NaN
|
||||
// IEEE 754 defines a whole range of NaN values.
|
||||
// https://doc.rust-lang.org/std/primitive.f64.html#associatedconstant.NAN
|
||||
// We can ignore that complication here as the rule is that 2 types which are equal (`==`)
|
||||
// must hash the same.
|
||||
// `ContentEq` uses `==` equality, and even the same NaN doesn't equal itself!
|
||||
// `f64::NAN != f64::NAN`
|
||||
// So it doesn't matter if two NaNs have the same hash or not.
|
||||
//
|
||||
// # Zero
|
||||
// `ContentEq` uses `==` equality, which considers `0.0` and `-0.0` equal, so we must make
|
||||
// them hash the same.
|
||||
// But `(0.0).to_bits() != (-0.0).to_bits()`, so we need to convert `-0.0` to `0.0`.
|
||||
//
|
||||
// # Infinity
|
||||
// `f64::INFINITY != -f64::INFINITY` and `f64::INFINITY.to_bits() != (-f64::INFINITY).to_bits()`
|
||||
// so infinity needs no special handling.
|
||||
//
|
||||
// Whatever the value, we convert to `u64` using `to_bits`, and hash that.
|
||||
let mut value = self.value;
|
||||
if value == -0.0 {
|
||||
value = 0.0;
|
||||
}
|
||||
let value = value.to_bits();
|
||||
std::hash::Hash::hash(&value, state);
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for NumericLiteral<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
// We have 2 choices here:
|
||||
|
|
@ -155,12 +117,6 @@ impl ContentEq for StringLiteral<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
impl ContentHash for StringLiteral<'_> {
|
||||
fn content_hash<H: Hasher>(&self, state: &mut H) {
|
||||
ContentHash::content_hash(&self.value, state);
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<str> for StringLiteral<'_> {
|
||||
#[inline]
|
||||
fn as_ref(&self) -> &str {
|
||||
|
|
@ -188,12 +144,6 @@ impl ContentEq for BigIntLiteral<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
impl ContentHash for BigIntLiteral<'_> {
|
||||
fn content_hash<H: Hasher>(&self, state: &mut H) {
|
||||
ContentHash::content_hash(&self.raw, state);
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for BigIntLiteral<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.raw.fmt(f)
|
||||
|
|
@ -277,16 +227,6 @@ impl ContentEq for RegExpPattern<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
impl ContentHash for RegExpPattern<'_> {
|
||||
fn content_hash<H: Hasher>(&self, state: &mut H) {
|
||||
let self_str = match self {
|
||||
Self::Raw(s) | Self::Invalid(s) => s,
|
||||
Self::Pattern(p) => &&*p.to_string(),
|
||||
};
|
||||
ContentHash::content_hash(self_str, state);
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for RegExpPattern<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
|
|
@ -302,12 +242,6 @@ impl ContentEq for RegExpFlags {
|
|||
}
|
||||
}
|
||||
|
||||
impl ContentHash for RegExpFlags {
|
||||
fn content_hash<H: Hasher>(&self, state: &mut H) {
|
||||
Hash::hash(self, state);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'alloc> CloneIn<'alloc> for RegExpFlags {
|
||||
type Cloned = Self;
|
||||
|
||||
|
|
|
|||
|
|
@ -81,8 +81,6 @@ fn abs_trait(
|
|||
(quote!(::oxc_allocator::GetAddress), TokenStream::default())
|
||||
} else if ident == "ContentEq" {
|
||||
(quote!(::oxc_span::cmp::ContentEq), TokenStream::default())
|
||||
} else if ident == "ContentHash" {
|
||||
(quote!(::oxc_span::hash::ContentHash), TokenStream::default())
|
||||
} else if ident == "ESTree" {
|
||||
(quote!(::oxc_estree::ESTree), TokenStream::default())
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use oxc_allocator::{Box, CloneIn, GetAddress, Vec};
|
||||
use oxc_ast_macros::ast;
|
||||
use oxc_estree::ESTree;
|
||||
use oxc_span::{cmp::ContentEq, hash::ContentHash, Atom, GetSpan, Span};
|
||||
use oxc_span::{cmp::ContentEq, Atom, GetSpan, Span};
|
||||
|
||||
/// The root of the `PatternParser` result.
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct Pattern<'a> {
|
||||
pub span: Span,
|
||||
pub body: Disjunction<'a>,
|
||||
|
|
@ -15,7 +15,7 @@ pub struct Pattern<'a> {
|
|||
/// Pile of [`Alternative`]s separated by `|`.
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct Disjunction<'a> {
|
||||
pub span: Span,
|
||||
pub body: Vec<'a, Alternative<'a>>,
|
||||
|
|
@ -24,7 +24,7 @@ pub struct Disjunction<'a> {
|
|||
/// Single unit of `|` separated alternatives.
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct Alternative<'a> {
|
||||
pub span: Span,
|
||||
pub body: Vec<'a, Term<'a>>,
|
||||
|
|
@ -33,7 +33,7 @@ pub struct Alternative<'a> {
|
|||
/// Single unit of [`Alternative`], containing various kinds.
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum Term<'a> {
|
||||
// Assertion, QuantifiableAssertion
|
||||
BoundaryAssertion(Box<'a, BoundaryAssertion>) = 0,
|
||||
|
|
@ -76,7 +76,7 @@ impl GetSpan for Term<'_> {
|
|||
/// e.g. `^`, `$`, `\b`, `\B`
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct BoundaryAssertion {
|
||||
pub span: Span,
|
||||
pub kind: BoundaryAssertionKind,
|
||||
|
|
@ -84,7 +84,7 @@ pub struct BoundaryAssertion {
|
|||
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum BoundaryAssertionKind {
|
||||
Start = 0,
|
||||
End = 1,
|
||||
|
|
@ -96,7 +96,7 @@ pub enum BoundaryAssertionKind {
|
|||
/// e.g. `(?=...)`, `(?!...)`, `(?<=...)`, `(?<!...)`
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct LookAroundAssertion<'a> {
|
||||
pub span: Span,
|
||||
pub kind: LookAroundAssertionKind,
|
||||
|
|
@ -105,7 +105,7 @@ pub struct LookAroundAssertion<'a> {
|
|||
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum LookAroundAssertionKind {
|
||||
Lookahead = 0,
|
||||
NegativeLookahead = 1,
|
||||
|
|
@ -117,7 +117,7 @@ pub enum LookAroundAssertionKind {
|
|||
/// e.g. `a*`, `b+`, `c?`, `d{3}`, `e{4,}`, `f{5,6}`
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct Quantifier<'a> {
|
||||
pub span: Span,
|
||||
pub min: u64,
|
||||
|
|
@ -130,7 +130,7 @@ pub struct Quantifier<'a> {
|
|||
/// Single character.
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct Character {
|
||||
/// This will be invalid position when `UnicodeMode` is disabled and `value` is a surrogate pair.
|
||||
pub span: Span,
|
||||
|
|
@ -141,7 +141,7 @@ pub struct Character {
|
|||
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum CharacterKind {
|
||||
ControlLetter = 0,
|
||||
HexadecimalEscape = 1,
|
||||
|
|
@ -160,7 +160,7 @@ pub enum CharacterKind {
|
|||
/// e.g. `\d`, `\D`, `\s`, `\S`, `\w`, `\W`
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct CharacterClassEscape {
|
||||
pub span: Span,
|
||||
pub kind: CharacterClassEscapeKind,
|
||||
|
|
@ -168,7 +168,7 @@ pub struct CharacterClassEscape {
|
|||
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum CharacterClassEscapeKind {
|
||||
D = 0,
|
||||
NegativeD = 1,
|
||||
|
|
@ -182,7 +182,7 @@ pub enum CharacterClassEscapeKind {
|
|||
/// e.g. `\p{ASCII}`, `\P{ASCII}`, `\p{sc=Hiragana}`, `\P{sc=Hiragana}`
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct UnicodePropertyEscape<'a> {
|
||||
pub span: Span,
|
||||
pub negative: bool,
|
||||
|
|
@ -195,7 +195,7 @@ pub struct UnicodePropertyEscape<'a> {
|
|||
/// The `.`.
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct Dot {
|
||||
pub span: Span,
|
||||
}
|
||||
|
|
@ -204,7 +204,7 @@ pub struct Dot {
|
|||
/// e.g. `[a-z]`, `[^A-Z]`, `[abc]`, `[a&&b&&c]`, `[[a-z]--x--y]`
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct CharacterClass<'a> {
|
||||
pub span: Span,
|
||||
pub negative: bool,
|
||||
|
|
@ -218,7 +218,7 @@ pub struct CharacterClass<'a> {
|
|||
|
||||
#[ast]
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum CharacterClassContentsKind {
|
||||
Union = 0,
|
||||
/// `UnicodeSetsMode` only.
|
||||
|
|
@ -229,7 +229,7 @@ pub enum CharacterClassContentsKind {
|
|||
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, GetAddress, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, GetAddress, ESTree)]
|
||||
pub enum CharacterClassContents<'a> {
|
||||
CharacterClassRange(Box<'a, CharacterClassRange>) = 0,
|
||||
CharacterClassEscape(Box<'a, CharacterClassEscape>) = 1,
|
||||
|
|
@ -259,7 +259,7 @@ impl GetSpan for CharacterClassContents<'_> {
|
|||
/// e.g. `a-z`, `A-Z`, `0-9`
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct CharacterClassRange {
|
||||
pub span: Span,
|
||||
pub min: Character,
|
||||
|
|
@ -269,7 +269,7 @@ pub struct CharacterClassRange {
|
|||
/// `|` separated string of characters wrapped by `\q{}`.
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct ClassStringDisjunction<'a> {
|
||||
pub span: Span,
|
||||
/// `true` if body is empty or contains [`ClassString`] which `strings` is `true`.
|
||||
|
|
@ -280,7 +280,7 @@ pub struct ClassStringDisjunction<'a> {
|
|||
/// Single unit of [`ClassStringDisjunction`].
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct ClassString<'a> {
|
||||
pub span: Span,
|
||||
/// `true` if body is empty or contain 2 more characters.
|
||||
|
|
@ -292,7 +292,7 @@ pub struct ClassString<'a> {
|
|||
/// e.g. `(...)`, `(?<name>...)`
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct CapturingGroup<'a> {
|
||||
pub span: Span,
|
||||
/// Group name to be referenced by [`NamedReference`].
|
||||
|
|
@ -304,7 +304,7 @@ pub struct CapturingGroup<'a> {
|
|||
/// e.g. `(?:...)`
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct IgnoreGroup<'a> {
|
||||
pub span: Span,
|
||||
pub modifiers: Option<Modifiers>,
|
||||
|
|
@ -315,7 +315,7 @@ pub struct IgnoreGroup<'a> {
|
|||
/// e.g. `i` in `(?i:...)`, `-s` in `(?-s:...)`
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct Modifiers {
|
||||
pub span: Span,
|
||||
pub enabling: Option<Modifier>,
|
||||
|
|
@ -325,7 +325,7 @@ pub struct Modifiers {
|
|||
/// Each part of modifier in [`Modifiers`].
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct Modifier {
|
||||
pub ignore_case: bool,
|
||||
pub multiline: bool,
|
||||
|
|
@ -336,7 +336,7 @@ pub struct Modifier {
|
|||
/// e.g. `\1`, `\2`, `\3`
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct IndexedReference {
|
||||
pub span: Span,
|
||||
pub index: u32,
|
||||
|
|
@ -346,7 +346,7 @@ pub struct IndexedReference {
|
|||
/// e.g. `\k<name>`
|
||||
#[ast]
|
||||
#[derive(Debug)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub struct NamedReference<'a> {
|
||||
pub span: Span,
|
||||
pub name: Atom<'a>,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use oxc_allocator::{Allocator, CloneIn, FromIn};
|
|||
#[cfg(feature = "serialize")]
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::{cmp::ContentEq, hash::ContentHash, CompactStr};
|
||||
use crate::{cmp::ContentEq, CompactStr};
|
||||
|
||||
/// An inlinable string for oxc_allocator.
|
||||
///
|
||||
|
|
@ -196,12 +196,6 @@ impl ContentEq for Atom<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
impl ContentHash for Atom<'_> {
|
||||
fn content_hash<H: hash::Hasher>(&self, state: &mut H) {
|
||||
hash::Hash::hash(self, state);
|
||||
}
|
||||
}
|
||||
|
||||
impl hash::Hash for Atom<'_> {
|
||||
fn hash<H: hash::Hasher>(&self, hasher: &mut H) {
|
||||
self.as_str().hash(hasher);
|
||||
|
|
|
|||
|
|
@ -1,78 +0,0 @@
|
|||
//! Specialized hashing traits
|
||||
use std::{
|
||||
hash::{Hash, Hasher},
|
||||
mem::{discriminant, Discriminant},
|
||||
};
|
||||
|
||||
/// This trait works similarly to [std::hash::Hash] but it gives the liberty of hashing
|
||||
/// the object's content loosely. This would mean the implementor can skip some parts of
|
||||
/// the content while calculating the hash.
|
||||
///
|
||||
/// As an example, In AST types we ignore fields such as [crate::Span].
|
||||
pub trait ContentHash {
|
||||
/// Hash an AST node based on its content alone.
|
||||
///
|
||||
/// This hash ignores node location, but respects precedence and ordering.
|
||||
fn content_hash<H: Hasher>(&self, state: &mut H);
|
||||
}
|
||||
|
||||
/// Short-Circuting implementation for [Discriminant] since it is used to hash enums.
|
||||
impl<T> ContentHash for Discriminant<T> {
|
||||
fn content_hash<H: Hasher>(&self, state: &mut H) {
|
||||
Hash::hash(self, state);
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ContentHash> ContentHash for Option<T> {
|
||||
fn content_hash<H: Hasher>(&self, state: &mut H) {
|
||||
ContentHash::content_hash(&discriminant(self), state);
|
||||
if let Some(it) = self {
|
||||
ContentHash::content_hash(it, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ContentHash> ContentHash for oxc_allocator::Box<'_, T> {
|
||||
fn content_hash<H: Hasher>(&self, state: &mut H) {
|
||||
ContentHash::content_hash(self.as_ref(), state);
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ContentHash> ContentHash for oxc_allocator::Vec<'_, T> {
|
||||
fn content_hash<H: Hasher>(&self, state: &mut H) {
|
||||
for piece in self {
|
||||
piece.content_hash(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ContentHash> ContentHash for [T] {
|
||||
fn content_hash<H: Hasher>(&self, state: &mut H) {
|
||||
for piece in self {
|
||||
piece.content_hash(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mod auto_impl_content_hash {
|
||||
use super::ContentHash;
|
||||
|
||||
macro_rules! impl_content_hash {
|
||||
($($t:ty)*) => {
|
||||
$(
|
||||
impl ContentHash for $t {
|
||||
fn content_hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
std::hash::Hash::hash(self, state);
|
||||
}
|
||||
}
|
||||
)*
|
||||
};
|
||||
}
|
||||
|
||||
impl_content_hash! {
|
||||
char &str
|
||||
bool isize usize
|
||||
u8 u16 u32 u64 u128
|
||||
i8 i16 i32 i64 i128
|
||||
}
|
||||
}
|
||||
|
|
@ -10,7 +10,6 @@ mod source_type;
|
|||
mod span;
|
||||
|
||||
pub mod cmp;
|
||||
pub mod hash;
|
||||
|
||||
pub use crate::{
|
||||
atom::Atom,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use oxc_allocator::{Allocator, CloneIn};
|
|||
use oxc_ast_macros::ast;
|
||||
use oxc_estree::ESTree;
|
||||
|
||||
use crate::{cmp::ContentEq, hash::ContentHash};
|
||||
use crate::cmp::ContentEq;
|
||||
|
||||
mod error;
|
||||
pub use error::UnknownExtension;
|
||||
|
|
@ -96,13 +96,6 @@ impl ContentEq for SourceType {
|
|||
}
|
||||
}
|
||||
|
||||
impl ContentHash for SourceType {
|
||||
#[inline]
|
||||
fn content_hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
self.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
/// Valid file extensions
|
||||
pub const VALID_EXTENSIONS: [&str; 8] = ["js", "mjs", "cjs", "jsx", "ts", "mts", "cts", "tsx"];
|
||||
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ use oxc_estree::ESTree;
|
|||
/// assert_eq!(s.expand(5), s.expand_left(5).expand_right(5));
|
||||
/// ```
|
||||
///
|
||||
/// ## Hashing
|
||||
/// [`Span`] has a normal implementation of [`Hash`]. If you want to compare two
|
||||
/// ## Comparison
|
||||
/// [`Span`] has a normal implementation of [`PartialEq`]. If you want to compare two
|
||||
/// AST nodes without considering their locations (e.g. to see if they have the
|
||||
/// same content), use [`ContentHash`](crate::hash::ContentHash) instead.
|
||||
/// same content), use [`ContentEq`](crate::cmp::ContentEq) instead.
|
||||
///
|
||||
/// ## Implementation Notes
|
||||
/// See the [`text-size`](https://docs.rs/text-size) crate for details.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#![allow(missing_docs)] // fixme
|
||||
use oxc_allocator::CloneIn;
|
||||
use oxc_ast_macros::ast;
|
||||
use oxc_span::{cmp::ContentEq, hash::ContentHash};
|
||||
use oxc_span::cmp::ContentEq;
|
||||
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash)]
|
||||
#[generate_derive(CloneIn, ContentEq)]
|
||||
pub enum NumberBase {
|
||||
Float = 0,
|
||||
Decimal = 1,
|
||||
|
|
@ -22,7 +22,7 @@ impl NumberBase {
|
|||
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash)]
|
||||
#[generate_derive(CloneIn, ContentEq)]
|
||||
pub enum BigintBase {
|
||||
Decimal = 0,
|
||||
Binary = 1,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
use oxc_allocator::CloneIn;
|
||||
use oxc_ast_macros::ast;
|
||||
use oxc_estree::ESTree;
|
||||
use oxc_span::{cmp::ContentEq, hash::ContentHash};
|
||||
use oxc_span::cmp::ContentEq;
|
||||
|
||||
use crate::precedence::{GetPrecedence, Precedence};
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ use crate::precedence::{GetPrecedence, Precedence};
|
|||
/// - [13.15 Assignment Operators](https://tc39.es/ecma262/#sec-assignment-operators)
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum AssignmentOperator {
|
||||
/// `=`
|
||||
#[estree(rename = "=")]
|
||||
|
|
@ -159,7 +159,7 @@ impl AssignmentOperator {
|
|||
/// - [12.10 Binary Logical Operators](https://tc39.es/ecma262/#sec-binary-logical-operators)
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum BinaryOperator {
|
||||
/// `==`
|
||||
#[estree(rename = "==")]
|
||||
|
|
@ -416,7 +416,7 @@ impl GetPrecedence for BinaryOperator {
|
|||
/// Logical binary operators
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum LogicalOperator {
|
||||
/// `||`
|
||||
#[estree(rename = "||")]
|
||||
|
|
@ -478,7 +478,7 @@ impl GetPrecedence for LogicalOperator {
|
|||
/// - [12.5 Unary Operators](https://tc39.es/ecma262/#sec-unary-operators)
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum UnaryOperator {
|
||||
/// `+`
|
||||
#[estree(rename = "+")]
|
||||
|
|
@ -558,7 +558,7 @@ impl UnaryOperator {
|
|||
/// Unary update operators.
|
||||
#[ast]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[generate_derive(CloneIn, ContentEq, ContentHash, ESTree)]
|
||||
#[generate_derive(CloneIn, ContentEq, ESTree)]
|
||||
pub enum UpdateOperator {
|
||||
/// `++`
|
||||
#[estree(rename = "++")]
|
||||
|
|
|
|||
Loading…
Reference in a new issue