diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:44:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:44:51 +0000 |
commit | 9e3c08db40b8916968b9f30096c7be3f00ce9647 (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /third_party/rust/jsparagus-ast/src | |
parent | Initial commit. (diff) | |
download | thunderbird-9e3c08db40b8916968b9f30096c7be3f00ce9647.tar.xz thunderbird-9e3c08db40b8916968b9f30096c7be3f00ce9647.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/jsparagus-ast/src')
-rw-r--r-- | third_party/rust/jsparagus-ast/src/arena.rs | 85 | ||||
-rw-r--r-- | third_party/rust/jsparagus-ast/src/associated_data.rs | 143 | ||||
-rw-r--r-- | third_party/rust/jsparagus-ast/src/dump_generated.rs | 2269 | ||||
-rw-r--r-- | third_party/rust/jsparagus-ast/src/lib.rs | 30 | ||||
-rw-r--r-- | third_party/rust/jsparagus-ast/src/source_atom_set.rs | 221 | ||||
-rw-r--r-- | third_party/rust/jsparagus-ast/src/source_location.rs | 32 | ||||
-rw-r--r-- | third_party/rust/jsparagus-ast/src/source_location_accessor_generated.rs | 2047 | ||||
-rw-r--r-- | third_party/rust/jsparagus-ast/src/source_slice_list.rs | 49 | ||||
-rw-r--r-- | third_party/rust/jsparagus-ast/src/type_id_generated.rs | 712 | ||||
-rw-r--r-- | third_party/rust/jsparagus-ast/src/types_generated.rs | 1055 | ||||
-rw-r--r-- | third_party/rust/jsparagus-ast/src/visit_generated.rs | 5423 |
11 files changed, 12066 insertions, 0 deletions
diff --git a/third_party/rust/jsparagus-ast/src/arena.rs b/third_party/rust/jsparagus-ast/src/arena.rs new file mode 100644 index 0000000000..5c1abdbe86 --- /dev/null +++ b/third_party/rust/jsparagus-ast/src/arena.rs @@ -0,0 +1,85 @@ +use bumpalo::Bump; + +use std::{ + self, + fmt::{self, Debug, Formatter}, + ops, ptr, +}; + +pub use bumpalo::collections::{String, Vec}; + +pub struct Box<'alloc, T: ?Sized>(&'alloc mut T); + +impl<'alloc, T> Box<'alloc, T> { + pub fn unbox(self) -> T { + // This pointer read is safe because the reference `self.0` is + // guaranteed to be unique--not just now, but we're guaranteed it's not + // borrowed from some other reference. This in turn is because we never + // construct an alloc::Box with a borrowed reference, only with a fresh + // one just allocated from a Bump. + unsafe { ptr::read(self.0 as *mut T) } + } +} + +impl<'alloc, T: ?Sized> ops::Deref for Box<'alloc, T> { + type Target = T; + + fn deref(&self) -> &T { + self.0 + } +} + +impl<'alloc, T: ?Sized> ops::DerefMut for Box<'alloc, T> { + fn deref_mut(&mut self) -> &mut T { + self.0 + } +} + +impl<'alloc, T: ?Sized> Debug for Box<'alloc, T> +where + T: Debug, +{ + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + self.0.fmt(f) + } +} + +impl<'alloc, T> PartialEq for Box<'alloc, T> +where + T: PartialEq<T> + ?Sized, +{ + fn eq(&self, other: &Box<'alloc, T>) -> bool { + PartialEq::eq(&**self, &**other) + } + + fn ne(&self, other: &Box<'alloc, T>) -> bool { + PartialEq::ne(&**self, &**other) + } +} + +pub fn alloc<'alloc, T>(allocator: &'alloc Bump, value: T) -> Box<'alloc, T> { + Box(allocator.alloc(value)) +} + +pub fn alloc_with<'alloc, F, T>(allocator: &'alloc Bump, gen: F) -> Box<'alloc, T> +where + F: FnOnce() -> T, +{ + Box(allocator.alloc_with(gen)) +} + +pub fn alloc_str<'alloc>(allocator: &'alloc Bump, value: &str) -> &'alloc str { + String::from_str_in(value, allocator).into_bump_str() +} + +pub fn map_vec<'alloc, A, B>( + source: &mut Vec<A>, + mut map_fn: impl FnMut(&mut A) -> B, + allocator: &'alloc Bump, +) -> Vec<'alloc, B> { + let mut out = Vec::with_capacity_in(source.len(), allocator); + for item in source { + out.push(map_fn(item)); + } + out +} diff --git a/third_party/rust/jsparagus-ast/src/associated_data.rs b/third_party/rust/jsparagus-ast/src/associated_data.rs new file mode 100644 index 0000000000..bdde80c0fd --- /dev/null +++ b/third_party/rust/jsparagus-ast/src/associated_data.rs @@ -0,0 +1,143 @@ +use crate::source_location_accessor::SourceLocationAccessor; +use crate::type_id::{NodeTypeId, NodeTypeIdAccessor}; +use crate::SourceLocation; +use std::collections::HashMap; + +#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] +struct Key { + type_id: NodeTypeId, + loc: SourceLocation, +} + +impl Key { + fn new<NodeT>(node: &NodeT) -> Self + where + NodeT: SourceLocationAccessor + NodeTypeIdAccessor, + { + Self { + type_id: node.get_type_id(), + loc: node.get_loc(), + } + } +} + +impl NodeTypeIdAccessor for Key { + fn get_type_id(&self) -> NodeTypeId { + self.type_id + } +} + +impl SourceLocationAccessor for Key { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +#[derive(Debug)] +struct Item<ValueT> { + #[allow(dead_code)] + key: Key, + value: ValueT, +} + +impl<ValueT> Item<ValueT> { + fn new(key: Key, value: ValueT) -> Self { + Self { key, value } + } +} + +type ItemIndex = usize; + +#[derive(Debug)] +pub struct AssociatedDataItemIndex { + index: ItemIndex, +} +impl AssociatedDataItemIndex { + fn new(index: ItemIndex) -> Self { + Self { index } + } +} + +// A map from AST node to `ValueT`, to associate extra data to AST node. +#[derive(Debug)] +pub struct AssociatedData<ValueT> { + items: Vec<Item<ValueT>>, + map: HashMap<Key, ItemIndex>, +} + +impl<ValueT> AssociatedData<ValueT> { + pub fn new() -> Self { + Self { + items: Vec::new(), + map: HashMap::new(), + } + } + + // Insert an item for `node`. + // Returns the index of the inserted item. + pub fn insert<NodeT>(&mut self, node: &NodeT, value: ValueT) -> AssociatedDataItemIndex + where + NodeT: SourceLocationAccessor + NodeTypeIdAccessor, + { + let index = self.items.len(); + let key = Key::new(node); + self.items.push(Item::new(key.clone(), value)); + self.map.insert(key, index); + + AssociatedDataItemIndex::new(index) + } + + // Get the immutable reference of the item for the index. + // The index is the return value of `insert` or `to_index`. + pub fn get_by_index(&self, index: AssociatedDataItemIndex) -> &ValueT { + // NOTE: This can panic if `index` is created by another instance of + // `AssociatedData`. + &self.items[index.index].value + } + + // Get the mutable reference of the item for the index. + // The index is the return value of `insert` or `to_index`. + pub fn get_mut_by_index(&mut self, index: AssociatedDataItemIndex) -> &mut ValueT { + // NOTE: This can panic if `index` is created by another instance of + // `AssociatedData`. + &mut self.items[index.index].value + } + + // Get the immutable reference of the item for `node`. + // `None` if there's no item inserted for `node`. + pub fn get<NodeT>(&self, node: &NodeT) -> Option<&ValueT> + where + NodeT: SourceLocationAccessor + NodeTypeIdAccessor, + { + self.to_index(node) + .and_then(|index| Some(self.get_by_index(index))) + } + + // Get the mutable reference of the item for `node`. + // `None` if there's no item inserted for `node`. + pub fn get_mut<NodeT>(&mut self, node: &NodeT) -> Option<&mut ValueT> + where + NodeT: SourceLocationAccessor + NodeTypeIdAccessor, + { + self.to_index(node) + .and_then(move |index| Some(self.get_mut_by_index(index))) + } + + // Returns the index for the item for `node`. + // `None` if there's no item inserted for `node`. + pub fn to_index<NodeT>(&self, node: &NodeT) -> Option<AssociatedDataItemIndex> + where + NodeT: SourceLocationAccessor + NodeTypeIdAccessor, + { + let key = Key::new(node); + match self.map.get(&key) { + Some(index) => Some(AssociatedDataItemIndex::new(*index)), + None => None, + } + } +} diff --git a/third_party/rust/jsparagus-ast/src/dump_generated.rs b/third_party/rust/jsparagus-ast/src/dump_generated.rs new file mode 100644 index 0000000000..dfbd7c3dc8 --- /dev/null +++ b/third_party/rust/jsparagus-ast/src/dump_generated.rs @@ -0,0 +1,2269 @@ +// WARNING: This file is auto-generated by crates/ast/generate_ast.py. + +#![allow(unused_variables)] + +use crate::arena; +use crate::source_atom_set::{SourceAtomSet, SourceAtomSetIndex}; +use crate::source_slice_list::{SourceSliceList, SourceSliceIndex}; +use crate::types::*; +use std::ops::Deref; +use std::io; + +fn newline<W>(out: &mut W, depth: usize) +where + W: io::Write, +{ + writeln!(out, "").expect("failed to dump"); + for i in 0..depth { + write!(out, " ").expect("failed to dump"); + } +} + +pub trait ASTDump { + fn dump_with_atoms<W>( + &self, + out: &mut W, + atoms: &SourceAtomSet, + slices: &SourceSliceList + ) + where + W: io::Write, + { + self.dump_with_atoms_at(out, atoms, slices, 0); + writeln!(out, "").expect("failed to dump"); + } + + fn dump_with_atoms_at<W>( + &self, + out: &mut W, + atoms: &SourceAtomSet, + slices: &SourceSliceList, + depth: usize, + ) + where W: io::Write; +} +impl<'alloc> ASTDump for Argument<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + Argument::SpreadElement(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Argument::Expression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for Arguments<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(Arguments").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "args=").expect("failed to dump"); + self.args.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for Identifier { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(Identifier").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "value=").expect("failed to dump"); + self.value.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for IdentifierName { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(IdentifierName").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "value=").expect("failed to dump"); + self.value.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for PrivateIdentifier { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(PrivateIdentifier").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "value=").expect("failed to dump"); + self.value.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for Label { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(Label").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "value=").expect("failed to dump"); + self.value.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for VariableDeclarationKind { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + VariableDeclarationKind::Var { .. } => { + write!(out, "Var").expect("failed to dump"); + } + VariableDeclarationKind::Let { .. } => { + write!(out, "Let").expect("failed to dump"); + } + VariableDeclarationKind::Const { .. } => { + write!(out, "Const").expect("failed to dump"); + } + } + } +} + +impl<'alloc> ASTDump for CompoundAssignmentOperator { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + CompoundAssignmentOperator::LogicalOr { .. } => { + write!(out, "LogicalOr").expect("failed to dump"); + } + CompoundAssignmentOperator::LogicalAnd { .. } => { + write!(out, "LogicalAnd").expect("failed to dump"); + } + CompoundAssignmentOperator::Coalesce { .. } => { + write!(out, "Coalesce").expect("failed to dump"); + } + CompoundAssignmentOperator::Add { .. } => { + write!(out, "Add").expect("failed to dump"); + } + CompoundAssignmentOperator::Sub { .. } => { + write!(out, "Sub").expect("failed to dump"); + } + CompoundAssignmentOperator::Mul { .. } => { + write!(out, "Mul").expect("failed to dump"); + } + CompoundAssignmentOperator::Div { .. } => { + write!(out, "Div").expect("failed to dump"); + } + CompoundAssignmentOperator::Mod { .. } => { + write!(out, "Mod").expect("failed to dump"); + } + CompoundAssignmentOperator::Pow { .. } => { + write!(out, "Pow").expect("failed to dump"); + } + CompoundAssignmentOperator::LeftShift { .. } => { + write!(out, "LeftShift").expect("failed to dump"); + } + CompoundAssignmentOperator::RightShift { .. } => { + write!(out, "RightShift").expect("failed to dump"); + } + CompoundAssignmentOperator::RightShiftExt { .. } => { + write!(out, "RightShiftExt").expect("failed to dump"); + } + CompoundAssignmentOperator::Or { .. } => { + write!(out, "Or").expect("failed to dump"); + } + CompoundAssignmentOperator::Xor { .. } => { + write!(out, "Xor").expect("failed to dump"); + } + CompoundAssignmentOperator::And { .. } => { + write!(out, "And").expect("failed to dump"); + } + } + } +} + +impl<'alloc> ASTDump for BinaryOperator { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + BinaryOperator::Equals { .. } => { + write!(out, "Equals").expect("failed to dump"); + } + BinaryOperator::NotEquals { .. } => { + write!(out, "NotEquals").expect("failed to dump"); + } + BinaryOperator::StrictEquals { .. } => { + write!(out, "StrictEquals").expect("failed to dump"); + } + BinaryOperator::StrictNotEquals { .. } => { + write!(out, "StrictNotEquals").expect("failed to dump"); + } + BinaryOperator::LessThan { .. } => { + write!(out, "LessThan").expect("failed to dump"); + } + BinaryOperator::LessThanOrEqual { .. } => { + write!(out, "LessThanOrEqual").expect("failed to dump"); + } + BinaryOperator::GreaterThan { .. } => { + write!(out, "GreaterThan").expect("failed to dump"); + } + BinaryOperator::GreaterThanOrEqual { .. } => { + write!(out, "GreaterThanOrEqual").expect("failed to dump"); + } + BinaryOperator::In { .. } => { + write!(out, "In").expect("failed to dump"); + } + BinaryOperator::Instanceof { .. } => { + write!(out, "Instanceof").expect("failed to dump"); + } + BinaryOperator::LeftShift { .. } => { + write!(out, "LeftShift").expect("failed to dump"); + } + BinaryOperator::RightShift { .. } => { + write!(out, "RightShift").expect("failed to dump"); + } + BinaryOperator::RightShiftExt { .. } => { + write!(out, "RightShiftExt").expect("failed to dump"); + } + BinaryOperator::Add { .. } => { + write!(out, "Add").expect("failed to dump"); + } + BinaryOperator::Sub { .. } => { + write!(out, "Sub").expect("failed to dump"); + } + BinaryOperator::Mul { .. } => { + write!(out, "Mul").expect("failed to dump"); + } + BinaryOperator::Div { .. } => { + write!(out, "Div").expect("failed to dump"); + } + BinaryOperator::Mod { .. } => { + write!(out, "Mod").expect("failed to dump"); + } + BinaryOperator::Pow { .. } => { + write!(out, "Pow").expect("failed to dump"); + } + BinaryOperator::Comma { .. } => { + write!(out, "Comma").expect("failed to dump"); + } + BinaryOperator::Coalesce { .. } => { + write!(out, "Coalesce").expect("failed to dump"); + } + BinaryOperator::LogicalOr { .. } => { + write!(out, "LogicalOr").expect("failed to dump"); + } + BinaryOperator::LogicalAnd { .. } => { + write!(out, "LogicalAnd").expect("failed to dump"); + } + BinaryOperator::BitwiseOr { .. } => { + write!(out, "BitwiseOr").expect("failed to dump"); + } + BinaryOperator::BitwiseXor { .. } => { + write!(out, "BitwiseXor").expect("failed to dump"); + } + BinaryOperator::BitwiseAnd { .. } => { + write!(out, "BitwiseAnd").expect("failed to dump"); + } + } + } +} + +impl<'alloc> ASTDump for UnaryOperator { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + UnaryOperator::Plus { .. } => { + write!(out, "Plus").expect("failed to dump"); + } + UnaryOperator::Minus { .. } => { + write!(out, "Minus").expect("failed to dump"); + } + UnaryOperator::LogicalNot { .. } => { + write!(out, "LogicalNot").expect("failed to dump"); + } + UnaryOperator::BitwiseNot { .. } => { + write!(out, "BitwiseNot").expect("failed to dump"); + } + UnaryOperator::Typeof { .. } => { + write!(out, "Typeof").expect("failed to dump"); + } + UnaryOperator::Void { .. } => { + write!(out, "Void").expect("failed to dump"); + } + UnaryOperator::Delete { .. } => { + write!(out, "Delete").expect("failed to dump"); + } + } + } +} + +impl<'alloc> ASTDump for UpdateOperator { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + UpdateOperator::Increment { .. } => { + write!(out, "Increment").expect("failed to dump"); + } + UpdateOperator::Decrement { .. } => { + write!(out, "Decrement").expect("failed to dump"); + } + } + } +} + +impl<'alloc> ASTDump for Function<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(Function").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "name=").expect("failed to dump"); + self.name.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "is_async=").expect("failed to dump"); + self.is_async.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "is_generator=").expect("failed to dump"); + self.is_generator.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "params=").expect("failed to dump"); + self.params.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "body=").expect("failed to dump"); + self.body.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for Program<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + Program::Module(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Program::Script(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for IfStatement<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(IfStatement").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "test=").expect("failed to dump"); + self.test.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "consequent=").expect("failed to dump"); + self.consequent.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "alternate=").expect("failed to dump"); + self.alternate.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for Statement<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + Statement::BlockStatement { block, .. } => { + write!(out, "(BlockStatement").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "block=").expect("failed to dump"); + block.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::BreakStatement { label, .. } => { + write!(out, "(BreakStatement").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "label=").expect("failed to dump"); + label.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::ContinueStatement { label, .. } => { + write!(out, "(ContinueStatement").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "label=").expect("failed to dump"); + label.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::DebuggerStatement { .. } => { + write!(out, "DebuggerStatement").expect("failed to dump"); + } + Statement::DoWhileStatement { block, test, .. } => { + write!(out, "(DoWhileStatement").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "block=").expect("failed to dump"); + block.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "test=").expect("failed to dump"); + test.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::EmptyStatement { .. } => { + write!(out, "EmptyStatement").expect("failed to dump"); + } + Statement::ExpressionStatement(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Statement::ForInStatement { left, right, block, .. } => { + write!(out, "(ForInStatement").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "left=").expect("failed to dump"); + left.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "right=").expect("failed to dump"); + right.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "block=").expect("failed to dump"); + block.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::ForOfStatement { left, right, block, .. } => { + write!(out, "(ForOfStatement").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "left=").expect("failed to dump"); + left.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "right=").expect("failed to dump"); + right.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "block=").expect("failed to dump"); + block.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::ForStatement { init, test, update, block, .. } => { + write!(out, "(ForStatement").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "init=").expect("failed to dump"); + init.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "test=").expect("failed to dump"); + test.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "update=").expect("failed to dump"); + update.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "block=").expect("failed to dump"); + block.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::IfStatement(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Statement::LabelledStatement { label, body, .. } => { + write!(out, "(LabelledStatement").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "label=").expect("failed to dump"); + label.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "body=").expect("failed to dump"); + body.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::ReturnStatement { expression, .. } => { + write!(out, "(ReturnStatement").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "expression=").expect("failed to dump"); + expression.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::SwitchStatement { discriminant, cases, .. } => { + write!(out, "(SwitchStatement").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "discriminant=").expect("failed to dump"); + discriminant.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "cases=").expect("failed to dump"); + cases.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::SwitchStatementWithDefault { discriminant, pre_default_cases, default_case, post_default_cases, .. } => { + write!(out, "(SwitchStatementWithDefault").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "discriminant=").expect("failed to dump"); + discriminant.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "pre_default_cases=").expect("failed to dump"); + pre_default_cases.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "default_case=").expect("failed to dump"); + default_case.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "post_default_cases=").expect("failed to dump"); + post_default_cases.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::ThrowStatement { expression, .. } => { + write!(out, "(ThrowStatement").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "expression=").expect("failed to dump"); + expression.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::TryCatchStatement { body, catch_clause, .. } => { + write!(out, "(TryCatchStatement").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "body=").expect("failed to dump"); + body.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "catch_clause=").expect("failed to dump"); + catch_clause.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::TryFinallyStatement { body, catch_clause, finalizer, .. } => { + write!(out, "(TryFinallyStatement").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "body=").expect("failed to dump"); + body.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "catch_clause=").expect("failed to dump"); + catch_clause.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "finalizer=").expect("failed to dump"); + finalizer.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::WhileStatement { test, block, .. } => { + write!(out, "(WhileStatement").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "test=").expect("failed to dump"); + test.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "block=").expect("failed to dump"); + block.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::WithStatement { object, body, .. } => { + write!(out, "(WithStatement").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "object=").expect("failed to dump"); + object.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "body=").expect("failed to dump"); + body.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Statement::VariableDeclarationStatement(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Statement::FunctionDeclaration(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Statement::ClassDeclaration(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for Expression<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + Expression::MemberExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Expression::ClassExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Expression::LiteralBooleanExpression { value, .. } => { + write!(out, "(LiteralBooleanExpression").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "value=").expect("failed to dump"); + value.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::LiteralInfinityExpression { .. } => { + write!(out, "LiteralInfinityExpression").expect("failed to dump"); + } + Expression::LiteralNullExpression { .. } => { + write!(out, "LiteralNullExpression").expect("failed to dump"); + } + Expression::LiteralNumericExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Expression::LiteralRegExpExpression { pattern, global, ignore_case, multi_line, dot_all, sticky, unicode, .. } => { + write!(out, "(LiteralRegExpExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "pattern=").expect("failed to dump"); + pattern.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "global=").expect("failed to dump"); + global.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "ignore_case=").expect("failed to dump"); + ignore_case.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "multi_line=").expect("failed to dump"); + multi_line.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "dot_all=").expect("failed to dump"); + dot_all.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "sticky=").expect("failed to dump"); + sticky.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "unicode=").expect("failed to dump"); + unicode.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::LiteralStringExpression { value, .. } => { + write!(out, "(LiteralStringExpression").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "value=").expect("failed to dump"); + value.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::ArrayExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Expression::ArrowExpression { is_async, params, body, .. } => { + write!(out, "(ArrowExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "is_async=").expect("failed to dump"); + is_async.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "params=").expect("failed to dump"); + params.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "body=").expect("failed to dump"); + body.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::AssignmentExpression { binding, expression, .. } => { + write!(out, "(AssignmentExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "binding=").expect("failed to dump"); + binding.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "expression=").expect("failed to dump"); + expression.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::BinaryExpression { operator, left, right, .. } => { + write!(out, "(BinaryExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "operator=").expect("failed to dump"); + operator.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "left=").expect("failed to dump"); + left.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "right=").expect("failed to dump"); + right.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::CallExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Expression::CompoundAssignmentExpression { operator, binding, expression, .. } => { + write!(out, "(CompoundAssignmentExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "operator=").expect("failed to dump"); + operator.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "binding=").expect("failed to dump"); + binding.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "expression=").expect("failed to dump"); + expression.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::ConditionalExpression { test, consequent, alternate, .. } => { + write!(out, "(ConditionalExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "test=").expect("failed to dump"); + test.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "consequent=").expect("failed to dump"); + consequent.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "alternate=").expect("failed to dump"); + alternate.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::FunctionExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Expression::IdentifierExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Expression::NewExpression { callee, arguments, .. } => { + write!(out, "(NewExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "callee=").expect("failed to dump"); + callee.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "arguments=").expect("failed to dump"); + arguments.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::NewTargetExpression { .. } => { + write!(out, "NewTargetExpression").expect("failed to dump"); + } + Expression::ObjectExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Expression::OptionalExpression { object, tail, .. } => { + write!(out, "(OptionalExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "object=").expect("failed to dump"); + object.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "tail=").expect("failed to dump"); + tail.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::OptionalChain(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Expression::UnaryExpression { operator, operand, .. } => { + write!(out, "(UnaryExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "operator=").expect("failed to dump"); + operator.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "operand=").expect("failed to dump"); + operand.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::TemplateExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Expression::ThisExpression { .. } => { + write!(out, "ThisExpression").expect("failed to dump"); + } + Expression::UpdateExpression { is_prefix, operator, operand, .. } => { + write!(out, "(UpdateExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "is_prefix=").expect("failed to dump"); + is_prefix.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "operator=").expect("failed to dump"); + operator.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "operand=").expect("failed to dump"); + operand.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::YieldExpression { expression, .. } => { + write!(out, "(YieldExpression").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "expression=").expect("failed to dump"); + expression.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::YieldGeneratorExpression { expression, .. } => { + write!(out, "(YieldGeneratorExpression").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "expression=").expect("failed to dump"); + expression.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::AwaitExpression { expression, .. } => { + write!(out, "(AwaitExpression").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "expression=").expect("failed to dump"); + expression.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + Expression::ImportCallExpression { argument, .. } => { + write!(out, "(ImportCallExpression").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "argument=").expect("failed to dump"); + argument.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + } + } +} + +impl<'alloc> ASTDump for MemberExpression<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + MemberExpression::ComputedMemberExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + MemberExpression::StaticMemberExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + MemberExpression::PrivateFieldExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for OptionalChain<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + OptionalChain::ComputedMemberExpressionTail { expression, .. } => { + write!(out, "(ComputedMemberExpressionTail").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "expression=").expect("failed to dump"); + expression.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + OptionalChain::StaticMemberExpressionTail { property, .. } => { + write!(out, "(StaticMemberExpressionTail").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "property=").expect("failed to dump"); + property.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + OptionalChain::PrivateFieldExpressionTail { field, .. } => { + write!(out, "(PrivateFieldExpressionTail").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "field=").expect("failed to dump"); + field.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + OptionalChain::CallExpressionTail { arguments, .. } => { + write!(out, "(CallExpressionTail").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "arguments=").expect("failed to dump"); + arguments.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + OptionalChain::ComputedMemberExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + OptionalChain::StaticMemberExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + OptionalChain::PrivateFieldExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + OptionalChain::CallExpression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for PropertyName<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + PropertyName::ComputedPropertyName(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + PropertyName::StaticPropertyName(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + PropertyName::StaticNumericPropertyName(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for CallExpression<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(CallExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "callee=").expect("failed to dump"); + self.callee.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "arguments=").expect("failed to dump"); + self.arguments.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ClassElementName<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + ClassElementName::ComputedPropertyName(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ClassElementName::StaticPropertyName(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ClassElementName::StaticNumericPropertyName(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ClassElementName::PrivateFieldName(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for ObjectProperty<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + ObjectProperty::NamedObjectProperty(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ObjectProperty::ShorthandProperty(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ObjectProperty::SpreadProperty(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for NamedObjectProperty<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + NamedObjectProperty::MethodDefinition(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + NamedObjectProperty::DataProperty(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for MethodDefinition<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + MethodDefinition::Method(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + MethodDefinition::Getter(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + MethodDefinition::Setter(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for ImportDeclaration<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + ImportDeclaration::Import(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ImportDeclaration::ImportNamespace(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for ExportDeclaration<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + ExportDeclaration::ExportAllFrom(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ExportDeclaration::ExportFrom(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ExportDeclaration::ExportLocals(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ExportDeclaration::Export(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ExportDeclaration::ExportDefault(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for VariableReference { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + VariableReference::BindingIdentifier(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + VariableReference::AssignmentTargetIdentifier(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for BindingPattern<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + BindingPattern::ObjectBinding(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + BindingPattern::ArrayBinding(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for Binding<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + Binding::BindingPattern(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Binding::BindingIdentifier(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for SimpleAssignmentTarget<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + SimpleAssignmentTarget::AssignmentTargetIdentifier(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + SimpleAssignmentTarget::MemberAssignmentTarget(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for AssignmentTargetPattern<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + AssignmentTargetPattern::ArrayAssignmentTarget(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + AssignmentTargetPattern::ObjectAssignmentTarget(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for AssignmentTarget<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + AssignmentTarget::AssignmentTargetPattern(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + AssignmentTarget::SimpleAssignmentTarget(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for Parameter<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + Parameter::Binding(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Parameter::BindingWithDefault(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for BindingWithDefault<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(BindingWithDefault").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "binding=").expect("failed to dump"); + self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "init=").expect("failed to dump"); + self.init.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for BindingIdentifier { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(BindingIdentifier").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "name=").expect("failed to dump"); + self.name.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for AssignmentTargetIdentifier { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(AssignmentTargetIdentifier").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "name=").expect("failed to dump"); + self.name.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ExpressionOrSuper<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + ExpressionOrSuper::Expression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ExpressionOrSuper::Super { .. } => { + write!(out, "Super").expect("failed to dump"); + } + } + } +} + +impl<'alloc> ASTDump for MemberAssignmentTarget<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + MemberAssignmentTarget::ComputedMemberAssignmentTarget(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + MemberAssignmentTarget::PrivateFieldAssignmentTarget(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + MemberAssignmentTarget::StaticMemberAssignmentTarget(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for ComputedMemberAssignmentTarget<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ComputedMemberAssignmentTarget").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "object=").expect("failed to dump"); + self.object.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "expression=").expect("failed to dump"); + self.expression.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for PrivateFieldAssignmentTarget<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(PrivateFieldAssignmentTarget").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "object=").expect("failed to dump"); + self.object.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "field=").expect("failed to dump"); + self.field.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for StaticMemberAssignmentTarget<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(StaticMemberAssignmentTarget").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "object=").expect("failed to dump"); + self.object.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "property=").expect("failed to dump"); + self.property.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ArrayBinding<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ArrayBinding").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "elements=").expect("failed to dump"); + self.elements.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "rest=").expect("failed to dump"); + self.rest.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ObjectBinding<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ObjectBinding").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "properties=").expect("failed to dump"); + self.properties.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "rest=").expect("failed to dump"); + self.rest.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for BindingProperty<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + BindingProperty::BindingPropertyIdentifier(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + BindingProperty::BindingPropertyProperty(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for BindingPropertyIdentifier<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(BindingPropertyIdentifier").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "binding=").expect("failed to dump"); + self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "init=").expect("failed to dump"); + self.init.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for BindingPropertyProperty<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(BindingPropertyProperty").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "name=").expect("failed to dump"); + self.name.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "binding=").expect("failed to dump"); + self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for AssignmentTargetWithDefault<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(AssignmentTargetWithDefault").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "binding=").expect("failed to dump"); + self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "init=").expect("failed to dump"); + self.init.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for AssignmentTargetMaybeDefault<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + AssignmentTargetMaybeDefault::AssignmentTarget(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + AssignmentTargetMaybeDefault::AssignmentTargetWithDefault(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for ArrayAssignmentTarget<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ArrayAssignmentTarget").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "elements=").expect("failed to dump"); + self.elements.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "rest=").expect("failed to dump"); + self.rest.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ObjectAssignmentTarget<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ObjectAssignmentTarget").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "properties=").expect("failed to dump"); + self.properties.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "rest=").expect("failed to dump"); + self.rest.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for AssignmentTargetProperty<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + AssignmentTargetProperty::AssignmentTargetPropertyIdentifier(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + AssignmentTargetProperty::AssignmentTargetPropertyProperty(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for AssignmentTargetPropertyIdentifier<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(AssignmentTargetPropertyIdentifier").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "binding=").expect("failed to dump"); + self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "init=").expect("failed to dump"); + self.init.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for AssignmentTargetPropertyProperty<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(AssignmentTargetPropertyProperty").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "name=").expect("failed to dump"); + self.name.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "binding=").expect("failed to dump"); + self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ClassExpression<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ClassExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "name=").expect("failed to dump"); + self.name.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "super_=").expect("failed to dump"); + self.super_.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "elements=").expect("failed to dump"); + self.elements.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ClassDeclaration<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ClassDeclaration").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "name=").expect("failed to dump"); + self.name.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "super_=").expect("failed to dump"); + self.super_.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "elements=").expect("failed to dump"); + self.elements.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ClassElement<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + ClassElement::MethodDefinition { is_static, method, .. } => { + write!(out, "(MethodDefinition").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "is_static=").expect("failed to dump"); + is_static.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "method=").expect("failed to dump"); + method.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + ClassElement::FieldDefinition { name, init, .. } => { + write!(out, "(FieldDefinition").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "name=").expect("failed to dump"); + name.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "init=").expect("failed to dump"); + init.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + } + } +} + +impl<'alloc> ASTDump for ModuleItems<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + ModuleItems::ImportDeclaration(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ModuleItems::ExportDeclaration(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ModuleItems::Statement(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for Module<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(Module").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "directives=").expect("failed to dump"); + self.directives.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "items=").expect("failed to dump"); + self.items.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for Import<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(Import").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "module_specifier=").expect("failed to dump"); + self.module_specifier.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "default_binding=").expect("failed to dump"); + self.default_binding.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "named_imports=").expect("failed to dump"); + self.named_imports.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ImportNamespace { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ImportNamespace").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "module_specifier=").expect("failed to dump"); + self.module_specifier.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "default_binding=").expect("failed to dump"); + self.default_binding.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "namespace_binding=").expect("failed to dump"); + self.namespace_binding.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ImportSpecifier { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ImportSpecifier").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "name=").expect("failed to dump"); + self.name.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "binding=").expect("failed to dump"); + self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ExportAllFrom { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ExportAllFrom").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "module_specifier=").expect("failed to dump"); + self.module_specifier.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ExportFrom<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ExportFrom").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "named_exports=").expect("failed to dump"); + self.named_exports.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "module_specifier=").expect("failed to dump"); + self.module_specifier.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ExportLocals<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ExportLocals").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "named_exports=").expect("failed to dump"); + self.named_exports.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for Export<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + Export::FunctionDeclaration(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Export::ClassDeclaration(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + Export::VariableDeclaration(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for ExportDefault<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + ExportDefault::FunctionDeclaration(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ExportDefault::ClassDeclaration(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ExportDefault::Expression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for ExportFromSpecifier { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ExportFromSpecifier").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "name=").expect("failed to dump"); + self.name.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "exported_name=").expect("failed to dump"); + self.exported_name.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ExportLocalSpecifier { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ExportLocalSpecifier").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "name=").expect("failed to dump"); + self.name.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "exported_name=").expect("failed to dump"); + self.exported_name.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for Method<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(Method").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "name=").expect("failed to dump"); + self.name.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "is_async=").expect("failed to dump"); + self.is_async.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "is_generator=").expect("failed to dump"); + self.is_generator.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "params=").expect("failed to dump"); + self.params.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "body=").expect("failed to dump"); + self.body.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for Getter<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(Getter").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "property_name=").expect("failed to dump"); + self.property_name.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "body=").expect("failed to dump"); + self.body.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for Setter<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(Setter").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "property_name=").expect("failed to dump"); + self.property_name.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "param=").expect("failed to dump"); + self.param.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "body=").expect("failed to dump"); + self.body.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for DataProperty<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(DataProperty").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "property_name=").expect("failed to dump"); + self.property_name.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "expression=").expect("failed to dump"); + self.expression.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ShorthandProperty { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ShorthandProperty").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "name=").expect("failed to dump"); + self.name.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ComputedPropertyName<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ComputedPropertyName").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "expression=").expect("failed to dump"); + self.expression.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for StaticPropertyName { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(StaticPropertyName").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "value=").expect("failed to dump"); + self.value.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for NumericLiteral { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(NumericLiteral").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "value=").expect("failed to dump"); + self.value.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ArrayExpressionElement<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + ArrayExpressionElement::SpreadElement(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ArrayExpressionElement::Expression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ArrayExpressionElement::Elision { .. } => { + write!(out, "Elision").expect("failed to dump"); + } + } + } +} + +impl<'alloc> ASTDump for ArrayExpression<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ArrayExpression").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "elements=").expect("failed to dump"); + self.elements.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ArrowExpressionBody<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + ArrowExpressionBody::FunctionBody(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + ArrowExpressionBody::Expression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for ComputedMemberExpression<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ComputedMemberExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "object=").expect("failed to dump"); + self.object.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "expression=").expect("failed to dump"); + self.expression.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for IdentifierExpression { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(IdentifierExpression").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "name=").expect("failed to dump"); + self.name.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for ObjectExpression<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(ObjectExpression").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "properties=").expect("failed to dump"); + self.properties.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for StaticMemberExpression<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(StaticMemberExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "object=").expect("failed to dump"); + self.object.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "property=").expect("failed to dump"); + self.property.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for PrivateFieldExpression<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(PrivateFieldExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "object=").expect("failed to dump"); + self.object.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "field=").expect("failed to dump"); + self.field.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for TemplateExpressionElement<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + TemplateExpressionElement::Expression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + TemplateExpressionElement::TemplateElement(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for TemplateExpression<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(TemplateExpression").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "tag=").expect("failed to dump"); + self.tag.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "elements=").expect("failed to dump"); + self.elements.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for VariableDeclarationOrAssignmentTarget<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + VariableDeclarationOrAssignmentTarget::VariableDeclaration(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + VariableDeclarationOrAssignmentTarget::AssignmentTarget(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for VariableDeclarationOrExpression<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + VariableDeclarationOrExpression::VariableDeclaration(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + VariableDeclarationOrExpression::Expression(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc> ASTDump for Block<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(Block").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "statements=").expect("failed to dump"); + self.statements.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "declarations=").expect("failed to dump"); + self.declarations.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for CatchClause<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(CatchClause").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "binding=").expect("failed to dump"); + self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "body=").expect("failed to dump"); + self.body.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for Directive { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(Directive").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "raw_value=").expect("failed to dump"); + self.raw_value.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for FormalParameters<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(FormalParameters").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "items=").expect("failed to dump"); + self.items.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "rest=").expect("failed to dump"); + self.rest.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for FunctionBody<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(FunctionBody").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "directives=").expect("failed to dump"); + self.directives.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "statements=").expect("failed to dump"); + self.statements.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for Script<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(Script").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "directives=").expect("failed to dump"); + self.directives.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "statements=").expect("failed to dump"); + self.statements.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for SwitchCase<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(SwitchCase").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "test=").expect("failed to dump"); + self.test.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "consequent=").expect("failed to dump"); + self.consequent.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for SwitchDefault<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(SwitchDefault").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "consequent=").expect("failed to dump"); + self.consequent.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for TemplateElement { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(TemplateElement").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "raw_value=").expect("failed to dump"); + self.raw_value.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for VariableDeclaration<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(VariableDeclaration").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "kind=").expect("failed to dump"); + self.kind.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "declarators=").expect("failed to dump"); + self.declarators.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for VariableDeclarator<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + write!(out, "(VariableDeclarator").expect("failed to dump"); + newline(out, depth + 1); + write!(out, "binding=").expect("failed to dump"); + self.binding.dump_with_atoms_at(out, atoms, slices, depth + 1); + newline(out, depth + 1); + write!(out, "init=").expect("failed to dump"); + self.init.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } +} + +impl<'alloc> ASTDump for CoverParenthesized<'alloc> { + fn dump_with_atoms_at<W>(&self, out: &mut W, atoms: &SourceAtomSet, slices: &SourceSliceList, depth: usize) + where W: io::Write + { + match self { + CoverParenthesized::Expression { expression, .. } => { + write!(out, "(Expression").expect("failed to dump"); + write!(out, " ").expect("failed to dump"); + write!(out, "expression=").expect("failed to dump"); + expression.dump_with_atoms_at(out, atoms, slices, depth + 1); + write!(out, ")").expect("failed to dump"); + } + CoverParenthesized::Parameters(ast) => { + ast.dump_with_atoms_at(out, atoms, slices, depth); + } + } + } +} + +impl<'alloc, T> ASTDump for arena::Vec<'alloc, T> +where + T: ASTDump, +{ + fn dump_with_atoms_at<W>( + &self, + out: &mut W, + atoms: &SourceAtomSet, + slices: &SourceSliceList, + depth: usize, + ) + where + W: io::Write, + { + write!(out, "[").expect("failed to dump"); + if self.len() > 0 { + for item in self { + newline(out, depth + 1); + item.dump_with_atoms_at(out, atoms, slices, depth + 1); + } + newline(out, depth); + } + write!(out, "]").expect("failed to dump"); + } +} + +impl<T> ASTDump for Option<T> +where + T: ASTDump, +{ + fn dump_with_atoms_at<W>( + &self, + out: &mut W, + atoms: &SourceAtomSet, + slices: &SourceSliceList, + depth: usize, + ) + where + W: io::Write, + { + match self { + Some(v) => { + v.dump_with_atoms_at(out, atoms, slices, depth); + } + None => { + write!(out, "None").expect("failed to dump"); + } + } + } +} + +impl<'alloc, T> ASTDump for arena::Box<'alloc, T> +where + T: ASTDump, +{ + fn dump_with_atoms_at<W>( + &self, + out: &mut W, + atoms: &SourceAtomSet, + slices: &SourceSliceList, + depth: usize, + ) + where + W: io::Write, + { + self.deref().dump_with_atoms_at(out, atoms, slices, depth); + } +} + +impl ASTDump for bool { + fn dump_with_atoms_at<W>( + &self, + out: &mut W, + atoms: &SourceAtomSet, + slices: &SourceSliceList, + depth: usize, + ) + where + W: io::Write, + { + if *self { + write!(out, "true").expect("failed to dump"); + } else { + write!(out, "false").expect("failed to dump"); + } + } +} + +impl ASTDump for SourceAtomSetIndex { + fn dump_with_atoms_at<W>( + &self, + out: &mut W, + atoms: &SourceAtomSet, + slices: &SourceSliceList, + depth: usize, + ) + where + W: io::Write, + { + write!(out, "{:?}", atoms.get(self.clone())) + .expect("failed to dump"); + } +} + +impl ASTDump for SourceSliceIndex { + fn dump_with_atoms_at<W>( + &self, + out: &mut W, + atoms: &SourceAtomSet, + slices: &SourceSliceList, + depth: usize, + ) + where + W: io::Write, + { + write!(out, "{:?}", slices.get(self.clone())) + .expect("failed to dump"); + } +} + +impl ASTDump for f64 { + fn dump_with_atoms_at<W>( + &self, + out: &mut W, + atoms: &SourceAtomSet, + slices: &SourceSliceList, + depth: usize, + ) + where + W: io::Write, + { + write!(out, "{}", self).expect("failed to dump"); + } +} diff --git a/third_party/rust/jsparagus-ast/src/lib.rs b/third_party/rust/jsparagus-ast/src/lib.rs new file mode 100644 index 0000000000..3250d73508 --- /dev/null +++ b/third_party/rust/jsparagus-ast/src/lib.rs @@ -0,0 +1,30 @@ +//! The Visage AST (abstract syntax tree). + +pub mod arena; +pub mod associated_data; +pub mod source_atom_set; +pub mod source_location; +pub mod source_slice_list; + +mod source_location_accessor_generated; +pub mod source_location_accessor { + pub use crate::source_location_accessor_generated::*; +} +mod types_generated; +pub mod types { + pub use crate::types_generated::*; +} +mod visit_generated; +pub mod visit { + pub use crate::visit_generated::*; +} +mod type_id_generated; +pub mod type_id { + pub use crate::type_id_generated::*; +} +mod dump_generated; +pub mod dump { + pub use crate::dump_generated::*; +} + +pub use source_location::SourceLocation; diff --git a/third_party/rust/jsparagus-ast/src/source_atom_set.rs b/third_party/rust/jsparagus-ast/src/source_atom_set.rs new file mode 100644 index 0000000000..25369c9777 --- /dev/null +++ b/third_party/rust/jsparagus-ast/src/source_atom_set.rs @@ -0,0 +1,221 @@ +use indexmap::set::IndexSet; + +/// Index into SourceAtomSet.atoms. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub struct SourceAtomSetIndex { + index: usize, +} +impl SourceAtomSetIndex { + fn new(index: usize) -> Self { + Self { index } + } +} + +impl From<SourceAtomSetIndex> for usize { + fn from(index: SourceAtomSetIndex) -> usize { + index.index + } +} + +// Call $handler macro with the list of common atoms. +// +// Basic Usage: +// +// ``` +// for_all_common_atoms!(test); +// ``` +// +// is expanded to +// +// ``` +// test!( +// ("arguments", arguments, Arguments), +// ("async", async_, Async), +// ... +// ); +// ``` +// +// Extra Parameters: +// +// ``` +// for_all_common_atoms!(test, foo, bar); +// ``` +// +// is expanded to +// +// ``` +// test!( +// foo, bar, +// ("arguments", arguments, Arguments), +// ("async", async_, Async), +// ... +// ); +// ``` +macro_rules! for_all_common_atoms { + ($handler:ident $(, $($params:tt)*)?) => { + // string representation, method name, enum variant + $handler!( + $($($params)*,)? + ("arguments", arguments, Arguments), + ("as", as_, As), + ("async", async_, Async), + ("await", await_, Await), + ("break", break_, Break), + ("case", case, Case), + ("catch", catch, Catch), + ("class", class, Class), + ("const", const_, Const), + ("continue", continue_, Continue), + ("debugger", debugger, Debugger), + ("default", default, Default), + ("delete", delete, Delete), + ("do", do_, Do), + ("else", else_, Else), + ("enum", enum_, Enum), + ("eval", eval, Eval), + ("export", export, Export), + ("extends", extends, Extends), + ("false", false_, False), + ("finally", finally, Finally), + ("for", for_, For), + ("from", from, From), + ("function", function, Function), + ("get", get, Get), + ("if", if_, If), + ("implements", implements, Implements), + ("import", import, Import), + ("in", in_, In), + ("instanceof", instanceof, Instanceof), + ("interface", interface, Interface), + ("let", let_, Let), + ("new", new_, New), + ("null", null, Null), + ("of", of, Of), + ("package", package, Package), + ("private", private, Private), + ("protected", protected, Protected), + ("public", public, Public), + ("return", return_, Return), + ("set", set, Set), + ("static", static_, Static), + ("super", super_, Super), + ("switch", switch, Switch), + ("target", target, Target), + ("this", this, This), + ("throw", throw, Throw), + ("true", true_, True), + ("try", try_, Try), + ("typeof", typeof_, Typeof), + ("var", var, Var), + ("void", void, Void), + ("while", while_, While), + ("with", with, With), + ("yield", yield_, Yield), + ("use strict", use_strict, UseStrict), + ("__proto__", __proto__, Proto), + ); + } +} + +// Define CommonAtoms enum, with +// +// enum CommonAtoms { +// Arguments = 0, +// Async, +// ... +// } +macro_rules! define_enum { + (($s0:tt, $method0:ident, $variant0:ident), + $(($s:tt, $method:ident, $variant:ident),)*) => { + enum CommonAtoms { + $variant0 = 0, + $($variant,)* + } + }; +} +for_all_common_atoms!(define_enum); + +// Define CommonSourceAtomSetIndices struct. +// +// impl CommonSourceAtomSetIndices { +// pub fn arguments() -> SourceAtomSetIndex { ... } +// pub fn async_() -> SourceAtomSetIndex { ... } +// ... +// } +macro_rules! define_struct { + ($(($s:tt, $method:ident, $variant:ident),)*) => { + #[derive(Debug)] + pub struct CommonSourceAtomSetIndices {} + + impl CommonSourceAtomSetIndices { + $( + pub fn $method() -> SourceAtomSetIndex { + SourceAtomSetIndex::new(CommonAtoms::$variant as usize) + } + )* + } + }; +} +for_all_common_atoms!(define_struct); + +/// Set of atoms, including the following: +/// +/// * atoms referred from bytecode +/// * variable names referred from scope data +/// +/// WARNING: This set itself does *NOT* map to JSScript::atoms(). +#[derive(Debug)] +pub struct SourceAtomSet<'alloc> { + atoms: IndexSet<&'alloc str>, +} + +impl<'alloc> SourceAtomSet<'alloc> { + // Create a set, with all common atoms inserted. + pub fn new() -> Self { + let mut result = Self { + atoms: IndexSet::new(), + }; + result.insert_common_atoms(); + result + } + + // Insert all common atoms. + fn insert_common_atoms(&mut self) { + macro_rules! insert_atom { + ($self: ident, + $(($s:tt, $method:ident, $variant:ident),)*) => { + $( + $self.atoms.insert($s); + )* + }; + } + for_all_common_atoms!(insert_atom, self); + } + + // Create a set, without any common atoms. + // + // This is for moving `SourceAtomSet` out of `Rc<RefCell>`, by replacing + // it with the result of this method. + pub fn new_uninitialized() -> Self { + Self { + // 256 is a number which should cover 75% of scripts without + // reallocation. + atoms: IndexSet::with_capacity(256), + } + } + + pub fn insert(&mut self, s: &'alloc str) -> SourceAtomSetIndex { + let (index, _) = self.atoms.insert_full(s); + SourceAtomSetIndex::new(index) + } + + pub fn get(&self, index: SourceAtomSetIndex) -> &'alloc str { + self.atoms.get_index(usize::from(index)).unwrap() + } +} + +impl<'alloc> From<SourceAtomSet<'alloc>> for Vec<&'alloc str> { + fn from(set: SourceAtomSet<'alloc>) -> Vec<&'alloc str> { + set.atoms.into_iter().collect() + } +} diff --git a/third_party/rust/jsparagus-ast/src/source_location.rs b/third_party/rust/jsparagus-ast/src/source_location.rs new file mode 100644 index 0000000000..2219fa451e --- /dev/null +++ b/third_party/rust/jsparagus-ast/src/source_location.rs @@ -0,0 +1,32 @@ +#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] +pub struct SourceLocation { + pub start: usize, + pub end: usize, +} + +impl SourceLocation { + pub fn new(start: usize, end: usize) -> Self { + debug_assert!(start <= end); + + Self { start, end } + } + + pub fn from_parts(start: SourceLocation, end: SourceLocation) -> Self { + debug_assert!(start.start <= end.end); + + Self { + start: start.start, + end: end.end, + } + } + + pub fn set_range(&mut self, start: SourceLocation, end: SourceLocation) { + debug_assert!(start.start <= end.end); + self.start = start.start; + self.end = end.end; + } + + pub fn default() -> Self { + Self { start: 0, end: 0 } + } +} diff --git a/third_party/rust/jsparagus-ast/src/source_location_accessor_generated.rs b/third_party/rust/jsparagus-ast/src/source_location_accessor_generated.rs new file mode 100644 index 0000000000..aec1f962a0 --- /dev/null +++ b/third_party/rust/jsparagus-ast/src/source_location_accessor_generated.rs @@ -0,0 +1,2047 @@ +// WARNING: This file is auto-generated by crates/ast/generate_ast.py. + +use crate::SourceLocation; +use crate::arena; +use crate::types::*; +use std::borrow::{Borrow, BorrowMut}; + +pub trait SourceLocationAccessor { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation); + fn get_loc(&self) -> SourceLocation; +} +impl<'alloc> SourceLocationAccessor for Argument<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + Argument::SpreadElement(content) => { content.set_loc(start, end) } + Argument::Expression(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + Argument::SpreadElement(content) => { content.get_loc() } + Argument::Expression(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for Arguments<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ArrayAssignmentTarget<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ArrayBinding<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ArrayExpression<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ArrayExpressionElement<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + ArrayExpressionElement::SpreadElement(content) => { content.set_loc(start, end) } + ArrayExpressionElement::Expression(content) => { content.set_loc(start, end) } + ArrayExpressionElement::Elision { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + ArrayExpressionElement::SpreadElement(content) => { content.get_loc() } + ArrayExpressionElement::Expression(content) => { content.get_loc() } + ArrayExpressionElement::Elision { loc } => { + *loc + } + } + } +} + +impl<'alloc> SourceLocationAccessor for ArrowExpressionBody<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + ArrowExpressionBody::FunctionBody(content) => { content.set_loc(start, end) } + ArrowExpressionBody::Expression(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + ArrowExpressionBody::FunctionBody(content) => { content.get_loc() } + ArrowExpressionBody::Expression(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for AssignmentTarget<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + AssignmentTarget::AssignmentTargetPattern(content) => { content.set_loc(start, end) } + AssignmentTarget::SimpleAssignmentTarget(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + AssignmentTarget::AssignmentTargetPattern(content) => { content.get_loc() } + AssignmentTarget::SimpleAssignmentTarget(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for AssignmentTargetIdentifier { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for AssignmentTargetMaybeDefault<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + AssignmentTargetMaybeDefault::AssignmentTarget(content) => { content.set_loc(start, end) } + AssignmentTargetMaybeDefault::AssignmentTargetWithDefault(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + AssignmentTargetMaybeDefault::AssignmentTarget(content) => { content.get_loc() } + AssignmentTargetMaybeDefault::AssignmentTargetWithDefault(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for AssignmentTargetPattern<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + AssignmentTargetPattern::ArrayAssignmentTarget(content) => { content.set_loc(start, end) } + AssignmentTargetPattern::ObjectAssignmentTarget(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + AssignmentTargetPattern::ArrayAssignmentTarget(content) => { content.get_loc() } + AssignmentTargetPattern::ObjectAssignmentTarget(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for AssignmentTargetProperty<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + AssignmentTargetProperty::AssignmentTargetPropertyIdentifier(content) => { content.set_loc(start, end) } + AssignmentTargetProperty::AssignmentTargetPropertyProperty(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + AssignmentTargetProperty::AssignmentTargetPropertyIdentifier(content) => { content.get_loc() } + AssignmentTargetProperty::AssignmentTargetPropertyProperty(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for AssignmentTargetPropertyIdentifier<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for AssignmentTargetPropertyProperty<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for AssignmentTargetWithDefault<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for BinaryOperator { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + BinaryOperator::Equals { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::NotEquals { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::StrictEquals { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::StrictNotEquals { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::LessThan { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::LessThanOrEqual { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::GreaterThan { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::GreaterThanOrEqual { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::In { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::Instanceof { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::LeftShift { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::RightShift { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::RightShiftExt { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::Add { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::Sub { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::Mul { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::Div { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::Mod { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::Pow { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::Comma { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::Coalesce { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::LogicalOr { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::LogicalAnd { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::BitwiseOr { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::BitwiseXor { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + BinaryOperator::BitwiseAnd { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + BinaryOperator::Equals { loc } => { + *loc + } + BinaryOperator::NotEquals { loc } => { + *loc + } + BinaryOperator::StrictEquals { loc } => { + *loc + } + BinaryOperator::StrictNotEquals { loc } => { + *loc + } + BinaryOperator::LessThan { loc } => { + *loc + } + BinaryOperator::LessThanOrEqual { loc } => { + *loc + } + BinaryOperator::GreaterThan { loc } => { + *loc + } + BinaryOperator::GreaterThanOrEqual { loc } => { + *loc + } + BinaryOperator::In { loc } => { + *loc + } + BinaryOperator::Instanceof { loc } => { + *loc + } + BinaryOperator::LeftShift { loc } => { + *loc + } + BinaryOperator::RightShift { loc } => { + *loc + } + BinaryOperator::RightShiftExt { loc } => { + *loc + } + BinaryOperator::Add { loc } => { + *loc + } + BinaryOperator::Sub { loc } => { + *loc + } + BinaryOperator::Mul { loc } => { + *loc + } + BinaryOperator::Div { loc } => { + *loc + } + BinaryOperator::Mod { loc } => { + *loc + } + BinaryOperator::Pow { loc } => { + *loc + } + BinaryOperator::Comma { loc } => { + *loc + } + BinaryOperator::Coalesce { loc } => { + *loc + } + BinaryOperator::LogicalOr { loc } => { + *loc + } + BinaryOperator::LogicalAnd { loc } => { + *loc + } + BinaryOperator::BitwiseOr { loc } => { + *loc + } + BinaryOperator::BitwiseXor { loc } => { + *loc + } + BinaryOperator::BitwiseAnd { loc } => { + *loc + } + } + } +} + +impl<'alloc> SourceLocationAccessor for Binding<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + Binding::BindingPattern(content) => { content.set_loc(start, end) } + Binding::BindingIdentifier(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + Binding::BindingPattern(content) => { content.get_loc() } + Binding::BindingIdentifier(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for BindingIdentifier { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for BindingPattern<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + BindingPattern::ObjectBinding(content) => { content.set_loc(start, end) } + BindingPattern::ArrayBinding(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + BindingPattern::ObjectBinding(content) => { content.get_loc() } + BindingPattern::ArrayBinding(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for BindingProperty<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + BindingProperty::BindingPropertyIdentifier(content) => { content.set_loc(start, end) } + BindingProperty::BindingPropertyProperty(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + BindingProperty::BindingPropertyIdentifier(content) => { content.get_loc() } + BindingProperty::BindingPropertyProperty(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for BindingPropertyIdentifier<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for BindingPropertyProperty<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for BindingWithDefault<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for Block<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for CallExpression<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for CatchClause<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ClassDeclaration<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ClassElement<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + ClassElement::MethodDefinition { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + ClassElement::FieldDefinition { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + ClassElement::MethodDefinition { loc, .. } => { + *loc + } + ClassElement::FieldDefinition { loc, .. } => { + *loc + } + } + } +} + +impl<'alloc> SourceLocationAccessor for ClassElementName<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + ClassElementName::ComputedPropertyName(content) => { content.set_loc(start, end) } + ClassElementName::StaticPropertyName(content) => { content.set_loc(start, end) } + ClassElementName::StaticNumericPropertyName(content) => { content.set_loc(start, end) } + ClassElementName::PrivateFieldName(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + ClassElementName::ComputedPropertyName(content) => { content.get_loc() } + ClassElementName::StaticPropertyName(content) => { content.get_loc() } + ClassElementName::StaticNumericPropertyName(content) => { content.get_loc() } + ClassElementName::PrivateFieldName(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for ClassExpression<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for CompoundAssignmentOperator { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + CompoundAssignmentOperator::LogicalOr { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + CompoundAssignmentOperator::LogicalAnd { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + CompoundAssignmentOperator::Coalesce { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + CompoundAssignmentOperator::Add { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + CompoundAssignmentOperator::Sub { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + CompoundAssignmentOperator::Mul { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + CompoundAssignmentOperator::Div { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + CompoundAssignmentOperator::Mod { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + CompoundAssignmentOperator::Pow { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + CompoundAssignmentOperator::LeftShift { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + CompoundAssignmentOperator::RightShift { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + CompoundAssignmentOperator::RightShiftExt { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + CompoundAssignmentOperator::Or { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + CompoundAssignmentOperator::Xor { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + CompoundAssignmentOperator::And { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + CompoundAssignmentOperator::LogicalOr { loc } => { + *loc + } + CompoundAssignmentOperator::LogicalAnd { loc } => { + *loc + } + CompoundAssignmentOperator::Coalesce { loc } => { + *loc + } + CompoundAssignmentOperator::Add { loc } => { + *loc + } + CompoundAssignmentOperator::Sub { loc } => { + *loc + } + CompoundAssignmentOperator::Mul { loc } => { + *loc + } + CompoundAssignmentOperator::Div { loc } => { + *loc + } + CompoundAssignmentOperator::Mod { loc } => { + *loc + } + CompoundAssignmentOperator::Pow { loc } => { + *loc + } + CompoundAssignmentOperator::LeftShift { loc } => { + *loc + } + CompoundAssignmentOperator::RightShift { loc } => { + *loc + } + CompoundAssignmentOperator::RightShiftExt { loc } => { + *loc + } + CompoundAssignmentOperator::Or { loc } => { + *loc + } + CompoundAssignmentOperator::Xor { loc } => { + *loc + } + CompoundAssignmentOperator::And { loc } => { + *loc + } + } + } +} + +impl<'alloc> SourceLocationAccessor for ComputedMemberAssignmentTarget<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ComputedMemberExpression<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ComputedPropertyName<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for CoverParenthesized<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + CoverParenthesized::Expression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + CoverParenthesized::Parameters(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + CoverParenthesized::Expression { loc, .. } => { + *loc + } + CoverParenthesized::Parameters(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for DataProperty<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for Directive { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for Export<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + Export::FunctionDeclaration(content) => { content.set_loc(start, end) } + Export::ClassDeclaration(content) => { content.set_loc(start, end) } + Export::VariableDeclaration(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + Export::FunctionDeclaration(content) => { content.get_loc() } + Export::ClassDeclaration(content) => { content.get_loc() } + Export::VariableDeclaration(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for ExportAllFrom { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ExportDeclaration<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + ExportDeclaration::ExportAllFrom(content) => { content.set_loc(start, end) } + ExportDeclaration::ExportFrom(content) => { content.set_loc(start, end) } + ExportDeclaration::ExportLocals(content) => { content.set_loc(start, end) } + ExportDeclaration::Export(content) => { content.set_loc(start, end) } + ExportDeclaration::ExportDefault(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + ExportDeclaration::ExportAllFrom(content) => { content.get_loc() } + ExportDeclaration::ExportFrom(content) => { content.get_loc() } + ExportDeclaration::ExportLocals(content) => { content.get_loc() } + ExportDeclaration::Export(content) => { content.get_loc() } + ExportDeclaration::ExportDefault(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for ExportDefault<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + ExportDefault::FunctionDeclaration(content) => { content.set_loc(start, end) } + ExportDefault::ClassDeclaration(content) => { content.set_loc(start, end) } + ExportDefault::Expression(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + ExportDefault::FunctionDeclaration(content) => { content.get_loc() } + ExportDefault::ClassDeclaration(content) => { content.get_loc() } + ExportDefault::Expression(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for ExportFrom<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ExportFromSpecifier { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ExportLocalSpecifier { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ExportLocals<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for Expression<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + Expression::MemberExpression(content) => { content.set_loc(start, end) } + Expression::ClassExpression(content) => { content.set_loc(start, end) } + Expression::LiteralBooleanExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::LiteralInfinityExpression { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::LiteralNullExpression { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::LiteralNumericExpression(content) => { content.set_loc(start, end) } + Expression::LiteralRegExpExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::LiteralStringExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::ArrayExpression(content) => { content.set_loc(start, end) } + Expression::ArrowExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::AssignmentExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::BinaryExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::CallExpression(content) => { content.set_loc(start, end) } + Expression::CompoundAssignmentExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::ConditionalExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::FunctionExpression(content) => { content.set_loc(start, end) } + Expression::IdentifierExpression(content) => { content.set_loc(start, end) } + Expression::NewExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::NewTargetExpression { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::ObjectExpression(content) => { content.set_loc(start, end) } + Expression::OptionalExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::OptionalChain(content) => { content.set_loc(start, end) } + Expression::UnaryExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::TemplateExpression(content) => { content.set_loc(start, end) } + Expression::ThisExpression { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::UpdateExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::YieldExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::YieldGeneratorExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::AwaitExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Expression::ImportCallExpression { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + Expression::MemberExpression(content) => { content.get_loc() } + Expression::ClassExpression(content) => { content.get_loc() } + Expression::LiteralBooleanExpression { loc, .. } => { + *loc + } + Expression::LiteralInfinityExpression { loc } => { + *loc + } + Expression::LiteralNullExpression { loc } => { + *loc + } + Expression::LiteralNumericExpression(content) => { content.get_loc() } + Expression::LiteralRegExpExpression { loc, .. } => { + *loc + } + Expression::LiteralStringExpression { loc, .. } => { + *loc + } + Expression::ArrayExpression(content) => { content.get_loc() } + Expression::ArrowExpression { loc, .. } => { + *loc + } + Expression::AssignmentExpression { loc, .. } => { + *loc + } + Expression::BinaryExpression { loc, .. } => { + *loc + } + Expression::CallExpression(content) => { content.get_loc() } + Expression::CompoundAssignmentExpression { loc, .. } => { + *loc + } + Expression::ConditionalExpression { loc, .. } => { + *loc + } + Expression::FunctionExpression(content) => { content.get_loc() } + Expression::IdentifierExpression(content) => { content.get_loc() } + Expression::NewExpression { loc, .. } => { + *loc + } + Expression::NewTargetExpression { loc } => { + *loc + } + Expression::ObjectExpression(content) => { content.get_loc() } + Expression::OptionalExpression { loc, .. } => { + *loc + } + Expression::OptionalChain(content) => { content.get_loc() } + Expression::UnaryExpression { loc, .. } => { + *loc + } + Expression::TemplateExpression(content) => { content.get_loc() } + Expression::ThisExpression { loc } => { + *loc + } + Expression::UpdateExpression { loc, .. } => { + *loc + } + Expression::YieldExpression { loc, .. } => { + *loc + } + Expression::YieldGeneratorExpression { loc, .. } => { + *loc + } + Expression::AwaitExpression { loc, .. } => { + *loc + } + Expression::ImportCallExpression { loc, .. } => { + *loc + } + } + } +} + +impl<'alloc> SourceLocationAccessor for ExpressionOrSuper<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + ExpressionOrSuper::Expression(content) => { content.set_loc(start, end) } + ExpressionOrSuper::Super { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + ExpressionOrSuper::Expression(content) => { content.get_loc() } + ExpressionOrSuper::Super { loc } => { + *loc + } + } + } +} + +impl<'alloc> SourceLocationAccessor for FormalParameters<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for Function<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for FunctionBody<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for Getter<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for Identifier { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for IdentifierExpression { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for IdentifierName { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for IfStatement<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for Import<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ImportDeclaration<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + ImportDeclaration::Import(content) => { content.set_loc(start, end) } + ImportDeclaration::ImportNamespace(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + ImportDeclaration::Import(content) => { content.get_loc() } + ImportDeclaration::ImportNamespace(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for ImportNamespace { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ImportSpecifier { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for Label { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for MemberAssignmentTarget<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + MemberAssignmentTarget::ComputedMemberAssignmentTarget(content) => { content.set_loc(start, end) } + MemberAssignmentTarget::PrivateFieldAssignmentTarget(content) => { content.set_loc(start, end) } + MemberAssignmentTarget::StaticMemberAssignmentTarget(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + MemberAssignmentTarget::ComputedMemberAssignmentTarget(content) => { content.get_loc() } + MemberAssignmentTarget::PrivateFieldAssignmentTarget(content) => { content.get_loc() } + MemberAssignmentTarget::StaticMemberAssignmentTarget(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for MemberExpression<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + MemberExpression::ComputedMemberExpression(content) => { content.set_loc(start, end) } + MemberExpression::StaticMemberExpression(content) => { content.set_loc(start, end) } + MemberExpression::PrivateFieldExpression(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + MemberExpression::ComputedMemberExpression(content) => { content.get_loc() } + MemberExpression::StaticMemberExpression(content) => { content.get_loc() } + MemberExpression::PrivateFieldExpression(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for Method<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for MethodDefinition<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + MethodDefinition::Method(content) => { content.set_loc(start, end) } + MethodDefinition::Getter(content) => { content.set_loc(start, end) } + MethodDefinition::Setter(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + MethodDefinition::Method(content) => { content.get_loc() } + MethodDefinition::Getter(content) => { content.get_loc() } + MethodDefinition::Setter(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for Module<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ModuleItems<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + ModuleItems::ImportDeclaration(content) => { content.set_loc(start, end) } + ModuleItems::ExportDeclaration(content) => { content.set_loc(start, end) } + ModuleItems::Statement(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + ModuleItems::ImportDeclaration(content) => { content.get_loc() } + ModuleItems::ExportDeclaration(content) => { content.get_loc() } + ModuleItems::Statement(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for NamedObjectProperty<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + NamedObjectProperty::MethodDefinition(content) => { content.set_loc(start, end) } + NamedObjectProperty::DataProperty(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + NamedObjectProperty::MethodDefinition(content) => { content.get_loc() } + NamedObjectProperty::DataProperty(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for NumericLiteral { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ObjectAssignmentTarget<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ObjectBinding<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ObjectExpression<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ObjectProperty<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + ObjectProperty::NamedObjectProperty(content) => { content.set_loc(start, end) } + ObjectProperty::ShorthandProperty(content) => { content.set_loc(start, end) } + ObjectProperty::SpreadProperty(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + ObjectProperty::NamedObjectProperty(content) => { content.get_loc() } + ObjectProperty::ShorthandProperty(content) => { content.get_loc() } + ObjectProperty::SpreadProperty(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for OptionalChain<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + OptionalChain::ComputedMemberExpressionTail { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + OptionalChain::StaticMemberExpressionTail { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + OptionalChain::PrivateFieldExpressionTail { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + OptionalChain::CallExpressionTail { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + OptionalChain::ComputedMemberExpression(content) => { content.set_loc(start, end) } + OptionalChain::StaticMemberExpression(content) => { content.set_loc(start, end) } + OptionalChain::PrivateFieldExpression(content) => { content.set_loc(start, end) } + OptionalChain::CallExpression(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + OptionalChain::ComputedMemberExpressionTail { loc, .. } => { + *loc + } + OptionalChain::StaticMemberExpressionTail { loc, .. } => { + *loc + } + OptionalChain::PrivateFieldExpressionTail { loc, .. } => { + *loc + } + OptionalChain::CallExpressionTail { loc, .. } => { + *loc + } + OptionalChain::ComputedMemberExpression(content) => { content.get_loc() } + OptionalChain::StaticMemberExpression(content) => { content.get_loc() } + OptionalChain::PrivateFieldExpression(content) => { content.get_loc() } + OptionalChain::CallExpression(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for Parameter<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + Parameter::Binding(content) => { content.set_loc(start, end) } + Parameter::BindingWithDefault(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + Parameter::Binding(content) => { content.get_loc() } + Parameter::BindingWithDefault(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for PrivateFieldAssignmentTarget<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for PrivateFieldExpression<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for PrivateIdentifier { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for Program<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + Program::Module(content) => { content.set_loc(start, end) } + Program::Script(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + Program::Module(content) => { content.get_loc() } + Program::Script(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for PropertyName<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + PropertyName::ComputedPropertyName(content) => { content.set_loc(start, end) } + PropertyName::StaticPropertyName(content) => { content.set_loc(start, end) } + PropertyName::StaticNumericPropertyName(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + PropertyName::ComputedPropertyName(content) => { content.get_loc() } + PropertyName::StaticPropertyName(content) => { content.get_loc() } + PropertyName::StaticNumericPropertyName(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for Script<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for Setter<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for ShorthandProperty { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for SimpleAssignmentTarget<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + SimpleAssignmentTarget::AssignmentTargetIdentifier(content) => { content.set_loc(start, end) } + SimpleAssignmentTarget::MemberAssignmentTarget(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + SimpleAssignmentTarget::AssignmentTargetIdentifier(content) => { content.get_loc() } + SimpleAssignmentTarget::MemberAssignmentTarget(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for Statement<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + Statement::BlockStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::BreakStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::ContinueStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::DebuggerStatement { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::DoWhileStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::EmptyStatement { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::ExpressionStatement(content) => { content.set_loc(start, end) } + Statement::ForInStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::ForOfStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::ForStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::IfStatement(content) => { content.set_loc(start, end) } + Statement::LabelledStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::ReturnStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::SwitchStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::SwitchStatementWithDefault { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::ThrowStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::TryCatchStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::TryFinallyStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::WhileStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::WithStatement { mut loc, .. } => { + loc.start = start.start; + loc.end = end.end; + } + Statement::VariableDeclarationStatement(content) => { content.set_loc(start, end) } + Statement::FunctionDeclaration(content) => { content.set_loc(start, end) } + Statement::ClassDeclaration(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + Statement::BlockStatement { loc, .. } => { + *loc + } + Statement::BreakStatement { loc, .. } => { + *loc + } + Statement::ContinueStatement { loc, .. } => { + *loc + } + Statement::DebuggerStatement { loc } => { + *loc + } + Statement::DoWhileStatement { loc, .. } => { + *loc + } + Statement::EmptyStatement { loc } => { + *loc + } + Statement::ExpressionStatement(content) => { content.get_loc() } + Statement::ForInStatement { loc, .. } => { + *loc + } + Statement::ForOfStatement { loc, .. } => { + *loc + } + Statement::ForStatement { loc, .. } => { + *loc + } + Statement::IfStatement(content) => { content.get_loc() } + Statement::LabelledStatement { loc, .. } => { + *loc + } + Statement::ReturnStatement { loc, .. } => { + *loc + } + Statement::SwitchStatement { loc, .. } => { + *loc + } + Statement::SwitchStatementWithDefault { loc, .. } => { + *loc + } + Statement::ThrowStatement { loc, .. } => { + *loc + } + Statement::TryCatchStatement { loc, .. } => { + *loc + } + Statement::TryFinallyStatement { loc, .. } => { + *loc + } + Statement::WhileStatement { loc, .. } => { + *loc + } + Statement::WithStatement { loc, .. } => { + *loc + } + Statement::VariableDeclarationStatement(content) => { content.get_loc() } + Statement::FunctionDeclaration(content) => { content.get_loc() } + Statement::ClassDeclaration(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for StaticMemberAssignmentTarget<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for StaticMemberExpression<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for StaticPropertyName { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for SwitchCase<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for SwitchDefault<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for TemplateElement { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for TemplateExpression<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for TemplateExpressionElement<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + TemplateExpressionElement::Expression(content) => { content.set_loc(start, end) } + TemplateExpressionElement::TemplateElement(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + TemplateExpressionElement::Expression(content) => { content.get_loc() } + TemplateExpressionElement::TemplateElement(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for UnaryOperator { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + UnaryOperator::Plus { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + UnaryOperator::Minus { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + UnaryOperator::LogicalNot { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + UnaryOperator::BitwiseNot { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + UnaryOperator::Typeof { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + UnaryOperator::Void { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + UnaryOperator::Delete { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + UnaryOperator::Plus { loc } => { + *loc + } + UnaryOperator::Minus { loc } => { + *loc + } + UnaryOperator::LogicalNot { loc } => { + *loc + } + UnaryOperator::BitwiseNot { loc } => { + *loc + } + UnaryOperator::Typeof { loc } => { + *loc + } + UnaryOperator::Void { loc } => { + *loc + } + UnaryOperator::Delete { loc } => { + *loc + } + } + } +} + +impl<'alloc> SourceLocationAccessor for UpdateOperator { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + UpdateOperator::Increment { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + UpdateOperator::Decrement { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + UpdateOperator::Increment { loc } => { + *loc + } + UpdateOperator::Decrement { loc } => { + *loc + } + } + } +} + +impl<'alloc> SourceLocationAccessor for VariableDeclaration<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for VariableDeclarationKind { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + VariableDeclarationKind::Var { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + VariableDeclarationKind::Let { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + VariableDeclarationKind::Const { mut loc } => { + loc.start = start.start; + loc.end = end.end; + } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + VariableDeclarationKind::Var { loc } => { + *loc + } + VariableDeclarationKind::Let { loc } => { + *loc + } + VariableDeclarationKind::Const { loc } => { + *loc + } + } + } +} + +impl<'alloc> SourceLocationAccessor for VariableDeclarationOrAssignmentTarget<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + VariableDeclarationOrAssignmentTarget::VariableDeclaration(content) => { content.set_loc(start, end) } + VariableDeclarationOrAssignmentTarget::AssignmentTarget(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + VariableDeclarationOrAssignmentTarget::VariableDeclaration(content) => { content.get_loc() } + VariableDeclarationOrAssignmentTarget::AssignmentTarget(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for VariableDeclarationOrExpression<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + VariableDeclarationOrExpression::VariableDeclaration(content) => { content.set_loc(start, end) } + VariableDeclarationOrExpression::Expression(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + VariableDeclarationOrExpression::VariableDeclaration(content) => { content.get_loc() } + VariableDeclarationOrExpression::Expression(content) => { content.get_loc() } + } + } +} + +impl<'alloc> SourceLocationAccessor for VariableDeclarator<'alloc> { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + self.loc.start = start.start; + self.loc.end = end.end; + } + + fn get_loc(&self) -> SourceLocation { + self.loc + } +} + +impl<'alloc> SourceLocationAccessor for VariableReference { + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + match self { + VariableReference::BindingIdentifier(content) => { content.set_loc(start, end) } + VariableReference::AssignmentTargetIdentifier(content) => { content.set_loc(start, end) } + } + } + + fn get_loc(&self) -> SourceLocation { + match self { + VariableReference::BindingIdentifier(content) => { content.get_loc() } + VariableReference::AssignmentTargetIdentifier(content) => { content.get_loc() } + } + } +} + +impl<'alloc, T> SourceLocationAccessor for arena::Box<'alloc, T> +where + T: SourceLocationAccessor, +{ + fn set_loc(&mut self, start: SourceLocation, end: SourceLocation) { + (self.borrow_mut() as &mut T).set_loc(start, end) + } + + fn get_loc(&self) -> SourceLocation { + (self.borrow() as &T).get_loc() + } +} diff --git a/third_party/rust/jsparagus-ast/src/source_slice_list.rs b/third_party/rust/jsparagus-ast/src/source_slice_list.rs new file mode 100644 index 0000000000..c7005b3601 --- /dev/null +++ b/third_party/rust/jsparagus-ast/src/source_slice_list.rs @@ -0,0 +1,49 @@ +/// Index into SourceSliceList.items. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub struct SourceSliceIndex { + index: usize, +} +impl SourceSliceIndex { + fn new(index: usize) -> Self { + Self { index } + } +} + +impl From<SourceSliceIndex> for usize { + fn from(index: SourceSliceIndex) -> usize { + index.index + } +} + +/// Set of slices inside source, including the following: +/// +/// * RegExp source +/// * BigInt literal +/// +/// Compared to `SourceAtomSet`, this is not atomized. +#[derive(Debug)] +pub struct SourceSliceList<'alloc> { + items: Vec<&'alloc str>, +} + +impl<'alloc> SourceSliceList<'alloc> { + pub fn new() -> Self { + Self { items: Vec::new() } + } + + pub fn push(&mut self, s: &'alloc str) -> SourceSliceIndex { + let index = self.items.len(); + self.items.push(s); + SourceSliceIndex::new(index) + } + + pub fn get(&self, index: SourceSliceIndex) -> &'alloc str { + self.items.get(usize::from(index)).unwrap() + } +} + +impl<'alloc> From<SourceSliceList<'alloc>> for Vec<&'alloc str> { + fn from(set: SourceSliceList<'alloc>) -> Vec<&'alloc str> { + set.items.into_iter().collect() + } +} diff --git a/third_party/rust/jsparagus-ast/src/type_id_generated.rs b/third_party/rust/jsparagus-ast/src/type_id_generated.rs new file mode 100644 index 0000000000..d764194f24 --- /dev/null +++ b/third_party/rust/jsparagus-ast/src/type_id_generated.rs @@ -0,0 +1,712 @@ +// WARNING: This file is auto-generated. + +use crate::types::*; + +#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] +pub enum NodeTypeId { + Argument, + Arguments, + Identifier, + IdentifierName, + PrivateIdentifier, + Label, + VariableDeclarationKind, + CompoundAssignmentOperator, + BinaryOperator, + UnaryOperator, + UpdateOperator, + Function, + Program, + IfStatement, + Statement, + Expression, + MemberExpression, + OptionalChain, + PropertyName, + CallExpression, + ClassElementName, + ObjectProperty, + NamedObjectProperty, + MethodDefinition, + ImportDeclaration, + ExportDeclaration, + VariableReference, + BindingPattern, + Binding, + SimpleAssignmentTarget, + AssignmentTargetPattern, + AssignmentTarget, + Parameter, + BindingWithDefault, + BindingIdentifier, + AssignmentTargetIdentifier, + ExpressionOrSuper, + MemberAssignmentTarget, + ComputedMemberAssignmentTarget, + PrivateFieldAssignmentTarget, + StaticMemberAssignmentTarget, + ArrayBinding, + ObjectBinding, + BindingProperty, + BindingPropertyIdentifier, + BindingPropertyProperty, + AssignmentTargetWithDefault, + AssignmentTargetMaybeDefault, + ArrayAssignmentTarget, + ObjectAssignmentTarget, + AssignmentTargetProperty, + AssignmentTargetPropertyIdentifier, + AssignmentTargetPropertyProperty, + ClassExpression, + ClassDeclaration, + ClassElement, + ModuleItems, + Module, + Import, + ImportNamespace, + ImportSpecifier, + ExportAllFrom, + ExportFrom, + ExportLocals, + Export, + ExportDefault, + ExportFromSpecifier, + ExportLocalSpecifier, + Method, + Getter, + Setter, + DataProperty, + ShorthandProperty, + ComputedPropertyName, + StaticPropertyName, + NumericLiteral, + ArrayExpressionElement, + ArrayExpression, + ArrowExpressionBody, + ComputedMemberExpression, + IdentifierExpression, + ObjectExpression, + StaticMemberExpression, + PrivateFieldExpression, + TemplateExpressionElement, + TemplateExpression, + VariableDeclarationOrAssignmentTarget, + VariableDeclarationOrExpression, + Block, + CatchClause, + Directive, + FormalParameters, + FunctionBody, + Script, + SwitchCase, + SwitchDefault, + TemplateElement, + VariableDeclaration, + VariableDeclarator, + CoverParenthesized, +} + +pub trait NodeTypeIdAccessor { + fn get_type_id(&self) -> NodeTypeId; +} + +impl<'alloc> NodeTypeIdAccessor for Argument<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Argument + } +} + +impl<'alloc> NodeTypeIdAccessor for Arguments<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Arguments + } +} + +impl<'alloc> NodeTypeIdAccessor for Identifier { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Identifier + } +} + +impl<'alloc> NodeTypeIdAccessor for IdentifierName { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::IdentifierName + } +} + +impl<'alloc> NodeTypeIdAccessor for PrivateIdentifier { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::PrivateIdentifier + } +} + +impl<'alloc> NodeTypeIdAccessor for Label { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Label + } +} + +impl<'alloc> NodeTypeIdAccessor for VariableDeclarationKind { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::VariableDeclarationKind + } +} + +impl<'alloc> NodeTypeIdAccessor for CompoundAssignmentOperator { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::CompoundAssignmentOperator + } +} + +impl<'alloc> NodeTypeIdAccessor for BinaryOperator { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::BinaryOperator + } +} + +impl<'alloc> NodeTypeIdAccessor for UnaryOperator { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::UnaryOperator + } +} + +impl<'alloc> NodeTypeIdAccessor for UpdateOperator { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::UpdateOperator + } +} + +impl<'alloc> NodeTypeIdAccessor for Function<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Function + } +} + +impl<'alloc> NodeTypeIdAccessor for Program<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Program + } +} + +impl<'alloc> NodeTypeIdAccessor for IfStatement<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::IfStatement + } +} + +impl<'alloc> NodeTypeIdAccessor for Statement<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Statement + } +} + +impl<'alloc> NodeTypeIdAccessor for Expression<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Expression + } +} + +impl<'alloc> NodeTypeIdAccessor for MemberExpression<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::MemberExpression + } +} + +impl<'alloc> NodeTypeIdAccessor for OptionalChain<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::OptionalChain + } +} + +impl<'alloc> NodeTypeIdAccessor for PropertyName<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::PropertyName + } +} + +impl<'alloc> NodeTypeIdAccessor for CallExpression<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::CallExpression + } +} + +impl<'alloc> NodeTypeIdAccessor for ClassElementName<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ClassElementName + } +} + +impl<'alloc> NodeTypeIdAccessor for ObjectProperty<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ObjectProperty + } +} + +impl<'alloc> NodeTypeIdAccessor for NamedObjectProperty<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::NamedObjectProperty + } +} + +impl<'alloc> NodeTypeIdAccessor for MethodDefinition<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::MethodDefinition + } +} + +impl<'alloc> NodeTypeIdAccessor for ImportDeclaration<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ImportDeclaration + } +} + +impl<'alloc> NodeTypeIdAccessor for ExportDeclaration<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ExportDeclaration + } +} + +impl<'alloc> NodeTypeIdAccessor for VariableReference { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::VariableReference + } +} + +impl<'alloc> NodeTypeIdAccessor for BindingPattern<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::BindingPattern + } +} + +impl<'alloc> NodeTypeIdAccessor for Binding<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Binding + } +} + +impl<'alloc> NodeTypeIdAccessor for SimpleAssignmentTarget<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::SimpleAssignmentTarget + } +} + +impl<'alloc> NodeTypeIdAccessor for AssignmentTargetPattern<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::AssignmentTargetPattern + } +} + +impl<'alloc> NodeTypeIdAccessor for AssignmentTarget<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::AssignmentTarget + } +} + +impl<'alloc> NodeTypeIdAccessor for Parameter<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Parameter + } +} + +impl<'alloc> NodeTypeIdAccessor for BindingWithDefault<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::BindingWithDefault + } +} + +impl<'alloc> NodeTypeIdAccessor for BindingIdentifier { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::BindingIdentifier + } +} + +impl<'alloc> NodeTypeIdAccessor for AssignmentTargetIdentifier { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::AssignmentTargetIdentifier + } +} + +impl<'alloc> NodeTypeIdAccessor for ExpressionOrSuper<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ExpressionOrSuper + } +} + +impl<'alloc> NodeTypeIdAccessor for MemberAssignmentTarget<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::MemberAssignmentTarget + } +} + +impl<'alloc> NodeTypeIdAccessor for ComputedMemberAssignmentTarget<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ComputedMemberAssignmentTarget + } +} + +impl<'alloc> NodeTypeIdAccessor for PrivateFieldAssignmentTarget<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::PrivateFieldAssignmentTarget + } +} + +impl<'alloc> NodeTypeIdAccessor for StaticMemberAssignmentTarget<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::StaticMemberAssignmentTarget + } +} + +impl<'alloc> NodeTypeIdAccessor for ArrayBinding<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ArrayBinding + } +} + +impl<'alloc> NodeTypeIdAccessor for ObjectBinding<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ObjectBinding + } +} + +impl<'alloc> NodeTypeIdAccessor for BindingProperty<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::BindingProperty + } +} + +impl<'alloc> NodeTypeIdAccessor for BindingPropertyIdentifier<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::BindingPropertyIdentifier + } +} + +impl<'alloc> NodeTypeIdAccessor for BindingPropertyProperty<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::BindingPropertyProperty + } +} + +impl<'alloc> NodeTypeIdAccessor for AssignmentTargetWithDefault<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::AssignmentTargetWithDefault + } +} + +impl<'alloc> NodeTypeIdAccessor for AssignmentTargetMaybeDefault<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::AssignmentTargetMaybeDefault + } +} + +impl<'alloc> NodeTypeIdAccessor for ArrayAssignmentTarget<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ArrayAssignmentTarget + } +} + +impl<'alloc> NodeTypeIdAccessor for ObjectAssignmentTarget<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ObjectAssignmentTarget + } +} + +impl<'alloc> NodeTypeIdAccessor for AssignmentTargetProperty<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::AssignmentTargetProperty + } +} + +impl<'alloc> NodeTypeIdAccessor for AssignmentTargetPropertyIdentifier<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::AssignmentTargetPropertyIdentifier + } +} + +impl<'alloc> NodeTypeIdAccessor for AssignmentTargetPropertyProperty<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::AssignmentTargetPropertyProperty + } +} + +impl<'alloc> NodeTypeIdAccessor for ClassExpression<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ClassExpression + } +} + +impl<'alloc> NodeTypeIdAccessor for ClassDeclaration<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ClassDeclaration + } +} + +impl<'alloc> NodeTypeIdAccessor for ClassElement<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ClassElement + } +} + +impl<'alloc> NodeTypeIdAccessor for ModuleItems<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ModuleItems + } +} + +impl<'alloc> NodeTypeIdAccessor for Module<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Module + } +} + +impl<'alloc> NodeTypeIdAccessor for Import<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Import + } +} + +impl<'alloc> NodeTypeIdAccessor for ImportNamespace { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ImportNamespace + } +} + +impl<'alloc> NodeTypeIdAccessor for ImportSpecifier { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ImportSpecifier + } +} + +impl<'alloc> NodeTypeIdAccessor for ExportAllFrom { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ExportAllFrom + } +} + +impl<'alloc> NodeTypeIdAccessor for ExportFrom<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ExportFrom + } +} + +impl<'alloc> NodeTypeIdAccessor for ExportLocals<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ExportLocals + } +} + +impl<'alloc> NodeTypeIdAccessor for Export<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Export + } +} + +impl<'alloc> NodeTypeIdAccessor for ExportDefault<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ExportDefault + } +} + +impl<'alloc> NodeTypeIdAccessor for ExportFromSpecifier { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ExportFromSpecifier + } +} + +impl<'alloc> NodeTypeIdAccessor for ExportLocalSpecifier { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ExportLocalSpecifier + } +} + +impl<'alloc> NodeTypeIdAccessor for Method<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Method + } +} + +impl<'alloc> NodeTypeIdAccessor for Getter<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Getter + } +} + +impl<'alloc> NodeTypeIdAccessor for Setter<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Setter + } +} + +impl<'alloc> NodeTypeIdAccessor for DataProperty<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::DataProperty + } +} + +impl<'alloc> NodeTypeIdAccessor for ShorthandProperty { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ShorthandProperty + } +} + +impl<'alloc> NodeTypeIdAccessor for ComputedPropertyName<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ComputedPropertyName + } +} + +impl<'alloc> NodeTypeIdAccessor for StaticPropertyName { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::StaticPropertyName + } +} + +impl<'alloc> NodeTypeIdAccessor for NumericLiteral { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::NumericLiteral + } +} + +impl<'alloc> NodeTypeIdAccessor for ArrayExpressionElement<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ArrayExpressionElement + } +} + +impl<'alloc> NodeTypeIdAccessor for ArrayExpression<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ArrayExpression + } +} + +impl<'alloc> NodeTypeIdAccessor for ArrowExpressionBody<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ArrowExpressionBody + } +} + +impl<'alloc> NodeTypeIdAccessor for ComputedMemberExpression<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ComputedMemberExpression + } +} + +impl<'alloc> NodeTypeIdAccessor for IdentifierExpression { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::IdentifierExpression + } +} + +impl<'alloc> NodeTypeIdAccessor for ObjectExpression<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::ObjectExpression + } +} + +impl<'alloc> NodeTypeIdAccessor for StaticMemberExpression<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::StaticMemberExpression + } +} + +impl<'alloc> NodeTypeIdAccessor for PrivateFieldExpression<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::PrivateFieldExpression + } +} + +impl<'alloc> NodeTypeIdAccessor for TemplateExpressionElement<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::TemplateExpressionElement + } +} + +impl<'alloc> NodeTypeIdAccessor for TemplateExpression<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::TemplateExpression + } +} + +impl<'alloc> NodeTypeIdAccessor for VariableDeclarationOrAssignmentTarget<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::VariableDeclarationOrAssignmentTarget + } +} + +impl<'alloc> NodeTypeIdAccessor for VariableDeclarationOrExpression<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::VariableDeclarationOrExpression + } +} + +impl<'alloc> NodeTypeIdAccessor for Block<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Block + } +} + +impl<'alloc> NodeTypeIdAccessor for CatchClause<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::CatchClause + } +} + +impl<'alloc> NodeTypeIdAccessor for Directive { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Directive + } +} + +impl<'alloc> NodeTypeIdAccessor for FormalParameters<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::FormalParameters + } +} + +impl<'alloc> NodeTypeIdAccessor for FunctionBody<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::FunctionBody + } +} + +impl<'alloc> NodeTypeIdAccessor for Script<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::Script + } +} + +impl<'alloc> NodeTypeIdAccessor for SwitchCase<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::SwitchCase + } +} + +impl<'alloc> NodeTypeIdAccessor for SwitchDefault<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::SwitchDefault + } +} + +impl<'alloc> NodeTypeIdAccessor for TemplateElement { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::TemplateElement + } +} + +impl<'alloc> NodeTypeIdAccessor for VariableDeclaration<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::VariableDeclaration + } +} + +impl<'alloc> NodeTypeIdAccessor for VariableDeclarator<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::VariableDeclarator + } +} + +impl<'alloc> NodeTypeIdAccessor for CoverParenthesized<'alloc> { + fn get_type_id(&self) -> NodeTypeId { + NodeTypeId::CoverParenthesized + } +} + diff --git a/third_party/rust/jsparagus-ast/src/types_generated.rs b/third_party/rust/jsparagus-ast/src/types_generated.rs new file mode 100644 index 0000000000..82a9daccfd --- /dev/null +++ b/third_party/rust/jsparagus-ast/src/types_generated.rs @@ -0,0 +1,1055 @@ +// WARNING: This file is auto-generated. + +use crate::source_location::SourceLocation; +use crate::arena; +use crate::source_atom_set::SourceAtomSetIndex; +use crate::source_slice_list::SourceSliceIndex; + +#[derive(Debug, PartialEq)] +pub enum Void { +} + +#[derive(Debug, PartialEq)] +pub enum Argument<'alloc> { + SpreadElement(arena::Box<'alloc, Expression<'alloc>>), + Expression(arena::Box<'alloc, Expression<'alloc>>), +} + +#[derive(Debug, PartialEq)] +pub struct Arguments<'alloc> { + pub args: arena::Vec<'alloc, Argument<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct Identifier { + pub value: SourceAtomSetIndex, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct IdentifierName { + pub value: SourceAtomSetIndex, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct PrivateIdentifier { + pub value: SourceAtomSetIndex, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct Label { + pub value: SourceAtomSetIndex, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum VariableDeclarationKind { + Var { + loc: SourceLocation, + }, + Let { + loc: SourceLocation, + }, + Const { + loc: SourceLocation, + }, +} + +#[derive(Debug, PartialEq)] +pub enum CompoundAssignmentOperator { + LogicalOr { + loc: SourceLocation, + }, + LogicalAnd { + loc: SourceLocation, + }, + Coalesce { + loc: SourceLocation, + }, + Add { + loc: SourceLocation, + }, + Sub { + loc: SourceLocation, + }, + Mul { + loc: SourceLocation, + }, + Div { + loc: SourceLocation, + }, + Mod { + loc: SourceLocation, + }, + Pow { + loc: SourceLocation, + }, + LeftShift { + loc: SourceLocation, + }, + RightShift { + loc: SourceLocation, + }, + RightShiftExt { + loc: SourceLocation, + }, + Or { + loc: SourceLocation, + }, + Xor { + loc: SourceLocation, + }, + And { + loc: SourceLocation, + }, +} + +#[derive(Debug, PartialEq)] +pub enum BinaryOperator { + Equals { + loc: SourceLocation, + }, + NotEquals { + loc: SourceLocation, + }, + StrictEquals { + loc: SourceLocation, + }, + StrictNotEquals { + loc: SourceLocation, + }, + LessThan { + loc: SourceLocation, + }, + LessThanOrEqual { + loc: SourceLocation, + }, + GreaterThan { + loc: SourceLocation, + }, + GreaterThanOrEqual { + loc: SourceLocation, + }, + In { + loc: SourceLocation, + }, + Instanceof { + loc: SourceLocation, + }, + LeftShift { + loc: SourceLocation, + }, + RightShift { + loc: SourceLocation, + }, + RightShiftExt { + loc: SourceLocation, + }, + Add { + loc: SourceLocation, + }, + Sub { + loc: SourceLocation, + }, + Mul { + loc: SourceLocation, + }, + Div { + loc: SourceLocation, + }, + Mod { + loc: SourceLocation, + }, + Pow { + loc: SourceLocation, + }, + Comma { + loc: SourceLocation, + }, + Coalesce { + loc: SourceLocation, + }, + LogicalOr { + loc: SourceLocation, + }, + LogicalAnd { + loc: SourceLocation, + }, + BitwiseOr { + loc: SourceLocation, + }, + BitwiseXor { + loc: SourceLocation, + }, + BitwiseAnd { + loc: SourceLocation, + }, +} + +#[derive(Debug, PartialEq)] +pub enum UnaryOperator { + Plus { + loc: SourceLocation, + }, + Minus { + loc: SourceLocation, + }, + LogicalNot { + loc: SourceLocation, + }, + BitwiseNot { + loc: SourceLocation, + }, + Typeof { + loc: SourceLocation, + }, + Void { + loc: SourceLocation, + }, + Delete { + loc: SourceLocation, + }, +} + +#[derive(Debug, PartialEq)] +pub enum UpdateOperator { + Increment { + loc: SourceLocation, + }, + Decrement { + loc: SourceLocation, + }, +} + +#[derive(Debug, PartialEq)] +pub struct Function<'alloc> { + pub name: Option<BindingIdentifier>, + pub is_async: bool, + pub is_generator: bool, + pub params: FormalParameters<'alloc>, + pub body: FunctionBody<'alloc>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum Program<'alloc> { + Module(Module<'alloc>), + Script(Script<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub struct IfStatement<'alloc> { + pub test: arena::Box<'alloc, Expression<'alloc>>, + pub consequent: arena::Box<'alloc, Statement<'alloc>>, + pub alternate: Option<arena::Box<'alloc, Statement<'alloc>>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum Statement<'alloc> { + BlockStatement { + block: Block<'alloc>, + loc: SourceLocation, + }, + BreakStatement { + label: Option<Label>, + loc: SourceLocation, + }, + ContinueStatement { + label: Option<Label>, + loc: SourceLocation, + }, + DebuggerStatement { + loc: SourceLocation, + }, + DoWhileStatement { + block: arena::Box<'alloc, Statement<'alloc>>, + test: arena::Box<'alloc, Expression<'alloc>>, + loc: SourceLocation, + }, + EmptyStatement { + loc: SourceLocation, + }, + ExpressionStatement(arena::Box<'alloc, Expression<'alloc>>), + ForInStatement { + left: VariableDeclarationOrAssignmentTarget<'alloc>, + right: arena::Box<'alloc, Expression<'alloc>>, + block: arena::Box<'alloc, Statement<'alloc>>, + loc: SourceLocation, + }, + ForOfStatement { + left: VariableDeclarationOrAssignmentTarget<'alloc>, + right: arena::Box<'alloc, Expression<'alloc>>, + block: arena::Box<'alloc, Statement<'alloc>>, + loc: SourceLocation, + }, + ForStatement { + init: Option<VariableDeclarationOrExpression<'alloc>>, + test: Option<arena::Box<'alloc, Expression<'alloc>>>, + update: Option<arena::Box<'alloc, Expression<'alloc>>>, + block: arena::Box<'alloc, Statement<'alloc>>, + loc: SourceLocation, + }, + IfStatement(IfStatement<'alloc>), + LabelledStatement { + label: Label, + body: arena::Box<'alloc, Statement<'alloc>>, + loc: SourceLocation, + }, + ReturnStatement { + expression: Option<arena::Box<'alloc, Expression<'alloc>>>, + loc: SourceLocation, + }, + SwitchStatement { + discriminant: arena::Box<'alloc, Expression<'alloc>>, + cases: arena::Vec<'alloc, SwitchCase<'alloc>>, + loc: SourceLocation, + }, + SwitchStatementWithDefault { + discriminant: arena::Box<'alloc, Expression<'alloc>>, + pre_default_cases: arena::Vec<'alloc, SwitchCase<'alloc>>, + default_case: SwitchDefault<'alloc>, + post_default_cases: arena::Vec<'alloc, SwitchCase<'alloc>>, + loc: SourceLocation, + }, + ThrowStatement { + expression: arena::Box<'alloc, Expression<'alloc>>, + loc: SourceLocation, + }, + TryCatchStatement { + body: Block<'alloc>, + catch_clause: CatchClause<'alloc>, + loc: SourceLocation, + }, + TryFinallyStatement { + body: Block<'alloc>, + catch_clause: Option<CatchClause<'alloc>>, + finalizer: Block<'alloc>, + loc: SourceLocation, + }, + WhileStatement { + test: arena::Box<'alloc, Expression<'alloc>>, + block: arena::Box<'alloc, Statement<'alloc>>, + loc: SourceLocation, + }, + WithStatement { + object: arena::Box<'alloc, Expression<'alloc>>, + body: arena::Box<'alloc, Statement<'alloc>>, + loc: SourceLocation, + }, + VariableDeclarationStatement(VariableDeclaration<'alloc>), + FunctionDeclaration(Function<'alloc>), + ClassDeclaration(ClassDeclaration<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub enum Expression<'alloc> { + MemberExpression(MemberExpression<'alloc>), + ClassExpression(ClassExpression<'alloc>), + LiteralBooleanExpression { + value: bool, + loc: SourceLocation, + }, + LiteralInfinityExpression { + loc: SourceLocation, + }, + LiteralNullExpression { + loc: SourceLocation, + }, + LiteralNumericExpression(NumericLiteral), + LiteralRegExpExpression { + pattern: SourceSliceIndex, + global: bool, + ignore_case: bool, + multi_line: bool, + dot_all: bool, + sticky: bool, + unicode: bool, + loc: SourceLocation, + }, + LiteralStringExpression { + value: SourceAtomSetIndex, + loc: SourceLocation, + }, + ArrayExpression(ArrayExpression<'alloc>), + ArrowExpression { + is_async: bool, + params: FormalParameters<'alloc>, + body: ArrowExpressionBody<'alloc>, + loc: SourceLocation, + }, + AssignmentExpression { + binding: AssignmentTarget<'alloc>, + expression: arena::Box<'alloc, Expression<'alloc>>, + loc: SourceLocation, + }, + BinaryExpression { + operator: BinaryOperator, + left: arena::Box<'alloc, Expression<'alloc>>, + right: arena::Box<'alloc, Expression<'alloc>>, + loc: SourceLocation, + }, + CallExpression(CallExpression<'alloc>), + CompoundAssignmentExpression { + operator: CompoundAssignmentOperator, + binding: SimpleAssignmentTarget<'alloc>, + expression: arena::Box<'alloc, Expression<'alloc>>, + loc: SourceLocation, + }, + ConditionalExpression { + test: arena::Box<'alloc, Expression<'alloc>>, + consequent: arena::Box<'alloc, Expression<'alloc>>, + alternate: arena::Box<'alloc, Expression<'alloc>>, + loc: SourceLocation, + }, + FunctionExpression(Function<'alloc>), + IdentifierExpression(IdentifierExpression), + NewExpression { + callee: arena::Box<'alloc, Expression<'alloc>>, + arguments: Arguments<'alloc>, + loc: SourceLocation, + }, + NewTargetExpression { + loc: SourceLocation, + }, + ObjectExpression(ObjectExpression<'alloc>), + OptionalExpression { + object: ExpressionOrSuper<'alloc>, + tail: arena::Box<'alloc, Expression<'alloc>>, + loc: SourceLocation, + }, + OptionalChain(OptionalChain<'alloc>), + UnaryExpression { + operator: UnaryOperator, + operand: arena::Box<'alloc, Expression<'alloc>>, + loc: SourceLocation, + }, + TemplateExpression(TemplateExpression<'alloc>), + ThisExpression { + loc: SourceLocation, + }, + UpdateExpression { + is_prefix: bool, + operator: UpdateOperator, + operand: SimpleAssignmentTarget<'alloc>, + loc: SourceLocation, + }, + YieldExpression { + expression: Option<arena::Box<'alloc, Expression<'alloc>>>, + loc: SourceLocation, + }, + YieldGeneratorExpression { + expression: arena::Box<'alloc, Expression<'alloc>>, + loc: SourceLocation, + }, + AwaitExpression { + expression: arena::Box<'alloc, Expression<'alloc>>, + loc: SourceLocation, + }, + ImportCallExpression { + argument: arena::Box<'alloc, Expression<'alloc>>, + loc: SourceLocation, + }, +} + +#[derive(Debug, PartialEq)] +pub enum MemberExpression<'alloc> { + ComputedMemberExpression(ComputedMemberExpression<'alloc>), + StaticMemberExpression(StaticMemberExpression<'alloc>), + PrivateFieldExpression(PrivateFieldExpression<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub enum OptionalChain<'alloc> { + ComputedMemberExpressionTail { + expression: arena::Box<'alloc, Expression<'alloc>>, + loc: SourceLocation, + }, + StaticMemberExpressionTail { + property: IdentifierName, + loc: SourceLocation, + }, + PrivateFieldExpressionTail { + field: PrivateIdentifier, + loc: SourceLocation, + }, + CallExpressionTail { + arguments: Arguments<'alloc>, + loc: SourceLocation, + }, + ComputedMemberExpression(ComputedMemberExpression<'alloc>), + StaticMemberExpression(StaticMemberExpression<'alloc>), + PrivateFieldExpression(PrivateFieldExpression<'alloc>), + CallExpression(CallExpression<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub enum PropertyName<'alloc> { + ComputedPropertyName(ComputedPropertyName<'alloc>), + StaticPropertyName(StaticPropertyName), + StaticNumericPropertyName(NumericLiteral), +} + +#[derive(Debug, PartialEq)] +pub struct CallExpression<'alloc> { + pub callee: ExpressionOrSuper<'alloc>, + pub arguments: Arguments<'alloc>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum ClassElementName<'alloc> { + ComputedPropertyName(ComputedPropertyName<'alloc>), + StaticPropertyName(StaticPropertyName), + StaticNumericPropertyName(NumericLiteral), + PrivateFieldName(PrivateIdentifier), +} + +#[derive(Debug, PartialEq)] +pub enum ObjectProperty<'alloc> { + NamedObjectProperty(NamedObjectProperty<'alloc>), + ShorthandProperty(ShorthandProperty), + SpreadProperty(arena::Box<'alloc, Expression<'alloc>>), +} + +#[derive(Debug, PartialEq)] +pub enum NamedObjectProperty<'alloc> { + MethodDefinition(MethodDefinition<'alloc>), + DataProperty(DataProperty<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub enum MethodDefinition<'alloc> { + Method(Method<'alloc>), + Getter(Getter<'alloc>), + Setter(Setter<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub enum ImportDeclaration<'alloc> { + Import(Import<'alloc>), + ImportNamespace(ImportNamespace), +} + +#[derive(Debug, PartialEq)] +pub enum ExportDeclaration<'alloc> { + ExportAllFrom(ExportAllFrom), + ExportFrom(ExportFrom<'alloc>), + ExportLocals(ExportLocals<'alloc>), + Export(Export<'alloc>), + ExportDefault(ExportDefault<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub enum VariableReference { + BindingIdentifier(BindingIdentifier), + AssignmentTargetIdentifier(AssignmentTargetIdentifier), +} + +#[derive(Debug, PartialEq)] +pub enum BindingPattern<'alloc> { + ObjectBinding(ObjectBinding<'alloc>), + ArrayBinding(ArrayBinding<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub enum Binding<'alloc> { + BindingPattern(BindingPattern<'alloc>), + BindingIdentifier(BindingIdentifier), +} + +#[derive(Debug, PartialEq)] +pub enum SimpleAssignmentTarget<'alloc> { + AssignmentTargetIdentifier(AssignmentTargetIdentifier), + MemberAssignmentTarget(MemberAssignmentTarget<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub enum AssignmentTargetPattern<'alloc> { + ArrayAssignmentTarget(ArrayAssignmentTarget<'alloc>), + ObjectAssignmentTarget(ObjectAssignmentTarget<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub enum AssignmentTarget<'alloc> { + AssignmentTargetPattern(AssignmentTargetPattern<'alloc>), + SimpleAssignmentTarget(SimpleAssignmentTarget<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub enum Parameter<'alloc> { + Binding(Binding<'alloc>), + BindingWithDefault(BindingWithDefault<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub struct BindingWithDefault<'alloc> { + pub binding: Binding<'alloc>, + pub init: arena::Box<'alloc, Expression<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct BindingIdentifier { + pub name: Identifier, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct AssignmentTargetIdentifier { + pub name: Identifier, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum ExpressionOrSuper<'alloc> { + Expression(arena::Box<'alloc, Expression<'alloc>>), + Super { + loc: SourceLocation, + }, +} + +#[derive(Debug, PartialEq)] +pub enum MemberAssignmentTarget<'alloc> { + ComputedMemberAssignmentTarget(ComputedMemberAssignmentTarget<'alloc>), + PrivateFieldAssignmentTarget(PrivateFieldAssignmentTarget<'alloc>), + StaticMemberAssignmentTarget(StaticMemberAssignmentTarget<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub struct ComputedMemberAssignmentTarget<'alloc> { + pub object: ExpressionOrSuper<'alloc>, + pub expression: arena::Box<'alloc, Expression<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct PrivateFieldAssignmentTarget<'alloc> { + pub object: ExpressionOrSuper<'alloc>, + pub field: PrivateIdentifier, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct StaticMemberAssignmentTarget<'alloc> { + pub object: ExpressionOrSuper<'alloc>, + pub property: IdentifierName, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct ArrayBinding<'alloc> { + pub elements: arena::Vec<'alloc, Option<Parameter<'alloc>>>, + pub rest: Option<arena::Box<'alloc, Binding<'alloc>>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct ObjectBinding<'alloc> { + pub properties: arena::Vec<'alloc, BindingProperty<'alloc>>, + pub rest: Option<arena::Box<'alloc, BindingIdentifier>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum BindingProperty<'alloc> { + BindingPropertyIdentifier(BindingPropertyIdentifier<'alloc>), + BindingPropertyProperty(BindingPropertyProperty<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub struct BindingPropertyIdentifier<'alloc> { + pub binding: BindingIdentifier, + pub init: Option<arena::Box<'alloc, Expression<'alloc>>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct BindingPropertyProperty<'alloc> { + pub name: PropertyName<'alloc>, + pub binding: Parameter<'alloc>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct AssignmentTargetWithDefault<'alloc> { + pub binding: AssignmentTarget<'alloc>, + pub init: arena::Box<'alloc, Expression<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum AssignmentTargetMaybeDefault<'alloc> { + AssignmentTarget(AssignmentTarget<'alloc>), + AssignmentTargetWithDefault(AssignmentTargetWithDefault<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub struct ArrayAssignmentTarget<'alloc> { + pub elements: arena::Vec<'alloc, Option<AssignmentTargetMaybeDefault<'alloc>>>, + pub rest: Option<arena::Box<'alloc, AssignmentTarget<'alloc>>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct ObjectAssignmentTarget<'alloc> { + pub properties: arena::Vec<'alloc, AssignmentTargetProperty<'alloc>>, + pub rest: Option<arena::Box<'alloc, AssignmentTarget<'alloc>>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum AssignmentTargetProperty<'alloc> { + AssignmentTargetPropertyIdentifier(AssignmentTargetPropertyIdentifier<'alloc>), + AssignmentTargetPropertyProperty(AssignmentTargetPropertyProperty<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub struct AssignmentTargetPropertyIdentifier<'alloc> { + pub binding: AssignmentTargetIdentifier, + pub init: Option<arena::Box<'alloc, Expression<'alloc>>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct AssignmentTargetPropertyProperty<'alloc> { + pub name: PropertyName<'alloc>, + pub binding: AssignmentTargetMaybeDefault<'alloc>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct ClassExpression<'alloc> { + pub name: Option<BindingIdentifier>, + pub super_: Option<arena::Box<'alloc, Expression<'alloc>>>, + pub elements: arena::Vec<'alloc, arena::Box<'alloc, ClassElement<'alloc>>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct ClassDeclaration<'alloc> { + pub name: BindingIdentifier, + pub super_: Option<arena::Box<'alloc, Expression<'alloc>>>, + pub elements: arena::Vec<'alloc, arena::Box<'alloc, ClassElement<'alloc>>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum ClassElement<'alloc> { + MethodDefinition { + is_static: bool, + method: MethodDefinition<'alloc>, + loc: SourceLocation, + }, + FieldDefinition { + name: ClassElementName<'alloc>, + init: Option<arena::Box<'alloc, Expression<'alloc>>>, + loc: SourceLocation, + }, +} + +#[derive(Debug, PartialEq)] +pub enum ModuleItems<'alloc> { + ImportDeclaration(ImportDeclaration<'alloc>), + ExportDeclaration(ExportDeclaration<'alloc>), + Statement(arena::Box<'alloc, Statement<'alloc>>), +} + +#[derive(Debug, PartialEq)] +pub struct Module<'alloc> { + pub directives: arena::Vec<'alloc, Directive>, + pub items: arena::Vec<'alloc, ModuleItems<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct Import<'alloc> { + pub module_specifier: SourceAtomSetIndex, + pub default_binding: Option<BindingIdentifier>, + pub named_imports: arena::Vec<'alloc, ImportSpecifier>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct ImportNamespace { + pub module_specifier: SourceAtomSetIndex, + pub default_binding: Option<BindingIdentifier>, + pub namespace_binding: BindingIdentifier, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct ImportSpecifier { + pub name: Option<IdentifierName>, + pub binding: BindingIdentifier, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct ExportAllFrom { + pub module_specifier: SourceAtomSetIndex, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct ExportFrom<'alloc> { + pub named_exports: arena::Vec<'alloc, ExportFromSpecifier>, + pub module_specifier: SourceAtomSetIndex, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct ExportLocals<'alloc> { + pub named_exports: arena::Vec<'alloc, ExportLocalSpecifier>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum Export<'alloc> { + FunctionDeclaration(Function<'alloc>), + ClassDeclaration(ClassDeclaration<'alloc>), + VariableDeclaration(VariableDeclaration<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub enum ExportDefault<'alloc> { + FunctionDeclaration(Function<'alloc>), + ClassDeclaration(ClassDeclaration<'alloc>), + Expression(arena::Box<'alloc, Expression<'alloc>>), +} + +#[derive(Debug, PartialEq)] +pub struct ExportFromSpecifier { + pub name: IdentifierName, + pub exported_name: Option<IdentifierName>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct ExportLocalSpecifier { + pub name: IdentifierExpression, + pub exported_name: Option<IdentifierName>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct Method<'alloc> { + pub name: ClassElementName<'alloc>, + pub is_async: bool, + pub is_generator: bool, + pub params: FormalParameters<'alloc>, + pub body: FunctionBody<'alloc>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct Getter<'alloc> { + pub property_name: ClassElementName<'alloc>, + pub body: FunctionBody<'alloc>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct Setter<'alloc> { + pub property_name: ClassElementName<'alloc>, + pub param: Parameter<'alloc>, + pub body: FunctionBody<'alloc>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct DataProperty<'alloc> { + pub property_name: PropertyName<'alloc>, + pub expression: arena::Box<'alloc, Expression<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct ShorthandProperty { + pub name: IdentifierExpression, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct ComputedPropertyName<'alloc> { + pub expression: arena::Box<'alloc, Expression<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct StaticPropertyName { + pub value: SourceAtomSetIndex, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct NumericLiteral { + pub value: f64, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum ArrayExpressionElement<'alloc> { + SpreadElement(arena::Box<'alloc, Expression<'alloc>>), + Expression(arena::Box<'alloc, Expression<'alloc>>), + Elision { + loc: SourceLocation, + }, +} + +#[derive(Debug, PartialEq)] +pub struct ArrayExpression<'alloc> { + pub elements: arena::Vec<'alloc, ArrayExpressionElement<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum ArrowExpressionBody<'alloc> { + FunctionBody(FunctionBody<'alloc>), + Expression(arena::Box<'alloc, Expression<'alloc>>), +} + +#[derive(Debug, PartialEq)] +pub struct ComputedMemberExpression<'alloc> { + pub object: ExpressionOrSuper<'alloc>, + pub expression: arena::Box<'alloc, Expression<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct IdentifierExpression { + pub name: Identifier, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct ObjectExpression<'alloc> { + pub properties: arena::Vec<'alloc, arena::Box<'alloc, ObjectProperty<'alloc>>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct StaticMemberExpression<'alloc> { + pub object: ExpressionOrSuper<'alloc>, + pub property: IdentifierName, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct PrivateFieldExpression<'alloc> { + pub object: ExpressionOrSuper<'alloc>, + pub field: PrivateIdentifier, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum TemplateExpressionElement<'alloc> { + Expression(arena::Box<'alloc, Expression<'alloc>>), + TemplateElement(TemplateElement), +} + +#[derive(Debug, PartialEq)] +pub struct TemplateExpression<'alloc> { + pub tag: Option<arena::Box<'alloc, Expression<'alloc>>>, + pub elements: arena::Vec<'alloc, TemplateExpressionElement<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum VariableDeclarationOrAssignmentTarget<'alloc> { + VariableDeclaration(VariableDeclaration<'alloc>), + AssignmentTarget(AssignmentTarget<'alloc>), +} + +#[derive(Debug, PartialEq)] +pub enum VariableDeclarationOrExpression<'alloc> { + VariableDeclaration(VariableDeclaration<'alloc>), + Expression(arena::Box<'alloc, Expression<'alloc>>), +} + +#[derive(Debug, PartialEq)] +pub struct Block<'alloc> { + pub statements: arena::Vec<'alloc, Statement<'alloc>>, + pub declarations: Option<arena::Vec<'alloc, SourceAtomSetIndex>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct CatchClause<'alloc> { + pub binding: Option<arena::Box<'alloc, Binding<'alloc>>>, + pub body: Block<'alloc>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct Directive { + pub raw_value: SourceAtomSetIndex, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct FormalParameters<'alloc> { + pub items: arena::Vec<'alloc, Parameter<'alloc>>, + pub rest: Option<Binding<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct FunctionBody<'alloc> { + pub directives: arena::Vec<'alloc, Directive>, + pub statements: arena::Vec<'alloc, Statement<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct Script<'alloc> { + pub directives: arena::Vec<'alloc, Directive>, + pub statements: arena::Vec<'alloc, Statement<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct SwitchCase<'alloc> { + pub test: arena::Box<'alloc, Expression<'alloc>>, + pub consequent: arena::Vec<'alloc, Statement<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct SwitchDefault<'alloc> { + pub consequent: arena::Vec<'alloc, Statement<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct TemplateElement { + pub raw_value: SourceAtomSetIndex, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct VariableDeclaration<'alloc> { + pub kind: VariableDeclarationKind, + pub declarators: arena::Vec<'alloc, VariableDeclarator<'alloc>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub struct VariableDeclarator<'alloc> { + pub binding: Binding<'alloc>, + pub init: Option<arena::Box<'alloc, Expression<'alloc>>>, + pub loc: SourceLocation, +} + +#[derive(Debug, PartialEq)] +pub enum CoverParenthesized<'alloc> { + Expression { + expression: arena::Box<'alloc, Expression<'alloc>>, + loc: SourceLocation, + }, + Parameters(arena::Box<'alloc, FormalParameters<'alloc>>), +} + diff --git a/third_party/rust/jsparagus-ast/src/visit_generated.rs b/third_party/rust/jsparagus-ast/src/visit_generated.rs new file mode 100644 index 0000000000..58a914c38e --- /dev/null +++ b/third_party/rust/jsparagus-ast/src/visit_generated.rs @@ -0,0 +1,5423 @@ +// WARNING: This file is auto-generated. + +#![allow(unused_mut)] +#![allow(unused_parens)] +#![allow(unused_variables)] +#![allow(dead_code)] + +use crate::arena; +use crate::source_atom_set::SourceAtomSetIndex; +use crate::source_slice_list::SourceSliceIndex; +use crate::types::*; + +pub trait Pass<'alloc> { + fn visit_argument(&mut self, ast: &'alloc Argument<'alloc>) { + self.enter_argument(ast); + match ast { + Argument::SpreadElement(ast) => { + self.visit_enum_argument_variant_spread_element(ast) + } + Argument::Expression(ast) => { + self.visit_enum_argument_variant_expression(ast) + } + } + self.leave_argument(ast); + } + + fn enter_argument(&mut self, ast: &'alloc Argument<'alloc>) { + } + + fn leave_argument(&mut self, ast: &'alloc Argument<'alloc>) { + } + + fn visit_enum_argument_variant_spread_element( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_argument_variant_spread_element(ast); + self.visit_expression(ast); + self.leave_enum_argument_variant_spread_element(ast); + } + + fn enter_enum_argument_variant_spread_element( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_argument_variant_spread_element( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_argument_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_argument_variant_expression(ast); + self.visit_expression(ast); + self.leave_enum_argument_variant_expression(ast); + } + + fn enter_enum_argument_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_argument_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_arguments(&mut self, ast: &'alloc Arguments<'alloc>) { + self.enter_arguments(ast); + for item in &ast.args { + self.visit_argument(item); + } + self.leave_arguments(ast); + } + + fn enter_arguments(&mut self, ast: &'alloc Arguments<'alloc>) { + } + + fn leave_arguments(&mut self, ast: &'alloc Arguments<'alloc>) { + } + + fn visit_identifier(&mut self, ast: &'alloc Identifier) { + self.enter_identifier(ast); + self.leave_identifier(ast); + } + + fn enter_identifier(&mut self, ast: &'alloc Identifier) { + } + + fn leave_identifier(&mut self, ast: &'alloc Identifier) { + } + + fn visit_identifier_name(&mut self, ast: &'alloc IdentifierName) { + self.enter_identifier_name(ast); + self.leave_identifier_name(ast); + } + + fn enter_identifier_name(&mut self, ast: &'alloc IdentifierName) { + } + + fn leave_identifier_name(&mut self, ast: &'alloc IdentifierName) { + } + + fn visit_private_identifier(&mut self, ast: &'alloc PrivateIdentifier) { + self.enter_private_identifier(ast); + self.leave_private_identifier(ast); + } + + fn enter_private_identifier(&mut self, ast: &'alloc PrivateIdentifier) { + } + + fn leave_private_identifier(&mut self, ast: &'alloc PrivateIdentifier) { + } + + fn visit_label(&mut self, ast: &'alloc Label) { + self.enter_label(ast); + self.leave_label(ast); + } + + fn enter_label(&mut self, ast: &'alloc Label) { + } + + fn leave_label(&mut self, ast: &'alloc Label) { + } + + fn visit_variable_declaration_kind(&mut self, ast: &'alloc VariableDeclarationKind) { + self.enter_variable_declaration_kind(ast); + match ast { + VariableDeclarationKind::Var { .. } => { + self.visit_enum_variable_declaration_kind_variant_var() + } + VariableDeclarationKind::Let { .. } => { + self.visit_enum_variable_declaration_kind_variant_let() + } + VariableDeclarationKind::Const { .. } => { + self.visit_enum_variable_declaration_kind_variant_const() + } + } + self.leave_variable_declaration_kind(ast); + } + + fn enter_variable_declaration_kind(&mut self, ast: &'alloc VariableDeclarationKind) { + } + + fn leave_variable_declaration_kind(&mut self, ast: &'alloc VariableDeclarationKind) { + } + + fn visit_enum_variable_declaration_kind_variant_var(&mut self) { + } + + fn visit_enum_variable_declaration_kind_variant_let(&mut self) { + } + + fn visit_enum_variable_declaration_kind_variant_const(&mut self) { + } + + fn visit_compound_assignment_operator(&mut self, ast: &'alloc CompoundAssignmentOperator) { + self.enter_compound_assignment_operator(ast); + match ast { + CompoundAssignmentOperator::LogicalOr { .. } => { + self.visit_enum_compound_assignment_operator_variant_logical_or() + } + CompoundAssignmentOperator::LogicalAnd { .. } => { + self.visit_enum_compound_assignment_operator_variant_logical_and() + } + CompoundAssignmentOperator::Coalesce { .. } => { + self.visit_enum_compound_assignment_operator_variant_coalesce() + } + CompoundAssignmentOperator::Add { .. } => { + self.visit_enum_compound_assignment_operator_variant_add() + } + CompoundAssignmentOperator::Sub { .. } => { + self.visit_enum_compound_assignment_operator_variant_sub() + } + CompoundAssignmentOperator::Mul { .. } => { + self.visit_enum_compound_assignment_operator_variant_mul() + } + CompoundAssignmentOperator::Div { .. } => { + self.visit_enum_compound_assignment_operator_variant_div() + } + CompoundAssignmentOperator::Mod { .. } => { + self.visit_enum_compound_assignment_operator_variant_mod() + } + CompoundAssignmentOperator::Pow { .. } => { + self.visit_enum_compound_assignment_operator_variant_pow() + } + CompoundAssignmentOperator::LeftShift { .. } => { + self.visit_enum_compound_assignment_operator_variant_left_shift() + } + CompoundAssignmentOperator::RightShift { .. } => { + self.visit_enum_compound_assignment_operator_variant_right_shift() + } + CompoundAssignmentOperator::RightShiftExt { .. } => { + self.visit_enum_compound_assignment_operator_variant_right_shift_ext() + } + CompoundAssignmentOperator::Or { .. } => { + self.visit_enum_compound_assignment_operator_variant_or() + } + CompoundAssignmentOperator::Xor { .. } => { + self.visit_enum_compound_assignment_operator_variant_xor() + } + CompoundAssignmentOperator::And { .. } => { + self.visit_enum_compound_assignment_operator_variant_and() + } + } + self.leave_compound_assignment_operator(ast); + } + + fn enter_compound_assignment_operator(&mut self, ast: &'alloc CompoundAssignmentOperator) { + } + + fn leave_compound_assignment_operator(&mut self, ast: &'alloc CompoundAssignmentOperator) { + } + + fn visit_enum_compound_assignment_operator_variant_logical_or(&mut self) { + } + + fn visit_enum_compound_assignment_operator_variant_logical_and(&mut self) { + } + + fn visit_enum_compound_assignment_operator_variant_coalesce(&mut self) { + } + + fn visit_enum_compound_assignment_operator_variant_add(&mut self) { + } + + fn visit_enum_compound_assignment_operator_variant_sub(&mut self) { + } + + fn visit_enum_compound_assignment_operator_variant_mul(&mut self) { + } + + fn visit_enum_compound_assignment_operator_variant_div(&mut self) { + } + + fn visit_enum_compound_assignment_operator_variant_mod(&mut self) { + } + + fn visit_enum_compound_assignment_operator_variant_pow(&mut self) { + } + + fn visit_enum_compound_assignment_operator_variant_left_shift(&mut self) { + } + + fn visit_enum_compound_assignment_operator_variant_right_shift(&mut self) { + } + + fn visit_enum_compound_assignment_operator_variant_right_shift_ext(&mut self) { + } + + fn visit_enum_compound_assignment_operator_variant_or(&mut self) { + } + + fn visit_enum_compound_assignment_operator_variant_xor(&mut self) { + } + + fn visit_enum_compound_assignment_operator_variant_and(&mut self) { + } + + fn visit_binary_operator(&mut self, ast: &'alloc BinaryOperator) { + self.enter_binary_operator(ast); + match ast { + BinaryOperator::Equals { .. } => { + self.visit_enum_binary_operator_variant_equals() + } + BinaryOperator::NotEquals { .. } => { + self.visit_enum_binary_operator_variant_not_equals() + } + BinaryOperator::StrictEquals { .. } => { + self.visit_enum_binary_operator_variant_strict_equals() + } + BinaryOperator::StrictNotEquals { .. } => { + self.visit_enum_binary_operator_variant_strict_not_equals() + } + BinaryOperator::LessThan { .. } => { + self.visit_enum_binary_operator_variant_less_than() + } + BinaryOperator::LessThanOrEqual { .. } => { + self.visit_enum_binary_operator_variant_less_than_or_equal() + } + BinaryOperator::GreaterThan { .. } => { + self.visit_enum_binary_operator_variant_greater_than() + } + BinaryOperator::GreaterThanOrEqual { .. } => { + self.visit_enum_binary_operator_variant_greater_than_or_equal() + } + BinaryOperator::In { .. } => { + self.visit_enum_binary_operator_variant_in() + } + BinaryOperator::Instanceof { .. } => { + self.visit_enum_binary_operator_variant_instanceof() + } + BinaryOperator::LeftShift { .. } => { + self.visit_enum_binary_operator_variant_left_shift() + } + BinaryOperator::RightShift { .. } => { + self.visit_enum_binary_operator_variant_right_shift() + } + BinaryOperator::RightShiftExt { .. } => { + self.visit_enum_binary_operator_variant_right_shift_ext() + } + BinaryOperator::Add { .. } => { + self.visit_enum_binary_operator_variant_add() + } + BinaryOperator::Sub { .. } => { + self.visit_enum_binary_operator_variant_sub() + } + BinaryOperator::Mul { .. } => { + self.visit_enum_binary_operator_variant_mul() + } + BinaryOperator::Div { .. } => { + self.visit_enum_binary_operator_variant_div() + } + BinaryOperator::Mod { .. } => { + self.visit_enum_binary_operator_variant_mod() + } + BinaryOperator::Pow { .. } => { + self.visit_enum_binary_operator_variant_pow() + } + BinaryOperator::Comma { .. } => { + self.visit_enum_binary_operator_variant_comma() + } + BinaryOperator::Coalesce { .. } => { + self.visit_enum_binary_operator_variant_coalesce() + } + BinaryOperator::LogicalOr { .. } => { + self.visit_enum_binary_operator_variant_logical_or() + } + BinaryOperator::LogicalAnd { .. } => { + self.visit_enum_binary_operator_variant_logical_and() + } + BinaryOperator::BitwiseOr { .. } => { + self.visit_enum_binary_operator_variant_bitwise_or() + } + BinaryOperator::BitwiseXor { .. } => { + self.visit_enum_binary_operator_variant_bitwise_xor() + } + BinaryOperator::BitwiseAnd { .. } => { + self.visit_enum_binary_operator_variant_bitwise_and() + } + } + self.leave_binary_operator(ast); + } + + fn enter_binary_operator(&mut self, ast: &'alloc BinaryOperator) { + } + + fn leave_binary_operator(&mut self, ast: &'alloc BinaryOperator) { + } + + fn visit_enum_binary_operator_variant_equals(&mut self) { + } + + fn visit_enum_binary_operator_variant_not_equals(&mut self) { + } + + fn visit_enum_binary_operator_variant_strict_equals(&mut self) { + } + + fn visit_enum_binary_operator_variant_strict_not_equals(&mut self) { + } + + fn visit_enum_binary_operator_variant_less_than(&mut self) { + } + + fn visit_enum_binary_operator_variant_less_than_or_equal(&mut self) { + } + + fn visit_enum_binary_operator_variant_greater_than(&mut self) { + } + + fn visit_enum_binary_operator_variant_greater_than_or_equal(&mut self) { + } + + fn visit_enum_binary_operator_variant_in(&mut self) { + } + + fn visit_enum_binary_operator_variant_instanceof(&mut self) { + } + + fn visit_enum_binary_operator_variant_left_shift(&mut self) { + } + + fn visit_enum_binary_operator_variant_right_shift(&mut self) { + } + + fn visit_enum_binary_operator_variant_right_shift_ext(&mut self) { + } + + fn visit_enum_binary_operator_variant_add(&mut self) { + } + + fn visit_enum_binary_operator_variant_sub(&mut self) { + } + + fn visit_enum_binary_operator_variant_mul(&mut self) { + } + + fn visit_enum_binary_operator_variant_div(&mut self) { + } + + fn visit_enum_binary_operator_variant_mod(&mut self) { + } + + fn visit_enum_binary_operator_variant_pow(&mut self) { + } + + fn visit_enum_binary_operator_variant_comma(&mut self) { + } + + fn visit_enum_binary_operator_variant_coalesce(&mut self) { + } + + fn visit_enum_binary_operator_variant_logical_or(&mut self) { + } + + fn visit_enum_binary_operator_variant_logical_and(&mut self) { + } + + fn visit_enum_binary_operator_variant_bitwise_or(&mut self) { + } + + fn visit_enum_binary_operator_variant_bitwise_xor(&mut self) { + } + + fn visit_enum_binary_operator_variant_bitwise_and(&mut self) { + } + + fn visit_unary_operator(&mut self, ast: &'alloc UnaryOperator) { + self.enter_unary_operator(ast); + match ast { + UnaryOperator::Plus { .. } => { + self.visit_enum_unary_operator_variant_plus() + } + UnaryOperator::Minus { .. } => { + self.visit_enum_unary_operator_variant_minus() + } + UnaryOperator::LogicalNot { .. } => { + self.visit_enum_unary_operator_variant_logical_not() + } + UnaryOperator::BitwiseNot { .. } => { + self.visit_enum_unary_operator_variant_bitwise_not() + } + UnaryOperator::Typeof { .. } => { + self.visit_enum_unary_operator_variant_typeof() + } + UnaryOperator::Void { .. } => { + self.visit_enum_unary_operator_variant_void() + } + UnaryOperator::Delete { .. } => { + self.visit_enum_unary_operator_variant_delete() + } + } + self.leave_unary_operator(ast); + } + + fn enter_unary_operator(&mut self, ast: &'alloc UnaryOperator) { + } + + fn leave_unary_operator(&mut self, ast: &'alloc UnaryOperator) { + } + + fn visit_enum_unary_operator_variant_plus(&mut self) { + } + + fn visit_enum_unary_operator_variant_minus(&mut self) { + } + + fn visit_enum_unary_operator_variant_logical_not(&mut self) { + } + + fn visit_enum_unary_operator_variant_bitwise_not(&mut self) { + } + + fn visit_enum_unary_operator_variant_typeof(&mut self) { + } + + fn visit_enum_unary_operator_variant_void(&mut self) { + } + + fn visit_enum_unary_operator_variant_delete(&mut self) { + } + + fn visit_update_operator(&mut self, ast: &'alloc UpdateOperator) { + self.enter_update_operator(ast); + match ast { + UpdateOperator::Increment { .. } => { + self.visit_enum_update_operator_variant_increment() + } + UpdateOperator::Decrement { .. } => { + self.visit_enum_update_operator_variant_decrement() + } + } + self.leave_update_operator(ast); + } + + fn enter_update_operator(&mut self, ast: &'alloc UpdateOperator) { + } + + fn leave_update_operator(&mut self, ast: &'alloc UpdateOperator) { + } + + fn visit_enum_update_operator_variant_increment(&mut self) { + } + + fn visit_enum_update_operator_variant_decrement(&mut self) { + } + + fn visit_function(&mut self, ast: &'alloc Function<'alloc>) { + self.enter_function(ast); + if let Some(item) = &ast.name { + self.visit_binding_identifier(item); + } + self.visit_formal_parameters(&ast.params); + self.visit_function_body(&ast.body); + self.leave_function(ast); + } + + fn enter_function(&mut self, ast: &'alloc Function<'alloc>) { + } + + fn leave_function(&mut self, ast: &'alloc Function<'alloc>) { + } + + fn visit_program(&mut self, ast: &'alloc Program<'alloc>) { + self.enter_program(ast); + match ast { + Program::Module(ast) => { + self.visit_enum_program_variant_module(ast) + } + Program::Script(ast) => { + self.visit_enum_program_variant_script(ast) + } + } + self.leave_program(ast); + } + + fn enter_program(&mut self, ast: &'alloc Program<'alloc>) { + } + + fn leave_program(&mut self, ast: &'alloc Program<'alloc>) { + } + + fn visit_enum_program_variant_module( + &mut self, + ast: &'alloc Module<'alloc>, + ) { + self.enter_enum_program_variant_module(ast); + self.visit_module(ast); + self.leave_enum_program_variant_module(ast); + } + + fn enter_enum_program_variant_module( + &mut self, + ast: &'alloc Module<'alloc>, + ) { + } + + fn leave_enum_program_variant_module( + &mut self, + ast: &'alloc Module<'alloc>, + ) { + } + + fn visit_enum_program_variant_script( + &mut self, + ast: &'alloc Script<'alloc>, + ) { + self.enter_enum_program_variant_script(ast); + self.visit_script(ast); + self.leave_enum_program_variant_script(ast); + } + + fn enter_enum_program_variant_script( + &mut self, + ast: &'alloc Script<'alloc>, + ) { + } + + fn leave_enum_program_variant_script( + &mut self, + ast: &'alloc Script<'alloc>, + ) { + } + + fn visit_if_statement(&mut self, ast: &'alloc IfStatement<'alloc>) { + self.enter_if_statement(ast); + self.visit_expression(&ast.test); + self.visit_statement(&ast.consequent); + if let Some(item) = &ast.alternate { + self.visit_statement(item); + } + self.leave_if_statement(ast); + } + + fn enter_if_statement(&mut self, ast: &'alloc IfStatement<'alloc>) { + } + + fn leave_if_statement(&mut self, ast: &'alloc IfStatement<'alloc>) { + } + + fn visit_statement(&mut self, ast: &'alloc Statement<'alloc>) { + self.enter_statement(ast); + match ast { + Statement::BlockStatement { block, .. } => { + self.visit_enum_statement_variant_block_statement( + block, + ) + } + Statement::BreakStatement { label, .. } => { + self.visit_enum_statement_variant_break_statement( + label, + ) + } + Statement::ContinueStatement { label, .. } => { + self.visit_enum_statement_variant_continue_statement( + label, + ) + } + Statement::DebuggerStatement { .. } => { + self.visit_enum_statement_variant_debugger_statement() + } + Statement::DoWhileStatement { block, test, .. } => { + self.visit_enum_statement_variant_do_while_statement( + block, + test, + ) + } + Statement::EmptyStatement { .. } => { + self.visit_enum_statement_variant_empty_statement() + } + Statement::ExpressionStatement(ast) => { + self.visit_enum_statement_variant_expression_statement(ast) + } + Statement::ForInStatement { left, right, block, .. } => { + self.visit_enum_statement_variant_for_in_statement( + left, + right, + block, + ) + } + Statement::ForOfStatement { left, right, block, .. } => { + self.visit_enum_statement_variant_for_of_statement( + left, + right, + block, + ) + } + Statement::ForStatement { init, test, update, block, .. } => { + self.visit_enum_statement_variant_for_statement( + init, + test, + update, + block, + ) + } + Statement::IfStatement(ast) => { + self.visit_enum_statement_variant_if_statement(ast) + } + Statement::LabelledStatement { label, body, .. } => { + self.visit_enum_statement_variant_labelled_statement( + label, + body, + ) + } + Statement::ReturnStatement { expression, .. } => { + self.visit_enum_statement_variant_return_statement( + expression, + ) + } + Statement::SwitchStatement { discriminant, cases, .. } => { + self.visit_enum_statement_variant_switch_statement( + discriminant, + cases, + ) + } + Statement::SwitchStatementWithDefault { discriminant, pre_default_cases, default_case, post_default_cases, .. } => { + self.visit_enum_statement_variant_switch_statement_with_default( + discriminant, + pre_default_cases, + default_case, + post_default_cases, + ) + } + Statement::ThrowStatement { expression, .. } => { + self.visit_enum_statement_variant_throw_statement( + expression, + ) + } + Statement::TryCatchStatement { body, catch_clause, .. } => { + self.visit_enum_statement_variant_try_catch_statement( + body, + catch_clause, + ) + } + Statement::TryFinallyStatement { body, catch_clause, finalizer, .. } => { + self.visit_enum_statement_variant_try_finally_statement( + body, + catch_clause, + finalizer, + ) + } + Statement::WhileStatement { test, block, .. } => { + self.visit_enum_statement_variant_while_statement( + test, + block, + ) + } + Statement::WithStatement { object, body, .. } => { + self.visit_enum_statement_variant_with_statement( + object, + body, + ) + } + Statement::VariableDeclarationStatement(ast) => { + self.visit_enum_statement_variant_variable_declaration_statement(ast) + } + Statement::FunctionDeclaration(ast) => { + self.visit_enum_statement_variant_function_declaration(ast) + } + Statement::ClassDeclaration(ast) => { + self.visit_enum_statement_variant_class_declaration(ast) + } + } + self.leave_statement(ast); + } + + fn enter_statement(&mut self, ast: &'alloc Statement<'alloc>) { + } + + fn leave_statement(&mut self, ast: &'alloc Statement<'alloc>) { + } + + fn visit_enum_statement_variant_block_statement( + &mut self, + block: &'alloc Block<'alloc>, + ) { + self.enter_enum_statement_variant_block_statement( + block, + ); + self.visit_block(block); + self.leave_enum_statement_variant_block_statement( + block, + ); + } + + fn enter_enum_statement_variant_block_statement( + &mut self, + block: &'alloc Block<'alloc>, + ) { + } + + fn leave_enum_statement_variant_block_statement( + &mut self, + block: &'alloc Block<'alloc>, + ) { + } + + fn visit_enum_statement_variant_break_statement( + &mut self, + label: &'alloc Option<Label>, + ) { + self.enter_enum_statement_variant_break_statement( + label, + ); + if let Some(item) = label { + self.visit_label(item); + } + self.leave_enum_statement_variant_break_statement( + label, + ); + } + + fn enter_enum_statement_variant_break_statement( + &mut self, + label: &'alloc Option<Label>, + ) { + } + + fn leave_enum_statement_variant_break_statement( + &mut self, + label: &'alloc Option<Label>, + ) { + } + + fn visit_enum_statement_variant_continue_statement( + &mut self, + label: &'alloc Option<Label>, + ) { + self.enter_enum_statement_variant_continue_statement( + label, + ); + if let Some(item) = label { + self.visit_label(item); + } + self.leave_enum_statement_variant_continue_statement( + label, + ); + } + + fn enter_enum_statement_variant_continue_statement( + &mut self, + label: &'alloc Option<Label>, + ) { + } + + fn leave_enum_statement_variant_continue_statement( + &mut self, + label: &'alloc Option<Label>, + ) { + } + + fn visit_enum_statement_variant_debugger_statement(&mut self) { + } + + fn visit_enum_statement_variant_do_while_statement( + &mut self, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + test: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_statement_variant_do_while_statement( + block, + test, + ); + self.visit_statement(block); + self.visit_expression(test); + self.leave_enum_statement_variant_do_while_statement( + block, + test, + ); + } + + fn enter_enum_statement_variant_do_while_statement( + &mut self, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + test: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_statement_variant_do_while_statement( + &mut self, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + test: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_statement_variant_empty_statement(&mut self) { + } + + fn visit_enum_statement_variant_expression_statement( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_statement_variant_expression_statement(ast); + self.visit_expression(ast); + self.leave_enum_statement_variant_expression_statement(ast); + } + + fn enter_enum_statement_variant_expression_statement( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_statement_variant_expression_statement( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_statement_variant_for_in_statement( + &mut self, + left: &'alloc VariableDeclarationOrAssignmentTarget<'alloc>, + right: &'alloc arena::Box<'alloc, Expression<'alloc>>, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + self.enter_enum_statement_variant_for_in_statement( + left, + right, + block, + ); + self.visit_variable_declaration_or_assignment_target(left); + self.visit_expression(right); + self.visit_statement(block); + self.leave_enum_statement_variant_for_in_statement( + left, + right, + block, + ); + } + + fn enter_enum_statement_variant_for_in_statement( + &mut self, + left: &'alloc VariableDeclarationOrAssignmentTarget<'alloc>, + right: &'alloc arena::Box<'alloc, Expression<'alloc>>, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + } + + fn leave_enum_statement_variant_for_in_statement( + &mut self, + left: &'alloc VariableDeclarationOrAssignmentTarget<'alloc>, + right: &'alloc arena::Box<'alloc, Expression<'alloc>>, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + } + + fn visit_enum_statement_variant_for_of_statement( + &mut self, + left: &'alloc VariableDeclarationOrAssignmentTarget<'alloc>, + right: &'alloc arena::Box<'alloc, Expression<'alloc>>, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + self.enter_enum_statement_variant_for_of_statement( + left, + right, + block, + ); + self.visit_variable_declaration_or_assignment_target(left); + self.visit_expression(right); + self.visit_statement(block); + self.leave_enum_statement_variant_for_of_statement( + left, + right, + block, + ); + } + + fn enter_enum_statement_variant_for_of_statement( + &mut self, + left: &'alloc VariableDeclarationOrAssignmentTarget<'alloc>, + right: &'alloc arena::Box<'alloc, Expression<'alloc>>, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + } + + fn leave_enum_statement_variant_for_of_statement( + &mut self, + left: &'alloc VariableDeclarationOrAssignmentTarget<'alloc>, + right: &'alloc arena::Box<'alloc, Expression<'alloc>>, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + } + + fn visit_enum_statement_variant_for_statement( + &mut self, + init: &'alloc Option<VariableDeclarationOrExpression<'alloc>>, + test: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + update: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + self.enter_enum_statement_variant_for_statement( + init, + test, + update, + block, + ); + if let Some(item) = init { + self.visit_variable_declaration_or_expression(item); + } + if let Some(item) = test { + self.visit_expression(item); + } + if let Some(item) = update { + self.visit_expression(item); + } + self.visit_statement(block); + self.leave_enum_statement_variant_for_statement( + init, + test, + update, + block, + ); + } + + fn enter_enum_statement_variant_for_statement( + &mut self, + init: &'alloc Option<VariableDeclarationOrExpression<'alloc>>, + test: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + update: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + } + + fn leave_enum_statement_variant_for_statement( + &mut self, + init: &'alloc Option<VariableDeclarationOrExpression<'alloc>>, + test: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + update: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + } + + fn visit_enum_statement_variant_if_statement( + &mut self, + ast: &'alloc IfStatement<'alloc>, + ) { + self.enter_enum_statement_variant_if_statement(ast); + self.visit_if_statement(ast); + self.leave_enum_statement_variant_if_statement(ast); + } + + fn enter_enum_statement_variant_if_statement( + &mut self, + ast: &'alloc IfStatement<'alloc>, + ) { + } + + fn leave_enum_statement_variant_if_statement( + &mut self, + ast: &'alloc IfStatement<'alloc>, + ) { + } + + fn visit_enum_statement_variant_labelled_statement( + &mut self, + label: &'alloc Label, + body: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + self.enter_enum_statement_variant_labelled_statement( + label, + body, + ); + self.visit_label(label); + self.visit_statement(body); + self.leave_enum_statement_variant_labelled_statement( + label, + body, + ); + } + + fn enter_enum_statement_variant_labelled_statement( + &mut self, + label: &'alloc Label, + body: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + } + + fn leave_enum_statement_variant_labelled_statement( + &mut self, + label: &'alloc Label, + body: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + } + + fn visit_enum_statement_variant_return_statement( + &mut self, + expression: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + ) { + self.enter_enum_statement_variant_return_statement( + expression, + ); + if let Some(item) = expression { + self.visit_expression(item); + } + self.leave_enum_statement_variant_return_statement( + expression, + ); + } + + fn enter_enum_statement_variant_return_statement( + &mut self, + expression: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + ) { + } + + fn leave_enum_statement_variant_return_statement( + &mut self, + expression: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + ) { + } + + fn visit_enum_statement_variant_switch_statement( + &mut self, + discriminant: &'alloc arena::Box<'alloc, Expression<'alloc>>, + cases: &'alloc arena::Vec<'alloc, SwitchCase<'alloc>>, + ) { + self.enter_enum_statement_variant_switch_statement( + discriminant, + cases, + ); + self.visit_expression(discriminant); + for item in cases.iter() { + self.visit_switch_case(item); + } + self.leave_enum_statement_variant_switch_statement( + discriminant, + cases, + ); + } + + fn enter_enum_statement_variant_switch_statement( + &mut self, + discriminant: &'alloc arena::Box<'alloc, Expression<'alloc>>, + cases: &'alloc arena::Vec<'alloc, SwitchCase<'alloc>>, + ) { + } + + fn leave_enum_statement_variant_switch_statement( + &mut self, + discriminant: &'alloc arena::Box<'alloc, Expression<'alloc>>, + cases: &'alloc arena::Vec<'alloc, SwitchCase<'alloc>>, + ) { + } + + fn visit_enum_statement_variant_switch_statement_with_default( + &mut self, + discriminant: &'alloc arena::Box<'alloc, Expression<'alloc>>, + pre_default_cases: &'alloc arena::Vec<'alloc, SwitchCase<'alloc>>, + default_case: &'alloc SwitchDefault<'alloc>, + post_default_cases: &'alloc arena::Vec<'alloc, SwitchCase<'alloc>>, + ) { + self.enter_enum_statement_variant_switch_statement_with_default( + discriminant, + pre_default_cases, + default_case, + post_default_cases, + ); + self.visit_expression(discriminant); + for item in pre_default_cases.iter() { + self.visit_switch_case(item); + } + self.visit_switch_default(default_case); + for item in post_default_cases.iter() { + self.visit_switch_case(item); + } + self.leave_enum_statement_variant_switch_statement_with_default( + discriminant, + pre_default_cases, + default_case, + post_default_cases, + ); + } + + fn enter_enum_statement_variant_switch_statement_with_default( + &mut self, + discriminant: &'alloc arena::Box<'alloc, Expression<'alloc>>, + pre_default_cases: &'alloc arena::Vec<'alloc, SwitchCase<'alloc>>, + default_case: &'alloc SwitchDefault<'alloc>, + post_default_cases: &'alloc arena::Vec<'alloc, SwitchCase<'alloc>>, + ) { + } + + fn leave_enum_statement_variant_switch_statement_with_default( + &mut self, + discriminant: &'alloc arena::Box<'alloc, Expression<'alloc>>, + pre_default_cases: &'alloc arena::Vec<'alloc, SwitchCase<'alloc>>, + default_case: &'alloc SwitchDefault<'alloc>, + post_default_cases: &'alloc arena::Vec<'alloc, SwitchCase<'alloc>>, + ) { + } + + fn visit_enum_statement_variant_throw_statement( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_statement_variant_throw_statement( + expression, + ); + self.visit_expression(expression); + self.leave_enum_statement_variant_throw_statement( + expression, + ); + } + + fn enter_enum_statement_variant_throw_statement( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_statement_variant_throw_statement( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_statement_variant_try_catch_statement( + &mut self, + body: &'alloc Block<'alloc>, + catch_clause: &'alloc CatchClause<'alloc>, + ) { + self.enter_enum_statement_variant_try_catch_statement( + body, + catch_clause, + ); + self.visit_block(body); + self.visit_catch_clause(catch_clause); + self.leave_enum_statement_variant_try_catch_statement( + body, + catch_clause, + ); + } + + fn enter_enum_statement_variant_try_catch_statement( + &mut self, + body: &'alloc Block<'alloc>, + catch_clause: &'alloc CatchClause<'alloc>, + ) { + } + + fn leave_enum_statement_variant_try_catch_statement( + &mut self, + body: &'alloc Block<'alloc>, + catch_clause: &'alloc CatchClause<'alloc>, + ) { + } + + fn visit_enum_statement_variant_try_finally_statement( + &mut self, + body: &'alloc Block<'alloc>, + catch_clause: &'alloc Option<CatchClause<'alloc>>, + finalizer: &'alloc Block<'alloc>, + ) { + self.enter_enum_statement_variant_try_finally_statement( + body, + catch_clause, + finalizer, + ); + self.visit_block(body); + if let Some(item) = catch_clause { + self.visit_catch_clause(item); + } + self.visit_block(finalizer); + self.leave_enum_statement_variant_try_finally_statement( + body, + catch_clause, + finalizer, + ); + } + + fn enter_enum_statement_variant_try_finally_statement( + &mut self, + body: &'alloc Block<'alloc>, + catch_clause: &'alloc Option<CatchClause<'alloc>>, + finalizer: &'alloc Block<'alloc>, + ) { + } + + fn leave_enum_statement_variant_try_finally_statement( + &mut self, + body: &'alloc Block<'alloc>, + catch_clause: &'alloc Option<CatchClause<'alloc>>, + finalizer: &'alloc Block<'alloc>, + ) { + } + + fn visit_enum_statement_variant_while_statement( + &mut self, + test: &'alloc arena::Box<'alloc, Expression<'alloc>>, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + self.enter_enum_statement_variant_while_statement( + test, + block, + ); + self.visit_expression(test); + self.visit_statement(block); + self.leave_enum_statement_variant_while_statement( + test, + block, + ); + } + + fn enter_enum_statement_variant_while_statement( + &mut self, + test: &'alloc arena::Box<'alloc, Expression<'alloc>>, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + } + + fn leave_enum_statement_variant_while_statement( + &mut self, + test: &'alloc arena::Box<'alloc, Expression<'alloc>>, + block: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + } + + fn visit_enum_statement_variant_with_statement( + &mut self, + object: &'alloc arena::Box<'alloc, Expression<'alloc>>, + body: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + self.enter_enum_statement_variant_with_statement( + object, + body, + ); + self.visit_expression(object); + self.visit_statement(body); + self.leave_enum_statement_variant_with_statement( + object, + body, + ); + } + + fn enter_enum_statement_variant_with_statement( + &mut self, + object: &'alloc arena::Box<'alloc, Expression<'alloc>>, + body: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + } + + fn leave_enum_statement_variant_with_statement( + &mut self, + object: &'alloc arena::Box<'alloc, Expression<'alloc>>, + body: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + } + + fn visit_enum_statement_variant_variable_declaration_statement( + &mut self, + ast: &'alloc VariableDeclaration<'alloc>, + ) { + self.enter_enum_statement_variant_variable_declaration_statement(ast); + self.visit_variable_declaration(ast); + self.leave_enum_statement_variant_variable_declaration_statement(ast); + } + + fn enter_enum_statement_variant_variable_declaration_statement( + &mut self, + ast: &'alloc VariableDeclaration<'alloc>, + ) { + } + + fn leave_enum_statement_variant_variable_declaration_statement( + &mut self, + ast: &'alloc VariableDeclaration<'alloc>, + ) { + } + + fn visit_enum_statement_variant_function_declaration( + &mut self, + ast: &'alloc Function<'alloc>, + ) { + self.enter_enum_statement_variant_function_declaration(ast); + self.visit_function(ast); + self.leave_enum_statement_variant_function_declaration(ast); + } + + fn enter_enum_statement_variant_function_declaration( + &mut self, + ast: &'alloc Function<'alloc>, + ) { + } + + fn leave_enum_statement_variant_function_declaration( + &mut self, + ast: &'alloc Function<'alloc>, + ) { + } + + fn visit_enum_statement_variant_class_declaration( + &mut self, + ast: &'alloc ClassDeclaration<'alloc>, + ) { + self.enter_enum_statement_variant_class_declaration(ast); + self.visit_class_declaration(ast); + self.leave_enum_statement_variant_class_declaration(ast); + } + + fn enter_enum_statement_variant_class_declaration( + &mut self, + ast: &'alloc ClassDeclaration<'alloc>, + ) { + } + + fn leave_enum_statement_variant_class_declaration( + &mut self, + ast: &'alloc ClassDeclaration<'alloc>, + ) { + } + + fn visit_expression(&mut self, ast: &'alloc Expression<'alloc>) { + self.enter_expression(ast); + match ast { + Expression::MemberExpression(ast) => { + self.visit_enum_expression_variant_member_expression(ast) + } + Expression::ClassExpression(ast) => { + self.visit_enum_expression_variant_class_expression(ast) + } + Expression::LiteralBooleanExpression { value, .. } => { + self.visit_enum_expression_variant_literal_boolean_expression( + value, + ) + } + Expression::LiteralInfinityExpression { .. } => { + self.visit_enum_expression_variant_literal_infinity_expression() + } + Expression::LiteralNullExpression { .. } => { + self.visit_enum_expression_variant_literal_null_expression() + } + Expression::LiteralNumericExpression(ast) => { + self.visit_enum_expression_variant_literal_numeric_expression(ast) + } + Expression::LiteralRegExpExpression { pattern, global, ignore_case, multi_line, dot_all, sticky, unicode, .. } => { + self.visit_enum_expression_variant_literal_reg_exp_expression( + pattern, + global, + ignore_case, + multi_line, + dot_all, + sticky, + unicode, + ) + } + Expression::LiteralStringExpression { value, .. } => { + self.visit_enum_expression_variant_literal_string_expression( + value, + ) + } + Expression::ArrayExpression(ast) => { + self.visit_enum_expression_variant_array_expression(ast) + } + Expression::ArrowExpression { is_async, params, body, .. } => { + self.visit_enum_expression_variant_arrow_expression( + is_async, + params, + body, + ) + } + Expression::AssignmentExpression { binding, expression, .. } => { + self.visit_enum_expression_variant_assignment_expression( + binding, + expression, + ) + } + Expression::BinaryExpression { operator, left, right, .. } => { + self.visit_enum_expression_variant_binary_expression( + operator, + left, + right, + ) + } + Expression::CallExpression(ast) => { + self.visit_enum_expression_variant_call_expression(ast) + } + Expression::CompoundAssignmentExpression { operator, binding, expression, .. } => { + self.visit_enum_expression_variant_compound_assignment_expression( + operator, + binding, + expression, + ) + } + Expression::ConditionalExpression { test, consequent, alternate, .. } => { + self.visit_enum_expression_variant_conditional_expression( + test, + consequent, + alternate, + ) + } + Expression::FunctionExpression(ast) => { + self.visit_enum_expression_variant_function_expression(ast) + } + Expression::IdentifierExpression(ast) => { + self.visit_enum_expression_variant_identifier_expression(ast) + } + Expression::NewExpression { callee, arguments, .. } => { + self.visit_enum_expression_variant_new_expression( + callee, + arguments, + ) + } + Expression::NewTargetExpression { .. } => { + self.visit_enum_expression_variant_new_target_expression() + } + Expression::ObjectExpression(ast) => { + self.visit_enum_expression_variant_object_expression(ast) + } + Expression::OptionalExpression { object, tail, .. } => { + self.visit_enum_expression_variant_optional_expression( + object, + tail, + ) + } + Expression::OptionalChain(ast) => { + self.visit_enum_expression_variant_optional_chain(ast) + } + Expression::UnaryExpression { operator, operand, .. } => { + self.visit_enum_expression_variant_unary_expression( + operator, + operand, + ) + } + Expression::TemplateExpression(ast) => { + self.visit_enum_expression_variant_template_expression(ast) + } + Expression::ThisExpression { .. } => { + self.visit_enum_expression_variant_this_expression() + } + Expression::UpdateExpression { is_prefix, operator, operand, .. } => { + self.visit_enum_expression_variant_update_expression( + is_prefix, + operator, + operand, + ) + } + Expression::YieldExpression { expression, .. } => { + self.visit_enum_expression_variant_yield_expression( + expression, + ) + } + Expression::YieldGeneratorExpression { expression, .. } => { + self.visit_enum_expression_variant_yield_generator_expression( + expression, + ) + } + Expression::AwaitExpression { expression, .. } => { + self.visit_enum_expression_variant_await_expression( + expression, + ) + } + Expression::ImportCallExpression { argument, .. } => { + self.visit_enum_expression_variant_import_call_expression( + argument, + ) + } + } + self.leave_expression(ast); + } + + fn enter_expression(&mut self, ast: &'alloc Expression<'alloc>) { + } + + fn leave_expression(&mut self, ast: &'alloc Expression<'alloc>) { + } + + fn visit_enum_expression_variant_member_expression( + &mut self, + ast: &'alloc MemberExpression<'alloc>, + ) { + self.enter_enum_expression_variant_member_expression(ast); + self.visit_member_expression(ast); + self.leave_enum_expression_variant_member_expression(ast); + } + + fn enter_enum_expression_variant_member_expression( + &mut self, + ast: &'alloc MemberExpression<'alloc>, + ) { + } + + fn leave_enum_expression_variant_member_expression( + &mut self, + ast: &'alloc MemberExpression<'alloc>, + ) { + } + + fn visit_enum_expression_variant_class_expression( + &mut self, + ast: &'alloc ClassExpression<'alloc>, + ) { + self.enter_enum_expression_variant_class_expression(ast); + self.visit_class_expression(ast); + self.leave_enum_expression_variant_class_expression(ast); + } + + fn enter_enum_expression_variant_class_expression( + &mut self, + ast: &'alloc ClassExpression<'alloc>, + ) { + } + + fn leave_enum_expression_variant_class_expression( + &mut self, + ast: &'alloc ClassExpression<'alloc>, + ) { + } + + fn visit_enum_expression_variant_literal_boolean_expression( + &mut self, + value: &'alloc bool, + ) { + self.enter_enum_expression_variant_literal_boolean_expression( + value, + ); + self.leave_enum_expression_variant_literal_boolean_expression( + value, + ); + } + + fn enter_enum_expression_variant_literal_boolean_expression( + &mut self, + value: &'alloc bool, + ) { + } + + fn leave_enum_expression_variant_literal_boolean_expression( + &mut self, + value: &'alloc bool, + ) { + } + + fn visit_enum_expression_variant_literal_infinity_expression(&mut self) { + } + + fn visit_enum_expression_variant_literal_null_expression(&mut self) { + } + + fn visit_enum_expression_variant_literal_numeric_expression( + &mut self, + ast: &'alloc NumericLiteral, + ) { + self.enter_enum_expression_variant_literal_numeric_expression(ast); + self.visit_numeric_literal(ast); + self.leave_enum_expression_variant_literal_numeric_expression(ast); + } + + fn enter_enum_expression_variant_literal_numeric_expression( + &mut self, + ast: &'alloc NumericLiteral, + ) { + } + + fn leave_enum_expression_variant_literal_numeric_expression( + &mut self, + ast: &'alloc NumericLiteral, + ) { + } + + fn visit_enum_expression_variant_literal_reg_exp_expression( + &mut self, + pattern: &'alloc SourceSliceIndex, + global: &'alloc bool, + ignore_case: &'alloc bool, + multi_line: &'alloc bool, + dot_all: &'alloc bool, + sticky: &'alloc bool, + unicode: &'alloc bool, + ) { + self.enter_enum_expression_variant_literal_reg_exp_expression( + pattern, + global, + ignore_case, + multi_line, + dot_all, + sticky, + unicode, + ); + self.leave_enum_expression_variant_literal_reg_exp_expression( + pattern, + global, + ignore_case, + multi_line, + dot_all, + sticky, + unicode, + ); + } + + fn enter_enum_expression_variant_literal_reg_exp_expression( + &mut self, + pattern: &'alloc SourceSliceIndex, + global: &'alloc bool, + ignore_case: &'alloc bool, + multi_line: &'alloc bool, + dot_all: &'alloc bool, + sticky: &'alloc bool, + unicode: &'alloc bool, + ) { + } + + fn leave_enum_expression_variant_literal_reg_exp_expression( + &mut self, + pattern: &'alloc SourceSliceIndex, + global: &'alloc bool, + ignore_case: &'alloc bool, + multi_line: &'alloc bool, + dot_all: &'alloc bool, + sticky: &'alloc bool, + unicode: &'alloc bool, + ) { + } + + fn visit_enum_expression_variant_literal_string_expression( + &mut self, + value: &'alloc SourceAtomSetIndex, + ) { + self.enter_enum_expression_variant_literal_string_expression( + value, + ); + self.leave_enum_expression_variant_literal_string_expression( + value, + ); + } + + fn enter_enum_expression_variant_literal_string_expression( + &mut self, + value: &'alloc SourceAtomSetIndex, + ) { + } + + fn leave_enum_expression_variant_literal_string_expression( + &mut self, + value: &'alloc SourceAtomSetIndex, + ) { + } + + fn visit_enum_expression_variant_array_expression( + &mut self, + ast: &'alloc ArrayExpression<'alloc>, + ) { + self.enter_enum_expression_variant_array_expression(ast); + self.visit_array_expression(ast); + self.leave_enum_expression_variant_array_expression(ast); + } + + fn enter_enum_expression_variant_array_expression( + &mut self, + ast: &'alloc ArrayExpression<'alloc>, + ) { + } + + fn leave_enum_expression_variant_array_expression( + &mut self, + ast: &'alloc ArrayExpression<'alloc>, + ) { + } + + fn visit_enum_expression_variant_arrow_expression( + &mut self, + is_async: &'alloc bool, + params: &'alloc FormalParameters<'alloc>, + body: &'alloc ArrowExpressionBody<'alloc>, + ) { + self.enter_enum_expression_variant_arrow_expression( + is_async, + params, + body, + ); + self.visit_formal_parameters(params); + self.visit_arrow_expression_body(body); + self.leave_enum_expression_variant_arrow_expression( + is_async, + params, + body, + ); + } + + fn enter_enum_expression_variant_arrow_expression( + &mut self, + is_async: &'alloc bool, + params: &'alloc FormalParameters<'alloc>, + body: &'alloc ArrowExpressionBody<'alloc>, + ) { + } + + fn leave_enum_expression_variant_arrow_expression( + &mut self, + is_async: &'alloc bool, + params: &'alloc FormalParameters<'alloc>, + body: &'alloc ArrowExpressionBody<'alloc>, + ) { + } + + fn visit_enum_expression_variant_assignment_expression( + &mut self, + binding: &'alloc AssignmentTarget<'alloc>, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_expression_variant_assignment_expression( + binding, + expression, + ); + self.visit_assignment_target(binding); + self.visit_expression(expression); + self.leave_enum_expression_variant_assignment_expression( + binding, + expression, + ); + } + + fn enter_enum_expression_variant_assignment_expression( + &mut self, + binding: &'alloc AssignmentTarget<'alloc>, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_expression_variant_assignment_expression( + &mut self, + binding: &'alloc AssignmentTarget<'alloc>, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_expression_variant_binary_expression( + &mut self, + operator: &'alloc BinaryOperator, + left: &'alloc arena::Box<'alloc, Expression<'alloc>>, + right: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_expression_variant_binary_expression( + operator, + left, + right, + ); + self.visit_binary_operator(operator); + self.visit_expression(left); + self.visit_expression(right); + self.leave_enum_expression_variant_binary_expression( + operator, + left, + right, + ); + } + + fn enter_enum_expression_variant_binary_expression( + &mut self, + operator: &'alloc BinaryOperator, + left: &'alloc arena::Box<'alloc, Expression<'alloc>>, + right: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_expression_variant_binary_expression( + &mut self, + operator: &'alloc BinaryOperator, + left: &'alloc arena::Box<'alloc, Expression<'alloc>>, + right: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_expression_variant_call_expression( + &mut self, + ast: &'alloc CallExpression<'alloc>, + ) { + self.enter_enum_expression_variant_call_expression(ast); + self.visit_call_expression(ast); + self.leave_enum_expression_variant_call_expression(ast); + } + + fn enter_enum_expression_variant_call_expression( + &mut self, + ast: &'alloc CallExpression<'alloc>, + ) { + } + + fn leave_enum_expression_variant_call_expression( + &mut self, + ast: &'alloc CallExpression<'alloc>, + ) { + } + + fn visit_enum_expression_variant_compound_assignment_expression( + &mut self, + operator: &'alloc CompoundAssignmentOperator, + binding: &'alloc SimpleAssignmentTarget<'alloc>, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_expression_variant_compound_assignment_expression( + operator, + binding, + expression, + ); + self.visit_compound_assignment_operator(operator); + self.visit_simple_assignment_target(binding); + self.visit_expression(expression); + self.leave_enum_expression_variant_compound_assignment_expression( + operator, + binding, + expression, + ); + } + + fn enter_enum_expression_variant_compound_assignment_expression( + &mut self, + operator: &'alloc CompoundAssignmentOperator, + binding: &'alloc SimpleAssignmentTarget<'alloc>, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_expression_variant_compound_assignment_expression( + &mut self, + operator: &'alloc CompoundAssignmentOperator, + binding: &'alloc SimpleAssignmentTarget<'alloc>, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_expression_variant_conditional_expression( + &mut self, + test: &'alloc arena::Box<'alloc, Expression<'alloc>>, + consequent: &'alloc arena::Box<'alloc, Expression<'alloc>>, + alternate: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_expression_variant_conditional_expression( + test, + consequent, + alternate, + ); + self.visit_expression(test); + self.visit_expression(consequent); + self.visit_expression(alternate); + self.leave_enum_expression_variant_conditional_expression( + test, + consequent, + alternate, + ); + } + + fn enter_enum_expression_variant_conditional_expression( + &mut self, + test: &'alloc arena::Box<'alloc, Expression<'alloc>>, + consequent: &'alloc arena::Box<'alloc, Expression<'alloc>>, + alternate: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_expression_variant_conditional_expression( + &mut self, + test: &'alloc arena::Box<'alloc, Expression<'alloc>>, + consequent: &'alloc arena::Box<'alloc, Expression<'alloc>>, + alternate: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_expression_variant_function_expression( + &mut self, + ast: &'alloc Function<'alloc>, + ) { + self.enter_enum_expression_variant_function_expression(ast); + self.visit_function(ast); + self.leave_enum_expression_variant_function_expression(ast); + } + + fn enter_enum_expression_variant_function_expression( + &mut self, + ast: &'alloc Function<'alloc>, + ) { + } + + fn leave_enum_expression_variant_function_expression( + &mut self, + ast: &'alloc Function<'alloc>, + ) { + } + + fn visit_enum_expression_variant_identifier_expression( + &mut self, + ast: &'alloc IdentifierExpression, + ) { + self.enter_enum_expression_variant_identifier_expression(ast); + self.visit_identifier_expression(ast); + self.leave_enum_expression_variant_identifier_expression(ast); + } + + fn enter_enum_expression_variant_identifier_expression( + &mut self, + ast: &'alloc IdentifierExpression, + ) { + } + + fn leave_enum_expression_variant_identifier_expression( + &mut self, + ast: &'alloc IdentifierExpression, + ) { + } + + fn visit_enum_expression_variant_new_expression( + &mut self, + callee: &'alloc arena::Box<'alloc, Expression<'alloc>>, + arguments: &'alloc Arguments<'alloc>, + ) { + self.enter_enum_expression_variant_new_expression( + callee, + arguments, + ); + self.visit_expression(callee); + self.visit_arguments(arguments); + self.leave_enum_expression_variant_new_expression( + callee, + arguments, + ); + } + + fn enter_enum_expression_variant_new_expression( + &mut self, + callee: &'alloc arena::Box<'alloc, Expression<'alloc>>, + arguments: &'alloc Arguments<'alloc>, + ) { + } + + fn leave_enum_expression_variant_new_expression( + &mut self, + callee: &'alloc arena::Box<'alloc, Expression<'alloc>>, + arguments: &'alloc Arguments<'alloc>, + ) { + } + + fn visit_enum_expression_variant_new_target_expression(&mut self) { + } + + fn visit_enum_expression_variant_object_expression( + &mut self, + ast: &'alloc ObjectExpression<'alloc>, + ) { + self.enter_enum_expression_variant_object_expression(ast); + self.visit_object_expression(ast); + self.leave_enum_expression_variant_object_expression(ast); + } + + fn enter_enum_expression_variant_object_expression( + &mut self, + ast: &'alloc ObjectExpression<'alloc>, + ) { + } + + fn leave_enum_expression_variant_object_expression( + &mut self, + ast: &'alloc ObjectExpression<'alloc>, + ) { + } + + fn visit_enum_expression_variant_optional_expression( + &mut self, + object: &'alloc ExpressionOrSuper<'alloc>, + tail: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_expression_variant_optional_expression( + object, + tail, + ); + self.visit_expression_or_super(object); + self.visit_expression(tail); + self.leave_enum_expression_variant_optional_expression( + object, + tail, + ); + } + + fn enter_enum_expression_variant_optional_expression( + &mut self, + object: &'alloc ExpressionOrSuper<'alloc>, + tail: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_expression_variant_optional_expression( + &mut self, + object: &'alloc ExpressionOrSuper<'alloc>, + tail: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_expression_variant_optional_chain( + &mut self, + ast: &'alloc OptionalChain<'alloc>, + ) { + self.enter_enum_expression_variant_optional_chain(ast); + self.visit_optional_chain(ast); + self.leave_enum_expression_variant_optional_chain(ast); + } + + fn enter_enum_expression_variant_optional_chain( + &mut self, + ast: &'alloc OptionalChain<'alloc>, + ) { + } + + fn leave_enum_expression_variant_optional_chain( + &mut self, + ast: &'alloc OptionalChain<'alloc>, + ) { + } + + fn visit_enum_expression_variant_unary_expression( + &mut self, + operator: &'alloc UnaryOperator, + operand: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_expression_variant_unary_expression( + operator, + operand, + ); + self.visit_unary_operator(operator); + self.visit_expression(operand); + self.leave_enum_expression_variant_unary_expression( + operator, + operand, + ); + } + + fn enter_enum_expression_variant_unary_expression( + &mut self, + operator: &'alloc UnaryOperator, + operand: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_expression_variant_unary_expression( + &mut self, + operator: &'alloc UnaryOperator, + operand: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_expression_variant_template_expression( + &mut self, + ast: &'alloc TemplateExpression<'alloc>, + ) { + self.enter_enum_expression_variant_template_expression(ast); + self.visit_template_expression(ast); + self.leave_enum_expression_variant_template_expression(ast); + } + + fn enter_enum_expression_variant_template_expression( + &mut self, + ast: &'alloc TemplateExpression<'alloc>, + ) { + } + + fn leave_enum_expression_variant_template_expression( + &mut self, + ast: &'alloc TemplateExpression<'alloc>, + ) { + } + + fn visit_enum_expression_variant_this_expression(&mut self) { + } + + fn visit_enum_expression_variant_update_expression( + &mut self, + is_prefix: &'alloc bool, + operator: &'alloc UpdateOperator, + operand: &'alloc SimpleAssignmentTarget<'alloc>, + ) { + self.enter_enum_expression_variant_update_expression( + is_prefix, + operator, + operand, + ); + self.visit_update_operator(operator); + self.visit_simple_assignment_target(operand); + self.leave_enum_expression_variant_update_expression( + is_prefix, + operator, + operand, + ); + } + + fn enter_enum_expression_variant_update_expression( + &mut self, + is_prefix: &'alloc bool, + operator: &'alloc UpdateOperator, + operand: &'alloc SimpleAssignmentTarget<'alloc>, + ) { + } + + fn leave_enum_expression_variant_update_expression( + &mut self, + is_prefix: &'alloc bool, + operator: &'alloc UpdateOperator, + operand: &'alloc SimpleAssignmentTarget<'alloc>, + ) { + } + + fn visit_enum_expression_variant_yield_expression( + &mut self, + expression: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + ) { + self.enter_enum_expression_variant_yield_expression( + expression, + ); + if let Some(item) = expression { + self.visit_expression(item); + } + self.leave_enum_expression_variant_yield_expression( + expression, + ); + } + + fn enter_enum_expression_variant_yield_expression( + &mut self, + expression: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + ) { + } + + fn leave_enum_expression_variant_yield_expression( + &mut self, + expression: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + ) { + } + + fn visit_enum_expression_variant_yield_generator_expression( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_expression_variant_yield_generator_expression( + expression, + ); + self.visit_expression(expression); + self.leave_enum_expression_variant_yield_generator_expression( + expression, + ); + } + + fn enter_enum_expression_variant_yield_generator_expression( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_expression_variant_yield_generator_expression( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_expression_variant_await_expression( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_expression_variant_await_expression( + expression, + ); + self.visit_expression(expression); + self.leave_enum_expression_variant_await_expression( + expression, + ); + } + + fn enter_enum_expression_variant_await_expression( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_expression_variant_await_expression( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_expression_variant_import_call_expression( + &mut self, + argument: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_expression_variant_import_call_expression( + argument, + ); + self.visit_expression(argument); + self.leave_enum_expression_variant_import_call_expression( + argument, + ); + } + + fn enter_enum_expression_variant_import_call_expression( + &mut self, + argument: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_expression_variant_import_call_expression( + &mut self, + argument: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_member_expression(&mut self, ast: &'alloc MemberExpression<'alloc>) { + self.enter_member_expression(ast); + match ast { + MemberExpression::ComputedMemberExpression(ast) => { + self.visit_enum_member_expression_variant_computed_member_expression(ast) + } + MemberExpression::StaticMemberExpression(ast) => { + self.visit_enum_member_expression_variant_static_member_expression(ast) + } + MemberExpression::PrivateFieldExpression(ast) => { + self.visit_enum_member_expression_variant_private_field_expression(ast) + } + } + self.leave_member_expression(ast); + } + + fn enter_member_expression(&mut self, ast: &'alloc MemberExpression<'alloc>) { + } + + fn leave_member_expression(&mut self, ast: &'alloc MemberExpression<'alloc>) { + } + + fn visit_enum_member_expression_variant_computed_member_expression( + &mut self, + ast: &'alloc ComputedMemberExpression<'alloc>, + ) { + self.enter_enum_member_expression_variant_computed_member_expression(ast); + self.visit_computed_member_expression(ast); + self.leave_enum_member_expression_variant_computed_member_expression(ast); + } + + fn enter_enum_member_expression_variant_computed_member_expression( + &mut self, + ast: &'alloc ComputedMemberExpression<'alloc>, + ) { + } + + fn leave_enum_member_expression_variant_computed_member_expression( + &mut self, + ast: &'alloc ComputedMemberExpression<'alloc>, + ) { + } + + fn visit_enum_member_expression_variant_static_member_expression( + &mut self, + ast: &'alloc StaticMemberExpression<'alloc>, + ) { + self.enter_enum_member_expression_variant_static_member_expression(ast); + self.visit_static_member_expression(ast); + self.leave_enum_member_expression_variant_static_member_expression(ast); + } + + fn enter_enum_member_expression_variant_static_member_expression( + &mut self, + ast: &'alloc StaticMemberExpression<'alloc>, + ) { + } + + fn leave_enum_member_expression_variant_static_member_expression( + &mut self, + ast: &'alloc StaticMemberExpression<'alloc>, + ) { + } + + fn visit_enum_member_expression_variant_private_field_expression( + &mut self, + ast: &'alloc PrivateFieldExpression<'alloc>, + ) { + self.enter_enum_member_expression_variant_private_field_expression(ast); + self.visit_private_field_expression(ast); + self.leave_enum_member_expression_variant_private_field_expression(ast); + } + + fn enter_enum_member_expression_variant_private_field_expression( + &mut self, + ast: &'alloc PrivateFieldExpression<'alloc>, + ) { + } + + fn leave_enum_member_expression_variant_private_field_expression( + &mut self, + ast: &'alloc PrivateFieldExpression<'alloc>, + ) { + } + + fn visit_optional_chain(&mut self, ast: &'alloc OptionalChain<'alloc>) { + self.enter_optional_chain(ast); + match ast { + OptionalChain::ComputedMemberExpressionTail { expression, .. } => { + self.visit_enum_optional_chain_variant_computed_member_expression_tail( + expression, + ) + } + OptionalChain::StaticMemberExpressionTail { property, .. } => { + self.visit_enum_optional_chain_variant_static_member_expression_tail( + property, + ) + } + OptionalChain::PrivateFieldExpressionTail { field, .. } => { + self.visit_enum_optional_chain_variant_private_field_expression_tail( + field, + ) + } + OptionalChain::CallExpressionTail { arguments, .. } => { + self.visit_enum_optional_chain_variant_call_expression_tail( + arguments, + ) + } + OptionalChain::ComputedMemberExpression(ast) => { + self.visit_enum_optional_chain_variant_computed_member_expression(ast) + } + OptionalChain::StaticMemberExpression(ast) => { + self.visit_enum_optional_chain_variant_static_member_expression(ast) + } + OptionalChain::PrivateFieldExpression(ast) => { + self.visit_enum_optional_chain_variant_private_field_expression(ast) + } + OptionalChain::CallExpression(ast) => { + self.visit_enum_optional_chain_variant_call_expression(ast) + } + } + self.leave_optional_chain(ast); + } + + fn enter_optional_chain(&mut self, ast: &'alloc OptionalChain<'alloc>) { + } + + fn leave_optional_chain(&mut self, ast: &'alloc OptionalChain<'alloc>) { + } + + fn visit_enum_optional_chain_variant_computed_member_expression_tail( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_optional_chain_variant_computed_member_expression_tail( + expression, + ); + self.visit_expression(expression); + self.leave_enum_optional_chain_variant_computed_member_expression_tail( + expression, + ); + } + + fn enter_enum_optional_chain_variant_computed_member_expression_tail( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_optional_chain_variant_computed_member_expression_tail( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_optional_chain_variant_static_member_expression_tail( + &mut self, + property: &'alloc IdentifierName, + ) { + self.enter_enum_optional_chain_variant_static_member_expression_tail( + property, + ); + self.visit_identifier_name(property); + self.leave_enum_optional_chain_variant_static_member_expression_tail( + property, + ); + } + + fn enter_enum_optional_chain_variant_static_member_expression_tail( + &mut self, + property: &'alloc IdentifierName, + ) { + } + + fn leave_enum_optional_chain_variant_static_member_expression_tail( + &mut self, + property: &'alloc IdentifierName, + ) { + } + + fn visit_enum_optional_chain_variant_private_field_expression_tail( + &mut self, + field: &'alloc PrivateIdentifier, + ) { + self.enter_enum_optional_chain_variant_private_field_expression_tail( + field, + ); + self.visit_private_identifier(field); + self.leave_enum_optional_chain_variant_private_field_expression_tail( + field, + ); + } + + fn enter_enum_optional_chain_variant_private_field_expression_tail( + &mut self, + field: &'alloc PrivateIdentifier, + ) { + } + + fn leave_enum_optional_chain_variant_private_field_expression_tail( + &mut self, + field: &'alloc PrivateIdentifier, + ) { + } + + fn visit_enum_optional_chain_variant_call_expression_tail( + &mut self, + arguments: &'alloc Arguments<'alloc>, + ) { + self.enter_enum_optional_chain_variant_call_expression_tail( + arguments, + ); + self.visit_arguments(arguments); + self.leave_enum_optional_chain_variant_call_expression_tail( + arguments, + ); + } + + fn enter_enum_optional_chain_variant_call_expression_tail( + &mut self, + arguments: &'alloc Arguments<'alloc>, + ) { + } + + fn leave_enum_optional_chain_variant_call_expression_tail( + &mut self, + arguments: &'alloc Arguments<'alloc>, + ) { + } + + fn visit_enum_optional_chain_variant_computed_member_expression( + &mut self, + ast: &'alloc ComputedMemberExpression<'alloc>, + ) { + self.enter_enum_optional_chain_variant_computed_member_expression(ast); + self.visit_computed_member_expression(ast); + self.leave_enum_optional_chain_variant_computed_member_expression(ast); + } + + fn enter_enum_optional_chain_variant_computed_member_expression( + &mut self, + ast: &'alloc ComputedMemberExpression<'alloc>, + ) { + } + + fn leave_enum_optional_chain_variant_computed_member_expression( + &mut self, + ast: &'alloc ComputedMemberExpression<'alloc>, + ) { + } + + fn visit_enum_optional_chain_variant_static_member_expression( + &mut self, + ast: &'alloc StaticMemberExpression<'alloc>, + ) { + self.enter_enum_optional_chain_variant_static_member_expression(ast); + self.visit_static_member_expression(ast); + self.leave_enum_optional_chain_variant_static_member_expression(ast); + } + + fn enter_enum_optional_chain_variant_static_member_expression( + &mut self, + ast: &'alloc StaticMemberExpression<'alloc>, + ) { + } + + fn leave_enum_optional_chain_variant_static_member_expression( + &mut self, + ast: &'alloc StaticMemberExpression<'alloc>, + ) { + } + + fn visit_enum_optional_chain_variant_private_field_expression( + &mut self, + ast: &'alloc PrivateFieldExpression<'alloc>, + ) { + self.enter_enum_optional_chain_variant_private_field_expression(ast); + self.visit_private_field_expression(ast); + self.leave_enum_optional_chain_variant_private_field_expression(ast); + } + + fn enter_enum_optional_chain_variant_private_field_expression( + &mut self, + ast: &'alloc PrivateFieldExpression<'alloc>, + ) { + } + + fn leave_enum_optional_chain_variant_private_field_expression( + &mut self, + ast: &'alloc PrivateFieldExpression<'alloc>, + ) { + } + + fn visit_enum_optional_chain_variant_call_expression( + &mut self, + ast: &'alloc CallExpression<'alloc>, + ) { + self.enter_enum_optional_chain_variant_call_expression(ast); + self.visit_call_expression(ast); + self.leave_enum_optional_chain_variant_call_expression(ast); + } + + fn enter_enum_optional_chain_variant_call_expression( + &mut self, + ast: &'alloc CallExpression<'alloc>, + ) { + } + + fn leave_enum_optional_chain_variant_call_expression( + &mut self, + ast: &'alloc CallExpression<'alloc>, + ) { + } + + fn visit_property_name(&mut self, ast: &'alloc PropertyName<'alloc>) { + self.enter_property_name(ast); + match ast { + PropertyName::ComputedPropertyName(ast) => { + self.visit_enum_property_name_variant_computed_property_name(ast) + } + PropertyName::StaticPropertyName(ast) => { + self.visit_enum_property_name_variant_static_property_name(ast) + } + PropertyName::StaticNumericPropertyName(ast) => { + self.visit_enum_property_name_variant_static_numeric_property_name(ast) + } + } + self.leave_property_name(ast); + } + + fn enter_property_name(&mut self, ast: &'alloc PropertyName<'alloc>) { + } + + fn leave_property_name(&mut self, ast: &'alloc PropertyName<'alloc>) { + } + + fn visit_enum_property_name_variant_computed_property_name( + &mut self, + ast: &'alloc ComputedPropertyName<'alloc>, + ) { + self.enter_enum_property_name_variant_computed_property_name(ast); + self.visit_computed_property_name(ast); + self.leave_enum_property_name_variant_computed_property_name(ast); + } + + fn enter_enum_property_name_variant_computed_property_name( + &mut self, + ast: &'alloc ComputedPropertyName<'alloc>, + ) { + } + + fn leave_enum_property_name_variant_computed_property_name( + &mut self, + ast: &'alloc ComputedPropertyName<'alloc>, + ) { + } + + fn visit_enum_property_name_variant_static_property_name( + &mut self, + ast: &'alloc StaticPropertyName, + ) { + self.enter_enum_property_name_variant_static_property_name(ast); + self.visit_static_property_name(ast); + self.leave_enum_property_name_variant_static_property_name(ast); + } + + fn enter_enum_property_name_variant_static_property_name( + &mut self, + ast: &'alloc StaticPropertyName, + ) { + } + + fn leave_enum_property_name_variant_static_property_name( + &mut self, + ast: &'alloc StaticPropertyName, + ) { + } + + fn visit_enum_property_name_variant_static_numeric_property_name( + &mut self, + ast: &'alloc NumericLiteral, + ) { + self.enter_enum_property_name_variant_static_numeric_property_name(ast); + self.visit_numeric_literal(ast); + self.leave_enum_property_name_variant_static_numeric_property_name(ast); + } + + fn enter_enum_property_name_variant_static_numeric_property_name( + &mut self, + ast: &'alloc NumericLiteral, + ) { + } + + fn leave_enum_property_name_variant_static_numeric_property_name( + &mut self, + ast: &'alloc NumericLiteral, + ) { + } + + fn visit_call_expression(&mut self, ast: &'alloc CallExpression<'alloc>) { + self.enter_call_expression(ast); + self.visit_expression_or_super(&ast.callee); + self.visit_arguments(&ast.arguments); + self.leave_call_expression(ast); + } + + fn enter_call_expression(&mut self, ast: &'alloc CallExpression<'alloc>) { + } + + fn leave_call_expression(&mut self, ast: &'alloc CallExpression<'alloc>) { + } + + fn visit_class_element_name(&mut self, ast: &'alloc ClassElementName<'alloc>) { + self.enter_class_element_name(ast); + match ast { + ClassElementName::ComputedPropertyName(ast) => { + self.visit_enum_class_element_name_variant_computed_property_name(ast) + } + ClassElementName::StaticPropertyName(ast) => { + self.visit_enum_class_element_name_variant_static_property_name(ast) + } + ClassElementName::StaticNumericPropertyName(ast) => { + self.visit_enum_class_element_name_variant_static_numeric_property_name(ast) + } + ClassElementName::PrivateFieldName(ast) => { + self.visit_enum_class_element_name_variant_private_field_name(ast) + } + } + self.leave_class_element_name(ast); + } + + fn enter_class_element_name(&mut self, ast: &'alloc ClassElementName<'alloc>) { + } + + fn leave_class_element_name(&mut self, ast: &'alloc ClassElementName<'alloc>) { + } + + fn visit_enum_class_element_name_variant_computed_property_name( + &mut self, + ast: &'alloc ComputedPropertyName<'alloc>, + ) { + self.enter_enum_class_element_name_variant_computed_property_name(ast); + self.visit_computed_property_name(ast); + self.leave_enum_class_element_name_variant_computed_property_name(ast); + } + + fn enter_enum_class_element_name_variant_computed_property_name( + &mut self, + ast: &'alloc ComputedPropertyName<'alloc>, + ) { + } + + fn leave_enum_class_element_name_variant_computed_property_name( + &mut self, + ast: &'alloc ComputedPropertyName<'alloc>, + ) { + } + + fn visit_enum_class_element_name_variant_static_property_name( + &mut self, + ast: &'alloc StaticPropertyName, + ) { + self.enter_enum_class_element_name_variant_static_property_name(ast); + self.visit_static_property_name(ast); + self.leave_enum_class_element_name_variant_static_property_name(ast); + } + + fn enter_enum_class_element_name_variant_static_property_name( + &mut self, + ast: &'alloc StaticPropertyName, + ) { + } + + fn leave_enum_class_element_name_variant_static_property_name( + &mut self, + ast: &'alloc StaticPropertyName, + ) { + } + + fn visit_enum_class_element_name_variant_static_numeric_property_name( + &mut self, + ast: &'alloc NumericLiteral, + ) { + self.enter_enum_class_element_name_variant_static_numeric_property_name(ast); + self.visit_numeric_literal(ast); + self.leave_enum_class_element_name_variant_static_numeric_property_name(ast); + } + + fn enter_enum_class_element_name_variant_static_numeric_property_name( + &mut self, + ast: &'alloc NumericLiteral, + ) { + } + + fn leave_enum_class_element_name_variant_static_numeric_property_name( + &mut self, + ast: &'alloc NumericLiteral, + ) { + } + + fn visit_enum_class_element_name_variant_private_field_name( + &mut self, + ast: &'alloc PrivateIdentifier, + ) { + self.enter_enum_class_element_name_variant_private_field_name(ast); + self.visit_private_identifier(ast); + self.leave_enum_class_element_name_variant_private_field_name(ast); + } + + fn enter_enum_class_element_name_variant_private_field_name( + &mut self, + ast: &'alloc PrivateIdentifier, + ) { + } + + fn leave_enum_class_element_name_variant_private_field_name( + &mut self, + ast: &'alloc PrivateIdentifier, + ) { + } + + fn visit_object_property(&mut self, ast: &'alloc ObjectProperty<'alloc>) { + self.enter_object_property(ast); + match ast { + ObjectProperty::NamedObjectProperty(ast) => { + self.visit_enum_object_property_variant_named_object_property(ast) + } + ObjectProperty::ShorthandProperty(ast) => { + self.visit_enum_object_property_variant_shorthand_property(ast) + } + ObjectProperty::SpreadProperty(ast) => { + self.visit_enum_object_property_variant_spread_property(ast) + } + } + self.leave_object_property(ast); + } + + fn enter_object_property(&mut self, ast: &'alloc ObjectProperty<'alloc>) { + } + + fn leave_object_property(&mut self, ast: &'alloc ObjectProperty<'alloc>) { + } + + fn visit_enum_object_property_variant_named_object_property( + &mut self, + ast: &'alloc NamedObjectProperty<'alloc>, + ) { + self.enter_enum_object_property_variant_named_object_property(ast); + self.visit_named_object_property(ast); + self.leave_enum_object_property_variant_named_object_property(ast); + } + + fn enter_enum_object_property_variant_named_object_property( + &mut self, + ast: &'alloc NamedObjectProperty<'alloc>, + ) { + } + + fn leave_enum_object_property_variant_named_object_property( + &mut self, + ast: &'alloc NamedObjectProperty<'alloc>, + ) { + } + + fn visit_enum_object_property_variant_shorthand_property( + &mut self, + ast: &'alloc ShorthandProperty, + ) { + self.enter_enum_object_property_variant_shorthand_property(ast); + self.visit_shorthand_property(ast); + self.leave_enum_object_property_variant_shorthand_property(ast); + } + + fn enter_enum_object_property_variant_shorthand_property( + &mut self, + ast: &'alloc ShorthandProperty, + ) { + } + + fn leave_enum_object_property_variant_shorthand_property( + &mut self, + ast: &'alloc ShorthandProperty, + ) { + } + + fn visit_enum_object_property_variant_spread_property( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_object_property_variant_spread_property(ast); + self.visit_expression(ast); + self.leave_enum_object_property_variant_spread_property(ast); + } + + fn enter_enum_object_property_variant_spread_property( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_object_property_variant_spread_property( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_named_object_property(&mut self, ast: &'alloc NamedObjectProperty<'alloc>) { + self.enter_named_object_property(ast); + match ast { + NamedObjectProperty::MethodDefinition(ast) => { + self.visit_enum_named_object_property_variant_method_definition(ast) + } + NamedObjectProperty::DataProperty(ast) => { + self.visit_enum_named_object_property_variant_data_property(ast) + } + } + self.leave_named_object_property(ast); + } + + fn enter_named_object_property(&mut self, ast: &'alloc NamedObjectProperty<'alloc>) { + } + + fn leave_named_object_property(&mut self, ast: &'alloc NamedObjectProperty<'alloc>) { + } + + fn visit_enum_named_object_property_variant_method_definition( + &mut self, + ast: &'alloc MethodDefinition<'alloc>, + ) { + self.enter_enum_named_object_property_variant_method_definition(ast); + self.visit_method_definition(ast); + self.leave_enum_named_object_property_variant_method_definition(ast); + } + + fn enter_enum_named_object_property_variant_method_definition( + &mut self, + ast: &'alloc MethodDefinition<'alloc>, + ) { + } + + fn leave_enum_named_object_property_variant_method_definition( + &mut self, + ast: &'alloc MethodDefinition<'alloc>, + ) { + } + + fn visit_enum_named_object_property_variant_data_property( + &mut self, + ast: &'alloc DataProperty<'alloc>, + ) { + self.enter_enum_named_object_property_variant_data_property(ast); + self.visit_data_property(ast); + self.leave_enum_named_object_property_variant_data_property(ast); + } + + fn enter_enum_named_object_property_variant_data_property( + &mut self, + ast: &'alloc DataProperty<'alloc>, + ) { + } + + fn leave_enum_named_object_property_variant_data_property( + &mut self, + ast: &'alloc DataProperty<'alloc>, + ) { + } + + fn visit_method_definition(&mut self, ast: &'alloc MethodDefinition<'alloc>) { + self.enter_method_definition(ast); + match ast { + MethodDefinition::Method(ast) => { + self.visit_enum_method_definition_variant_method(ast) + } + MethodDefinition::Getter(ast) => { + self.visit_enum_method_definition_variant_getter(ast) + } + MethodDefinition::Setter(ast) => { + self.visit_enum_method_definition_variant_setter(ast) + } + } + self.leave_method_definition(ast); + } + + fn enter_method_definition(&mut self, ast: &'alloc MethodDefinition<'alloc>) { + } + + fn leave_method_definition(&mut self, ast: &'alloc MethodDefinition<'alloc>) { + } + + fn visit_enum_method_definition_variant_method( + &mut self, + ast: &'alloc Method<'alloc>, + ) { + self.enter_enum_method_definition_variant_method(ast); + self.visit_method(ast); + self.leave_enum_method_definition_variant_method(ast); + } + + fn enter_enum_method_definition_variant_method( + &mut self, + ast: &'alloc Method<'alloc>, + ) { + } + + fn leave_enum_method_definition_variant_method( + &mut self, + ast: &'alloc Method<'alloc>, + ) { + } + + fn visit_enum_method_definition_variant_getter( + &mut self, + ast: &'alloc Getter<'alloc>, + ) { + self.enter_enum_method_definition_variant_getter(ast); + self.visit_getter(ast); + self.leave_enum_method_definition_variant_getter(ast); + } + + fn enter_enum_method_definition_variant_getter( + &mut self, + ast: &'alloc Getter<'alloc>, + ) { + } + + fn leave_enum_method_definition_variant_getter( + &mut self, + ast: &'alloc Getter<'alloc>, + ) { + } + + fn visit_enum_method_definition_variant_setter( + &mut self, + ast: &'alloc Setter<'alloc>, + ) { + self.enter_enum_method_definition_variant_setter(ast); + self.visit_setter(ast); + self.leave_enum_method_definition_variant_setter(ast); + } + + fn enter_enum_method_definition_variant_setter( + &mut self, + ast: &'alloc Setter<'alloc>, + ) { + } + + fn leave_enum_method_definition_variant_setter( + &mut self, + ast: &'alloc Setter<'alloc>, + ) { + } + + fn visit_import_declaration(&mut self, ast: &'alloc ImportDeclaration<'alloc>) { + self.enter_import_declaration(ast); + match ast { + ImportDeclaration::Import(ast) => { + self.visit_enum_import_declaration_variant_import(ast) + } + ImportDeclaration::ImportNamespace(ast) => { + self.visit_enum_import_declaration_variant_import_namespace(ast) + } + } + self.leave_import_declaration(ast); + } + + fn enter_import_declaration(&mut self, ast: &'alloc ImportDeclaration<'alloc>) { + } + + fn leave_import_declaration(&mut self, ast: &'alloc ImportDeclaration<'alloc>) { + } + + fn visit_enum_import_declaration_variant_import( + &mut self, + ast: &'alloc Import<'alloc>, + ) { + self.enter_enum_import_declaration_variant_import(ast); + self.visit_import(ast); + self.leave_enum_import_declaration_variant_import(ast); + } + + fn enter_enum_import_declaration_variant_import( + &mut self, + ast: &'alloc Import<'alloc>, + ) { + } + + fn leave_enum_import_declaration_variant_import( + &mut self, + ast: &'alloc Import<'alloc>, + ) { + } + + fn visit_enum_import_declaration_variant_import_namespace( + &mut self, + ast: &'alloc ImportNamespace, + ) { + self.enter_enum_import_declaration_variant_import_namespace(ast); + self.visit_import_namespace(ast); + self.leave_enum_import_declaration_variant_import_namespace(ast); + } + + fn enter_enum_import_declaration_variant_import_namespace( + &mut self, + ast: &'alloc ImportNamespace, + ) { + } + + fn leave_enum_import_declaration_variant_import_namespace( + &mut self, + ast: &'alloc ImportNamespace, + ) { + } + + fn visit_export_declaration(&mut self, ast: &'alloc ExportDeclaration<'alloc>) { + self.enter_export_declaration(ast); + match ast { + ExportDeclaration::ExportAllFrom(ast) => { + self.visit_enum_export_declaration_variant_export_all_from(ast) + } + ExportDeclaration::ExportFrom(ast) => { + self.visit_enum_export_declaration_variant_export_from(ast) + } + ExportDeclaration::ExportLocals(ast) => { + self.visit_enum_export_declaration_variant_export_locals(ast) + } + ExportDeclaration::Export(ast) => { + self.visit_enum_export_declaration_variant_export(ast) + } + ExportDeclaration::ExportDefault(ast) => { + self.visit_enum_export_declaration_variant_export_default(ast) + } + } + self.leave_export_declaration(ast); + } + + fn enter_export_declaration(&mut self, ast: &'alloc ExportDeclaration<'alloc>) { + } + + fn leave_export_declaration(&mut self, ast: &'alloc ExportDeclaration<'alloc>) { + } + + fn visit_enum_export_declaration_variant_export_all_from( + &mut self, + ast: &'alloc ExportAllFrom, + ) { + self.enter_enum_export_declaration_variant_export_all_from(ast); + self.visit_export_all_from(ast); + self.leave_enum_export_declaration_variant_export_all_from(ast); + } + + fn enter_enum_export_declaration_variant_export_all_from( + &mut self, + ast: &'alloc ExportAllFrom, + ) { + } + + fn leave_enum_export_declaration_variant_export_all_from( + &mut self, + ast: &'alloc ExportAllFrom, + ) { + } + + fn visit_enum_export_declaration_variant_export_from( + &mut self, + ast: &'alloc ExportFrom<'alloc>, + ) { + self.enter_enum_export_declaration_variant_export_from(ast); + self.visit_export_from(ast); + self.leave_enum_export_declaration_variant_export_from(ast); + } + + fn enter_enum_export_declaration_variant_export_from( + &mut self, + ast: &'alloc ExportFrom<'alloc>, + ) { + } + + fn leave_enum_export_declaration_variant_export_from( + &mut self, + ast: &'alloc ExportFrom<'alloc>, + ) { + } + + fn visit_enum_export_declaration_variant_export_locals( + &mut self, + ast: &'alloc ExportLocals<'alloc>, + ) { + self.enter_enum_export_declaration_variant_export_locals(ast); + self.visit_export_locals(ast); + self.leave_enum_export_declaration_variant_export_locals(ast); + } + + fn enter_enum_export_declaration_variant_export_locals( + &mut self, + ast: &'alloc ExportLocals<'alloc>, + ) { + } + + fn leave_enum_export_declaration_variant_export_locals( + &mut self, + ast: &'alloc ExportLocals<'alloc>, + ) { + } + + fn visit_enum_export_declaration_variant_export( + &mut self, + ast: &'alloc Export<'alloc>, + ) { + self.enter_enum_export_declaration_variant_export(ast); + self.visit_export(ast); + self.leave_enum_export_declaration_variant_export(ast); + } + + fn enter_enum_export_declaration_variant_export( + &mut self, + ast: &'alloc Export<'alloc>, + ) { + } + + fn leave_enum_export_declaration_variant_export( + &mut self, + ast: &'alloc Export<'alloc>, + ) { + } + + fn visit_enum_export_declaration_variant_export_default( + &mut self, + ast: &'alloc ExportDefault<'alloc>, + ) { + self.enter_enum_export_declaration_variant_export_default(ast); + self.visit_export_default(ast); + self.leave_enum_export_declaration_variant_export_default(ast); + } + + fn enter_enum_export_declaration_variant_export_default( + &mut self, + ast: &'alloc ExportDefault<'alloc>, + ) { + } + + fn leave_enum_export_declaration_variant_export_default( + &mut self, + ast: &'alloc ExportDefault<'alloc>, + ) { + } + + fn visit_variable_reference(&mut self, ast: &'alloc VariableReference) { + self.enter_variable_reference(ast); + match ast { + VariableReference::BindingIdentifier(ast) => { + self.visit_enum_variable_reference_variant_binding_identifier(ast) + } + VariableReference::AssignmentTargetIdentifier(ast) => { + self.visit_enum_variable_reference_variant_assignment_target_identifier(ast) + } + } + self.leave_variable_reference(ast); + } + + fn enter_variable_reference(&mut self, ast: &'alloc VariableReference) { + } + + fn leave_variable_reference(&mut self, ast: &'alloc VariableReference) { + } + + fn visit_enum_variable_reference_variant_binding_identifier( + &mut self, + ast: &'alloc BindingIdentifier, + ) { + self.enter_enum_variable_reference_variant_binding_identifier(ast); + self.visit_binding_identifier(ast); + self.leave_enum_variable_reference_variant_binding_identifier(ast); + } + + fn enter_enum_variable_reference_variant_binding_identifier( + &mut self, + ast: &'alloc BindingIdentifier, + ) { + } + + fn leave_enum_variable_reference_variant_binding_identifier( + &mut self, + ast: &'alloc BindingIdentifier, + ) { + } + + fn visit_enum_variable_reference_variant_assignment_target_identifier( + &mut self, + ast: &'alloc AssignmentTargetIdentifier, + ) { + self.enter_enum_variable_reference_variant_assignment_target_identifier(ast); + self.visit_assignment_target_identifier(ast); + self.leave_enum_variable_reference_variant_assignment_target_identifier(ast); + } + + fn enter_enum_variable_reference_variant_assignment_target_identifier( + &mut self, + ast: &'alloc AssignmentTargetIdentifier, + ) { + } + + fn leave_enum_variable_reference_variant_assignment_target_identifier( + &mut self, + ast: &'alloc AssignmentTargetIdentifier, + ) { + } + + fn visit_binding_pattern(&mut self, ast: &'alloc BindingPattern<'alloc>) { + self.enter_binding_pattern(ast); + match ast { + BindingPattern::ObjectBinding(ast) => { + self.visit_enum_binding_pattern_variant_object_binding(ast) + } + BindingPattern::ArrayBinding(ast) => { + self.visit_enum_binding_pattern_variant_array_binding(ast) + } + } + self.leave_binding_pattern(ast); + } + + fn enter_binding_pattern(&mut self, ast: &'alloc BindingPattern<'alloc>) { + } + + fn leave_binding_pattern(&mut self, ast: &'alloc BindingPattern<'alloc>) { + } + + fn visit_enum_binding_pattern_variant_object_binding( + &mut self, + ast: &'alloc ObjectBinding<'alloc>, + ) { + self.enter_enum_binding_pattern_variant_object_binding(ast); + self.visit_object_binding(ast); + self.leave_enum_binding_pattern_variant_object_binding(ast); + } + + fn enter_enum_binding_pattern_variant_object_binding( + &mut self, + ast: &'alloc ObjectBinding<'alloc>, + ) { + } + + fn leave_enum_binding_pattern_variant_object_binding( + &mut self, + ast: &'alloc ObjectBinding<'alloc>, + ) { + } + + fn visit_enum_binding_pattern_variant_array_binding( + &mut self, + ast: &'alloc ArrayBinding<'alloc>, + ) { + self.enter_enum_binding_pattern_variant_array_binding(ast); + self.visit_array_binding(ast); + self.leave_enum_binding_pattern_variant_array_binding(ast); + } + + fn enter_enum_binding_pattern_variant_array_binding( + &mut self, + ast: &'alloc ArrayBinding<'alloc>, + ) { + } + + fn leave_enum_binding_pattern_variant_array_binding( + &mut self, + ast: &'alloc ArrayBinding<'alloc>, + ) { + } + + fn visit_binding(&mut self, ast: &'alloc Binding<'alloc>) { + self.enter_binding(ast); + match ast { + Binding::BindingPattern(ast) => { + self.visit_enum_binding_variant_binding_pattern(ast) + } + Binding::BindingIdentifier(ast) => { + self.visit_enum_binding_variant_binding_identifier(ast) + } + } + self.leave_binding(ast); + } + + fn enter_binding(&mut self, ast: &'alloc Binding<'alloc>) { + } + + fn leave_binding(&mut self, ast: &'alloc Binding<'alloc>) { + } + + fn visit_enum_binding_variant_binding_pattern( + &mut self, + ast: &'alloc BindingPattern<'alloc>, + ) { + self.enter_enum_binding_variant_binding_pattern(ast); + self.visit_binding_pattern(ast); + self.leave_enum_binding_variant_binding_pattern(ast); + } + + fn enter_enum_binding_variant_binding_pattern( + &mut self, + ast: &'alloc BindingPattern<'alloc>, + ) { + } + + fn leave_enum_binding_variant_binding_pattern( + &mut self, + ast: &'alloc BindingPattern<'alloc>, + ) { + } + + fn visit_enum_binding_variant_binding_identifier( + &mut self, + ast: &'alloc BindingIdentifier, + ) { + self.enter_enum_binding_variant_binding_identifier(ast); + self.visit_binding_identifier(ast); + self.leave_enum_binding_variant_binding_identifier(ast); + } + + fn enter_enum_binding_variant_binding_identifier( + &mut self, + ast: &'alloc BindingIdentifier, + ) { + } + + fn leave_enum_binding_variant_binding_identifier( + &mut self, + ast: &'alloc BindingIdentifier, + ) { + } + + fn visit_simple_assignment_target(&mut self, ast: &'alloc SimpleAssignmentTarget<'alloc>) { + self.enter_simple_assignment_target(ast); + match ast { + SimpleAssignmentTarget::AssignmentTargetIdentifier(ast) => { + self.visit_enum_simple_assignment_target_variant_assignment_target_identifier(ast) + } + SimpleAssignmentTarget::MemberAssignmentTarget(ast) => { + self.visit_enum_simple_assignment_target_variant_member_assignment_target(ast) + } + } + self.leave_simple_assignment_target(ast); + } + + fn enter_simple_assignment_target(&mut self, ast: &'alloc SimpleAssignmentTarget<'alloc>) { + } + + fn leave_simple_assignment_target(&mut self, ast: &'alloc SimpleAssignmentTarget<'alloc>) { + } + + fn visit_enum_simple_assignment_target_variant_assignment_target_identifier( + &mut self, + ast: &'alloc AssignmentTargetIdentifier, + ) { + self.enter_enum_simple_assignment_target_variant_assignment_target_identifier(ast); + self.visit_assignment_target_identifier(ast); + self.leave_enum_simple_assignment_target_variant_assignment_target_identifier(ast); + } + + fn enter_enum_simple_assignment_target_variant_assignment_target_identifier( + &mut self, + ast: &'alloc AssignmentTargetIdentifier, + ) { + } + + fn leave_enum_simple_assignment_target_variant_assignment_target_identifier( + &mut self, + ast: &'alloc AssignmentTargetIdentifier, + ) { + } + + fn visit_enum_simple_assignment_target_variant_member_assignment_target( + &mut self, + ast: &'alloc MemberAssignmentTarget<'alloc>, + ) { + self.enter_enum_simple_assignment_target_variant_member_assignment_target(ast); + self.visit_member_assignment_target(ast); + self.leave_enum_simple_assignment_target_variant_member_assignment_target(ast); + } + + fn enter_enum_simple_assignment_target_variant_member_assignment_target( + &mut self, + ast: &'alloc MemberAssignmentTarget<'alloc>, + ) { + } + + fn leave_enum_simple_assignment_target_variant_member_assignment_target( + &mut self, + ast: &'alloc MemberAssignmentTarget<'alloc>, + ) { + } + + fn visit_assignment_target_pattern(&mut self, ast: &'alloc AssignmentTargetPattern<'alloc>) { + self.enter_assignment_target_pattern(ast); + match ast { + AssignmentTargetPattern::ArrayAssignmentTarget(ast) => { + self.visit_enum_assignment_target_pattern_variant_array_assignment_target(ast) + } + AssignmentTargetPattern::ObjectAssignmentTarget(ast) => { + self.visit_enum_assignment_target_pattern_variant_object_assignment_target(ast) + } + } + self.leave_assignment_target_pattern(ast); + } + + fn enter_assignment_target_pattern(&mut self, ast: &'alloc AssignmentTargetPattern<'alloc>) { + } + + fn leave_assignment_target_pattern(&mut self, ast: &'alloc AssignmentTargetPattern<'alloc>) { + } + + fn visit_enum_assignment_target_pattern_variant_array_assignment_target( + &mut self, + ast: &'alloc ArrayAssignmentTarget<'alloc>, + ) { + self.enter_enum_assignment_target_pattern_variant_array_assignment_target(ast); + self.visit_array_assignment_target(ast); + self.leave_enum_assignment_target_pattern_variant_array_assignment_target(ast); + } + + fn enter_enum_assignment_target_pattern_variant_array_assignment_target( + &mut self, + ast: &'alloc ArrayAssignmentTarget<'alloc>, + ) { + } + + fn leave_enum_assignment_target_pattern_variant_array_assignment_target( + &mut self, + ast: &'alloc ArrayAssignmentTarget<'alloc>, + ) { + } + + fn visit_enum_assignment_target_pattern_variant_object_assignment_target( + &mut self, + ast: &'alloc ObjectAssignmentTarget<'alloc>, + ) { + self.enter_enum_assignment_target_pattern_variant_object_assignment_target(ast); + self.visit_object_assignment_target(ast); + self.leave_enum_assignment_target_pattern_variant_object_assignment_target(ast); + } + + fn enter_enum_assignment_target_pattern_variant_object_assignment_target( + &mut self, + ast: &'alloc ObjectAssignmentTarget<'alloc>, + ) { + } + + fn leave_enum_assignment_target_pattern_variant_object_assignment_target( + &mut self, + ast: &'alloc ObjectAssignmentTarget<'alloc>, + ) { + } + + fn visit_assignment_target(&mut self, ast: &'alloc AssignmentTarget<'alloc>) { + self.enter_assignment_target(ast); + match ast { + AssignmentTarget::AssignmentTargetPattern(ast) => { + self.visit_enum_assignment_target_variant_assignment_target_pattern(ast) + } + AssignmentTarget::SimpleAssignmentTarget(ast) => { + self.visit_enum_assignment_target_variant_simple_assignment_target(ast) + } + } + self.leave_assignment_target(ast); + } + + fn enter_assignment_target(&mut self, ast: &'alloc AssignmentTarget<'alloc>) { + } + + fn leave_assignment_target(&mut self, ast: &'alloc AssignmentTarget<'alloc>) { + } + + fn visit_enum_assignment_target_variant_assignment_target_pattern( + &mut self, + ast: &'alloc AssignmentTargetPattern<'alloc>, + ) { + self.enter_enum_assignment_target_variant_assignment_target_pattern(ast); + self.visit_assignment_target_pattern(ast); + self.leave_enum_assignment_target_variant_assignment_target_pattern(ast); + } + + fn enter_enum_assignment_target_variant_assignment_target_pattern( + &mut self, + ast: &'alloc AssignmentTargetPattern<'alloc>, + ) { + } + + fn leave_enum_assignment_target_variant_assignment_target_pattern( + &mut self, + ast: &'alloc AssignmentTargetPattern<'alloc>, + ) { + } + + fn visit_enum_assignment_target_variant_simple_assignment_target( + &mut self, + ast: &'alloc SimpleAssignmentTarget<'alloc>, + ) { + self.enter_enum_assignment_target_variant_simple_assignment_target(ast); + self.visit_simple_assignment_target(ast); + self.leave_enum_assignment_target_variant_simple_assignment_target(ast); + } + + fn enter_enum_assignment_target_variant_simple_assignment_target( + &mut self, + ast: &'alloc SimpleAssignmentTarget<'alloc>, + ) { + } + + fn leave_enum_assignment_target_variant_simple_assignment_target( + &mut self, + ast: &'alloc SimpleAssignmentTarget<'alloc>, + ) { + } + + fn visit_parameter(&mut self, ast: &'alloc Parameter<'alloc>) { + self.enter_parameter(ast); + match ast { + Parameter::Binding(ast) => { + self.visit_enum_parameter_variant_binding(ast) + } + Parameter::BindingWithDefault(ast) => { + self.visit_enum_parameter_variant_binding_with_default(ast) + } + } + self.leave_parameter(ast); + } + + fn enter_parameter(&mut self, ast: &'alloc Parameter<'alloc>) { + } + + fn leave_parameter(&mut self, ast: &'alloc Parameter<'alloc>) { + } + + fn visit_enum_parameter_variant_binding( + &mut self, + ast: &'alloc Binding<'alloc>, + ) { + self.enter_enum_parameter_variant_binding(ast); + self.visit_binding(ast); + self.leave_enum_parameter_variant_binding(ast); + } + + fn enter_enum_parameter_variant_binding( + &mut self, + ast: &'alloc Binding<'alloc>, + ) { + } + + fn leave_enum_parameter_variant_binding( + &mut self, + ast: &'alloc Binding<'alloc>, + ) { + } + + fn visit_enum_parameter_variant_binding_with_default( + &mut self, + ast: &'alloc BindingWithDefault<'alloc>, + ) { + self.enter_enum_parameter_variant_binding_with_default(ast); + self.visit_binding_with_default(ast); + self.leave_enum_parameter_variant_binding_with_default(ast); + } + + fn enter_enum_parameter_variant_binding_with_default( + &mut self, + ast: &'alloc BindingWithDefault<'alloc>, + ) { + } + + fn leave_enum_parameter_variant_binding_with_default( + &mut self, + ast: &'alloc BindingWithDefault<'alloc>, + ) { + } + + fn visit_binding_with_default(&mut self, ast: &'alloc BindingWithDefault<'alloc>) { + self.enter_binding_with_default(ast); + self.visit_binding(&ast.binding); + self.visit_expression(&ast.init); + self.leave_binding_with_default(ast); + } + + fn enter_binding_with_default(&mut self, ast: &'alloc BindingWithDefault<'alloc>) { + } + + fn leave_binding_with_default(&mut self, ast: &'alloc BindingWithDefault<'alloc>) { + } + + fn visit_binding_identifier(&mut self, ast: &'alloc BindingIdentifier) { + self.enter_binding_identifier(ast); + self.visit_identifier(&ast.name); + self.leave_binding_identifier(ast); + } + + fn enter_binding_identifier(&mut self, ast: &'alloc BindingIdentifier) { + } + + fn leave_binding_identifier(&mut self, ast: &'alloc BindingIdentifier) { + } + + fn visit_assignment_target_identifier(&mut self, ast: &'alloc AssignmentTargetIdentifier) { + self.enter_assignment_target_identifier(ast); + self.visit_identifier(&ast.name); + self.leave_assignment_target_identifier(ast); + } + + fn enter_assignment_target_identifier(&mut self, ast: &'alloc AssignmentTargetIdentifier) { + } + + fn leave_assignment_target_identifier(&mut self, ast: &'alloc AssignmentTargetIdentifier) { + } + + fn visit_expression_or_super(&mut self, ast: &'alloc ExpressionOrSuper<'alloc>) { + self.enter_expression_or_super(ast); + match ast { + ExpressionOrSuper::Expression(ast) => { + self.visit_enum_expression_or_super_variant_expression(ast) + } + ExpressionOrSuper::Super { .. } => { + self.visit_enum_expression_or_super_variant_super() + } + } + self.leave_expression_or_super(ast); + } + + fn enter_expression_or_super(&mut self, ast: &'alloc ExpressionOrSuper<'alloc>) { + } + + fn leave_expression_or_super(&mut self, ast: &'alloc ExpressionOrSuper<'alloc>) { + } + + fn visit_enum_expression_or_super_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_expression_or_super_variant_expression(ast); + self.visit_expression(ast); + self.leave_enum_expression_or_super_variant_expression(ast); + } + + fn enter_enum_expression_or_super_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_expression_or_super_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_expression_or_super_variant_super(&mut self) { + } + + fn visit_member_assignment_target(&mut self, ast: &'alloc MemberAssignmentTarget<'alloc>) { + self.enter_member_assignment_target(ast); + match ast { + MemberAssignmentTarget::ComputedMemberAssignmentTarget(ast) => { + self.visit_enum_member_assignment_target_variant_computed_member_assignment_target(ast) + } + MemberAssignmentTarget::PrivateFieldAssignmentTarget(ast) => { + self.visit_enum_member_assignment_target_variant_private_field_assignment_target(ast) + } + MemberAssignmentTarget::StaticMemberAssignmentTarget(ast) => { + self.visit_enum_member_assignment_target_variant_static_member_assignment_target(ast) + } + } + self.leave_member_assignment_target(ast); + } + + fn enter_member_assignment_target(&mut self, ast: &'alloc MemberAssignmentTarget<'alloc>) { + } + + fn leave_member_assignment_target(&mut self, ast: &'alloc MemberAssignmentTarget<'alloc>) { + } + + fn visit_enum_member_assignment_target_variant_computed_member_assignment_target( + &mut self, + ast: &'alloc ComputedMemberAssignmentTarget<'alloc>, + ) { + self.enter_enum_member_assignment_target_variant_computed_member_assignment_target(ast); + self.visit_computed_member_assignment_target(ast); + self.leave_enum_member_assignment_target_variant_computed_member_assignment_target(ast); + } + + fn enter_enum_member_assignment_target_variant_computed_member_assignment_target( + &mut self, + ast: &'alloc ComputedMemberAssignmentTarget<'alloc>, + ) { + } + + fn leave_enum_member_assignment_target_variant_computed_member_assignment_target( + &mut self, + ast: &'alloc ComputedMemberAssignmentTarget<'alloc>, + ) { + } + + fn visit_enum_member_assignment_target_variant_private_field_assignment_target( + &mut self, + ast: &'alloc PrivateFieldAssignmentTarget<'alloc>, + ) { + self.enter_enum_member_assignment_target_variant_private_field_assignment_target(ast); + self.visit_private_field_assignment_target(ast); + self.leave_enum_member_assignment_target_variant_private_field_assignment_target(ast); + } + + fn enter_enum_member_assignment_target_variant_private_field_assignment_target( + &mut self, + ast: &'alloc PrivateFieldAssignmentTarget<'alloc>, + ) { + } + + fn leave_enum_member_assignment_target_variant_private_field_assignment_target( + &mut self, + ast: &'alloc PrivateFieldAssignmentTarget<'alloc>, + ) { + } + + fn visit_enum_member_assignment_target_variant_static_member_assignment_target( + &mut self, + ast: &'alloc StaticMemberAssignmentTarget<'alloc>, + ) { + self.enter_enum_member_assignment_target_variant_static_member_assignment_target(ast); + self.visit_static_member_assignment_target(ast); + self.leave_enum_member_assignment_target_variant_static_member_assignment_target(ast); + } + + fn enter_enum_member_assignment_target_variant_static_member_assignment_target( + &mut self, + ast: &'alloc StaticMemberAssignmentTarget<'alloc>, + ) { + } + + fn leave_enum_member_assignment_target_variant_static_member_assignment_target( + &mut self, + ast: &'alloc StaticMemberAssignmentTarget<'alloc>, + ) { + } + + fn visit_computed_member_assignment_target(&mut self, ast: &'alloc ComputedMemberAssignmentTarget<'alloc>) { + self.enter_computed_member_assignment_target(ast); + self.visit_expression_or_super(&ast.object); + self.visit_expression(&ast.expression); + self.leave_computed_member_assignment_target(ast); + } + + fn enter_computed_member_assignment_target(&mut self, ast: &'alloc ComputedMemberAssignmentTarget<'alloc>) { + } + + fn leave_computed_member_assignment_target(&mut self, ast: &'alloc ComputedMemberAssignmentTarget<'alloc>) { + } + + fn visit_private_field_assignment_target(&mut self, ast: &'alloc PrivateFieldAssignmentTarget<'alloc>) { + self.enter_private_field_assignment_target(ast); + self.visit_expression_or_super(&ast.object); + self.visit_private_identifier(&ast.field); + self.leave_private_field_assignment_target(ast); + } + + fn enter_private_field_assignment_target(&mut self, ast: &'alloc PrivateFieldAssignmentTarget<'alloc>) { + } + + fn leave_private_field_assignment_target(&mut self, ast: &'alloc PrivateFieldAssignmentTarget<'alloc>) { + } + + fn visit_static_member_assignment_target(&mut self, ast: &'alloc StaticMemberAssignmentTarget<'alloc>) { + self.enter_static_member_assignment_target(ast); + self.visit_expression_or_super(&ast.object); + self.visit_identifier_name(&ast.property); + self.leave_static_member_assignment_target(ast); + } + + fn enter_static_member_assignment_target(&mut self, ast: &'alloc StaticMemberAssignmentTarget<'alloc>) { + } + + fn leave_static_member_assignment_target(&mut self, ast: &'alloc StaticMemberAssignmentTarget<'alloc>) { + } + + fn visit_array_binding(&mut self, ast: &'alloc ArrayBinding<'alloc>) { + self.enter_array_binding(ast); + for item in &ast.elements { + if let Some(item) = item { + self.visit_parameter(item); + } + } + if let Some(item) = &ast.rest { + self.visit_binding(item); + } + self.leave_array_binding(ast); + } + + fn enter_array_binding(&mut self, ast: &'alloc ArrayBinding<'alloc>) { + } + + fn leave_array_binding(&mut self, ast: &'alloc ArrayBinding<'alloc>) { + } + + fn visit_object_binding(&mut self, ast: &'alloc ObjectBinding<'alloc>) { + self.enter_object_binding(ast); + for item in &ast.properties { + self.visit_binding_property(item); + } + if let Some(item) = &ast.rest { + self.visit_binding_identifier(item); + } + self.leave_object_binding(ast); + } + + fn enter_object_binding(&mut self, ast: &'alloc ObjectBinding<'alloc>) { + } + + fn leave_object_binding(&mut self, ast: &'alloc ObjectBinding<'alloc>) { + } + + fn visit_binding_property(&mut self, ast: &'alloc BindingProperty<'alloc>) { + self.enter_binding_property(ast); + match ast { + BindingProperty::BindingPropertyIdentifier(ast) => { + self.visit_enum_binding_property_variant_binding_property_identifier(ast) + } + BindingProperty::BindingPropertyProperty(ast) => { + self.visit_enum_binding_property_variant_binding_property_property(ast) + } + } + self.leave_binding_property(ast); + } + + fn enter_binding_property(&mut self, ast: &'alloc BindingProperty<'alloc>) { + } + + fn leave_binding_property(&mut self, ast: &'alloc BindingProperty<'alloc>) { + } + + fn visit_enum_binding_property_variant_binding_property_identifier( + &mut self, + ast: &'alloc BindingPropertyIdentifier<'alloc>, + ) { + self.enter_enum_binding_property_variant_binding_property_identifier(ast); + self.visit_binding_property_identifier(ast); + self.leave_enum_binding_property_variant_binding_property_identifier(ast); + } + + fn enter_enum_binding_property_variant_binding_property_identifier( + &mut self, + ast: &'alloc BindingPropertyIdentifier<'alloc>, + ) { + } + + fn leave_enum_binding_property_variant_binding_property_identifier( + &mut self, + ast: &'alloc BindingPropertyIdentifier<'alloc>, + ) { + } + + fn visit_enum_binding_property_variant_binding_property_property( + &mut self, + ast: &'alloc BindingPropertyProperty<'alloc>, + ) { + self.enter_enum_binding_property_variant_binding_property_property(ast); + self.visit_binding_property_property(ast); + self.leave_enum_binding_property_variant_binding_property_property(ast); + } + + fn enter_enum_binding_property_variant_binding_property_property( + &mut self, + ast: &'alloc BindingPropertyProperty<'alloc>, + ) { + } + + fn leave_enum_binding_property_variant_binding_property_property( + &mut self, + ast: &'alloc BindingPropertyProperty<'alloc>, + ) { + } + + fn visit_binding_property_identifier(&mut self, ast: &'alloc BindingPropertyIdentifier<'alloc>) { + self.enter_binding_property_identifier(ast); + self.visit_binding_identifier(&ast.binding); + if let Some(item) = &ast.init { + self.visit_expression(item); + } + self.leave_binding_property_identifier(ast); + } + + fn enter_binding_property_identifier(&mut self, ast: &'alloc BindingPropertyIdentifier<'alloc>) { + } + + fn leave_binding_property_identifier(&mut self, ast: &'alloc BindingPropertyIdentifier<'alloc>) { + } + + fn visit_binding_property_property(&mut self, ast: &'alloc BindingPropertyProperty<'alloc>) { + self.enter_binding_property_property(ast); + self.visit_property_name(&ast.name); + self.visit_parameter(&ast.binding); + self.leave_binding_property_property(ast); + } + + fn enter_binding_property_property(&mut self, ast: &'alloc BindingPropertyProperty<'alloc>) { + } + + fn leave_binding_property_property(&mut self, ast: &'alloc BindingPropertyProperty<'alloc>) { + } + + fn visit_assignment_target_with_default(&mut self, ast: &'alloc AssignmentTargetWithDefault<'alloc>) { + self.enter_assignment_target_with_default(ast); + self.visit_assignment_target(&ast.binding); + self.visit_expression(&ast.init); + self.leave_assignment_target_with_default(ast); + } + + fn enter_assignment_target_with_default(&mut self, ast: &'alloc AssignmentTargetWithDefault<'alloc>) { + } + + fn leave_assignment_target_with_default(&mut self, ast: &'alloc AssignmentTargetWithDefault<'alloc>) { + } + + fn visit_assignment_target_maybe_default(&mut self, ast: &'alloc AssignmentTargetMaybeDefault<'alloc>) { + self.enter_assignment_target_maybe_default(ast); + match ast { + AssignmentTargetMaybeDefault::AssignmentTarget(ast) => { + self.visit_enum_assignment_target_maybe_default_variant_assignment_target(ast) + } + AssignmentTargetMaybeDefault::AssignmentTargetWithDefault(ast) => { + self.visit_enum_assignment_target_maybe_default_variant_assignment_target_with_default(ast) + } + } + self.leave_assignment_target_maybe_default(ast); + } + + fn enter_assignment_target_maybe_default(&mut self, ast: &'alloc AssignmentTargetMaybeDefault<'alloc>) { + } + + fn leave_assignment_target_maybe_default(&mut self, ast: &'alloc AssignmentTargetMaybeDefault<'alloc>) { + } + + fn visit_enum_assignment_target_maybe_default_variant_assignment_target( + &mut self, + ast: &'alloc AssignmentTarget<'alloc>, + ) { + self.enter_enum_assignment_target_maybe_default_variant_assignment_target(ast); + self.visit_assignment_target(ast); + self.leave_enum_assignment_target_maybe_default_variant_assignment_target(ast); + } + + fn enter_enum_assignment_target_maybe_default_variant_assignment_target( + &mut self, + ast: &'alloc AssignmentTarget<'alloc>, + ) { + } + + fn leave_enum_assignment_target_maybe_default_variant_assignment_target( + &mut self, + ast: &'alloc AssignmentTarget<'alloc>, + ) { + } + + fn visit_enum_assignment_target_maybe_default_variant_assignment_target_with_default( + &mut self, + ast: &'alloc AssignmentTargetWithDefault<'alloc>, + ) { + self.enter_enum_assignment_target_maybe_default_variant_assignment_target_with_default(ast); + self.visit_assignment_target_with_default(ast); + self.leave_enum_assignment_target_maybe_default_variant_assignment_target_with_default(ast); + } + + fn enter_enum_assignment_target_maybe_default_variant_assignment_target_with_default( + &mut self, + ast: &'alloc AssignmentTargetWithDefault<'alloc>, + ) { + } + + fn leave_enum_assignment_target_maybe_default_variant_assignment_target_with_default( + &mut self, + ast: &'alloc AssignmentTargetWithDefault<'alloc>, + ) { + } + + fn visit_array_assignment_target(&mut self, ast: &'alloc ArrayAssignmentTarget<'alloc>) { + self.enter_array_assignment_target(ast); + for item in &ast.elements { + if let Some(item) = item { + self.visit_assignment_target_maybe_default(item); + } + } + if let Some(item) = &ast.rest { + self.visit_assignment_target(item); + } + self.leave_array_assignment_target(ast); + } + + fn enter_array_assignment_target(&mut self, ast: &'alloc ArrayAssignmentTarget<'alloc>) { + } + + fn leave_array_assignment_target(&mut self, ast: &'alloc ArrayAssignmentTarget<'alloc>) { + } + + fn visit_object_assignment_target(&mut self, ast: &'alloc ObjectAssignmentTarget<'alloc>) { + self.enter_object_assignment_target(ast); + for item in &ast.properties { + self.visit_assignment_target_property(item); + } + if let Some(item) = &ast.rest { + self.visit_assignment_target(item); + } + self.leave_object_assignment_target(ast); + } + + fn enter_object_assignment_target(&mut self, ast: &'alloc ObjectAssignmentTarget<'alloc>) { + } + + fn leave_object_assignment_target(&mut self, ast: &'alloc ObjectAssignmentTarget<'alloc>) { + } + + fn visit_assignment_target_property(&mut self, ast: &'alloc AssignmentTargetProperty<'alloc>) { + self.enter_assignment_target_property(ast); + match ast { + AssignmentTargetProperty::AssignmentTargetPropertyIdentifier(ast) => { + self.visit_enum_assignment_target_property_variant_assignment_target_property_identifier(ast) + } + AssignmentTargetProperty::AssignmentTargetPropertyProperty(ast) => { + self.visit_enum_assignment_target_property_variant_assignment_target_property_property(ast) + } + } + self.leave_assignment_target_property(ast); + } + + fn enter_assignment_target_property(&mut self, ast: &'alloc AssignmentTargetProperty<'alloc>) { + } + + fn leave_assignment_target_property(&mut self, ast: &'alloc AssignmentTargetProperty<'alloc>) { + } + + fn visit_enum_assignment_target_property_variant_assignment_target_property_identifier( + &mut self, + ast: &'alloc AssignmentTargetPropertyIdentifier<'alloc>, + ) { + self.enter_enum_assignment_target_property_variant_assignment_target_property_identifier(ast); + self.visit_assignment_target_property_identifier(ast); + self.leave_enum_assignment_target_property_variant_assignment_target_property_identifier(ast); + } + + fn enter_enum_assignment_target_property_variant_assignment_target_property_identifier( + &mut self, + ast: &'alloc AssignmentTargetPropertyIdentifier<'alloc>, + ) { + } + + fn leave_enum_assignment_target_property_variant_assignment_target_property_identifier( + &mut self, + ast: &'alloc AssignmentTargetPropertyIdentifier<'alloc>, + ) { + } + + fn visit_enum_assignment_target_property_variant_assignment_target_property_property( + &mut self, + ast: &'alloc AssignmentTargetPropertyProperty<'alloc>, + ) { + self.enter_enum_assignment_target_property_variant_assignment_target_property_property(ast); + self.visit_assignment_target_property_property(ast); + self.leave_enum_assignment_target_property_variant_assignment_target_property_property(ast); + } + + fn enter_enum_assignment_target_property_variant_assignment_target_property_property( + &mut self, + ast: &'alloc AssignmentTargetPropertyProperty<'alloc>, + ) { + } + + fn leave_enum_assignment_target_property_variant_assignment_target_property_property( + &mut self, + ast: &'alloc AssignmentTargetPropertyProperty<'alloc>, + ) { + } + + fn visit_assignment_target_property_identifier(&mut self, ast: &'alloc AssignmentTargetPropertyIdentifier<'alloc>) { + self.enter_assignment_target_property_identifier(ast); + self.visit_assignment_target_identifier(&ast.binding); + if let Some(item) = &ast.init { + self.visit_expression(item); + } + self.leave_assignment_target_property_identifier(ast); + } + + fn enter_assignment_target_property_identifier(&mut self, ast: &'alloc AssignmentTargetPropertyIdentifier<'alloc>) { + } + + fn leave_assignment_target_property_identifier(&mut self, ast: &'alloc AssignmentTargetPropertyIdentifier<'alloc>) { + } + + fn visit_assignment_target_property_property(&mut self, ast: &'alloc AssignmentTargetPropertyProperty<'alloc>) { + self.enter_assignment_target_property_property(ast); + self.visit_property_name(&ast.name); + self.visit_assignment_target_maybe_default(&ast.binding); + self.leave_assignment_target_property_property(ast); + } + + fn enter_assignment_target_property_property(&mut self, ast: &'alloc AssignmentTargetPropertyProperty<'alloc>) { + } + + fn leave_assignment_target_property_property(&mut self, ast: &'alloc AssignmentTargetPropertyProperty<'alloc>) { + } + + fn visit_class_expression(&mut self, ast: &'alloc ClassExpression<'alloc>) { + self.enter_class_expression(ast); + if let Some(item) = &ast.name { + self.visit_binding_identifier(item); + } + if let Some(item) = &ast.super_ { + self.visit_expression(item); + } + for item in &ast.elements { + self.visit_class_element(item); + } + self.leave_class_expression(ast); + } + + fn enter_class_expression(&mut self, ast: &'alloc ClassExpression<'alloc>) { + } + + fn leave_class_expression(&mut self, ast: &'alloc ClassExpression<'alloc>) { + } + + fn visit_class_declaration(&mut self, ast: &'alloc ClassDeclaration<'alloc>) { + self.enter_class_declaration(ast); + self.visit_binding_identifier(&ast.name); + if let Some(item) = &ast.super_ { + self.visit_expression(item); + } + for item in &ast.elements { + self.visit_class_element(item); + } + self.leave_class_declaration(ast); + } + + fn enter_class_declaration(&mut self, ast: &'alloc ClassDeclaration<'alloc>) { + } + + fn leave_class_declaration(&mut self, ast: &'alloc ClassDeclaration<'alloc>) { + } + + fn visit_class_element(&mut self, ast: &'alloc ClassElement<'alloc>) { + self.enter_class_element(ast); + match ast { + ClassElement::MethodDefinition { is_static, method, .. } => { + self.visit_enum_class_element_variant_method_definition( + is_static, + method, + ) + } + ClassElement::FieldDefinition { name, init, .. } => { + self.visit_enum_class_element_variant_field_definition( + name, + init, + ) + } + } + self.leave_class_element(ast); + } + + fn enter_class_element(&mut self, ast: &'alloc ClassElement<'alloc>) { + } + + fn leave_class_element(&mut self, ast: &'alloc ClassElement<'alloc>) { + } + + fn visit_enum_class_element_variant_method_definition( + &mut self, + is_static: &'alloc bool, + method: &'alloc MethodDefinition<'alloc>, + ) { + self.enter_enum_class_element_variant_method_definition( + is_static, + method, + ); + self.visit_method_definition(method); + self.leave_enum_class_element_variant_method_definition( + is_static, + method, + ); + } + + fn enter_enum_class_element_variant_method_definition( + &mut self, + is_static: &'alloc bool, + method: &'alloc MethodDefinition<'alloc>, + ) { + } + + fn leave_enum_class_element_variant_method_definition( + &mut self, + is_static: &'alloc bool, + method: &'alloc MethodDefinition<'alloc>, + ) { + } + + fn visit_enum_class_element_variant_field_definition( + &mut self, + name: &'alloc ClassElementName<'alloc>, + init: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + ) { + self.enter_enum_class_element_variant_field_definition( + name, + init, + ); + self.visit_class_element_name(name); + if let Some(item) = init { + self.visit_expression(item); + } + self.leave_enum_class_element_variant_field_definition( + name, + init, + ); + } + + fn enter_enum_class_element_variant_field_definition( + &mut self, + name: &'alloc ClassElementName<'alloc>, + init: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + ) { + } + + fn leave_enum_class_element_variant_field_definition( + &mut self, + name: &'alloc ClassElementName<'alloc>, + init: &'alloc Option<arena::Box<'alloc, Expression<'alloc>>>, + ) { + } + + fn visit_module_items(&mut self, ast: &'alloc ModuleItems<'alloc>) { + self.enter_module_items(ast); + match ast { + ModuleItems::ImportDeclaration(ast) => { + self.visit_enum_module_items_variant_import_declaration(ast) + } + ModuleItems::ExportDeclaration(ast) => { + self.visit_enum_module_items_variant_export_declaration(ast) + } + ModuleItems::Statement(ast) => { + self.visit_enum_module_items_variant_statement(ast) + } + } + self.leave_module_items(ast); + } + + fn enter_module_items(&mut self, ast: &'alloc ModuleItems<'alloc>) { + } + + fn leave_module_items(&mut self, ast: &'alloc ModuleItems<'alloc>) { + } + + fn visit_enum_module_items_variant_import_declaration( + &mut self, + ast: &'alloc ImportDeclaration<'alloc>, + ) { + self.enter_enum_module_items_variant_import_declaration(ast); + self.visit_import_declaration(ast); + self.leave_enum_module_items_variant_import_declaration(ast); + } + + fn enter_enum_module_items_variant_import_declaration( + &mut self, + ast: &'alloc ImportDeclaration<'alloc>, + ) { + } + + fn leave_enum_module_items_variant_import_declaration( + &mut self, + ast: &'alloc ImportDeclaration<'alloc>, + ) { + } + + fn visit_enum_module_items_variant_export_declaration( + &mut self, + ast: &'alloc ExportDeclaration<'alloc>, + ) { + self.enter_enum_module_items_variant_export_declaration(ast); + self.visit_export_declaration(ast); + self.leave_enum_module_items_variant_export_declaration(ast); + } + + fn enter_enum_module_items_variant_export_declaration( + &mut self, + ast: &'alloc ExportDeclaration<'alloc>, + ) { + } + + fn leave_enum_module_items_variant_export_declaration( + &mut self, + ast: &'alloc ExportDeclaration<'alloc>, + ) { + } + + fn visit_enum_module_items_variant_statement( + &mut self, + ast: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + self.enter_enum_module_items_variant_statement(ast); + self.visit_statement(ast); + self.leave_enum_module_items_variant_statement(ast); + } + + fn enter_enum_module_items_variant_statement( + &mut self, + ast: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + } + + fn leave_enum_module_items_variant_statement( + &mut self, + ast: &'alloc arena::Box<'alloc, Statement<'alloc>>, + ) { + } + + fn visit_module(&mut self, ast: &'alloc Module<'alloc>) { + self.enter_module(ast); + for item in &ast.directives { + self.visit_directive(item); + } + for item in &ast.items { + self.visit_module_items(item); + } + self.leave_module(ast); + } + + fn enter_module(&mut self, ast: &'alloc Module<'alloc>) { + } + + fn leave_module(&mut self, ast: &'alloc Module<'alloc>) { + } + + fn visit_import(&mut self, ast: &'alloc Import<'alloc>) { + self.enter_import(ast); + if let Some(item) = &ast.default_binding { + self.visit_binding_identifier(item); + } + for item in &ast.named_imports { + self.visit_import_specifier(item); + } + self.leave_import(ast); + } + + fn enter_import(&mut self, ast: &'alloc Import<'alloc>) { + } + + fn leave_import(&mut self, ast: &'alloc Import<'alloc>) { + } + + fn visit_import_namespace(&mut self, ast: &'alloc ImportNamespace) { + self.enter_import_namespace(ast); + if let Some(item) = &ast.default_binding { + self.visit_binding_identifier(item); + } + self.visit_binding_identifier(&ast.namespace_binding); + self.leave_import_namespace(ast); + } + + fn enter_import_namespace(&mut self, ast: &'alloc ImportNamespace) { + } + + fn leave_import_namespace(&mut self, ast: &'alloc ImportNamespace) { + } + + fn visit_import_specifier(&mut self, ast: &'alloc ImportSpecifier) { + self.enter_import_specifier(ast); + if let Some(item) = &ast.name { + self.visit_identifier_name(item); + } + self.visit_binding_identifier(&ast.binding); + self.leave_import_specifier(ast); + } + + fn enter_import_specifier(&mut self, ast: &'alloc ImportSpecifier) { + } + + fn leave_import_specifier(&mut self, ast: &'alloc ImportSpecifier) { + } + + fn visit_export_all_from(&mut self, ast: &'alloc ExportAllFrom) { + self.enter_export_all_from(ast); + self.leave_export_all_from(ast); + } + + fn enter_export_all_from(&mut self, ast: &'alloc ExportAllFrom) { + } + + fn leave_export_all_from(&mut self, ast: &'alloc ExportAllFrom) { + } + + fn visit_export_from(&mut self, ast: &'alloc ExportFrom<'alloc>) { + self.enter_export_from(ast); + for item in &ast.named_exports { + self.visit_export_from_specifier(item); + } + self.leave_export_from(ast); + } + + fn enter_export_from(&mut self, ast: &'alloc ExportFrom<'alloc>) { + } + + fn leave_export_from(&mut self, ast: &'alloc ExportFrom<'alloc>) { + } + + fn visit_export_locals(&mut self, ast: &'alloc ExportLocals<'alloc>) { + self.enter_export_locals(ast); + for item in &ast.named_exports { + self.visit_export_local_specifier(item); + } + self.leave_export_locals(ast); + } + + fn enter_export_locals(&mut self, ast: &'alloc ExportLocals<'alloc>) { + } + + fn leave_export_locals(&mut self, ast: &'alloc ExportLocals<'alloc>) { + } + + fn visit_export(&mut self, ast: &'alloc Export<'alloc>) { + self.enter_export(ast); + match ast { + Export::FunctionDeclaration(ast) => { + self.visit_enum_export_variant_function_declaration(ast) + } + Export::ClassDeclaration(ast) => { + self.visit_enum_export_variant_class_declaration(ast) + } + Export::VariableDeclaration(ast) => { + self.visit_enum_export_variant_variable_declaration(ast) + } + } + self.leave_export(ast); + } + + fn enter_export(&mut self, ast: &'alloc Export<'alloc>) { + } + + fn leave_export(&mut self, ast: &'alloc Export<'alloc>) { + } + + fn visit_enum_export_variant_function_declaration( + &mut self, + ast: &'alloc Function<'alloc>, + ) { + self.enter_enum_export_variant_function_declaration(ast); + self.visit_function(ast); + self.leave_enum_export_variant_function_declaration(ast); + } + + fn enter_enum_export_variant_function_declaration( + &mut self, + ast: &'alloc Function<'alloc>, + ) { + } + + fn leave_enum_export_variant_function_declaration( + &mut self, + ast: &'alloc Function<'alloc>, + ) { + } + + fn visit_enum_export_variant_class_declaration( + &mut self, + ast: &'alloc ClassDeclaration<'alloc>, + ) { + self.enter_enum_export_variant_class_declaration(ast); + self.visit_class_declaration(ast); + self.leave_enum_export_variant_class_declaration(ast); + } + + fn enter_enum_export_variant_class_declaration( + &mut self, + ast: &'alloc ClassDeclaration<'alloc>, + ) { + } + + fn leave_enum_export_variant_class_declaration( + &mut self, + ast: &'alloc ClassDeclaration<'alloc>, + ) { + } + + fn visit_enum_export_variant_variable_declaration( + &mut self, + ast: &'alloc VariableDeclaration<'alloc>, + ) { + self.enter_enum_export_variant_variable_declaration(ast); + self.visit_variable_declaration(ast); + self.leave_enum_export_variant_variable_declaration(ast); + } + + fn enter_enum_export_variant_variable_declaration( + &mut self, + ast: &'alloc VariableDeclaration<'alloc>, + ) { + } + + fn leave_enum_export_variant_variable_declaration( + &mut self, + ast: &'alloc VariableDeclaration<'alloc>, + ) { + } + + fn visit_export_default(&mut self, ast: &'alloc ExportDefault<'alloc>) { + self.enter_export_default(ast); + match ast { + ExportDefault::FunctionDeclaration(ast) => { + self.visit_enum_export_default_variant_function_declaration(ast) + } + ExportDefault::ClassDeclaration(ast) => { + self.visit_enum_export_default_variant_class_declaration(ast) + } + ExportDefault::Expression(ast) => { + self.visit_enum_export_default_variant_expression(ast) + } + } + self.leave_export_default(ast); + } + + fn enter_export_default(&mut self, ast: &'alloc ExportDefault<'alloc>) { + } + + fn leave_export_default(&mut self, ast: &'alloc ExportDefault<'alloc>) { + } + + fn visit_enum_export_default_variant_function_declaration( + &mut self, + ast: &'alloc Function<'alloc>, + ) { + self.enter_enum_export_default_variant_function_declaration(ast); + self.visit_function(ast); + self.leave_enum_export_default_variant_function_declaration(ast); + } + + fn enter_enum_export_default_variant_function_declaration( + &mut self, + ast: &'alloc Function<'alloc>, + ) { + } + + fn leave_enum_export_default_variant_function_declaration( + &mut self, + ast: &'alloc Function<'alloc>, + ) { + } + + fn visit_enum_export_default_variant_class_declaration( + &mut self, + ast: &'alloc ClassDeclaration<'alloc>, + ) { + self.enter_enum_export_default_variant_class_declaration(ast); + self.visit_class_declaration(ast); + self.leave_enum_export_default_variant_class_declaration(ast); + } + + fn enter_enum_export_default_variant_class_declaration( + &mut self, + ast: &'alloc ClassDeclaration<'alloc>, + ) { + } + + fn leave_enum_export_default_variant_class_declaration( + &mut self, + ast: &'alloc ClassDeclaration<'alloc>, + ) { + } + + fn visit_enum_export_default_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_export_default_variant_expression(ast); + self.visit_expression(ast); + self.leave_enum_export_default_variant_expression(ast); + } + + fn enter_enum_export_default_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_export_default_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_export_from_specifier(&mut self, ast: &'alloc ExportFromSpecifier) { + self.enter_export_from_specifier(ast); + self.visit_identifier_name(&ast.name); + if let Some(item) = &ast.exported_name { + self.visit_identifier_name(item); + } + self.leave_export_from_specifier(ast); + } + + fn enter_export_from_specifier(&mut self, ast: &'alloc ExportFromSpecifier) { + } + + fn leave_export_from_specifier(&mut self, ast: &'alloc ExportFromSpecifier) { + } + + fn visit_export_local_specifier(&mut self, ast: &'alloc ExportLocalSpecifier) { + self.enter_export_local_specifier(ast); + self.visit_identifier_expression(&ast.name); + if let Some(item) = &ast.exported_name { + self.visit_identifier_name(item); + } + self.leave_export_local_specifier(ast); + } + + fn enter_export_local_specifier(&mut self, ast: &'alloc ExportLocalSpecifier) { + } + + fn leave_export_local_specifier(&mut self, ast: &'alloc ExportLocalSpecifier) { + } + + fn visit_method(&mut self, ast: &'alloc Method<'alloc>) { + self.enter_method(ast); + self.visit_class_element_name(&ast.name); + self.visit_formal_parameters(&ast.params); + self.visit_function_body(&ast.body); + self.leave_method(ast); + } + + fn enter_method(&mut self, ast: &'alloc Method<'alloc>) { + } + + fn leave_method(&mut self, ast: &'alloc Method<'alloc>) { + } + + fn visit_getter(&mut self, ast: &'alloc Getter<'alloc>) { + self.enter_getter(ast); + self.visit_class_element_name(&ast.property_name); + self.visit_function_body(&ast.body); + self.leave_getter(ast); + } + + fn enter_getter(&mut self, ast: &'alloc Getter<'alloc>) { + } + + fn leave_getter(&mut self, ast: &'alloc Getter<'alloc>) { + } + + fn visit_setter(&mut self, ast: &'alloc Setter<'alloc>) { + self.enter_setter(ast); + self.visit_class_element_name(&ast.property_name); + self.visit_parameter(&ast.param); + self.visit_function_body(&ast.body); + self.leave_setter(ast); + } + + fn enter_setter(&mut self, ast: &'alloc Setter<'alloc>) { + } + + fn leave_setter(&mut self, ast: &'alloc Setter<'alloc>) { + } + + fn visit_data_property(&mut self, ast: &'alloc DataProperty<'alloc>) { + self.enter_data_property(ast); + self.visit_property_name(&ast.property_name); + self.visit_expression(&ast.expression); + self.leave_data_property(ast); + } + + fn enter_data_property(&mut self, ast: &'alloc DataProperty<'alloc>) { + } + + fn leave_data_property(&mut self, ast: &'alloc DataProperty<'alloc>) { + } + + fn visit_shorthand_property(&mut self, ast: &'alloc ShorthandProperty) { + self.enter_shorthand_property(ast); + self.visit_identifier_expression(&ast.name); + self.leave_shorthand_property(ast); + } + + fn enter_shorthand_property(&mut self, ast: &'alloc ShorthandProperty) { + } + + fn leave_shorthand_property(&mut self, ast: &'alloc ShorthandProperty) { + } + + fn visit_computed_property_name(&mut self, ast: &'alloc ComputedPropertyName<'alloc>) { + self.enter_computed_property_name(ast); + self.visit_expression(&ast.expression); + self.leave_computed_property_name(ast); + } + + fn enter_computed_property_name(&mut self, ast: &'alloc ComputedPropertyName<'alloc>) { + } + + fn leave_computed_property_name(&mut self, ast: &'alloc ComputedPropertyName<'alloc>) { + } + + fn visit_static_property_name(&mut self, ast: &'alloc StaticPropertyName) { + self.enter_static_property_name(ast); + self.leave_static_property_name(ast); + } + + fn enter_static_property_name(&mut self, ast: &'alloc StaticPropertyName) { + } + + fn leave_static_property_name(&mut self, ast: &'alloc StaticPropertyName) { + } + + fn visit_numeric_literal(&mut self, ast: &'alloc NumericLiteral) { + self.enter_numeric_literal(ast); + self.leave_numeric_literal(ast); + } + + fn enter_numeric_literal(&mut self, ast: &'alloc NumericLiteral) { + } + + fn leave_numeric_literal(&mut self, ast: &'alloc NumericLiteral) { + } + + fn visit_array_expression_element(&mut self, ast: &'alloc ArrayExpressionElement<'alloc>) { + self.enter_array_expression_element(ast); + match ast { + ArrayExpressionElement::SpreadElement(ast) => { + self.visit_enum_array_expression_element_variant_spread_element(ast) + } + ArrayExpressionElement::Expression(ast) => { + self.visit_enum_array_expression_element_variant_expression(ast) + } + ArrayExpressionElement::Elision { .. } => { + self.visit_enum_array_expression_element_variant_elision() + } + } + self.leave_array_expression_element(ast); + } + + fn enter_array_expression_element(&mut self, ast: &'alloc ArrayExpressionElement<'alloc>) { + } + + fn leave_array_expression_element(&mut self, ast: &'alloc ArrayExpressionElement<'alloc>) { + } + + fn visit_enum_array_expression_element_variant_spread_element( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_array_expression_element_variant_spread_element(ast); + self.visit_expression(ast); + self.leave_enum_array_expression_element_variant_spread_element(ast); + } + + fn enter_enum_array_expression_element_variant_spread_element( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_array_expression_element_variant_spread_element( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_array_expression_element_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_array_expression_element_variant_expression(ast); + self.visit_expression(ast); + self.leave_enum_array_expression_element_variant_expression(ast); + } + + fn enter_enum_array_expression_element_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_array_expression_element_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_array_expression_element_variant_elision(&mut self) { + } + + fn visit_array_expression(&mut self, ast: &'alloc ArrayExpression<'alloc>) { + self.enter_array_expression(ast); + for item in &ast.elements { + self.visit_array_expression_element(item); + } + self.leave_array_expression(ast); + } + + fn enter_array_expression(&mut self, ast: &'alloc ArrayExpression<'alloc>) { + } + + fn leave_array_expression(&mut self, ast: &'alloc ArrayExpression<'alloc>) { + } + + fn visit_arrow_expression_body(&mut self, ast: &'alloc ArrowExpressionBody<'alloc>) { + self.enter_arrow_expression_body(ast); + match ast { + ArrowExpressionBody::FunctionBody(ast) => { + self.visit_enum_arrow_expression_body_variant_function_body(ast) + } + ArrowExpressionBody::Expression(ast) => { + self.visit_enum_arrow_expression_body_variant_expression(ast) + } + } + self.leave_arrow_expression_body(ast); + } + + fn enter_arrow_expression_body(&mut self, ast: &'alloc ArrowExpressionBody<'alloc>) { + } + + fn leave_arrow_expression_body(&mut self, ast: &'alloc ArrowExpressionBody<'alloc>) { + } + + fn visit_enum_arrow_expression_body_variant_function_body( + &mut self, + ast: &'alloc FunctionBody<'alloc>, + ) { + self.enter_enum_arrow_expression_body_variant_function_body(ast); + self.visit_function_body(ast); + self.leave_enum_arrow_expression_body_variant_function_body(ast); + } + + fn enter_enum_arrow_expression_body_variant_function_body( + &mut self, + ast: &'alloc FunctionBody<'alloc>, + ) { + } + + fn leave_enum_arrow_expression_body_variant_function_body( + &mut self, + ast: &'alloc FunctionBody<'alloc>, + ) { + } + + fn visit_enum_arrow_expression_body_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_arrow_expression_body_variant_expression(ast); + self.visit_expression(ast); + self.leave_enum_arrow_expression_body_variant_expression(ast); + } + + fn enter_enum_arrow_expression_body_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_arrow_expression_body_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_computed_member_expression(&mut self, ast: &'alloc ComputedMemberExpression<'alloc>) { + self.enter_computed_member_expression(ast); + self.visit_expression_or_super(&ast.object); + self.visit_expression(&ast.expression); + self.leave_computed_member_expression(ast); + } + + fn enter_computed_member_expression(&mut self, ast: &'alloc ComputedMemberExpression<'alloc>) { + } + + fn leave_computed_member_expression(&mut self, ast: &'alloc ComputedMemberExpression<'alloc>) { + } + + fn visit_identifier_expression(&mut self, ast: &'alloc IdentifierExpression) { + self.enter_identifier_expression(ast); + self.visit_identifier(&ast.name); + self.leave_identifier_expression(ast); + } + + fn enter_identifier_expression(&mut self, ast: &'alloc IdentifierExpression) { + } + + fn leave_identifier_expression(&mut self, ast: &'alloc IdentifierExpression) { + } + + fn visit_object_expression(&mut self, ast: &'alloc ObjectExpression<'alloc>) { + self.enter_object_expression(ast); + for item in &ast.properties { + self.visit_object_property(item); + } + self.leave_object_expression(ast); + } + + fn enter_object_expression(&mut self, ast: &'alloc ObjectExpression<'alloc>) { + } + + fn leave_object_expression(&mut self, ast: &'alloc ObjectExpression<'alloc>) { + } + + fn visit_static_member_expression(&mut self, ast: &'alloc StaticMemberExpression<'alloc>) { + self.enter_static_member_expression(ast); + self.visit_expression_or_super(&ast.object); + self.visit_identifier_name(&ast.property); + self.leave_static_member_expression(ast); + } + + fn enter_static_member_expression(&mut self, ast: &'alloc StaticMemberExpression<'alloc>) { + } + + fn leave_static_member_expression(&mut self, ast: &'alloc StaticMemberExpression<'alloc>) { + } + + fn visit_private_field_expression(&mut self, ast: &'alloc PrivateFieldExpression<'alloc>) { + self.enter_private_field_expression(ast); + self.visit_expression_or_super(&ast.object); + self.visit_private_identifier(&ast.field); + self.leave_private_field_expression(ast); + } + + fn enter_private_field_expression(&mut self, ast: &'alloc PrivateFieldExpression<'alloc>) { + } + + fn leave_private_field_expression(&mut self, ast: &'alloc PrivateFieldExpression<'alloc>) { + } + + fn visit_template_expression_element(&mut self, ast: &'alloc TemplateExpressionElement<'alloc>) { + self.enter_template_expression_element(ast); + match ast { + TemplateExpressionElement::Expression(ast) => { + self.visit_enum_template_expression_element_variant_expression(ast) + } + TemplateExpressionElement::TemplateElement(ast) => { + self.visit_enum_template_expression_element_variant_template_element(ast) + } + } + self.leave_template_expression_element(ast); + } + + fn enter_template_expression_element(&mut self, ast: &'alloc TemplateExpressionElement<'alloc>) { + } + + fn leave_template_expression_element(&mut self, ast: &'alloc TemplateExpressionElement<'alloc>) { + } + + fn visit_enum_template_expression_element_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_template_expression_element_variant_expression(ast); + self.visit_expression(ast); + self.leave_enum_template_expression_element_variant_expression(ast); + } + + fn enter_enum_template_expression_element_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_template_expression_element_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_template_expression_element_variant_template_element( + &mut self, + ast: &'alloc TemplateElement, + ) { + self.enter_enum_template_expression_element_variant_template_element(ast); + self.visit_template_element(ast); + self.leave_enum_template_expression_element_variant_template_element(ast); + } + + fn enter_enum_template_expression_element_variant_template_element( + &mut self, + ast: &'alloc TemplateElement, + ) { + } + + fn leave_enum_template_expression_element_variant_template_element( + &mut self, + ast: &'alloc TemplateElement, + ) { + } + + fn visit_template_expression(&mut self, ast: &'alloc TemplateExpression<'alloc>) { + self.enter_template_expression(ast); + if let Some(item) = &ast.tag { + self.visit_expression(item); + } + for item in &ast.elements { + self.visit_template_expression_element(item); + } + self.leave_template_expression(ast); + } + + fn enter_template_expression(&mut self, ast: &'alloc TemplateExpression<'alloc>) { + } + + fn leave_template_expression(&mut self, ast: &'alloc TemplateExpression<'alloc>) { + } + + fn visit_variable_declaration_or_assignment_target(&mut self, ast: &'alloc VariableDeclarationOrAssignmentTarget<'alloc>) { + self.enter_variable_declaration_or_assignment_target(ast); + match ast { + VariableDeclarationOrAssignmentTarget::VariableDeclaration(ast) => { + self.visit_enum_variable_declaration_or_assignment_target_variant_variable_declaration(ast) + } + VariableDeclarationOrAssignmentTarget::AssignmentTarget(ast) => { + self.visit_enum_variable_declaration_or_assignment_target_variant_assignment_target(ast) + } + } + self.leave_variable_declaration_or_assignment_target(ast); + } + + fn enter_variable_declaration_or_assignment_target(&mut self, ast: &'alloc VariableDeclarationOrAssignmentTarget<'alloc>) { + } + + fn leave_variable_declaration_or_assignment_target(&mut self, ast: &'alloc VariableDeclarationOrAssignmentTarget<'alloc>) { + } + + fn visit_enum_variable_declaration_or_assignment_target_variant_variable_declaration( + &mut self, + ast: &'alloc VariableDeclaration<'alloc>, + ) { + self.enter_enum_variable_declaration_or_assignment_target_variant_variable_declaration(ast); + self.visit_variable_declaration(ast); + self.leave_enum_variable_declaration_or_assignment_target_variant_variable_declaration(ast); + } + + fn enter_enum_variable_declaration_or_assignment_target_variant_variable_declaration( + &mut self, + ast: &'alloc VariableDeclaration<'alloc>, + ) { + } + + fn leave_enum_variable_declaration_or_assignment_target_variant_variable_declaration( + &mut self, + ast: &'alloc VariableDeclaration<'alloc>, + ) { + } + + fn visit_enum_variable_declaration_or_assignment_target_variant_assignment_target( + &mut self, + ast: &'alloc AssignmentTarget<'alloc>, + ) { + self.enter_enum_variable_declaration_or_assignment_target_variant_assignment_target(ast); + self.visit_assignment_target(ast); + self.leave_enum_variable_declaration_or_assignment_target_variant_assignment_target(ast); + } + + fn enter_enum_variable_declaration_or_assignment_target_variant_assignment_target( + &mut self, + ast: &'alloc AssignmentTarget<'alloc>, + ) { + } + + fn leave_enum_variable_declaration_or_assignment_target_variant_assignment_target( + &mut self, + ast: &'alloc AssignmentTarget<'alloc>, + ) { + } + + fn visit_variable_declaration_or_expression(&mut self, ast: &'alloc VariableDeclarationOrExpression<'alloc>) { + self.enter_variable_declaration_or_expression(ast); + match ast { + VariableDeclarationOrExpression::VariableDeclaration(ast) => { + self.visit_enum_variable_declaration_or_expression_variant_variable_declaration(ast) + } + VariableDeclarationOrExpression::Expression(ast) => { + self.visit_enum_variable_declaration_or_expression_variant_expression(ast) + } + } + self.leave_variable_declaration_or_expression(ast); + } + + fn enter_variable_declaration_or_expression(&mut self, ast: &'alloc VariableDeclarationOrExpression<'alloc>) { + } + + fn leave_variable_declaration_or_expression(&mut self, ast: &'alloc VariableDeclarationOrExpression<'alloc>) { + } + + fn visit_enum_variable_declaration_or_expression_variant_variable_declaration( + &mut self, + ast: &'alloc VariableDeclaration<'alloc>, + ) { + self.enter_enum_variable_declaration_or_expression_variant_variable_declaration(ast); + self.visit_variable_declaration(ast); + self.leave_enum_variable_declaration_or_expression_variant_variable_declaration(ast); + } + + fn enter_enum_variable_declaration_or_expression_variant_variable_declaration( + &mut self, + ast: &'alloc VariableDeclaration<'alloc>, + ) { + } + + fn leave_enum_variable_declaration_or_expression_variant_variable_declaration( + &mut self, + ast: &'alloc VariableDeclaration<'alloc>, + ) { + } + + fn visit_enum_variable_declaration_or_expression_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_variable_declaration_or_expression_variant_expression(ast); + self.visit_expression(ast); + self.leave_enum_variable_declaration_or_expression_variant_expression(ast); + } + + fn enter_enum_variable_declaration_or_expression_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_variable_declaration_or_expression_variant_expression( + &mut self, + ast: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_block(&mut self, ast: &'alloc Block<'alloc>) { + self.enter_block(ast); + for item in &ast.statements { + self.visit_statement(item); + } + if let Some(item) = &ast.declarations { + for item in item { + } + } + self.leave_block(ast); + } + + fn enter_block(&mut self, ast: &'alloc Block<'alloc>) { + } + + fn leave_block(&mut self, ast: &'alloc Block<'alloc>) { + } + + fn visit_catch_clause(&mut self, ast: &'alloc CatchClause<'alloc>) { + self.enter_catch_clause(ast); + if let Some(item) = &ast.binding { + self.visit_binding(item); + } + self.visit_block(&ast.body); + self.leave_catch_clause(ast); + } + + fn enter_catch_clause(&mut self, ast: &'alloc CatchClause<'alloc>) { + } + + fn leave_catch_clause(&mut self, ast: &'alloc CatchClause<'alloc>) { + } + + fn visit_directive(&mut self, ast: &'alloc Directive) { + self.enter_directive(ast); + self.leave_directive(ast); + } + + fn enter_directive(&mut self, ast: &'alloc Directive) { + } + + fn leave_directive(&mut self, ast: &'alloc Directive) { + } + + fn visit_formal_parameters(&mut self, ast: &'alloc FormalParameters<'alloc>) { + self.enter_formal_parameters(ast); + for item in &ast.items { + self.visit_parameter(item); + } + if let Some(item) = &ast.rest { + self.visit_binding(item); + } + self.leave_formal_parameters(ast); + } + + fn enter_formal_parameters(&mut self, ast: &'alloc FormalParameters<'alloc>) { + } + + fn leave_formal_parameters(&mut self, ast: &'alloc FormalParameters<'alloc>) { + } + + fn visit_function_body(&mut self, ast: &'alloc FunctionBody<'alloc>) { + self.enter_function_body(ast); + for item in &ast.directives { + self.visit_directive(item); + } + for item in &ast.statements { + self.visit_statement(item); + } + self.leave_function_body(ast); + } + + fn enter_function_body(&mut self, ast: &'alloc FunctionBody<'alloc>) { + } + + fn leave_function_body(&mut self, ast: &'alloc FunctionBody<'alloc>) { + } + + fn visit_script(&mut self, ast: &'alloc Script<'alloc>) { + self.enter_script(ast); + for item in &ast.directives { + self.visit_directive(item); + } + for item in &ast.statements { + self.visit_statement(item); + } + self.leave_script(ast); + } + + fn enter_script(&mut self, ast: &'alloc Script<'alloc>) { + } + + fn leave_script(&mut self, ast: &'alloc Script<'alloc>) { + } + + fn visit_switch_case(&mut self, ast: &'alloc SwitchCase<'alloc>) { + self.enter_switch_case(ast); + self.visit_expression(&ast.test); + for item in &ast.consequent { + self.visit_statement(item); + } + self.leave_switch_case(ast); + } + + fn enter_switch_case(&mut self, ast: &'alloc SwitchCase<'alloc>) { + } + + fn leave_switch_case(&mut self, ast: &'alloc SwitchCase<'alloc>) { + } + + fn visit_switch_default(&mut self, ast: &'alloc SwitchDefault<'alloc>) { + self.enter_switch_default(ast); + for item in &ast.consequent { + self.visit_statement(item); + } + self.leave_switch_default(ast); + } + + fn enter_switch_default(&mut self, ast: &'alloc SwitchDefault<'alloc>) { + } + + fn leave_switch_default(&mut self, ast: &'alloc SwitchDefault<'alloc>) { + } + + fn visit_template_element(&mut self, ast: &'alloc TemplateElement) { + self.enter_template_element(ast); + self.leave_template_element(ast); + } + + fn enter_template_element(&mut self, ast: &'alloc TemplateElement) { + } + + fn leave_template_element(&mut self, ast: &'alloc TemplateElement) { + } + + fn visit_variable_declaration(&mut self, ast: &'alloc VariableDeclaration<'alloc>) { + self.enter_variable_declaration(ast); + self.visit_variable_declaration_kind(&ast.kind); + for item in &ast.declarators { + self.visit_variable_declarator(item); + } + self.leave_variable_declaration(ast); + } + + fn enter_variable_declaration(&mut self, ast: &'alloc VariableDeclaration<'alloc>) { + } + + fn leave_variable_declaration(&mut self, ast: &'alloc VariableDeclaration<'alloc>) { + } + + fn visit_variable_declarator(&mut self, ast: &'alloc VariableDeclarator<'alloc>) { + self.enter_variable_declarator(ast); + self.visit_binding(&ast.binding); + if let Some(item) = &ast.init { + self.visit_expression(item); + } + self.leave_variable_declarator(ast); + } + + fn enter_variable_declarator(&mut self, ast: &'alloc VariableDeclarator<'alloc>) { + } + + fn leave_variable_declarator(&mut self, ast: &'alloc VariableDeclarator<'alloc>) { + } + + fn visit_cover_parenthesized(&mut self, ast: &'alloc CoverParenthesized<'alloc>) { + self.enter_cover_parenthesized(ast); + match ast { + CoverParenthesized::Expression { expression, .. } => { + self.visit_enum_cover_parenthesized_variant_expression( + expression, + ) + } + CoverParenthesized::Parameters(ast) => { + self.visit_enum_cover_parenthesized_variant_parameters(ast) + } + } + self.leave_cover_parenthesized(ast); + } + + fn enter_cover_parenthesized(&mut self, ast: &'alloc CoverParenthesized<'alloc>) { + } + + fn leave_cover_parenthesized(&mut self, ast: &'alloc CoverParenthesized<'alloc>) { + } + + fn visit_enum_cover_parenthesized_variant_expression( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + self.enter_enum_cover_parenthesized_variant_expression( + expression, + ); + self.visit_expression(expression); + self.leave_enum_cover_parenthesized_variant_expression( + expression, + ); + } + + fn enter_enum_cover_parenthesized_variant_expression( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn leave_enum_cover_parenthesized_variant_expression( + &mut self, + expression: &'alloc arena::Box<'alloc, Expression<'alloc>>, + ) { + } + + fn visit_enum_cover_parenthesized_variant_parameters( + &mut self, + ast: &'alloc arena::Box<'alloc, FormalParameters<'alloc>>, + ) { + self.enter_enum_cover_parenthesized_variant_parameters(ast); + self.visit_formal_parameters(ast); + self.leave_enum_cover_parenthesized_variant_parameters(ast); + } + + fn enter_enum_cover_parenthesized_variant_parameters( + &mut self, + ast: &'alloc arena::Box<'alloc, FormalParameters<'alloc>>, + ) { + } + + fn leave_enum_cover_parenthesized_variant_parameters( + &mut self, + ast: &'alloc arena::Box<'alloc, FormalParameters<'alloc>>, + ) { + } + +} + |