From d65061e5650cf98eaa72774a768c93dd1ebfa987 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Sun, 15 Jun 2025 16:41:45 +0200 Subject: [PATCH 01/42] feat: add loc and range fields --- crates/oxc_ast/src/generated/derive_estree.rs | 2675 ++++++++++++++++- crates/oxc_ast/src/lib.rs | 2 +- crates/oxc_ast/src/serialize/mod.rs | 45 +- crates/oxc_estree/Cargo.toml | 2 +- crates/oxc_estree/src/lib.rs | 11 +- crates/oxc_estree/src/serialize/concat.rs | 2 +- crates/oxc_estree/src/serialize/mod.rs | 101 +- crates/oxc_estree/src/serialize/primitives.rs | 24 +- crates/oxc_estree/src/serialize/structs.rs | 48 + crates/oxc_parser/src/lib.rs | 16 + .../oxc_span/src/generated/derive_estree.rs | 3 +- .../oxc_syntax/src/generated/derive_estree.rs | 48 +- napi/parser/index.d.ts | 40 + napi/parser/src/convert.rs | 7 +- napi/parser/src/generated/derive_estree.rs | 48 +- napi/parser/src/lib.rs | 17 +- napi/parser/src/types.rs | 39 + napi/playground/src/lib.rs | 2 + tasks/ast_tools/src/derives/estree.rs | 34 +- 19 files changed, 3139 insertions(+), 25 deletions(-) diff --git a/crates/oxc_ast/src/generated/derive_estree.rs b/crates/oxc_ast/src/generated/derive_estree.rs index ab0a8242858ee..777be6a46ce34 100644 --- a/crates/oxc_ast/src/generated/derive_estree.rs +++ b/crates/oxc_ast/src/generated/derive_estree.rs @@ -4,7 +4,8 @@ #![allow(unused_imports, clippy::match_same_arms, clippy::semicolon_if_nothing_returned)] use oxc_estree::{ - Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Serializer, StructSerializer, + Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Range, Serializer, + StructSerializer, }; use crate::ast::comment::*; @@ -73,6 +74,21 @@ impl ESTree for IdentifierName<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -87,6 +103,21 @@ impl ESTree for IdentifierReference<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -101,6 +132,21 @@ impl ESTree for BindingIdentifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -115,6 +161,21 @@ impl ESTree for LabelIdentifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -129,6 +190,21 @@ impl ESTree for ThisExpression { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ThisExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -139,6 +215,21 @@ impl ESTree for ArrayExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrayExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("elements", &self.elements); @@ -208,6 +299,21 @@ impl ESTree for ObjectExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ObjectExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("properties", &self.properties); @@ -228,6 +334,21 @@ impl ESTree for ObjectProperty<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("kind", &self.kind); @@ -307,6 +428,21 @@ impl ESTree for TemplateLiteral<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TemplateLiteral")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("quasis", &self.quasis); @@ -319,6 +455,21 @@ impl ESTree for TaggedTemplateExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TaggedTemplateExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("tag", &self.tag); @@ -357,6 +508,21 @@ impl ESTree for ComputedMemberExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MemberExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("object", &self.object); @@ -371,6 +537,21 @@ impl ESTree for StaticMemberExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MemberExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("object", &self.object); @@ -385,6 +566,21 @@ impl ESTree for PrivateFieldExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MemberExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("object", &self.object); @@ -399,6 +595,21 @@ impl ESTree for CallExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("CallExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("callee", &self.callee); @@ -413,6 +624,21 @@ impl ESTree for NewExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("NewExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("callee", &self.callee); @@ -426,6 +652,21 @@ impl ESTree for MetaProperty<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MetaProperty")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("meta", &self.meta); @@ -438,6 +679,21 @@ impl ESTree for SpreadElement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SpreadElement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); @@ -500,6 +756,21 @@ impl ESTree for UpdateExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("UpdateExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("operator", &self.operator); @@ -513,6 +784,21 @@ impl ESTree for UnaryExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("UnaryExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("operator", &self.operator); @@ -526,6 +812,21 @@ impl ESTree for BinaryExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BinaryExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("left", &self.left); @@ -539,6 +840,21 @@ impl ESTree for PrivateInExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BinaryExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("left", &self.left); @@ -552,6 +868,21 @@ impl ESTree for LogicalExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("LogicalExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("left", &self.left); @@ -565,6 +896,21 @@ impl ESTree for ConditionalExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ConditionalExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("test", &self.test); @@ -578,6 +924,21 @@ impl ESTree for AssignmentExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AssignmentExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("operator", &self.operator); @@ -632,6 +993,21 @@ impl ESTree for ArrayAssignmentTarget<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrayPattern")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -646,6 +1022,21 @@ impl ESTree for ObjectAssignmentTarget<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ObjectPattern")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -660,6 +1051,21 @@ impl ESTree for AssignmentTargetRest<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("RestElement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -693,6 +1099,21 @@ impl ESTree for AssignmentTargetWithDefault<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AssignmentPattern")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -717,6 +1138,21 @@ impl ESTree for AssignmentTargetPropertyIdentifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("kind", &crate::serialize::basic::Init(self)); @@ -737,6 +1173,21 @@ impl ESTree for AssignmentTargetPropertyProperty<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("kind", &crate::serialize::basic::Init(self)); @@ -754,6 +1205,21 @@ impl ESTree for SequenceExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SequenceExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expressions", &self.expressions); @@ -765,6 +1231,21 @@ impl ESTree for Super { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Super")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -775,6 +1256,21 @@ impl ESTree for AwaitExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AwaitExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); @@ -786,6 +1282,21 @@ impl ESTree for ChainExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ChainExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -809,6 +1320,21 @@ impl ESTree for ParenthesizedExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ParenthesizedExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -859,6 +1385,21 @@ impl ESTree for Directive<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExpressionStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -871,6 +1412,21 @@ impl ESTree for Hashbang<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Hashbang")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); @@ -882,6 +1438,21 @@ impl ESTree for BlockStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BlockStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); @@ -908,6 +1479,21 @@ impl ESTree for VariableDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("VariableDeclaration")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("kind", &self.kind); @@ -933,6 +1519,21 @@ impl ESTree for VariableDeclarator<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("VariableDeclarator")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -946,6 +1547,21 @@ impl ESTree for EmptyStatement { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("EmptyStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -956,6 +1572,21 @@ impl ESTree for ExpressionStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExpressionStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -971,6 +1602,21 @@ impl ESTree for IfStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("IfStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("test", &self.test); @@ -984,6 +1630,21 @@ impl ESTree for DoWhileStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("DoWhileStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); @@ -996,6 +1657,21 @@ impl ESTree for WhileStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("WhileStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("test", &self.test); @@ -1008,6 +1684,21 @@ impl ESTree for ForStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ForStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("init", &self.init); @@ -1073,6 +1764,21 @@ impl ESTree for ForInStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ForInStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("left", &self.left); @@ -1104,6 +1810,21 @@ impl ESTree for ForOfStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ForOfStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("await", &self.r#await); @@ -1118,6 +1839,21 @@ impl ESTree for ContinueStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ContinueStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("label", &self.label); @@ -1129,6 +1865,21 @@ impl ESTree for BreakStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BreakStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("label", &self.label); @@ -1140,6 +1891,21 @@ impl ESTree for ReturnStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ReturnStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); @@ -1151,6 +1917,21 @@ impl ESTree for WithStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("WithStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("object", &self.object); @@ -1163,6 +1944,21 @@ impl ESTree for SwitchStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SwitchStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("discriminant", &self.discriminant); @@ -1175,6 +1971,21 @@ impl ESTree for SwitchCase<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SwitchCase")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("test", &self.test); @@ -1187,6 +1998,21 @@ impl ESTree for LabeledStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("LabeledStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("label", &self.label); @@ -1199,6 +2025,21 @@ impl ESTree for ThrowStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ThrowStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); @@ -1210,6 +2051,21 @@ impl ESTree for TryStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TryStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("block", &self.block); @@ -1223,6 +2079,21 @@ impl ESTree for CatchClause<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("CatchClause")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("param", &self.param); @@ -1241,6 +2112,21 @@ impl ESTree for DebuggerStatement { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("DebuggerStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -1268,6 +2154,21 @@ impl ESTree for AssignmentPattern<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AssignmentPattern")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -1283,6 +2184,21 @@ impl ESTree for ObjectPattern<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ObjectPattern")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -1297,6 +2213,21 @@ impl ESTree for BindingProperty<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("kind", &crate::serialize::basic::Init(self)); @@ -1314,6 +2245,21 @@ impl ESTree for ArrayPattern<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrayPattern")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -1328,6 +2274,21 @@ impl ESTree for BindingRestElement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("RestElement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -1343,6 +2304,21 @@ impl ESTree for Function<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -1404,6 +2380,21 @@ impl ESTree for FunctionBody<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BlockStatement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &Concat2(&self.directives, &self.statements)); @@ -1415,6 +2406,21 @@ impl ESTree for ArrowFunctionExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrowFunctionExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -1433,6 +2439,21 @@ impl ESTree for YieldExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("YieldExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("delegate", &self.delegate); @@ -1445,6 +2466,21 @@ impl ESTree for Class<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("decorators", &self.decorators); @@ -1473,6 +2509,21 @@ impl ESTree for ClassBody<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ClassBody")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); @@ -1496,6 +2547,21 @@ impl ESTree for MethodDefinition<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("decorators", &self.decorators); @@ -1526,6 +2592,21 @@ impl ESTree for PropertyDefinition<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("decorators", &self.decorators); @@ -1570,6 +2651,21 @@ impl ESTree for PrivateIdentifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("PrivateIdentifier")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); @@ -1581,6 +2677,21 @@ impl ESTree for StaticBlock<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("StaticBlock")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); @@ -1616,6 +2727,21 @@ impl ESTree for AccessorProperty<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("decorators", &self.decorators); @@ -1638,6 +2764,21 @@ impl ESTree for ImportExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("source", &self.source); @@ -1651,6 +2792,21 @@ impl ESTree for ImportDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportDeclaration")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field( @@ -1691,6 +2847,21 @@ impl ESTree for ImportSpecifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportSpecifier")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("imported", &self.imported); @@ -1704,6 +2875,21 @@ impl ESTree for ImportDefaultSpecifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportDefaultSpecifier")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("local", &self.local); @@ -1715,6 +2901,21 @@ impl ESTree for ImportNamespaceSpecifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportNamespaceSpecifier")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("local", &self.local); @@ -1734,6 +2935,21 @@ impl ESTree for ImportAttribute<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportAttribute")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("key", &self.key); @@ -1755,6 +2971,21 @@ impl ESTree for ExportNamedDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportNamedDeclaration")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("declaration", &self.declaration); @@ -1773,6 +3004,21 @@ impl ESTree for ExportDefaultDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportDefaultDeclaration")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("declaration", &self.declaration); @@ -1785,6 +3031,21 @@ impl ESTree for ExportAllDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportAllDeclaration")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("exported", &self.exported); @@ -1802,6 +3063,21 @@ impl ESTree for ExportSpecifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportSpecifier")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("local", &self.local); @@ -1878,7 +3154,22 @@ impl ESTree for V8IntrinsicExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("V8IntrinsicExpression")); - state.serialize_field("start", &self.span.start); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } + state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); state.serialize_field("arguments", &self.arguments); @@ -1890,6 +3181,21 @@ impl ESTree for BooleanLiteral { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); @@ -1902,6 +3208,21 @@ impl ESTree for NullLiteral { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &crate::serialize::basic::Null(self)); @@ -1914,6 +3235,21 @@ impl ESTree for NumericLiteral<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); @@ -1926,6 +3262,21 @@ impl ESTree for StringLiteral<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &crate::serialize::literal::StringLiteralValue(self)); @@ -1938,6 +3289,21 @@ impl ESTree for BigIntLiteral<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &crate::serialize::literal::BigIntLiteralValue(self)); @@ -1951,6 +3317,21 @@ impl ESTree for RegExpLiteral<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &crate::serialize::literal::RegExpLiteralValue(self)); @@ -1987,6 +3368,21 @@ impl ESTree for JSXElement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXElement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field( @@ -2003,6 +3399,21 @@ impl ESTree for JSXOpeningElement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXOpeningElement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); @@ -2020,6 +3431,21 @@ impl ESTree for JSXClosingElement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXClosingElement")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); @@ -2031,6 +3457,21 @@ impl ESTree for JSXFragment<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXFragment")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("openingFragment", &self.opening_fragment); @@ -2044,6 +3485,21 @@ impl ESTree for JSXOpeningFragment { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXOpeningFragment")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_js_field("attributes", &crate::serialize::basic::JsEmptyArray(self)); @@ -2056,6 +3512,21 @@ impl ESTree for JSXClosingFragment { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXClosingFragment")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2082,6 +3553,21 @@ impl ESTree for JSXNamespacedName<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXNamespacedName")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("namespace", &self.namespace); @@ -2094,6 +3580,21 @@ impl ESTree for JSXMemberExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXMemberExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("object", &self.object); @@ -2120,6 +3621,21 @@ impl ESTree for JSXExpressionContainer<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXExpressionContainer")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -2182,6 +3698,21 @@ impl ESTree for JSXEmptyExpression { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXEmptyExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2201,6 +3732,21 @@ impl ESTree for JSXAttribute<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXAttribute")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); @@ -2213,6 +3759,21 @@ impl ESTree for JSXSpreadAttribute<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXSpreadAttribute")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); @@ -2244,6 +3805,21 @@ impl ESTree for JSXIdentifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXIdentifier")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &JsonSafeString(self.name.as_str())); @@ -2267,6 +3843,21 @@ impl ESTree for JSXSpreadChild<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXSpreadChild")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -2278,6 +3869,21 @@ impl ESTree for JSXText<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXText")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); @@ -2290,6 +3896,21 @@ impl ESTree for TSThisParameter<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("decorators", &crate::serialize::basic::EmptyArray(self)); @@ -2304,6 +3925,21 @@ impl ESTree for TSEnumDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSEnumDeclaration")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -2318,6 +3954,21 @@ impl ESTree for TSEnumBody<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSEnumBody")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("members", &self.members); @@ -2329,6 +3980,21 @@ impl ESTree for TSEnumMember<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSEnumMember")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -2353,6 +4019,21 @@ impl ESTree for TSTypeAnnotation<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeAnnotation")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -2364,6 +4045,21 @@ impl ESTree for TSLiteralType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSLiteralType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("literal", &self.literal); @@ -2432,6 +4128,21 @@ impl ESTree for TSConditionalType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSConditionalType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("checkType", &self.check_type); @@ -2446,6 +4157,21 @@ impl ESTree for TSUnionType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSUnionType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("types", &self.types); @@ -2457,6 +4183,21 @@ impl ESTree for TSIntersectionType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIntersectionType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("types", &self.types); @@ -2468,6 +4209,21 @@ impl ESTree for TSParenthesizedType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSParenthesizedType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -2479,6 +4235,21 @@ impl ESTree for TSTypeOperator<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeOperator")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("operator", &self.operator); @@ -2501,6 +4272,21 @@ impl ESTree for TSArrayType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSArrayType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("elementType", &self.element_type); @@ -2512,6 +4298,21 @@ impl ESTree for TSIndexedAccessType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIndexedAccessType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("objectType", &self.object_type); @@ -2524,6 +4325,21 @@ impl ESTree for TSTupleType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTupleType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("elementTypes", &self.element_types); @@ -2535,6 +4351,21 @@ impl ESTree for TSNamedTupleMember<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNamedTupleMember")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("label", &self.label); @@ -2548,6 +4379,21 @@ impl ESTree for TSOptionalType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSOptionalType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -2559,6 +4405,21 @@ impl ESTree for TSRestType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSRestType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -2616,6 +4477,21 @@ impl ESTree for TSAnyKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSAnyKeyword")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2626,6 +4502,21 @@ impl ESTree for TSStringKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSStringKeyword")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2636,6 +4527,21 @@ impl ESTree for TSBooleanKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSBooleanKeyword")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2646,6 +4552,21 @@ impl ESTree for TSNumberKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNumberKeyword")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2656,6 +4577,21 @@ impl ESTree for TSNeverKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNeverKeyword")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2666,6 +4602,21 @@ impl ESTree for TSIntrinsicKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIntrinsicKeyword")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2676,6 +4627,21 @@ impl ESTree for TSUnknownKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSUnknownKeyword")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2686,6 +4652,21 @@ impl ESTree for TSNullKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNullKeyword")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2696,6 +4677,21 @@ impl ESTree for TSUndefinedKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSUndefinedKeyword")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2706,6 +4702,21 @@ impl ESTree for TSVoidKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSVoidKeyword")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2716,6 +4727,21 @@ impl ESTree for TSSymbolKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSSymbolKeyword")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2726,6 +4752,21 @@ impl ESTree for TSThisType { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSThisType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2736,6 +4777,21 @@ impl ESTree for TSObjectKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSObjectKeyword")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2746,6 +4802,21 @@ impl ESTree for TSBigIntKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSBigIntKeyword")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2756,6 +4827,21 @@ impl ESTree for TSTypeReference<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeReference")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeName", &self.type_name); @@ -2779,6 +4865,21 @@ impl ESTree for TSQualifiedName<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSQualifiedName")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("left", &self.left); @@ -2791,6 +4892,21 @@ impl ESTree for TSTypeParameterInstantiation<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeParameterInstantiation")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("params", &self.params); @@ -2802,6 +4918,21 @@ impl ESTree for TSTypeParameter<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeParameter")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); @@ -2818,6 +4949,21 @@ impl ESTree for TSTypeParameterDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeParameterDeclaration")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("params", &self.params); @@ -2829,6 +4975,21 @@ impl ESTree for TSTypeAliasDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeAliasDeclaration")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -2853,6 +5014,21 @@ impl ESTree for TSClassImplements<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSClassImplements")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field( @@ -2868,6 +5044,21 @@ impl ESTree for TSInterfaceDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInterfaceDeclaration")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -2883,6 +5074,21 @@ impl ESTree for TSInterfaceBody<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInterfaceBody")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); @@ -2894,6 +5100,21 @@ impl ESTree for TSPropertySignature<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSPropertySignature")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("computed", &self.computed); @@ -2923,6 +5144,21 @@ impl ESTree for TSIndexSignature<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIndexSignature")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("parameters", &self.parameters); @@ -2938,6 +5174,21 @@ impl ESTree for TSCallSignatureDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSCallSignatureDeclaration")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeParameters", &self.type_parameters); @@ -2964,6 +5215,21 @@ impl ESTree for TSMethodSignature<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSMethodSignature")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("key", &self.key); @@ -2984,6 +5250,21 @@ impl ESTree for TSConstructSignatureDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSConstructSignatureDeclaration")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeParameters", &self.type_parameters); @@ -2997,6 +5278,21 @@ impl ESTree for TSIndexSignatureName<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("decorators", &crate::serialize::basic::EmptyArray(self)); @@ -3011,6 +5307,21 @@ impl ESTree for TSInterfaceHeritage<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInterfaceHeritage")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -3023,6 +5334,21 @@ impl ESTree for TSTypePredicate<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypePredicate")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("parameterName", &self.parameter_name); @@ -3079,6 +5405,21 @@ impl ESTree for TSModuleBlock<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSModuleBlock")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &Concat2(&self.directives, &self.body)); @@ -3090,6 +5431,21 @@ impl ESTree for TSTypeLiteral<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeLiteral")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("members", &self.members); @@ -3101,6 +5457,21 @@ impl ESTree for TSInferType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInferType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeParameter", &self.type_parameter); @@ -3112,6 +5483,21 @@ impl ESTree for TSTypeQuery<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeQuery")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("exprName", &self.expr_name); @@ -3136,6 +5522,21 @@ impl ESTree for TSImportType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSImportType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); @@ -3150,6 +5551,21 @@ impl ESTree for TSFunctionType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSFunctionType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeParameters", &self.type_parameters); @@ -3163,6 +5579,21 @@ impl ESTree for TSConstructorType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSConstructorType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("abstract", &self.r#abstract); @@ -3177,6 +5608,21 @@ impl ESTree for TSMappedType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSMappedType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("key", &crate::serialize::ts::TSMappedTypeKey(self)); @@ -3203,6 +5649,21 @@ impl ESTree for TSTemplateLiteralType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTemplateLiteralType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("quasis", &self.quasis); @@ -3215,6 +5676,21 @@ impl ESTree for TSAsExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSAsExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -3227,6 +5703,21 @@ impl ESTree for TSSatisfiesExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSSatisfiesExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -3239,6 +5730,21 @@ impl ESTree for TSTypeAssertion<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeAssertion")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -3251,6 +5757,21 @@ impl ESTree for TSImportEqualsDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSImportEqualsDeclaration")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -3276,6 +5797,21 @@ impl ESTree for TSExternalModuleReference<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSExternalModuleReference")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -3287,6 +5823,21 @@ impl ESTree for TSNonNullExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNonNullExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -3298,6 +5849,21 @@ impl ESTree for Decorator<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Decorator")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -3309,6 +5875,21 @@ impl ESTree for TSExportAssignment<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSExportAssignment")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -3320,6 +5901,21 @@ impl ESTree for TSNamespaceExportDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNamespaceExportDeclaration")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -3331,6 +5927,21 @@ impl ESTree for TSInstantiationExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInstantiationExpression")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -3352,6 +5963,21 @@ impl ESTree for JSDocNullableType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSJSDocNullableType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -3364,6 +5990,21 @@ impl ESTree for JSDocNonNullableType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSJSDocNonNullableType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -3376,6 +6017,21 @@ impl ESTree for JSDocUnknownType { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSJSDocUnknownType")); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -3396,6 +6052,21 @@ impl ESTree for Comment { let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.kind); state.serialize_field("value", &crate::serialize::CommentValue(self)); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); diff --git a/crates/oxc_ast/src/lib.rs b/crates/oxc_ast/src/lib.rs index 31d9e4fcf7473..a035617029520 100644 --- a/crates/oxc_ast/src/lib.rs +++ b/crates/oxc_ast/src/lib.rs @@ -44,7 +44,7 @@ #![warn(missing_docs)] #[cfg(feature = "serialize")] -mod serialize; +pub mod serialize; pub mod ast; mod ast_builder_impl; diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index 5d8a8391f51c4..d1d6f0b15ed8f 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -4,11 +4,24 @@ use oxc_ast_macros::ast_meta; use oxc_estree::{ CompactFixesJSSerializer, CompactFixesTSSerializer, CompactJSSerializer, CompactTSSerializer, Concat2, ESTree, JsonSafeString, PrettyFixesJSSerializer, PrettyFixesTSSerializer, - PrettyJSSerializer, PrettyTSSerializer, Serializer, StructSerializer, + PrettyJSSerializer, PrettyTSSerializer, RuntimeOptions, Serializer, StructSerializer, }; use oxc_span::GetSpan; use crate::ast::*; +use crate::{ + ast::{ExportDefaultDeclarationKind, Statement}, + ast::{Declaration, Program}, +}; + +/// Options for ESTree serialization +#[derive(Clone, Copy)] +pub struct SerializationOptions { + /// Include range field [start, end] in each node + pub range: bool, + /// Include loc field with line/column information in each node + pub loc: bool, +} pub mod basic; pub mod js; @@ -80,15 +93,37 @@ impl Program<'_> { /// Serialize AST to ESTree JSON, including TypeScript fields, with list of fixes. pub fn to_estree_ts_json_with_fixes(&self) -> String { - let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let serializer = CompactFixesTSSerializer::with_capacity(capacity); - serializer.serialize_with_fixes(self) + self.to_estree_ts_json_with_fixes_and_options(None) } /// Serialize AST to ESTree JSON, without TypeScript fields, with list of fixes. pub fn to_estree_js_json_with_fixes(&self) -> String { + self.to_estree_js_json_with_fixes_and_options(None) + } + + /// Serialize AST to ESTree JSON, including TypeScript fields, with list of fixes and serialization options. + pub fn to_estree_ts_json_with_fixes_and_options(&self, options: Option<&SerializationOptions>) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let serializer = CompactFixesJSSerializer::with_capacity(capacity); + let runtime_options = options.map_or_else(RuntimeOptions::default, |o| RuntimeOptions { range: o.range, loc: o.loc }); + let mut serializer = CompactFixesTSSerializer::with_capacity(capacity).with_options(runtime_options); + if runtime_options.loc { + // SAFETY: source_text lives as long as the Program, and serialization is synchronous + let source_text_static: &'static str = unsafe { std::mem::transmute(self.source_text) }; + serializer = serializer.with_source_text(source_text_static); + } + serializer.serialize_with_fixes(self) + } + + /// Serialize AST to ESTree JSON, without TypeScript fields, with list of fixes and serialization options. + pub fn to_estree_js_json_with_fixes_and_options(&self, options: Option<&SerializationOptions>) -> String { + let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; + let runtime_options = options.map_or_else(RuntimeOptions::default, |o| RuntimeOptions { range: o.range, loc: o.loc }); + let mut serializer = CompactFixesJSSerializer::with_capacity(capacity).with_options(runtime_options); + if runtime_options.loc { + // SAFETY: source_text lives as long as the Program, and serialization is synchronous + let source_text_static: &'static str = unsafe { std::mem::transmute(self.source_text) }; + serializer = serializer.with_source_text(source_text_static); + } serializer.serialize_with_fixes(self) } diff --git a/crates/oxc_estree/Cargo.toml b/crates/oxc_estree/Cargo.toml index 286825182f4b0..cd4d953859faf 100644 --- a/crates/oxc_estree/Cargo.toml +++ b/crates/oxc_estree/Cargo.toml @@ -19,7 +19,7 @@ workspace = true doctest = false [dependencies] -oxc_data_structures = { workspace = true, features = ["code_buffer", "pointer_ext", "stack"], optional = true } +oxc_data_structures = { workspace = true, features = ["code_buffer", "pointer_ext", "rope", "stack"], optional = true } itoa = { workspace = true, optional = true } ryu-js = { workspace = true, optional = true } diff --git a/crates/oxc_estree/src/lib.rs b/crates/oxc_estree/src/lib.rs index ed6a304bc087a..b781000c1ab41 100644 --- a/crates/oxc_estree/src/lib.rs +++ b/crates/oxc_estree/src/lib.rs @@ -1,10 +1,13 @@ -#[cfg(feature = "serialize")] -mod serialize; -#[cfg(feature = "serialize")] -pub use serialize::*; +pub mod serialize; + +pub use serialize::{Position, SourceLocation}; /// Placeholder for real `ESTree` trait when `serialize` feature not enabled. /// /// Provided to support `#[generate_derive(ESTree)]`, without enabling the feature. #[cfg(not(feature = "serialize"))] pub trait ESTree {} + +// Re-export main serialize types for backward compatibility +#[cfg(feature = "serialize")] +pub use serialize::*; diff --git a/crates/oxc_estree/src/serialize/concat.rs b/crates/oxc_estree/src/serialize/concat.rs index ec099b15103b6..5b8d1c758c35b 100644 --- a/crates/oxc_estree/src/serialize/concat.rs +++ b/crates/oxc_estree/src/serialize/concat.rs @@ -1,4 +1,4 @@ -use crate::{ESTree, SequenceSerializer, Serializer}; +use super::{ESTree, SequenceSerializer, Serializer}; /// Trait for types which can be concatenated. /// diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index 9d798d2a794b7..c4baa5c3a8638 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -4,8 +4,7 @@ use std::mem; use itoa::Buffer as ItoaBuffer; - -use oxc_data_structures::{code_buffer::CodeBuffer, stack::NonEmptyStack}; +use oxc_data_structures::{code_buffer::CodeBuffer, stack::NonEmptyStack, rope::{Rope, get_line_column}}; mod blanket; mod concat; @@ -21,6 +20,7 @@ use sequences::ESTreeSequenceSerializer; use structs::ESTreeStructSerializer; pub use concat::{Concat2, Concat3, ConcatElement}; +pub use primitives::Range; pub use sequences::SequenceSerializer; pub use strings::{JsonSafeString, LoneSurrogatesString}; pub use structs::{FlatStructSerializer, StructSerializer}; @@ -44,6 +44,13 @@ pub trait Serializer: SerializerPrivate { /// Type of sequence serializer this serializer uses. type SequenceSerializer: SequenceSerializer; + fn range(&self) -> bool; + + fn loc(&self) -> bool; + + /// Get line and column position from byte offset + fn get_line_column(&self, offset: u32) -> Option<(u32, u32)>; + /// Serialize struct. fn serialize_struct(self) -> Self::StructSerializer; @@ -94,12 +101,21 @@ pub type PrettyFixesTSSerializer = ESTreeSerializer; +#[derive(Clone, Copy, Default)] +pub struct RuntimeOptions { + pub range: bool, + pub loc: bool, +} + /// ESTree serializer. pub struct ESTreeSerializer { buffer: CodeBuffer, formatter: F, trace_path: NonEmptyStack, fixes_buffer: CodeBuffer, + options: RuntimeOptions, + source_text: Option<&'static str>, + rope: Option, #[expect(unused)] config: C, } @@ -112,6 +128,9 @@ impl ESTreeSerializer { formatter: F::new(), trace_path: NonEmptyStack::new(TracePathPart::Index(0)), fixes_buffer: CodeBuffer::new(), + options: RuntimeOptions::default(), + source_text: None, + rope: None, config: C::new(), } } @@ -123,10 +142,37 @@ impl ESTreeSerializer { formatter: F::new(), trace_path: NonEmptyStack::new(TracePathPart::Index(0)), fixes_buffer: CodeBuffer::new(), + options: RuntimeOptions::default(), + source_text: None, + rope: None, config: C::new(), } } + pub fn with_options(mut self, options: RuntimeOptions) -> Self { + self.options = options; + self + } + + pub fn with_source_text(mut self, source_text: &'static str) -> Self { + self.source_text = Some(source_text); + if self.options.loc { + self.rope = Some(Rope::from_str(source_text)); + } + self + } + + /// Calculate line and column position from byte offset + pub fn get_line_column(&self, offset: u32) -> Option<(u32, u32)> { + if let (Some(source_text), Some(rope)) = (self.source_text, &self.rope) { + let (line, column) = get_line_column(rope, offset, source_text); + // ESTree uses 1-indexed lines and 0-indexed columns + Some((line + 1, column)) + } else { + None + } + } + /// Serialize `node` and output a `JSON` string containing /// `{ "node": { ... }, "fixes": [ ... ]}`, where `node` is the serialized AST node, /// and `fixes` is a list of paths to any `Literal`s which are `BigInt`s or `RegExp`s. @@ -179,6 +225,25 @@ impl<'s, C: Config, F: Formatter> Serializer for &'s mut ESTreeSerializer type StructSerializer = ESTreeStructSerializer<'s, C, F>; type SequenceSerializer = ESTreeSequenceSerializer<'s, C, F>; + fn range(&self) -> bool { + self.options.range + } + + fn loc(&self) -> bool { + self.options.loc + } + + /// Get line and column position from byte offset + fn get_line_column(&self, offset: u32) -> Option<(u32, u32)> { + if let (Some(source_text), Some(rope)) = (self.source_text, &self.rope) { + let (line, column) = get_line_column(rope, offset, source_text); + // ESTree uses 1-indexed lines and 0-indexed columns + Some((line + 1, column)) + } else { + None + } + } + /// Serialize struct. #[inline(always)] fn serialize_struct(self) -> ESTreeStructSerializer<'s, C, F> { @@ -254,3 +319,35 @@ pub enum TracePathPart { impl TracePathPart { pub const DUMMY: Self = TracePathPart::Index(0); } + +/// Position information for ESTree loc field +#[derive(Clone, Copy)] +pub struct Position { + pub line: u32, + pub column: u32, +} + +impl ESTree for Position { + fn serialize(&self, serializer: S) { + let mut state = serializer.serialize_struct(); + state.serialize_field("line", &self.line); + state.serialize_field("column", &self.column); + state.end(); + } +} + +/// Source location information for ESTree loc field +#[derive(Clone, Copy)] +pub struct SourceLocation { + pub start: Position, + pub end: Position, +} + +impl ESTree for SourceLocation { + fn serialize(&self, serializer: S) { + let mut state = serializer.serialize_struct(); + state.serialize_field("start", &self.start); + state.serialize_field("end", &self.end); + state.end(); + } +} \ No newline at end of file diff --git a/crates/oxc_estree/src/serialize/primitives.rs b/crates/oxc_estree/src/serialize/primitives.rs index 9b2ecec1cfca6..4b85f394864c0 100644 --- a/crates/oxc_estree/src/serialize/primitives.rs +++ b/crates/oxc_estree/src/serialize/primitives.rs @@ -1,7 +1,7 @@ use itoa::Buffer as ItoaBuffer; use ryu_js::Buffer as RyuBuffer; -use super::{ESTree, Serializer}; +use super::{ESTree, Serializer, SequenceSerializer}; /// [`ESTree`] implementation for `bool`. impl ESTree for bool { @@ -71,6 +71,28 @@ impl ESTree for () { } } +/// ESTree range type - represents [start, end] positions in source code +#[derive(Debug, Copy, Clone)] +pub struct Range { + pub start: u32, + pub end: u32, +} + +impl Range { + pub fn new(start: u32, end: u32) -> Self { + Self { start, end } + } +} + +impl ESTree for Range { + fn serialize(&self, serializer: S) { + let mut seq = serializer.serialize_sequence(); + seq.serialize_element(&self.start); + seq.serialize_element(&self.end); + seq.end(); + } +} + #[cfg(test)] mod tests { use super::super::CompactTSSerializer; diff --git a/crates/oxc_estree/src/serialize/structs.rs b/crates/oxc_estree/src/serialize/structs.rs index 2979f8d0469d2..36a74145dec49 100644 --- a/crates/oxc_estree/src/serialize/structs.rs +++ b/crates/oxc_estree/src/serialize/structs.rs @@ -39,6 +39,15 @@ pub trait StructSerializer { /// Finish serializing struct. fn end(self); + + /// Whether to include range information in the serialized output + fn range(&self) -> bool; + + /// Whether to include loc information in the serialized output + fn loc(&self) -> bool; + + /// Get line and column position from byte offset + fn get_line_column(&self, offset: u32) -> Option<(u32, u32)>; } /// Serializer for structs. @@ -146,6 +155,19 @@ impl StructSerializer for ESTreeStructSerializer<'_, C, } buffer.print_ascii_byte(b'}'); } + + fn range(&self) -> bool { + self.serializer.options.range + } + + fn loc(&self) -> bool { + self.serializer.options.loc + } + + /// Get line and column position from byte offset + fn get_line_column(&self, offset: u32) -> Option<(u32, u32)> { + self.serializer.get_line_column(offset) + } } /// State of [`StructSerializer`]. @@ -215,6 +237,19 @@ impl<'p, P: StructSerializer> Serializer for FlatStructSerializer<'p, P> { panic!("Cannot call `record_fix_path` on a `FlatStructSerializer`"); } } + + fn range(&self) -> bool { + self.0.range() + } + + fn loc(&self) -> bool { + self.0.loc() + } + + /// Get line and column position from byte offset + fn get_line_column(&self, offset: u32) -> Option<(u32, u32)> { + self.0.get_line_column(offset) + } } impl SerializerPrivate for FlatStructSerializer<'_, P> { @@ -280,6 +315,19 @@ impl StructSerializer for FlatStructSerializer<'_, P> { fn end(self) { // No-op - there may be more fields to be added to the struct in the parent } + + fn range(&self) -> bool { + self.0.range() + } + + fn loc(&self) -> bool { + self.0.loc() + } + + /// Get line and column position from byte offset + fn get_line_column(&self, offset: u32) -> Option<(u32, u32)> { + self.0.get_line_column(offset) + } } #[cfg(test)] diff --git a/crates/oxc_parser/src/lib.rs b/crates/oxc_parser/src/lib.rs index 98726e1b47e5a..130a5717108fd 100644 --- a/crates/oxc_parser/src/lib.rs +++ b/crates/oxc_parser/src/lib.rs @@ -221,6 +221,20 @@ pub struct ParseOptions { /// /// [`V8IntrinsicExpression`]: oxc_ast::ast::V8IntrinsicExpression pub allow_v8_intrinsics: bool, + + /// Controls whether the `range` information is included to each node. + /// The `range` property is a [number, number] which indicates the start/end index of the node in the file contents. + /// This is similar to the `loc` property, except this is the absolute index. + /// + /// Default: `false` + pub range: bool, + + /// Controls whether the `loc` information is included to each node. + /// The `loc` property is an object which contains the exact line/column the node starts/ends on. + /// This is similar to the `range` property, except it is line/column relative. + /// + /// Default: `false` + pub loc: bool, } impl Default for ParseOptions { @@ -231,6 +245,8 @@ impl Default for ParseOptions { allow_return_outside_function: false, preserve_parens: true, allow_v8_intrinsics: false, + range: false, + loc: false, } } } diff --git a/crates/oxc_span/src/generated/derive_estree.rs b/crates/oxc_span/src/generated/derive_estree.rs index f82c5f70cc9ec..6598fbd510f61 100644 --- a/crates/oxc_span/src/generated/derive_estree.rs +++ b/crates/oxc_span/src/generated/derive_estree.rs @@ -4,7 +4,8 @@ #![allow(unused_imports, clippy::match_same_arms, clippy::semicolon_if_nothing_returned)] use oxc_estree::{ - Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Serializer, StructSerializer, + Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Range, Serializer, + StructSerializer, }; use crate::source_type::*; diff --git a/crates/oxc_syntax/src/generated/derive_estree.rs b/crates/oxc_syntax/src/generated/derive_estree.rs index 40139563a60e0..306b372d4914c 100644 --- a/crates/oxc_syntax/src/generated/derive_estree.rs +++ b/crates/oxc_syntax/src/generated/derive_estree.rs @@ -4,7 +4,8 @@ #![allow(unused_imports, clippy::match_same_arms, clippy::semicolon_if_nothing_returned)] use oxc_estree::{ - Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Serializer, StructSerializer, + Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Range, Serializer, + StructSerializer, }; use crate::module_record::*; @@ -14,6 +15,21 @@ impl ESTree for NameSpan<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("value", &self.name); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -47,6 +63,21 @@ impl ESTree for ImportImportName<'_> { impl ESTree for ExportEntry<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("moduleRequest", &self.module_request); @@ -96,6 +127,21 @@ impl ESTree for ExportLocalName<'_> { impl ESTree for DynamicImport { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("moduleRequest", &self.module_request); diff --git a/napi/parser/index.d.ts b/napi/parser/index.d.ts index a863e91ace313..3f97d81af26ee 100644 --- a/napi/parser/index.d.ts +++ b/napi/parser/index.d.ts @@ -189,6 +189,22 @@ export interface ParserOptions { * The type of the file is determined from `lang` option, or extension of provided `filename`. */ astType?: 'js' | 'ts' + /** + * Controls whether the `range` property is included on AST nodes. + * The `range` property is a [number, number] which indicates the start/end index of the node in the file contents. + * This is similar to the `loc` property, except it is line/column relative. + * + * @default false + */ + range?: boolean + /** + * Controls whether the `loc` information is included to each node. + * The `loc` property is an object which contains the exact line/column the node starts/ends on. + * This is similar to the `range` property, except it is line/column relative. + * + * @default false + */ + loc?: boolean /** * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST. * @@ -240,12 +256,36 @@ export declare function parseSync(filename: string, sourceText: string, options? */ export declare function parseSyncRaw(filename: string, buffer: Uint8Array, sourceLen: number, options?: ParserOptions | undefined | null): void +/** ESTree Position - line/column information for a single point in source */ +export interface Position { + /** Line number (1-indexed) */ + line: number + /** Column number on the line (0-indexed) */ + column: number +} + /** Returns `true` if raw transfer is supported on this platform. */ export declare function rawTransferSupported(): boolean +/** ESTree SourceLocation - start/end position information */ +export interface SourceLocation { + /** The position of the first character of the parsed source region */ + start: Position + /** The position of the first character after the parsed source region */ + end: Position +} + export interface Span { start: number end: number + /** + * An array of two numbers. + * Both numbers are a 0-based index which is the position in the array of source code characters. + * The first is the start position of the node, the second is the end position of the node. + */ + range?: [number, number] + /** ESTree loc field - line/column info when loc option is enabled */ + loc?: SourceLocation } export interface StaticExport { diff --git a/napi/parser/src/convert.rs b/napi/parser/src/convert.rs index 3838646b59ab0..6de6eddc95e4a 100644 --- a/napi/parser/src/convert.rs +++ b/napi/parser/src/convert.rs @@ -79,7 +79,12 @@ impl From<&ModuleRecord<'_>> for EcmaScriptModule { impl From<&oxc::span::Span> for Span { fn from(span: &oxc::span::Span) -> Self { - Self { start: span.start, end: span.end } + Self { + start: span.start, + end: span.end, + range: None, // Will be populated later based on parser options + loc: None, // Will be populated later based on parser options + } } } diff --git a/napi/parser/src/generated/derive_estree.rs b/napi/parser/src/generated/derive_estree.rs index b894a373a1694..7b34ad3c03973 100644 --- a/napi/parser/src/generated/derive_estree.rs +++ b/napi/parser/src/generated/derive_estree.rs @@ -4,7 +4,8 @@ #![allow(unused_imports, clippy::match_same_arms, clippy::semicolon_if_nothing_returned)] use oxc_estree::{ - Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Serializer, StructSerializer, + Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Range, Serializer, + StructSerializer, }; use crate::raw_transfer_types::*; @@ -46,6 +47,21 @@ impl ESTree for ErrorLabel<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("message", &self.message); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -67,6 +83,21 @@ impl ESTree for EcmaScriptModule<'_> { impl ESTree for StaticImport<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("moduleRequest", &self.module_request); @@ -78,6 +109,21 @@ impl ESTree for StaticImport<'_> { impl ESTree for StaticExport<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); + if state.range() { + let range = oxc_estree::Range::new(self.span.start, self.span.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = + (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) + { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("entries", &self.entries); diff --git a/napi/parser/src/lib.rs b/napi/parser/src/lib.rs index ad9ed8c7c03ba..d9a0dfa4020a7 100644 --- a/napi/parser/src/lib.rs +++ b/napi/parser/src/lib.rs @@ -15,6 +15,7 @@ use napi_derive::napi; use oxc::{ allocator::Allocator, + ast::serialize::SerializationOptions, parser::{ParseOptions, Parser, ParserReturn}, semantic::SemanticBuilder, span::SourceType, @@ -65,6 +66,8 @@ fn parse<'a>( Parser::new(allocator, source_text, source_type) .with_options(ParseOptions { preserve_parens: options.preserve_parens.unwrap_or(true), + range: options.range.unwrap_or(false), + loc: options.loc.unwrap_or(false), ..ParseOptions::default() }) .parse() @@ -106,14 +109,24 @@ fn parse_with_return(filename: &str, source_text: String, options: &ParserOption ); } - program.to_estree_js_json_with_fixes() + program.to_estree_js_json_with_fixes_and_options( + Some(&SerializationOptions { + range: options.range.unwrap_or(false), + loc: options.loc.unwrap_or(false), + }) + ) } AstType::TypeScript => { // Note: `@typescript-eslint/parser` ignores hashbangs, // despite appearances to the contrary in AST explorers. // So we ignore them too. // See: https://github.com/typescript-eslint/typescript-eslint/issues/6500 - program.to_estree_ts_json_with_fixes() + program.to_estree_ts_json_with_fixes_and_options( + Some(&SerializationOptions { + range: options.range.unwrap_or(false), + loc: options.loc.unwrap_or(false), + }) + ) } }; diff --git a/napi/parser/src/types.rs b/napi/parser/src/types.rs index c93fc969c47c2..fbca94b8230a8 100644 --- a/napi/parser/src/types.rs +++ b/napi/parser/src/types.rs @@ -23,6 +23,22 @@ pub struct ParserOptions { #[napi(ts_type = "'js' | 'ts'")] pub ast_type: Option, + /// Controls whether the `range` property is included on AST nodes. + /// The `range` property is a [number, number] which indicates the start/end index of the node in the file contents. + /// This is similar to the `loc` property, except it is line/column relative. + /// + /// @default false + #[napi(ts_type = "boolean")] + pub range: Option, + + /// Controls whether the `loc` information is included to each node. + /// The `loc` property is an object which contains the exact line/column the node starts/ends on. + /// This is similar to the `range` property, except it is line/column relative. + /// + /// @default false + #[napi(ts_type = "boolean")] + pub loc: Option, + /// Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST. /// /// If this option is true, parenthesized expressions are represented by @@ -94,6 +110,13 @@ pub struct EcmaScriptModule { pub struct Span { pub start: u32, pub end: u32, + /// An array of two numbers. + /// Both numbers are a 0-based index which is the position in the array of source code characters. + /// The first is the start position of the node, the second is the end position of the node. + #[napi(ts_type = "[number, number]")] + pub range: Option>, + /// ESTree loc field - line/column info when loc option is enabled + pub loc: Option, } #[napi(object)] @@ -265,3 +288,19 @@ pub struct DynamicImport { pub end: u32, pub module_request: Span, } + +#[napi(object)] +pub struct Position { + /// Line number (1-indexed) + pub line: u32, + /// Column number on the line (0-indexed) + pub column: u32, +} + +#[napi(object)] +pub struct SourceLocation { + /// The position of the first character of the parsed source region + pub start: Position, + /// The position of the first character after the parsed source region + pub end: Position, +} diff --git a/napi/playground/src/lib.rs b/napi/playground/src/lib.rs index 8fc55978ddb89..34502b224b903 100644 --- a/napi/playground/src/lib.rs +++ b/napi/playground/src/lib.rs @@ -124,6 +124,8 @@ impl Oxc { allow_v8_intrinsics: parser_options .allow_v8_intrinsics .unwrap_or(default_parser_options.allow_v8_intrinsics), + range: false, + loc: false, }; let ParserReturn { mut program, errors, mut module_record, .. } = Parser::new(&allocator, &source_text, source_type) diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index 6833071c33140..198b231728ff2 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -74,7 +74,7 @@ impl Derive for DeriveESTree { ///@@line_break use oxc_estree::{ Concat2, Concat3, ESTree, FlatStructSerializer, - JsonSafeString, Serializer, StructSerializer, + JsonSafeString, Range, Serializer, StructSerializer, }; } } @@ -412,7 +412,9 @@ impl<'s> StructSerializerGenerator<'s> { fn generate_stmts_for_struct(&mut self, struct_def: &StructDef, self_path: &TokenStream) { for &field_index in &struct_def.estree.field_indices { let field_index = field_index as usize; - if let Some(field) = struct_def.fields.get(field_index) { + if field_index < struct_def.fields.len() { + // Real field + let field = &struct_def.fields[field_index]; self.generate_stmts_for_field(field, struct_def, self_path); } else { let (field_name, converter_name) = @@ -435,9 +437,37 @@ impl<'s> StructSerializerGenerator<'s> { let field_name_ident = field.ident(); + // Special case for `Span` fields - add conditional range and loc serialization + if let TypeDef::Struct(inner_struct_def) = field.type_def(self.schema) { + if inner_struct_def.name() == "Span" && field.name() == "span" { + self.stmts.extend(quote! { + if state.range() { + let range = oxc_estree::Range::new(#self_path.#field_name_ident.start, #self_path.#field_name_ident.end); + state.serialize_field("range", &range); + } + if state.loc() { + if let (Some(start_pos), Some(end_pos)) = ( + state.get_line_column(#self_path.#field_name_ident.start), + state.get_line_column(#self_path.#field_name_ident.end) + ) { + let loc = oxc_estree::SourceLocation { + start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, + end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, + }; + state.serialize_field("loc", &loc); + } + } + state.serialize_field("start", &#self_path.#field_name_ident.start); + state.serialize_field("end", &#self_path.#field_name_ident.end); + }); + return; + } + } + if should_flatten_field(field, self.schema) { if can_flatten_field_inline(field, self.krate, self.schema) { let inner_struct_def = field.type_def(self.schema).as_struct().unwrap(); + self.generate_stmts_for_struct( inner_struct_def, "e!(#self_path.#field_name_ident), From cb6fa21d197eedc6ed8cfd200ecf3e0d0fa4e5e9 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Sun, 15 Jun 2025 16:48:35 +0200 Subject: [PATCH 02/42] chore: cleanup --- crates/oxc_estree/src/lib.rs | 9 ++++----- napi/parser/Cargo.toml | 2 +- napi/parser/index.d.ts | 2 -- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/crates/oxc_estree/src/lib.rs b/crates/oxc_estree/src/lib.rs index b781000c1ab41..dbb6323479ef7 100644 --- a/crates/oxc_estree/src/lib.rs +++ b/crates/oxc_estree/src/lib.rs @@ -1,13 +1,12 @@ +// When serialize feature is enabled, expose all serialization functionality +#[cfg(feature = "serialize")] pub mod serialize; -pub use serialize::{Position, SourceLocation}; +#[cfg(feature = "serialize")] +pub use serialize::*; /// Placeholder for real `ESTree` trait when `serialize` feature not enabled. /// /// Provided to support `#[generate_derive(ESTree)]`, without enabling the feature. #[cfg(not(feature = "serialize"))] pub trait ESTree {} - -// Re-export main serialize types for backward compatibility -#[cfg(feature = "serialize")] -pub use serialize::*; diff --git a/napi/parser/Cargo.toml b/napi/parser/Cargo.toml index 7303fca883efd..7bf249727c9b7 100644 --- a/napi/parser/Cargo.toml +++ b/napi/parser/Cargo.toml @@ -24,7 +24,7 @@ doctest = false [dependencies] oxc = { workspace = true, features = ["ast_visit", "regular_expression", "semantic", "serialize"] } oxc_ast_macros = { workspace = true } -oxc_estree = { workspace = true } +oxc_estree = { workspace = true, features = ["serialize"] } oxc_napi = { workspace = true } rustc-hash = { workspace = true } diff --git a/napi/parser/index.d.ts b/napi/parser/index.d.ts index 3f97d81af26ee..698bace677f5a 100644 --- a/napi/parser/index.d.ts +++ b/napi/parser/index.d.ts @@ -256,7 +256,6 @@ export declare function parseSync(filename: string, sourceText: string, options? */ export declare function parseSyncRaw(filename: string, buffer: Uint8Array, sourceLen: number, options?: ParserOptions | undefined | null): void -/** ESTree Position - line/column information for a single point in source */ export interface Position { /** Line number (1-indexed) */ line: number @@ -267,7 +266,6 @@ export interface Position { /** Returns `true` if raw transfer is supported on this platform. */ export declare function rawTransferSupported(): boolean -/** ESTree SourceLocation - start/end position information */ export interface SourceLocation { /** The position of the first character of the parsed source region */ start: Position From 2407a0c8f2b8d46c64e5c32ce2ec37f23a92370c Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Sun, 15 Jun 2025 17:23:40 +0200 Subject: [PATCH 03/42] chore: cleanup --- crates/oxc_ast/src/serialize/mod.rs | 2 -- crates/oxc_estree/src/lib.rs | 1 - crates/oxc_estree/src/serialize/mod.rs | 8 +------- crates/oxc_estree/src/serialize/structs.rs | 3 ++- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index d1d6f0b15ed8f..ed1f26217b042 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -107,7 +107,6 @@ impl Program<'_> { let runtime_options = options.map_or_else(RuntimeOptions::default, |o| RuntimeOptions { range: o.range, loc: o.loc }); let mut serializer = CompactFixesTSSerializer::with_capacity(capacity).with_options(runtime_options); if runtime_options.loc { - // SAFETY: source_text lives as long as the Program, and serialization is synchronous let source_text_static: &'static str = unsafe { std::mem::transmute(self.source_text) }; serializer = serializer.with_source_text(source_text_static); } @@ -120,7 +119,6 @@ impl Program<'_> { let runtime_options = options.map_or_else(RuntimeOptions::default, |o| RuntimeOptions { range: o.range, loc: o.loc }); let mut serializer = CompactFixesJSSerializer::with_capacity(capacity).with_options(runtime_options); if runtime_options.loc { - // SAFETY: source_text lives as long as the Program, and serialization is synchronous let source_text_static: &'static str = unsafe { std::mem::transmute(self.source_text) }; serializer = serializer.with_source_text(source_text_static); } diff --git a/crates/oxc_estree/src/lib.rs b/crates/oxc_estree/src/lib.rs index dbb6323479ef7..026d5c41deb53 100644 --- a/crates/oxc_estree/src/lib.rs +++ b/crates/oxc_estree/src/lib.rs @@ -1,4 +1,3 @@ -// When serialize feature is enabled, expose all serialization functionality #[cfg(feature = "serialize")] pub mod serialize; diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index c4baa5c3a8638..4ddbbee463aa1 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -235,13 +235,7 @@ impl<'s, C: Config, F: Formatter> Serializer for &'s mut ESTreeSerializer /// Get line and column position from byte offset fn get_line_column(&self, offset: u32) -> Option<(u32, u32)> { - if let (Some(source_text), Some(rope)) = (self.source_text, &self.rope) { - let (line, column) = get_line_column(rope, offset, source_text); - // ESTree uses 1-indexed lines and 0-indexed columns - Some((line + 1, column)) - } else { - None - } + (**self).get_line_column(offset) } /// Serialize struct. diff --git a/crates/oxc_estree/src/serialize/structs.rs b/crates/oxc_estree/src/serialize/structs.rs index 36a74145dec49..2aa88b5aa4a34 100644 --- a/crates/oxc_estree/src/serialize/structs.rs +++ b/crates/oxc_estree/src/serialize/structs.rs @@ -326,7 +326,8 @@ impl StructSerializer for FlatStructSerializer<'_, P> { /// Get line and column position from byte offset fn get_line_column(&self, offset: u32) -> Option<(u32, u32)> { - self.0.get_line_column(offset) + use super::Serializer; + Serializer::get_line_column(self, offset) } } From 1e9a4660facb354f62c0bb9d3cbade9e716d3bf8 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 13:03:13 +0000 Subject: [PATCH 04/42] [autofix.ci] apply automated fixes --- crates/oxc_ast/src/serialize/mod.rs | 28 ++++++++++++++----- crates/oxc_estree/src/serialize/mod.rs | 8 ++++-- crates/oxc_estree/src/serialize/primitives.rs | 2 +- crates/oxc_estree/src/serialize/structs.rs | 2 +- napi/parser/src/convert.rs | 8 +++--- napi/parser/src/lib.rs | 20 ++++++------- tasks/ast_tools/src/derives/estree.rs | 2 +- 7 files changed, 42 insertions(+), 28 deletions(-) diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index ed1f26217b042..f1e5a35d0c36c 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -10,8 +10,8 @@ use oxc_span::GetSpan; use crate::ast::*; use crate::{ - ast::{ExportDefaultDeclarationKind, Statement}, ast::{Declaration, Program}, + ast::{ExportDefaultDeclarationKind, Statement}, }; /// Options for ESTree serialization @@ -102,10 +102,17 @@ impl Program<'_> { } /// Serialize AST to ESTree JSON, including TypeScript fields, with list of fixes and serialization options. - pub fn to_estree_ts_json_with_fixes_and_options(&self, options: Option<&SerializationOptions>) -> String { + pub fn to_estree_ts_json_with_fixes_and_options( + &self, + options: Option<&SerializationOptions>, + ) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let runtime_options = options.map_or_else(RuntimeOptions::default, |o| RuntimeOptions { range: o.range, loc: o.loc }); - let mut serializer = CompactFixesTSSerializer::with_capacity(capacity).with_options(runtime_options); + let runtime_options = options.map_or_else(RuntimeOptions::default, |o| RuntimeOptions { + range: o.range, + loc: o.loc, + }); + let mut serializer = + CompactFixesTSSerializer::with_capacity(capacity).with_options(runtime_options); if runtime_options.loc { let source_text_static: &'static str = unsafe { std::mem::transmute(self.source_text) }; serializer = serializer.with_source_text(source_text_static); @@ -114,10 +121,17 @@ impl Program<'_> { } /// Serialize AST to ESTree JSON, without TypeScript fields, with list of fixes and serialization options. - pub fn to_estree_js_json_with_fixes_and_options(&self, options: Option<&SerializationOptions>) -> String { + pub fn to_estree_js_json_with_fixes_and_options( + &self, + options: Option<&SerializationOptions>, + ) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let runtime_options = options.map_or_else(RuntimeOptions::default, |o| RuntimeOptions { range: o.range, loc: o.loc }); - let mut serializer = CompactFixesJSSerializer::with_capacity(capacity).with_options(runtime_options); + let runtime_options = options.map_or_else(RuntimeOptions::default, |o| RuntimeOptions { + range: o.range, + loc: o.loc, + }); + let mut serializer = + CompactFixesJSSerializer::with_capacity(capacity).with_options(runtime_options); if runtime_options.loc { let source_text_static: &'static str = unsafe { std::mem::transmute(self.source_text) }; serializer = serializer.with_source_text(source_text_static); diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index 4ddbbee463aa1..eb50c711aa5c2 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -4,7 +4,11 @@ use std::mem; use itoa::Buffer as ItoaBuffer; -use oxc_data_structures::{code_buffer::CodeBuffer, stack::NonEmptyStack, rope::{Rope, get_line_column}}; +use oxc_data_structures::{ + code_buffer::CodeBuffer, + rope::{Rope, get_line_column}, + stack::NonEmptyStack, +}; mod blanket; mod concat; @@ -344,4 +348,4 @@ impl ESTree for SourceLocation { state.serialize_field("end", &self.end); state.end(); } -} \ No newline at end of file +} diff --git a/crates/oxc_estree/src/serialize/primitives.rs b/crates/oxc_estree/src/serialize/primitives.rs index 4b85f394864c0..e16a36775c6c8 100644 --- a/crates/oxc_estree/src/serialize/primitives.rs +++ b/crates/oxc_estree/src/serialize/primitives.rs @@ -1,7 +1,7 @@ use itoa::Buffer as ItoaBuffer; use ryu_js::Buffer as RyuBuffer; -use super::{ESTree, Serializer, SequenceSerializer}; +use super::{ESTree, SequenceSerializer, Serializer}; /// [`ESTree`] implementation for `bool`. impl ESTree for bool { diff --git a/crates/oxc_estree/src/serialize/structs.rs b/crates/oxc_estree/src/serialize/structs.rs index 2aa88b5aa4a34..c42a2da35288a 100644 --- a/crates/oxc_estree/src/serialize/structs.rs +++ b/crates/oxc_estree/src/serialize/structs.rs @@ -240,7 +240,7 @@ impl<'p, P: StructSerializer> Serializer for FlatStructSerializer<'p, P> { fn range(&self) -> bool { self.0.range() - } + } fn loc(&self) -> bool { self.0.loc() diff --git a/napi/parser/src/convert.rs b/napi/parser/src/convert.rs index 6de6eddc95e4a..d0eca25c33d5f 100644 --- a/napi/parser/src/convert.rs +++ b/napi/parser/src/convert.rs @@ -79,11 +79,11 @@ impl From<&ModuleRecord<'_>> for EcmaScriptModule { impl From<&oxc::span::Span> for Span { fn from(span: &oxc::span::Span) -> Self { - Self { - start: span.start, + Self { + start: span.start, end: span.end, - range: None, // Will be populated later based on parser options - loc: None, // Will be populated later based on parser options + range: None, // Will be populated later based on parser options + loc: None, // Will be populated later based on parser options } } } diff --git a/napi/parser/src/lib.rs b/napi/parser/src/lib.rs index d9a0dfa4020a7..22d3073cbbecf 100644 --- a/napi/parser/src/lib.rs +++ b/napi/parser/src/lib.rs @@ -109,24 +109,20 @@ fn parse_with_return(filename: &str, source_text: String, options: &ParserOption ); } - program.to_estree_js_json_with_fixes_and_options( - Some(&SerializationOptions { - range: options.range.unwrap_or(false), - loc: options.loc.unwrap_or(false), - }) - ) + program.to_estree_js_json_with_fixes_and_options(Some(&SerializationOptions { + range: options.range.unwrap_or(false), + loc: options.loc.unwrap_or(false), + })) } AstType::TypeScript => { // Note: `@typescript-eslint/parser` ignores hashbangs, // despite appearances to the contrary in AST explorers. // So we ignore them too. // See: https://github.com/typescript-eslint/typescript-eslint/issues/6500 - program.to_estree_ts_json_with_fixes_and_options( - Some(&SerializationOptions { - range: options.range.unwrap_or(false), - loc: options.loc.unwrap_or(false), - }) - ) + program.to_estree_ts_json_with_fixes_and_options(Some(&SerializationOptions { + range: options.range.unwrap_or(false), + loc: options.loc.unwrap_or(false), + })) } }; diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index 198b231728ff2..6e90bf97a91b4 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -467,7 +467,7 @@ impl<'s> StructSerializerGenerator<'s> { if should_flatten_field(field, self.schema) { if can_flatten_field_inline(field, self.krate, self.schema) { let inner_struct_def = field.type_def(self.schema).as_struct().unwrap(); - + self.generate_stmts_for_struct( inner_struct_def, "e!(#self_path.#field_name_ident), From 208bd1f578b99358aa7f74242dd9d3b28a01f225 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Tue, 17 Jun 2025 00:43:50 +0200 Subject: [PATCH 05/42] chore: remove loc --- crates/oxc_ast/src/generated/derive_estree.rs | 1958 ----------------- crates/oxc_ast/src/serialize/mod.rs | 16 +- crates/oxc_estree/src/serialize/mod.rs | 62 +- crates/oxc_estree/src/serialize/structs.rs | 34 - crates/oxc_parser/src/lib.rs | 8 - .../oxc_syntax/src/generated/derive_estree.rs | 33 - napi/parser/index.d.ts | 24 - napi/parser/src/convert.rs | 1 - napi/parser/src/generated/derive_estree.rs | 33 - napi/parser/src/lib.rs | 21 +- napi/parser/src/types.rs | 26 - napi/playground/src/lib.rs | 1 - tasks/ast_tools/src/derives/estree.rs | 12 - 13 files changed, 14 insertions(+), 2215 deletions(-) diff --git a/crates/oxc_ast/src/generated/derive_estree.rs b/crates/oxc_ast/src/generated/derive_estree.rs index 777be6a46ce34..5b95c039e1778 100644 --- a/crates/oxc_ast/src/generated/derive_estree.rs +++ b/crates/oxc_ast/src/generated/derive_estree.rs @@ -78,17 +78,6 @@ impl ESTree for IdentifierName<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -107,17 +96,6 @@ impl ESTree for IdentifierReference<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -136,17 +114,6 @@ impl ESTree for BindingIdentifier<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -165,17 +132,6 @@ impl ESTree for LabelIdentifier<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -194,17 +150,6 @@ impl ESTree for ThisExpression { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -219,17 +164,6 @@ impl ESTree for ArrayExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("elements", &self.elements); @@ -303,17 +237,6 @@ impl ESTree for ObjectExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("properties", &self.properties); @@ -338,17 +261,6 @@ impl ESTree for ObjectProperty<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("kind", &self.kind); @@ -432,17 +344,6 @@ impl ESTree for TemplateLiteral<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("quasis", &self.quasis); @@ -459,17 +360,6 @@ impl ESTree for TaggedTemplateExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("tag", &self.tag); @@ -512,17 +402,6 @@ impl ESTree for ComputedMemberExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("object", &self.object); @@ -541,17 +420,6 @@ impl ESTree for StaticMemberExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("object", &self.object); @@ -570,17 +438,6 @@ impl ESTree for PrivateFieldExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("object", &self.object); @@ -599,17 +456,6 @@ impl ESTree for CallExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("callee", &self.callee); @@ -628,17 +474,6 @@ impl ESTree for NewExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("callee", &self.callee); @@ -656,17 +491,6 @@ impl ESTree for MetaProperty<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("meta", &self.meta); @@ -683,17 +507,6 @@ impl ESTree for SpreadElement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); @@ -760,17 +573,6 @@ impl ESTree for UpdateExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("operator", &self.operator); @@ -788,17 +590,6 @@ impl ESTree for UnaryExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("operator", &self.operator); @@ -816,17 +607,6 @@ impl ESTree for BinaryExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("left", &self.left); @@ -844,17 +624,6 @@ impl ESTree for PrivateInExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("left", &self.left); @@ -872,17 +641,6 @@ impl ESTree for LogicalExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("left", &self.left); @@ -900,17 +658,6 @@ impl ESTree for ConditionalExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("test", &self.test); @@ -928,17 +675,6 @@ impl ESTree for AssignmentExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("operator", &self.operator); @@ -997,17 +733,6 @@ impl ESTree for ArrayAssignmentTarget<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -1026,17 +751,6 @@ impl ESTree for ObjectAssignmentTarget<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -1055,17 +769,6 @@ impl ESTree for AssignmentTargetRest<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -1103,17 +806,6 @@ impl ESTree for AssignmentTargetWithDefault<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -1142,17 +834,6 @@ impl ESTree for AssignmentTargetPropertyIdentifier<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("kind", &crate::serialize::basic::Init(self)); @@ -1177,17 +858,6 @@ impl ESTree for AssignmentTargetPropertyProperty<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("kind", &crate::serialize::basic::Init(self)); @@ -1209,17 +879,6 @@ impl ESTree for SequenceExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expressions", &self.expressions); @@ -1235,17 +894,6 @@ impl ESTree for Super { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -1260,17 +908,6 @@ impl ESTree for AwaitExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); @@ -1286,17 +923,6 @@ impl ESTree for ChainExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -1324,17 +950,6 @@ impl ESTree for ParenthesizedExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -1389,17 +1004,6 @@ impl ESTree for Directive<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -1416,17 +1020,6 @@ impl ESTree for Hashbang<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); @@ -1442,17 +1035,6 @@ impl ESTree for BlockStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); @@ -1483,17 +1065,6 @@ impl ESTree for VariableDeclaration<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("kind", &self.kind); @@ -1523,17 +1094,6 @@ impl ESTree for VariableDeclarator<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -1551,17 +1111,6 @@ impl ESTree for EmptyStatement { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -1576,17 +1125,6 @@ impl ESTree for ExpressionStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -1606,17 +1144,6 @@ impl ESTree for IfStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("test", &self.test); @@ -1634,17 +1161,6 @@ impl ESTree for DoWhileStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); @@ -1661,17 +1177,6 @@ impl ESTree for WhileStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("test", &self.test); @@ -1688,17 +1193,6 @@ impl ESTree for ForStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("init", &self.init); @@ -1768,17 +1262,6 @@ impl ESTree for ForInStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("left", &self.left); @@ -1814,17 +1297,6 @@ impl ESTree for ForOfStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("await", &self.r#await); @@ -1843,17 +1315,6 @@ impl ESTree for ContinueStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("label", &self.label); @@ -1869,17 +1330,6 @@ impl ESTree for BreakStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("label", &self.label); @@ -1895,17 +1345,6 @@ impl ESTree for ReturnStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); @@ -1921,17 +1360,6 @@ impl ESTree for WithStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("object", &self.object); @@ -1948,17 +1376,6 @@ impl ESTree for SwitchStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("discriminant", &self.discriminant); @@ -1975,17 +1392,6 @@ impl ESTree for SwitchCase<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("test", &self.test); @@ -2002,17 +1408,6 @@ impl ESTree for LabeledStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("label", &self.label); @@ -2029,17 +1424,6 @@ impl ESTree for ThrowStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); @@ -2055,17 +1439,6 @@ impl ESTree for TryStatement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("block", &self.block); @@ -2083,17 +1456,6 @@ impl ESTree for CatchClause<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("param", &self.param); @@ -2116,17 +1478,6 @@ impl ESTree for DebuggerStatement { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -2158,17 +1509,6 @@ impl ESTree for AssignmentPattern<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -2188,17 +1528,6 @@ impl ESTree for ObjectPattern<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -2217,17 +1546,6 @@ impl ESTree for BindingProperty<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("kind", &crate::serialize::basic::Init(self)); @@ -2249,17 +1567,6 @@ impl ESTree for ArrayPattern<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -2278,17 +1585,6 @@ impl ESTree for BindingRestElement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); @@ -2308,17 +1604,6 @@ impl ESTree for Function<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -2384,17 +1669,6 @@ impl ESTree for FunctionBody<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &Concat2(&self.directives, &self.statements)); @@ -2410,17 +1684,6 @@ impl ESTree for ArrowFunctionExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -2443,17 +1706,6 @@ impl ESTree for YieldExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("delegate", &self.delegate); @@ -2470,17 +1722,6 @@ impl ESTree for Class<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("decorators", &self.decorators); @@ -2513,17 +1754,6 @@ impl ESTree for ClassBody<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); @@ -2551,17 +1781,6 @@ impl ESTree for MethodDefinition<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("decorators", &self.decorators); @@ -2596,17 +1815,6 @@ impl ESTree for PropertyDefinition<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("decorators", &self.decorators); @@ -2655,17 +1863,6 @@ impl ESTree for PrivateIdentifier<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); @@ -2681,17 +1878,6 @@ impl ESTree for StaticBlock<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); @@ -2731,17 +1917,6 @@ impl ESTree for AccessorProperty<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("decorators", &self.decorators); @@ -2768,17 +1943,6 @@ impl ESTree for ImportExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("source", &self.source); @@ -2796,17 +1960,6 @@ impl ESTree for ImportDeclaration<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field( @@ -2851,17 +2004,6 @@ impl ESTree for ImportSpecifier<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("imported", &self.imported); @@ -2879,17 +2021,6 @@ impl ESTree for ImportDefaultSpecifier<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("local", &self.local); @@ -2905,17 +2036,6 @@ impl ESTree for ImportNamespaceSpecifier<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("local", &self.local); @@ -2939,17 +2059,6 @@ impl ESTree for ImportAttribute<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("key", &self.key); @@ -2975,17 +2084,6 @@ impl ESTree for ExportNamedDeclaration<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("declaration", &self.declaration); @@ -3008,17 +2106,6 @@ impl ESTree for ExportDefaultDeclaration<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("declaration", &self.declaration); @@ -3035,17 +2122,6 @@ impl ESTree for ExportAllDeclaration<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("exported", &self.exported); @@ -3067,17 +2143,6 @@ impl ESTree for ExportSpecifier<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("local", &self.local); @@ -3158,17 +2223,6 @@ impl ESTree for V8IntrinsicExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); @@ -3185,17 +2239,6 @@ impl ESTree for BooleanLiteral { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); @@ -3212,17 +2255,6 @@ impl ESTree for NullLiteral { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &crate::serialize::basic::Null(self)); @@ -3239,17 +2271,6 @@ impl ESTree for NumericLiteral<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); @@ -3266,17 +2287,6 @@ impl ESTree for StringLiteral<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &crate::serialize::literal::StringLiteralValue(self)); @@ -3293,17 +2303,6 @@ impl ESTree for BigIntLiteral<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &crate::serialize::literal::BigIntLiteralValue(self)); @@ -3321,17 +2320,6 @@ impl ESTree for RegExpLiteral<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &crate::serialize::literal::RegExpLiteralValue(self)); @@ -3372,17 +2360,6 @@ impl ESTree for JSXElement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field( @@ -3403,17 +2380,6 @@ impl ESTree for JSXOpeningElement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); @@ -3435,17 +2401,6 @@ impl ESTree for JSXClosingElement<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); @@ -3461,17 +2416,6 @@ impl ESTree for JSXFragment<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("openingFragment", &self.opening_fragment); @@ -3489,17 +2433,6 @@ impl ESTree for JSXOpeningFragment { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_js_field("attributes", &crate::serialize::basic::JsEmptyArray(self)); @@ -3516,17 +2449,6 @@ impl ESTree for JSXClosingFragment { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -3557,17 +2479,6 @@ impl ESTree for JSXNamespacedName<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("namespace", &self.namespace); @@ -3584,17 +2495,6 @@ impl ESTree for JSXMemberExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("object", &self.object); @@ -3625,17 +2525,6 @@ impl ESTree for JSXExpressionContainer<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -3702,17 +2591,6 @@ impl ESTree for JSXEmptyExpression { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -3736,17 +2614,6 @@ impl ESTree for JSXAttribute<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); @@ -3763,17 +2630,6 @@ impl ESTree for JSXSpreadAttribute<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); @@ -3809,17 +2665,6 @@ impl ESTree for JSXIdentifier<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &JsonSafeString(self.name.as_str())); @@ -3847,17 +2692,6 @@ impl ESTree for JSXSpreadChild<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -3873,17 +2707,6 @@ impl ESTree for JSXText<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); @@ -3900,17 +2723,6 @@ impl ESTree for TSThisParameter<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("decorators", &crate::serialize::basic::EmptyArray(self)); @@ -3929,17 +2741,6 @@ impl ESTree for TSEnumDeclaration<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -3958,17 +2759,6 @@ impl ESTree for TSEnumBody<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("members", &self.members); @@ -3984,17 +2774,6 @@ impl ESTree for TSEnumMember<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -4023,17 +2802,6 @@ impl ESTree for TSTypeAnnotation<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -4049,17 +2817,6 @@ impl ESTree for TSLiteralType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("literal", &self.literal); @@ -4132,17 +2889,6 @@ impl ESTree for TSConditionalType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("checkType", &self.check_type); @@ -4161,17 +2907,6 @@ impl ESTree for TSUnionType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("types", &self.types); @@ -4187,17 +2922,6 @@ impl ESTree for TSIntersectionType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("types", &self.types); @@ -4213,17 +2937,6 @@ impl ESTree for TSParenthesizedType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -4239,17 +2952,6 @@ impl ESTree for TSTypeOperator<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("operator", &self.operator); @@ -4276,17 +2978,6 @@ impl ESTree for TSArrayType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("elementType", &self.element_type); @@ -4302,17 +2993,6 @@ impl ESTree for TSIndexedAccessType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("objectType", &self.object_type); @@ -4329,17 +3009,6 @@ impl ESTree for TSTupleType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("elementTypes", &self.element_types); @@ -4355,17 +3024,6 @@ impl ESTree for TSNamedTupleMember<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("label", &self.label); @@ -4383,17 +3041,6 @@ impl ESTree for TSOptionalType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -4409,17 +3056,6 @@ impl ESTree for TSRestType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -4481,17 +3117,6 @@ impl ESTree for TSAnyKeyword { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -4506,17 +3131,6 @@ impl ESTree for TSStringKeyword { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -4531,17 +3145,6 @@ impl ESTree for TSBooleanKeyword { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -4556,17 +3159,6 @@ impl ESTree for TSNumberKeyword { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -4581,17 +3173,6 @@ impl ESTree for TSNeverKeyword { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -4606,17 +3187,6 @@ impl ESTree for TSIntrinsicKeyword { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -4631,17 +3201,6 @@ impl ESTree for TSUnknownKeyword { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -4656,17 +3215,6 @@ impl ESTree for TSNullKeyword { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -4681,17 +3229,6 @@ impl ESTree for TSUndefinedKeyword { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -4706,17 +3243,6 @@ impl ESTree for TSVoidKeyword { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -4731,17 +3257,6 @@ impl ESTree for TSSymbolKeyword { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -4756,17 +3271,6 @@ impl ESTree for TSThisType { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -4781,17 +3285,6 @@ impl ESTree for TSObjectKeyword { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -4806,17 +3299,6 @@ impl ESTree for TSBigIntKeyword { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -4831,17 +3313,6 @@ impl ESTree for TSTypeReference<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeName", &self.type_name); @@ -4869,17 +3340,6 @@ impl ESTree for TSQualifiedName<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("left", &self.left); @@ -4896,17 +3356,6 @@ impl ESTree for TSTypeParameterInstantiation<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("params", &self.params); @@ -4922,17 +3371,6 @@ impl ESTree for TSTypeParameter<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); @@ -4953,17 +3391,6 @@ impl ESTree for TSTypeParameterDeclaration<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("params", &self.params); @@ -4979,17 +3406,6 @@ impl ESTree for TSTypeAliasDeclaration<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -5018,17 +3434,6 @@ impl ESTree for TSClassImplements<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field( @@ -5048,17 +3453,6 @@ impl ESTree for TSInterfaceDeclaration<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -5078,17 +3472,6 @@ impl ESTree for TSInterfaceBody<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); @@ -5104,17 +3487,6 @@ impl ESTree for TSPropertySignature<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("computed", &self.computed); @@ -5148,17 +3520,6 @@ impl ESTree for TSIndexSignature<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("parameters", &self.parameters); @@ -5178,17 +3539,6 @@ impl ESTree for TSCallSignatureDeclaration<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeParameters", &self.type_parameters); @@ -5219,17 +3569,6 @@ impl ESTree for TSMethodSignature<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("key", &self.key); @@ -5254,17 +3593,6 @@ impl ESTree for TSConstructSignatureDeclaration<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeParameters", &self.type_parameters); @@ -5282,17 +3610,6 @@ impl ESTree for TSIndexSignatureName<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("decorators", &crate::serialize::basic::EmptyArray(self)); @@ -5311,17 +3628,6 @@ impl ESTree for TSInterfaceHeritage<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -5338,17 +3644,6 @@ impl ESTree for TSTypePredicate<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("parameterName", &self.parameter_name); @@ -5409,17 +3704,6 @@ impl ESTree for TSModuleBlock<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &Concat2(&self.directives, &self.body)); @@ -5435,17 +3719,6 @@ impl ESTree for TSTypeLiteral<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("members", &self.members); @@ -5461,17 +3734,6 @@ impl ESTree for TSInferType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeParameter", &self.type_parameter); @@ -5487,17 +3749,6 @@ impl ESTree for TSTypeQuery<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("exprName", &self.expr_name); @@ -5526,17 +3777,6 @@ impl ESTree for TSImportType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); @@ -5555,17 +3795,6 @@ impl ESTree for TSFunctionType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeParameters", &self.type_parameters); @@ -5583,17 +3812,6 @@ impl ESTree for TSConstructorType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("abstract", &self.r#abstract); @@ -5612,17 +3830,6 @@ impl ESTree for TSMappedType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("key", &crate::serialize::ts::TSMappedTypeKey(self)); @@ -5653,17 +3860,6 @@ impl ESTree for TSTemplateLiteralType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("quasis", &self.quasis); @@ -5680,17 +3876,6 @@ impl ESTree for TSAsExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -5707,17 +3892,6 @@ impl ESTree for TSSatisfiesExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -5734,17 +3908,6 @@ impl ESTree for TSTypeAssertion<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -5761,17 +3924,6 @@ impl ESTree for TSImportEqualsDeclaration<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -5801,17 +3953,6 @@ impl ESTree for TSExternalModuleReference<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -5827,17 +3968,6 @@ impl ESTree for TSNonNullExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -5853,17 +3983,6 @@ impl ESTree for Decorator<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -5879,17 +3998,6 @@ impl ESTree for TSExportAssignment<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -5905,17 +4013,6 @@ impl ESTree for TSNamespaceExportDeclaration<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); @@ -5931,17 +4028,6 @@ impl ESTree for TSInstantiationExpression<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); @@ -5967,17 +4053,6 @@ impl ESTree for JSDocNullableType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -5994,17 +4069,6 @@ impl ESTree for JSDocNonNullableType<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -6021,17 +4085,6 @@ impl ESTree for JSDocUnknownType { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -6056,17 +4109,6 @@ impl ESTree for Comment { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index f1e5a35d0c36c..14a2401a2ce40 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -19,8 +19,6 @@ use crate::{ pub struct SerializationOptions { /// Include range field [start, end] in each node pub range: bool, - /// Include loc field with line/column information in each node - pub loc: bool, } pub mod basic; @@ -109,14 +107,9 @@ impl Program<'_> { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; let runtime_options = options.map_or_else(RuntimeOptions::default, |o| RuntimeOptions { range: o.range, - loc: o.loc, }); - let mut serializer = + let serializer = CompactFixesTSSerializer::with_capacity(capacity).with_options(runtime_options); - if runtime_options.loc { - let source_text_static: &'static str = unsafe { std::mem::transmute(self.source_text) }; - serializer = serializer.with_source_text(source_text_static); - } serializer.serialize_with_fixes(self) } @@ -128,14 +121,9 @@ impl Program<'_> { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; let runtime_options = options.map_or_else(RuntimeOptions::default, |o| RuntimeOptions { range: o.range, - loc: o.loc, }); - let mut serializer = + let serializer = CompactFixesJSSerializer::with_capacity(capacity).with_options(runtime_options); - if runtime_options.loc { - let source_text_static: &'static str = unsafe { std::mem::transmute(self.source_text) }; - serializer = serializer.with_source_text(source_text_static); - } serializer.serialize_with_fixes(self) } diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index eb50c711aa5c2..242bd86d4ffe1 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -6,7 +6,6 @@ use std::mem; use itoa::Buffer as ItoaBuffer; use oxc_data_structures::{ code_buffer::CodeBuffer, - rope::{Rope, get_line_column}, stack::NonEmptyStack, }; @@ -50,11 +49,6 @@ pub trait Serializer: SerializerPrivate { fn range(&self) -> bool; - fn loc(&self) -> bool; - - /// Get line and column position from byte offset - fn get_line_column(&self, offset: u32) -> Option<(u32, u32)>; - /// Serialize struct. fn serialize_struct(self) -> Self::StructSerializer; @@ -108,7 +102,6 @@ pub type PrettyFixesJSSerializer = ESTreeSerializer { fixes_buffer: CodeBuffer, options: RuntimeOptions, source_text: Option<&'static str>, - rope: Option, #[expect(unused)] config: C, } @@ -134,7 +126,6 @@ impl ESTreeSerializer { fixes_buffer: CodeBuffer::new(), options: RuntimeOptions::default(), source_text: None, - rope: None, config: C::new(), } } @@ -148,7 +139,6 @@ impl ESTreeSerializer { fixes_buffer: CodeBuffer::new(), options: RuntimeOptions::default(), source_text: None, - rope: None, config: C::new(), } } @@ -160,21 +150,12 @@ impl ESTreeSerializer { pub fn with_source_text(mut self, source_text: &'static str) -> Self { self.source_text = Some(source_text); - if self.options.loc { - self.rope = Some(Rope::from_str(source_text)); - } self } /// Calculate line and column position from byte offset - pub fn get_line_column(&self, offset: u32) -> Option<(u32, u32)> { - if let (Some(source_text), Some(rope)) = (self.source_text, &self.rope) { - let (line, column) = get_line_column(rope, offset, source_text); - // ESTree uses 1-indexed lines and 0-indexed columns - Some((line + 1, column)) - } else { - None - } + pub fn get_line_column(&self, _offset: u32) -> Option<(u32, u32)> { + None } /// Serialize `node` and output a `JSON` string containing @@ -233,15 +214,6 @@ impl<'s, C: Config, F: Formatter> Serializer for &'s mut ESTreeSerializer self.options.range } - fn loc(&self) -> bool { - self.options.loc - } - - /// Get line and column position from byte offset - fn get_line_column(&self, offset: u32) -> Option<(u32, u32)> { - (**self).get_line_column(offset) - } - /// Serialize struct. #[inline(always)] fn serialize_struct(self) -> ESTreeStructSerializer<'s, C, F> { @@ -318,34 +290,4 @@ impl TracePathPart { pub const DUMMY: Self = TracePathPart::Index(0); } -/// Position information for ESTree loc field -#[derive(Clone, Copy)] -pub struct Position { - pub line: u32, - pub column: u32, -} - -impl ESTree for Position { - fn serialize(&self, serializer: S) { - let mut state = serializer.serialize_struct(); - state.serialize_field("line", &self.line); - state.serialize_field("column", &self.column); - state.end(); - } -} -/// Source location information for ESTree loc field -#[derive(Clone, Copy)] -pub struct SourceLocation { - pub start: Position, - pub end: Position, -} - -impl ESTree for SourceLocation { - fn serialize(&self, serializer: S) { - let mut state = serializer.serialize_struct(); - state.serialize_field("start", &self.start); - state.serialize_field("end", &self.end); - state.end(); - } -} diff --git a/crates/oxc_estree/src/serialize/structs.rs b/crates/oxc_estree/src/serialize/structs.rs index c42a2da35288a..52b2270125984 100644 --- a/crates/oxc_estree/src/serialize/structs.rs +++ b/crates/oxc_estree/src/serialize/structs.rs @@ -42,12 +42,6 @@ pub trait StructSerializer { /// Whether to include range information in the serialized output fn range(&self) -> bool; - - /// Whether to include loc information in the serialized output - fn loc(&self) -> bool; - - /// Get line and column position from byte offset - fn get_line_column(&self, offset: u32) -> Option<(u32, u32)>; } /// Serializer for structs. @@ -159,15 +153,6 @@ impl StructSerializer for ESTreeStructSerializer<'_, C, fn range(&self) -> bool { self.serializer.options.range } - - fn loc(&self) -> bool { - self.serializer.options.loc - } - - /// Get line and column position from byte offset - fn get_line_column(&self, offset: u32) -> Option<(u32, u32)> { - self.serializer.get_line_column(offset) - } } /// State of [`StructSerializer`]. @@ -241,15 +226,6 @@ impl<'p, P: StructSerializer> Serializer for FlatStructSerializer<'p, P> { fn range(&self) -> bool { self.0.range() } - - fn loc(&self) -> bool { - self.0.loc() - } - - /// Get line and column position from byte offset - fn get_line_column(&self, offset: u32) -> Option<(u32, u32)> { - self.0.get_line_column(offset) - } } impl SerializerPrivate for FlatStructSerializer<'_, P> { @@ -319,16 +295,6 @@ impl StructSerializer for FlatStructSerializer<'_, P> { fn range(&self) -> bool { self.0.range() } - - fn loc(&self) -> bool { - self.0.loc() - } - - /// Get line and column position from byte offset - fn get_line_column(&self, offset: u32) -> Option<(u32, u32)> { - use super::Serializer; - Serializer::get_line_column(self, offset) - } } #[cfg(test)] diff --git a/crates/oxc_parser/src/lib.rs b/crates/oxc_parser/src/lib.rs index 130a5717108fd..b526f40426656 100644 --- a/crates/oxc_parser/src/lib.rs +++ b/crates/oxc_parser/src/lib.rs @@ -228,13 +228,6 @@ pub struct ParseOptions { /// /// Default: `false` pub range: bool, - - /// Controls whether the `loc` information is included to each node. - /// The `loc` property is an object which contains the exact line/column the node starts/ends on. - /// This is similar to the `range` property, except it is line/column relative. - /// - /// Default: `false` - pub loc: bool, } impl Default for ParseOptions { @@ -246,7 +239,6 @@ impl Default for ParseOptions { preserve_parens: true, allow_v8_intrinsics: false, range: false, - loc: false, } } } diff --git a/crates/oxc_syntax/src/generated/derive_estree.rs b/crates/oxc_syntax/src/generated/derive_estree.rs index 306b372d4914c..0d0b7072f8d25 100644 --- a/crates/oxc_syntax/src/generated/derive_estree.rs +++ b/crates/oxc_syntax/src/generated/derive_estree.rs @@ -19,17 +19,6 @@ impl ESTree for NameSpan<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -67,17 +56,6 @@ impl ESTree for ExportEntry<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("moduleRequest", &self.module_request); @@ -131,17 +109,6 @@ impl ESTree for DynamicImport { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("moduleRequest", &self.module_request); diff --git a/napi/parser/index.d.ts b/napi/parser/index.d.ts index 698bace677f5a..a350735adcbf4 100644 --- a/napi/parser/index.d.ts +++ b/napi/parser/index.d.ts @@ -197,14 +197,6 @@ export interface ParserOptions { * @default false */ range?: boolean - /** - * Controls whether the `loc` information is included to each node. - * The `loc` property is an object which contains the exact line/column the node starts/ends on. - * This is similar to the `range` property, except it is line/column relative. - * - * @default false - */ - loc?: boolean /** * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST. * @@ -256,23 +248,9 @@ export declare function parseSync(filename: string, sourceText: string, options? */ export declare function parseSyncRaw(filename: string, buffer: Uint8Array, sourceLen: number, options?: ParserOptions | undefined | null): void -export interface Position { - /** Line number (1-indexed) */ - line: number - /** Column number on the line (0-indexed) */ - column: number -} - /** Returns `true` if raw transfer is supported on this platform. */ export declare function rawTransferSupported(): boolean -export interface SourceLocation { - /** The position of the first character of the parsed source region */ - start: Position - /** The position of the first character after the parsed source region */ - end: Position -} - export interface Span { start: number end: number @@ -282,8 +260,6 @@ export interface Span { * The first is the start position of the node, the second is the end position of the node. */ range?: [number, number] - /** ESTree loc field - line/column info when loc option is enabled */ - loc?: SourceLocation } export interface StaticExport { diff --git a/napi/parser/src/convert.rs b/napi/parser/src/convert.rs index d0eca25c33d5f..e6d21d8c7c177 100644 --- a/napi/parser/src/convert.rs +++ b/napi/parser/src/convert.rs @@ -83,7 +83,6 @@ impl From<&oxc::span::Span> for Span { start: span.start, end: span.end, range: None, // Will be populated later based on parser options - loc: None, // Will be populated later based on parser options } } } diff --git a/napi/parser/src/generated/derive_estree.rs b/napi/parser/src/generated/derive_estree.rs index 7b34ad3c03973..e1edd2b02e701 100644 --- a/napi/parser/src/generated/derive_estree.rs +++ b/napi/parser/src/generated/derive_estree.rs @@ -51,17 +51,6 @@ impl ESTree for ErrorLabel<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.end(); @@ -87,17 +76,6 @@ impl ESTree for StaticImport<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("moduleRequest", &self.module_request); @@ -113,17 +91,6 @@ impl ESTree for StaticExport<'_> { let range = oxc_estree::Range::new(self.span.start, self.span.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = - (state.get_line_column(self.span.start), state.get_line_column(self.span.end)) - { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("entries", &self.entries); diff --git a/napi/parser/src/lib.rs b/napi/parser/src/lib.rs index 22d3073cbbecf..9ae6fbdc5986a 100644 --- a/napi/parser/src/lib.rs +++ b/napi/parser/src/lib.rs @@ -67,7 +67,6 @@ fn parse<'a>( .with_options(ParseOptions { preserve_parens: options.preserve_parens.unwrap_or(true), range: options.range.unwrap_or(false), - loc: options.loc.unwrap_or(false), ..ParseOptions::default() }) .parse() @@ -109,20 +108,20 @@ fn parse_with_return(filename: &str, source_text: String, options: &ParserOption ); } - program.to_estree_js_json_with_fixes_and_options(Some(&SerializationOptions { - range: options.range.unwrap_or(false), - loc: options.loc.unwrap_or(false), - })) + program.to_estree_js_json_with_fixes_and_options( + Some(&SerializationOptions { + range: options.range.unwrap_or(false), + }) + ) } AstType::TypeScript => { // Note: `@typescript-eslint/parser` ignores hashbangs, - // despite appearances to the contrary in AST explorers. - // So we ignore them too. // See: https://github.com/typescript-eslint/typescript-eslint/issues/6500 - program.to_estree_ts_json_with_fixes_and_options(Some(&SerializationOptions { - range: options.range.unwrap_or(false), - loc: options.loc.unwrap_or(false), - })) + program.to_estree_ts_json_with_fixes_and_options( + Some(&SerializationOptions { + range: options.range.unwrap_or(false), + }) + ) } }; diff --git a/napi/parser/src/types.rs b/napi/parser/src/types.rs index fbca94b8230a8..65fad57fc642a 100644 --- a/napi/parser/src/types.rs +++ b/napi/parser/src/types.rs @@ -31,14 +31,6 @@ pub struct ParserOptions { #[napi(ts_type = "boolean")] pub range: Option, - /// Controls whether the `loc` information is included to each node. - /// The `loc` property is an object which contains the exact line/column the node starts/ends on. - /// This is similar to the `range` property, except it is line/column relative. - /// - /// @default false - #[napi(ts_type = "boolean")] - pub loc: Option, - /// Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST. /// /// If this option is true, parenthesized expressions are represented by @@ -115,8 +107,6 @@ pub struct Span { /// The first is the start position of the node, the second is the end position of the node. #[napi(ts_type = "[number, number]")] pub range: Option>, - /// ESTree loc field - line/column info when loc option is enabled - pub loc: Option, } #[napi(object)] @@ -288,19 +278,3 @@ pub struct DynamicImport { pub end: u32, pub module_request: Span, } - -#[napi(object)] -pub struct Position { - /// Line number (1-indexed) - pub line: u32, - /// Column number on the line (0-indexed) - pub column: u32, -} - -#[napi(object)] -pub struct SourceLocation { - /// The position of the first character of the parsed source region - pub start: Position, - /// The position of the first character after the parsed source region - pub end: Position, -} diff --git a/napi/playground/src/lib.rs b/napi/playground/src/lib.rs index 03418bbf56703..4a0c834b6a001 100644 --- a/napi/playground/src/lib.rs +++ b/napi/playground/src/lib.rs @@ -125,7 +125,6 @@ impl Oxc { .allow_v8_intrinsics .unwrap_or(default_parser_options.allow_v8_intrinsics), range: false, - loc: false, }; let ParserReturn { mut program, errors, mut module_record, .. } = Parser::new(&allocator, &source_text, source_type) diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index 6e90bf97a91b4..ff049f007e4a4 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -445,18 +445,6 @@ impl<'s> StructSerializerGenerator<'s> { let range = oxc_estree::Range::new(#self_path.#field_name_ident.start, #self_path.#field_name_ident.end); state.serialize_field("range", &range); } - if state.loc() { - if let (Some(start_pos), Some(end_pos)) = ( - state.get_line_column(#self_path.#field_name_ident.start), - state.get_line_column(#self_path.#field_name_ident.end) - ) { - let loc = oxc_estree::SourceLocation { - start: oxc_estree::Position { line: start_pos.0, column: start_pos.1 }, - end: oxc_estree::Position { line: end_pos.0, column: end_pos.1 }, - }; - state.serialize_field("loc", &loc); - } - } state.serialize_field("start", &#self_path.#field_name_ident.start); state.serialize_field("end", &#self_path.#field_name_ident.end); }); From 4012c79d37ae559ed54c853fc6babace0b86c4ef Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Tue, 17 Jun 2025 01:39:10 +0200 Subject: [PATCH 06/42] feat: move range configuration from serializer to config types --- crates/oxc_estree/src/serialize/config.rs | 47 +++++++++++++++++++---- crates/oxc_estree/src/serialize/mod.rs | 3 +- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/crates/oxc_estree/src/serialize/config.rs b/crates/oxc_estree/src/serialize/config.rs index 6291480fd1ed5..c90465c7c9ac7 100644 --- a/crates/oxc_estree/src/serialize/config.rs +++ b/crates/oxc_estree/src/serialize/config.rs @@ -6,10 +6,15 @@ pub trait Config { const FIXES: bool; fn new() -> Self; + + /// Whether to include range information in the serialized output + fn ranges(&self) -> bool; } /// Config for serializing AST with TypeScript fields, -pub struct ConfigTS; +pub struct ConfigTS { + ranges: bool, +} impl Config for ConfigTS { const INCLUDE_TS_FIELDS: bool = true; @@ -17,12 +22,19 @@ impl Config for ConfigTS { #[inline(always)] fn new() -> Self { - Self + Self { ranges: false } + } + + #[inline] + fn ranges(&self) -> bool { + self.ranges } } /// Config for serializing AST without TypeScript fields. -pub struct ConfigJS; +pub struct ConfigJS { + ranges: bool, +} impl Config for ConfigJS { const INCLUDE_TS_FIELDS: bool = false; @@ -30,12 +42,19 @@ impl Config for ConfigJS { #[inline(always)] fn new() -> Self { - Self + Self { ranges: false } + } + + #[inline] + fn ranges(&self) -> bool { + self.ranges } } /// Config for serializing AST with TypeScript fields, with fixes. -pub struct ConfigFixesTS; +pub struct ConfigFixesTS { + ranges: bool, +} impl Config for ConfigFixesTS { const INCLUDE_TS_FIELDS: bool = true; @@ -43,12 +62,19 @@ impl Config for ConfigFixesTS { #[inline(always)] fn new() -> Self { - Self + Self { ranges: false } + } + + #[inline] + fn ranges(&self) -> bool { + self.ranges } } /// Config for serializing AST without TypeScript fields, with fixes. -pub struct ConfigFixesJS; +pub struct ConfigFixesJS { + ranges: bool, +} impl Config for ConfigFixesJS { const INCLUDE_TS_FIELDS: bool = false; @@ -56,6 +82,11 @@ impl Config for ConfigFixesJS { #[inline(always)] fn new() -> Self { - Self + Self { ranges: false } + } + + #[inline] + fn ranges(&self) -> bool { + self.ranges } } diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index 242bd86d4ffe1..6bb3a6ca0274f 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -112,7 +112,6 @@ pub struct ESTreeSerializer { fixes_buffer: CodeBuffer, options: RuntimeOptions, source_text: Option<&'static str>, - #[expect(unused)] config: C, } @@ -211,7 +210,7 @@ impl<'s, C: Config, F: Formatter> Serializer for &'s mut ESTreeSerializer type SequenceSerializer = ESTreeSequenceSerializer<'s, C, F>; fn range(&self) -> bool { - self.options.range + self.config.ranges() } /// Serialize struct. From 7663b54b65db1f069968cda7403c2d951a6187f9 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Tue, 17 Jun 2025 09:39:55 +0200 Subject: [PATCH 07/42] chore: move to config --- crates/oxc_ast/src/generated/derive_estree.rs | 1249 +++++++---------- crates/oxc_ast/src/serialize/mod.rs | 20 +- crates/oxc_estree/src/lib.rs | 2 +- crates/oxc_estree/src/serialize/config.rs | 32 + crates/oxc_estree/src/serialize/mod.rs | 25 +- crates/oxc_estree/src/serialize/primitives.rs | 22 +- crates/oxc_estree/src/serialize/structs.rs | 2 +- crates/oxc_parser/src/lib.rs | 1 - .../oxc_span/src/generated/derive_estree.rs | 3 +- crates/oxc_span/src/span.rs | 4 + .../oxc_syntax/src/generated/derive_estree.rs | 24 +- napi/parser/index.d.ts | 1 - napi/parser/src/generated/derive_estree.rs | 24 +- napi/parser/src/types.rs | 1 - napi/parser/test/parse.test.ts | 20 + tasks/ast_tools/src/derives/estree.rs | 13 +- 16 files changed, 641 insertions(+), 802 deletions(-) diff --git a/crates/oxc_ast/src/generated/derive_estree.rs b/crates/oxc_ast/src/generated/derive_estree.rs index 69a9c94597544..abe4a7cb0a1d6 100644 --- a/crates/oxc_ast/src/generated/derive_estree.rs +++ b/crates/oxc_ast/src/generated/derive_estree.rs @@ -4,8 +4,7 @@ #![allow(unused_imports, clippy::match_same_arms, clippy::semicolon_if_nothing_returned)] use oxc_estree::{ - Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Range, Serializer, - StructSerializer, + Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Serializer, StructSerializer, }; use crate::ast::comment::*; @@ -74,12 +73,11 @@ impl ESTree for IdentifierName<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -92,12 +90,11 @@ impl ESTree for IdentifierReference<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -110,12 +107,11 @@ impl ESTree for BindingIdentifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -128,12 +124,11 @@ impl ESTree for LabelIdentifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -146,12 +141,11 @@ impl ESTree for ThisExpression { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ThisExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -160,12 +154,11 @@ impl ESTree for ArrayExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrayExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("elements", &self.elements); state.end(); } @@ -233,12 +226,11 @@ impl ESTree for ObjectExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ObjectExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("properties", &self.properties); state.end(); } @@ -257,12 +249,11 @@ impl ESTree for ObjectProperty<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("kind", &self.kind); state.serialize_field("key", &self.key); state.serialize_field("value", &self.value); @@ -340,12 +331,11 @@ impl ESTree for TemplateLiteral<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TemplateLiteral")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("quasis", &self.quasis); state.serialize_field("expressions", &self.expressions); state.end(); @@ -356,12 +346,11 @@ impl ESTree for TaggedTemplateExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TaggedTemplateExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("tag", &self.tag); state.serialize_ts_field("typeArguments", &self.type_arguments); state.serialize_field("quasi", &self.quasi); @@ -398,12 +387,11 @@ impl ESTree for ComputedMemberExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MemberExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("object", &self.object); state.serialize_field("property", &self.expression); state.serialize_field("optional", &self.optional); @@ -416,12 +404,11 @@ impl ESTree for StaticMemberExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MemberExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("object", &self.object); state.serialize_field("property", &self.property); state.serialize_field("optional", &self.optional); @@ -434,12 +421,11 @@ impl ESTree for PrivateFieldExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MemberExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("object", &self.object); state.serialize_field("property", &self.field); state.serialize_field("optional", &self.optional); @@ -452,12 +438,11 @@ impl ESTree for CallExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("CallExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("callee", &self.callee); state.serialize_ts_field("typeArguments", &self.type_arguments); state.serialize_field("arguments", &self.arguments); @@ -470,12 +455,11 @@ impl ESTree for NewExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("NewExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("callee", &self.callee); state.serialize_ts_field("typeArguments", &self.type_arguments); state.serialize_field("arguments", &self.arguments); @@ -487,12 +471,11 @@ impl ESTree for MetaProperty<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MetaProperty")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("meta", &self.meta); state.serialize_field("property", &self.property); state.end(); @@ -503,12 +486,11 @@ impl ESTree for SpreadElement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SpreadElement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("argument", &self.argument); state.end(); } @@ -569,12 +551,11 @@ impl ESTree for UpdateExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("UpdateExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("operator", &self.operator); state.serialize_field("prefix", &self.prefix); state.serialize_field("argument", &self.argument); @@ -586,12 +567,11 @@ impl ESTree for UnaryExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("UnaryExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("operator", &self.operator); state.serialize_field("argument", &self.argument); state.serialize_field("prefix", &crate::serialize::basic::True(self)); @@ -603,12 +583,11 @@ impl ESTree for BinaryExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BinaryExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("left", &self.left); state.serialize_field("operator", &self.operator); state.serialize_field("right", &self.right); @@ -620,12 +599,11 @@ impl ESTree for PrivateInExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BinaryExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("left", &self.left); state.serialize_field("operator", &crate::serialize::basic::In(self)); state.serialize_field("right", &self.right); @@ -637,12 +615,11 @@ impl ESTree for LogicalExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("LogicalExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("left", &self.left); state.serialize_field("operator", &self.operator); state.serialize_field("right", &self.right); @@ -654,12 +631,11 @@ impl ESTree for ConditionalExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ConditionalExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("test", &self.test); state.serialize_field("consequent", &self.consequent); state.serialize_field("alternate", &self.alternate); @@ -671,12 +647,11 @@ impl ESTree for AssignmentExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AssignmentExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("operator", &self.operator); state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); @@ -729,12 +704,11 @@ impl ESTree for ArrayAssignmentTarget<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrayPattern")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("elements", &Concat2(&self.elements, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -747,12 +721,11 @@ impl ESTree for ObjectAssignmentTarget<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ObjectPattern")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("properties", &Concat2(&self.properties, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -765,12 +738,11 @@ impl ESTree for AssignmentTargetRest<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("RestElement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("argument", &self.target); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -802,12 +774,11 @@ impl ESTree for AssignmentTargetWithDefault<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AssignmentPattern")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("left", &self.binding); state.serialize_field("right", &self.init); @@ -830,12 +801,11 @@ impl ESTree for AssignmentTargetPropertyIdentifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("kind", &crate::serialize::basic::Init(self)); state.serialize_field("key", &self.binding); state.serialize_field( @@ -854,12 +824,11 @@ impl ESTree for AssignmentTargetPropertyProperty<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("kind", &crate::serialize::basic::Init(self)); state.serialize_field("key", &self.name); state.serialize_field("value", &self.binding); @@ -875,12 +844,11 @@ impl ESTree for SequenceExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SequenceExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expressions", &self.expressions); state.end(); } @@ -890,12 +858,11 @@ impl ESTree for Super { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Super")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -904,12 +871,11 @@ impl ESTree for AwaitExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AwaitExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("argument", &self.argument); state.end(); } @@ -919,12 +885,11 @@ impl ESTree for ChainExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ChainExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.end(); } @@ -946,12 +911,11 @@ impl ESTree for ParenthesizedExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ParenthesizedExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.end(); } @@ -1000,12 +964,11 @@ impl ESTree for Directive<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExpressionStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.serialize_field("directive", &self.directive); state.end(); @@ -1016,12 +979,11 @@ impl ESTree for Hashbang<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Hashbang")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("value", &self.value); state.end(); } @@ -1031,12 +993,11 @@ impl ESTree for BlockStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BlockStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("body", &self.body); state.end(); } @@ -1061,12 +1022,11 @@ impl ESTree for VariableDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("VariableDeclaration")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("kind", &self.kind); state.serialize_field("declarations", &self.declarations); state.serialize_ts_field("declare", &self.declare); @@ -1090,12 +1050,11 @@ impl ESTree for VariableDeclarator<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("VariableDeclarator")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("id", &self.id); state.serialize_field("init", &self.init); state.serialize_ts_field("definite", &self.definite); @@ -1107,12 +1066,11 @@ impl ESTree for EmptyStatement { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("EmptyStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1121,12 +1079,11 @@ impl ESTree for ExpressionStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExpressionStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.serialize_ts_field( "directive", @@ -1140,12 +1097,11 @@ impl ESTree for IfStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("IfStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("test", &self.test); state.serialize_field("consequent", &self.consequent); state.serialize_field("alternate", &self.alternate); @@ -1157,12 +1113,11 @@ impl ESTree for DoWhileStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("DoWhileStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("body", &self.body); state.serialize_field("test", &self.test); state.end(); @@ -1173,12 +1128,11 @@ impl ESTree for WhileStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("WhileStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("test", &self.test); state.serialize_field("body", &self.body); state.end(); @@ -1189,12 +1143,11 @@ impl ESTree for ForStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ForStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("init", &self.init); state.serialize_field("test", &self.test); state.serialize_field("update", &self.update); @@ -1258,12 +1211,11 @@ impl ESTree for ForInStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ForInStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); state.serialize_field("body", &self.body); @@ -1293,12 +1245,11 @@ impl ESTree for ForOfStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ForOfStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("await", &self.r#await); state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); @@ -1311,12 +1262,11 @@ impl ESTree for ContinueStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ContinueStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("label", &self.label); state.end(); } @@ -1326,12 +1276,11 @@ impl ESTree for BreakStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BreakStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("label", &self.label); state.end(); } @@ -1341,12 +1290,11 @@ impl ESTree for ReturnStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ReturnStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("argument", &self.argument); state.end(); } @@ -1356,12 +1304,11 @@ impl ESTree for WithStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("WithStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("object", &self.object); state.serialize_field("body", &self.body); state.end(); @@ -1372,12 +1319,11 @@ impl ESTree for SwitchStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SwitchStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("discriminant", &self.discriminant); state.serialize_field("cases", &self.cases); state.end(); @@ -1388,12 +1334,11 @@ impl ESTree for SwitchCase<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SwitchCase")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("test", &self.test); state.serialize_field("consequent", &self.consequent); state.end(); @@ -1404,12 +1349,11 @@ impl ESTree for LabeledStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("LabeledStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("label", &self.label); state.serialize_field("body", &self.body); state.end(); @@ -1420,12 +1364,11 @@ impl ESTree for ThrowStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ThrowStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("argument", &self.argument); state.end(); } @@ -1435,12 +1378,11 @@ impl ESTree for TryStatement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TryStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("block", &self.block); state.serialize_field("handler", &self.handler); state.serialize_field("finalizer", &self.finalizer); @@ -1452,12 +1394,11 @@ impl ESTree for CatchClause<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("CatchClause")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("param", &self.param); state.serialize_field("body", &self.body); state.end(); @@ -1474,12 +1415,11 @@ impl ESTree for DebuggerStatement { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("DebuggerStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1505,12 +1445,11 @@ impl ESTree for AssignmentPattern<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AssignmentPattern")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); @@ -1524,12 +1463,11 @@ impl ESTree for ObjectPattern<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ObjectPattern")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("properties", &Concat2(&self.properties, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -1542,12 +1480,11 @@ impl ESTree for BindingProperty<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("kind", &crate::serialize::basic::Init(self)); state.serialize_field("key", &self.key); state.serialize_field("value", &self.value); @@ -1563,12 +1500,11 @@ impl ESTree for ArrayPattern<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrayPattern")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("elements", &Concat2(&self.elements, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -1581,12 +1517,11 @@ impl ESTree for BindingRestElement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("RestElement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("argument", &self.argument); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -1600,12 +1535,11 @@ impl ESTree for Function<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("id", &self.id); state.serialize_field("generator", &self.generator); state.serialize_field("async", &self.r#async); @@ -1665,12 +1599,11 @@ impl ESTree for FunctionBody<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BlockStatement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("body", &Concat2(&self.directives, &self.statements)); state.end(); } @@ -1680,12 +1613,11 @@ impl ESTree for ArrowFunctionExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrowFunctionExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.serialize_field("async", &self.r#async); state.serialize_ts_field("typeParameters", &self.type_parameters); @@ -1702,12 +1634,11 @@ impl ESTree for YieldExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("YieldExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("delegate", &self.delegate); state.serialize_field("argument", &self.argument); state.end(); @@ -1718,12 +1649,11 @@ impl ESTree for Class<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("decorators", &self.decorators); state.serialize_field("id", &self.id); state.serialize_ts_field("typeParameters", &self.type_parameters); @@ -1750,12 +1680,11 @@ impl ESTree for ClassBody<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ClassBody")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("body", &self.body); state.end(); } @@ -1777,12 +1706,11 @@ impl ESTree for MethodDefinition<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("decorators", &self.decorators); state.serialize_field("key", &self.key); state.serialize_field("value", &self.value); @@ -1811,12 +1739,11 @@ impl ESTree for PropertyDefinition<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("decorators", &self.decorators); state.serialize_field("key", &self.key); state.serialize_ts_field("typeAnnotation", &self.type_annotation); @@ -1859,12 +1786,11 @@ impl ESTree for PrivateIdentifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("PrivateIdentifier")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("name", &self.name); state.end(); } @@ -1874,12 +1800,11 @@ impl ESTree for StaticBlock<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("StaticBlock")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("body", &self.body); state.end(); } @@ -1913,12 +1838,11 @@ impl ESTree for AccessorProperty<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("decorators", &self.decorators); state.serialize_field("key", &self.key); state.serialize_ts_field("typeAnnotation", &self.type_annotation); @@ -1939,12 +1863,11 @@ impl ESTree for ImportExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("source", &self.source); state.serialize_field("options", &self.options); state.serialize_field("phase", &self.phase); @@ -1956,12 +1879,11 @@ impl ESTree for ImportDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportDeclaration")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field( "specifiers", &crate::serialize::js::ImportDeclarationSpecifiers(self), @@ -2000,12 +1922,11 @@ impl ESTree for ImportSpecifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportSpecifier")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("imported", &self.imported); state.serialize_field("local", &self.local); state.serialize_ts_field("importKind", &self.import_kind); @@ -2017,12 +1938,11 @@ impl ESTree for ImportDefaultSpecifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportDefaultSpecifier")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("local", &self.local); state.end(); } @@ -2032,12 +1952,11 @@ impl ESTree for ImportNamespaceSpecifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportNamespaceSpecifier")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("local", &self.local); state.end(); } @@ -2055,12 +1974,11 @@ impl ESTree for ImportAttribute<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportAttribute")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("key", &self.key); state.serialize_field("value", &self.value); state.end(); @@ -2080,12 +1998,11 @@ impl ESTree for ExportNamedDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportNamedDeclaration")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("declaration", &self.declaration); state.serialize_field("specifiers", &self.specifiers); state.serialize_field("source", &self.source); @@ -2102,12 +2019,11 @@ impl ESTree for ExportDefaultDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportDefaultDeclaration")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("declaration", &self.declaration); state.serialize_ts_field("exportKind", &crate::serialize::basic::TsValue(self)); state.end(); @@ -2118,12 +2034,11 @@ impl ESTree for ExportAllDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportAllDeclaration")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("exported", &self.exported); state.serialize_field("source", &self.source); state.serialize_field( @@ -2139,12 +2054,11 @@ impl ESTree for ExportSpecifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportSpecifier")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("local", &self.local); state.serialize_field("exported", &self.exported); state.serialize_ts_field("exportKind", &self.export_kind); @@ -2219,12 +2133,11 @@ impl ESTree for V8IntrinsicExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("V8IntrinsicExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("name", &self.name); state.serialize_field("arguments", &self.arguments); state.end(); @@ -2235,12 +2148,11 @@ impl ESTree for BooleanLiteral { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("value", &self.value); state.serialize_field("raw", &crate::serialize::literal::BooleanLiteralRaw(self)); state.end(); @@ -2251,12 +2163,11 @@ impl ESTree for NullLiteral { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("value", &crate::serialize::basic::Null(self)); state.serialize_field("raw", &crate::serialize::literal::NullLiteralRaw(self)); state.end(); @@ -2267,12 +2178,11 @@ impl ESTree for NumericLiteral<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("value", &self.value); state.serialize_field("raw", &self.raw.map(|s| JsonSafeString(s.as_str()))); state.end(); @@ -2283,12 +2193,11 @@ impl ESTree for StringLiteral<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("value", &crate::serialize::literal::StringLiteralValue(self)); state.serialize_field("raw", &self.raw); state.end(); @@ -2299,12 +2208,11 @@ impl ESTree for BigIntLiteral<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("value", &crate::serialize::literal::BigIntLiteralValue(self)); state.serialize_field("raw", &self.raw.map(|s| JsonSafeString(s.as_str()))); state.serialize_field("bigint", &crate::serialize::literal::BigIntLiteralBigint(self)); @@ -2316,12 +2224,11 @@ impl ESTree for RegExpLiteral<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("value", &crate::serialize::literal::RegExpLiteralValue(self)); state.serialize_field("raw", &self.raw); state.serialize_field("regex", &self.regex); @@ -2356,12 +2263,11 @@ impl ESTree for JSXElement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXElement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field( "openingElement", &crate::serialize::jsx::JSXElementOpeningElement(self), @@ -2376,12 +2282,11 @@ impl ESTree for JSXOpeningElement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXOpeningElement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("name", &self.name); state.serialize_ts_field("typeArguments", &self.type_arguments); state.serialize_field("attributes", &self.attributes); @@ -2397,12 +2302,11 @@ impl ESTree for JSXClosingElement<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXClosingElement")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("name", &self.name); state.end(); } @@ -2412,12 +2316,11 @@ impl ESTree for JSXFragment<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXFragment")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("openingFragment", &self.opening_fragment); state.serialize_field("children", &self.children); state.serialize_field("closingFragment", &self.closing_fragment); @@ -2429,12 +2332,11 @@ impl ESTree for JSXOpeningFragment { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXOpeningFragment")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_js_field("attributes", &crate::serialize::basic::JsEmptyArray(self)); state.serialize_js_field("selfClosing", &crate::serialize::basic::JsFalse(self)); state.end(); @@ -2445,12 +2347,11 @@ impl ESTree for JSXClosingFragment { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXClosingFragment")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2475,12 +2376,11 @@ impl ESTree for JSXNamespacedName<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXNamespacedName")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("namespace", &self.namespace); state.serialize_field("name", &self.name); state.end(); @@ -2491,12 +2391,11 @@ impl ESTree for JSXMemberExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXMemberExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("object", &self.object); state.serialize_field("property", &self.property); state.end(); @@ -2521,12 +2420,11 @@ impl ESTree for JSXExpressionContainer<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXExpressionContainer")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.end(); } @@ -2587,12 +2485,11 @@ impl ESTree for JSXEmptyExpression { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXEmptyExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2610,12 +2507,11 @@ impl ESTree for JSXAttribute<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXAttribute")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("name", &self.name); state.serialize_field("value", &self.value); state.end(); @@ -2626,12 +2522,11 @@ impl ESTree for JSXSpreadAttribute<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXSpreadAttribute")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("argument", &self.argument); state.end(); } @@ -2661,12 +2556,11 @@ impl ESTree for JSXIdentifier<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXIdentifier")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.end(); } @@ -2688,12 +2582,11 @@ impl ESTree for JSXSpreadChild<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXSpreadChild")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.end(); } @@ -2703,12 +2596,11 @@ impl ESTree for JSXText<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXText")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("value", &self.value); state.serialize_field("raw", &self.raw); state.end(); @@ -2719,12 +2611,11 @@ impl ESTree for TSThisParameter<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("decorators", &crate::serialize::basic::EmptyArray(self)); state.serialize_field("name", &crate::serialize::basic::This(self)); state.serialize_field("optional", &crate::serialize::basic::False(self)); @@ -2737,12 +2628,11 @@ impl ESTree for TSEnumDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSEnumDeclaration")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("id", &self.id); state.serialize_field("body", &self.body); state.serialize_field("const", &self.r#const); @@ -2755,12 +2645,11 @@ impl ESTree for TSEnumBody<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSEnumBody")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("members", &self.members); state.end(); } @@ -2770,12 +2659,11 @@ impl ESTree for TSEnumMember<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSEnumMember")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("id", &self.id); state.serialize_field("initializer", &self.initializer); state.serialize_field("computed", &crate::serialize::ts::TSEnumMemberComputed(self)); @@ -2798,12 +2686,11 @@ impl ESTree for TSTypeAnnotation<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeAnnotation")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("typeAnnotation", &self.type_annotation); state.end(); } @@ -2813,12 +2700,11 @@ impl ESTree for TSLiteralType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSLiteralType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("literal", &self.literal); state.end(); } @@ -2885,12 +2771,11 @@ impl ESTree for TSConditionalType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSConditionalType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("checkType", &self.check_type); state.serialize_field("extendsType", &self.extends_type); state.serialize_field("trueType", &self.true_type); @@ -2903,12 +2788,11 @@ impl ESTree for TSUnionType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSUnionType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("types", &self.types); state.end(); } @@ -2918,12 +2802,11 @@ impl ESTree for TSIntersectionType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIntersectionType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("types", &self.types); state.end(); } @@ -2933,12 +2816,11 @@ impl ESTree for TSParenthesizedType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSParenthesizedType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("typeAnnotation", &self.type_annotation); state.end(); } @@ -2948,12 +2830,11 @@ impl ESTree for TSTypeOperator<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeOperator")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("operator", &self.operator); state.serialize_field("typeAnnotation", &self.type_annotation); state.end(); @@ -2974,12 +2855,11 @@ impl ESTree for TSArrayType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSArrayType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("elementType", &self.element_type); state.end(); } @@ -2989,12 +2869,11 @@ impl ESTree for TSIndexedAccessType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIndexedAccessType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("objectType", &self.object_type); state.serialize_field("indexType", &self.index_type); state.end(); @@ -3005,12 +2884,11 @@ impl ESTree for TSTupleType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTupleType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("elementTypes", &self.element_types); state.end(); } @@ -3020,12 +2898,11 @@ impl ESTree for TSNamedTupleMember<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNamedTupleMember")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("label", &self.label); state.serialize_field("elementType", &self.element_type); state.serialize_field("optional", &self.optional); @@ -3037,12 +2914,11 @@ impl ESTree for TSOptionalType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSOptionalType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("typeAnnotation", &self.type_annotation); state.end(); } @@ -3052,12 +2928,11 @@ impl ESTree for TSRestType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSRestType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("typeAnnotation", &self.type_annotation); state.end(); } @@ -3113,12 +2988,11 @@ impl ESTree for TSAnyKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSAnyKeyword")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3127,12 +3001,11 @@ impl ESTree for TSStringKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSStringKeyword")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3141,12 +3014,11 @@ impl ESTree for TSBooleanKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSBooleanKeyword")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3155,12 +3027,11 @@ impl ESTree for TSNumberKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNumberKeyword")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3169,12 +3040,11 @@ impl ESTree for TSNeverKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNeverKeyword")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3183,12 +3053,11 @@ impl ESTree for TSIntrinsicKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIntrinsicKeyword")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3197,12 +3066,11 @@ impl ESTree for TSUnknownKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSUnknownKeyword")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3211,12 +3079,11 @@ impl ESTree for TSNullKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNullKeyword")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3225,12 +3092,11 @@ impl ESTree for TSUndefinedKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSUndefinedKeyword")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3239,12 +3105,11 @@ impl ESTree for TSVoidKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSVoidKeyword")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3253,12 +3118,11 @@ impl ESTree for TSSymbolKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSSymbolKeyword")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3267,12 +3131,11 @@ impl ESTree for TSThisType { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSThisType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3281,12 +3144,11 @@ impl ESTree for TSObjectKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSObjectKeyword")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3295,12 +3157,11 @@ impl ESTree for TSBigIntKeyword { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSBigIntKeyword")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3309,12 +3170,11 @@ impl ESTree for TSTypeReference<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeReference")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("typeName", &self.type_name); state.serialize_field("typeArguments", &self.type_arguments); state.end(); @@ -3336,12 +3196,11 @@ impl ESTree for TSQualifiedName<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSQualifiedName")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); state.end(); @@ -3352,12 +3211,11 @@ impl ESTree for TSTypeParameterInstantiation<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeParameterInstantiation")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("params", &self.params); state.end(); } @@ -3367,12 +3225,11 @@ impl ESTree for TSTypeParameter<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeParameter")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("name", &self.name); state.serialize_field("constraint", &self.constraint); state.serialize_field("default", &self.default); @@ -3387,12 +3244,11 @@ impl ESTree for TSTypeParameterDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeParameterDeclaration")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("params", &self.params); state.end(); } @@ -3402,12 +3258,11 @@ impl ESTree for TSTypeAliasDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeAliasDeclaration")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("id", &self.id); state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -3430,12 +3285,11 @@ impl ESTree for TSClassImplements<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSClassImplements")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field( "expression", &crate::serialize::ts::TSClassImplementsExpression(self), @@ -3449,12 +3303,11 @@ impl ESTree for TSInterfaceDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInterfaceDeclaration")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("id", &self.id); state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("extends", &self.extends); @@ -3468,12 +3321,11 @@ impl ESTree for TSInterfaceBody<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInterfaceBody")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("body", &self.body); state.end(); } @@ -3483,12 +3335,11 @@ impl ESTree for TSPropertySignature<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSPropertySignature")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("computed", &self.computed); state.serialize_field("optional", &self.optional); state.serialize_field("readonly", &self.readonly); @@ -3516,12 +3367,11 @@ impl ESTree for TSIndexSignature<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIndexSignature")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("parameters", &self.parameters); state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("readonly", &self.readonly); @@ -3535,12 +3385,11 @@ impl ESTree for TSCallSignatureDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSCallSignatureDeclaration")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field( "params", @@ -3565,12 +3414,11 @@ impl ESTree for TSMethodSignature<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSMethodSignature")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("key", &self.key); state.serialize_field("computed", &self.computed); state.serialize_field("optional", &self.optional); @@ -3589,12 +3437,11 @@ impl ESTree for TSConstructSignatureDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSConstructSignatureDeclaration")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("params", &self.params); state.serialize_field("returnType", &self.return_type); @@ -3606,12 +3453,11 @@ impl ESTree for TSIndexSignatureName<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("decorators", &crate::serialize::basic::EmptyArray(self)); state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_field("optional", &crate::serialize::basic::False(self)); @@ -3624,12 +3470,11 @@ impl ESTree for TSInterfaceHeritage<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInterfaceHeritage")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.serialize_field("typeArguments", &self.type_arguments); state.end(); @@ -3640,12 +3485,11 @@ impl ESTree for TSTypePredicate<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypePredicate")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("parameterName", &self.parameter_name); state.serialize_field("asserts", &self.asserts); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -3700,12 +3544,11 @@ impl ESTree for TSModuleBlock<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSModuleBlock")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("body", &Concat2(&self.directives, &self.body)); state.end(); } @@ -3715,12 +3558,11 @@ impl ESTree for TSTypeLiteral<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeLiteral")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("members", &self.members); state.end(); } @@ -3730,12 +3572,11 @@ impl ESTree for TSInferType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInferType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("typeParameter", &self.type_parameter); state.end(); } @@ -3745,12 +3586,11 @@ impl ESTree for TSTypeQuery<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeQuery")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("exprName", &self.expr_name); state.serialize_field("typeArguments", &self.type_arguments); state.end(); @@ -3773,12 +3613,11 @@ impl ESTree for TSImportType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSImportType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("argument", &self.argument); state.serialize_field("options", &self.options); state.serialize_field("qualifier", &self.qualifier); @@ -3791,12 +3630,11 @@ impl ESTree for TSFunctionType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSFunctionType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("params", &crate::serialize::ts::TSFunctionTypeParams(self)); state.serialize_field("returnType", &self.return_type); @@ -3808,12 +3646,11 @@ impl ESTree for TSConstructorType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSConstructorType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("abstract", &self.r#abstract); state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("params", &self.params); @@ -3826,12 +3663,11 @@ impl ESTree for TSMappedType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSMappedType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("key", &crate::serialize::ts::TSMappedTypeKey(self)); state.serialize_field("constraint", &crate::serialize::ts::TSMappedTypeConstraint(self)); state.serialize_field("nameType", &self.name_type); @@ -3856,12 +3692,11 @@ impl ESTree for TSTemplateLiteralType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTemplateLiteralType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("quasis", &self.quasis); state.serialize_field("types", &self.types); state.end(); @@ -3872,12 +3707,11 @@ impl ESTree for TSAsExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSAsExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.serialize_field("typeAnnotation", &self.type_annotation); state.end(); @@ -3888,12 +3722,11 @@ impl ESTree for TSSatisfiesExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSSatisfiesExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.serialize_field("typeAnnotation", &self.type_annotation); state.end(); @@ -3904,12 +3737,11 @@ impl ESTree for TSTypeAssertion<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeAssertion")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("expression", &self.expression); state.end(); @@ -3920,12 +3752,11 @@ impl ESTree for TSImportEqualsDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSImportEqualsDeclaration")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("id", &self.id); state.serialize_field("moduleReference", &self.module_reference); state.serialize_field("importKind", &self.import_kind); @@ -3949,12 +3780,11 @@ impl ESTree for TSExternalModuleReference<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSExternalModuleReference")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.end(); } @@ -3964,12 +3794,11 @@ impl ESTree for TSNonNullExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNonNullExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.end(); } @@ -3979,12 +3808,11 @@ impl ESTree for Decorator<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Decorator")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.end(); } @@ -3994,12 +3822,11 @@ impl ESTree for TSExportAssignment<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSExportAssignment")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.end(); } @@ -4009,12 +3836,11 @@ impl ESTree for TSNamespaceExportDeclaration<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNamespaceExportDeclaration")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("id", &self.id); state.end(); } @@ -4024,12 +3850,11 @@ impl ESTree for TSInstantiationExpression<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInstantiationExpression")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("expression", &self.expression); state.serialize_field("typeArguments", &self.type_arguments); state.end(); @@ -4049,12 +3874,11 @@ impl ESTree for JSDocNullableType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSJSDocNullableType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("postfix", &self.postfix); state.end(); @@ -4065,12 +3889,11 @@ impl ESTree for JSDocNonNullableType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSJSDocNonNullableType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("postfix", &self.postfix); state.end(); @@ -4081,12 +3904,11 @@ impl ESTree for JSDocUnknownType { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSJSDocUnknownType")); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -4105,12 +3927,11 @@ impl ESTree for Comment { let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.kind); state.serialize_field("value", &crate::serialize::CommentValue(self)); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index 14a2401a2ce40..704fc36b49cda 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -3,8 +3,8 @@ use std::cmp; use oxc_ast_macros::ast_meta; use oxc_estree::{ CompactFixesJSSerializer, CompactFixesTSSerializer, CompactJSSerializer, CompactTSSerializer, - Concat2, ESTree, JsonSafeString, PrettyFixesJSSerializer, PrettyFixesTSSerializer, - PrettyJSSerializer, PrettyTSSerializer, RuntimeOptions, Serializer, StructSerializer, + Concat2, ConfigFixesJS, ConfigFixesTS, ESTree, JsonSafeString, PrettyFixesJSSerializer, PrettyFixesTSSerializer, + PrettyJSSerializer, PrettyTSSerializer, Serializer, StructSerializer, }; use oxc_span::GetSpan; @@ -105,11 +105,9 @@ impl Program<'_> { options: Option<&SerializationOptions>, ) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let runtime_options = options.map_or_else(RuntimeOptions::default, |o| RuntimeOptions { - range: o.range, - }); - let serializer = - CompactFixesTSSerializer::with_capacity(capacity).with_options(runtime_options); + let range = options.map_or(false, |opts| opts.range); + let config = ConfigFixesTS::with_ranges(range); + let serializer = CompactFixesTSSerializer::with_config_and_capacity(config, capacity); serializer.serialize_with_fixes(self) } @@ -119,11 +117,9 @@ impl Program<'_> { options: Option<&SerializationOptions>, ) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let runtime_options = options.map_or_else(RuntimeOptions::default, |o| RuntimeOptions { - range: o.range, - }); - let serializer = - CompactFixesJSSerializer::with_capacity(capacity).with_options(runtime_options); + let range = options.map_or(false, |opts| opts.range); + let config = ConfigFixesJS::with_ranges(range); + let serializer = CompactFixesJSSerializer::with_config_and_capacity(config, capacity); serializer.serialize_with_fixes(self) } diff --git a/crates/oxc_estree/src/lib.rs b/crates/oxc_estree/src/lib.rs index 026d5c41deb53..7048452fda792 100644 --- a/crates/oxc_estree/src/lib.rs +++ b/crates/oxc_estree/src/lib.rs @@ -1,5 +1,5 @@ #[cfg(feature = "serialize")] -pub mod serialize; +mod serialize; #[cfg(feature = "serialize")] pub use serialize::*; diff --git a/crates/oxc_estree/src/serialize/config.rs b/crates/oxc_estree/src/serialize/config.rs index c90465c7c9ac7..aa5bec9e48ce3 100644 --- a/crates/oxc_estree/src/serialize/config.rs +++ b/crates/oxc_estree/src/serialize/config.rs @@ -16,6 +16,14 @@ pub struct ConfigTS { ranges: bool, } +impl ConfigTS { + /// Create a new ConfigTS with the specified ranges setting + #[inline(always)] + pub fn with_ranges(ranges: bool) -> Self { + Self { ranges } + } +} + impl Config for ConfigTS { const INCLUDE_TS_FIELDS: bool = true; const FIXES: bool = false; @@ -36,6 +44,14 @@ pub struct ConfigJS { ranges: bool, } +impl ConfigJS { + /// Create a new ConfigJS with the specified ranges setting + #[inline(always)] + pub fn with_ranges(ranges: bool) -> Self { + Self { ranges } + } +} + impl Config for ConfigJS { const INCLUDE_TS_FIELDS: bool = false; const FIXES: bool = false; @@ -56,6 +72,14 @@ pub struct ConfigFixesTS { ranges: bool, } +impl ConfigFixesTS { + /// Create a new ConfigFixesTS with the specified ranges setting + #[inline(always)] + pub fn with_ranges(ranges: bool) -> Self { + Self { ranges } + } +} + impl Config for ConfigFixesTS { const INCLUDE_TS_FIELDS: bool = true; const FIXES: bool = true; @@ -76,6 +100,14 @@ pub struct ConfigFixesJS { ranges: bool, } +impl ConfigFixesJS { + /// Create a new ConfigFixesJS with the specified ranges setting + #[inline(always)] + pub fn with_ranges(ranges: bool) -> Self { + Self { ranges } + } +} + impl Config for ConfigFixesJS { const INCLUDE_TS_FIELDS: bool = false; const FIXES: bool = true; diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index 6bb3a6ca0274f..41477cd20e93a 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -17,13 +17,13 @@ mod primitives; mod sequences; mod strings; mod structs; -use config::{Config, ConfigFixesJS, ConfigFixesTS, ConfigJS, ConfigTS}; use formatter::{CompactFormatter, Formatter, PrettyFormatter}; use sequences::ESTreeSequenceSerializer; use structs::ESTreeStructSerializer; pub use concat::{Concat2, Concat3, ConcatElement}; -pub use primitives::Range; +pub use config::{Config, ConfigFixesJS, ConfigFixesTS, ConfigJS, ConfigTS}; + pub use sequences::SequenceSerializer; pub use strings::{JsonSafeString, LoneSurrogatesString}; pub use structs::{FlatStructSerializer, StructSerializer}; @@ -99,18 +99,12 @@ pub type PrettyFixesTSSerializer = ESTreeSerializer; -#[derive(Clone, Copy, Default)] -pub struct RuntimeOptions { - pub range: bool, -} - /// ESTree serializer. pub struct ESTreeSerializer { buffer: CodeBuffer, formatter: F, trace_path: NonEmptyStack, fixes_buffer: CodeBuffer, - options: RuntimeOptions, source_text: Option<&'static str>, config: C, } @@ -123,7 +117,6 @@ impl ESTreeSerializer { formatter: F::new(), trace_path: NonEmptyStack::new(TracePathPart::Index(0)), fixes_buffer: CodeBuffer::new(), - options: RuntimeOptions::default(), source_text: None, config: C::new(), } @@ -136,15 +129,21 @@ impl ESTreeSerializer { formatter: F::new(), trace_path: NonEmptyStack::new(TracePathPart::Index(0)), fixes_buffer: CodeBuffer::new(), - options: RuntimeOptions::default(), source_text: None, config: C::new(), } } - pub fn with_options(mut self, options: RuntimeOptions) -> Self { - self.options = options; - self + /// Create new [`ESTreeSerializer`] with specified config and buffer capacity. + pub fn with_config_and_capacity(config: C, capacity: usize) -> Self { + Self { + buffer: CodeBuffer::with_capacity(capacity), + formatter: F::new(), + trace_path: NonEmptyStack::new(TracePathPart::Index(0)), + fixes_buffer: CodeBuffer::new(), + source_text: None, + config, + } } pub fn with_source_text(mut self, source_text: &'static str) -> Self { diff --git a/crates/oxc_estree/src/serialize/primitives.rs b/crates/oxc_estree/src/serialize/primitives.rs index e16a36775c6c8..c8d1323425b60 100644 --- a/crates/oxc_estree/src/serialize/primitives.rs +++ b/crates/oxc_estree/src/serialize/primitives.rs @@ -1,7 +1,7 @@ use itoa::Buffer as ItoaBuffer; use ryu_js::Buffer as RyuBuffer; -use super::{ESTree, SequenceSerializer, Serializer}; +use super::{ESTree, Serializer}; /// [`ESTree`] implementation for `bool`. impl ESTree for bool { @@ -71,27 +71,7 @@ impl ESTree for () { } } -/// ESTree range type - represents [start, end] positions in source code -#[derive(Debug, Copy, Clone)] -pub struct Range { - pub start: u32, - pub end: u32, -} - -impl Range { - pub fn new(start: u32, end: u32) -> Self { - Self { start, end } - } -} -impl ESTree for Range { - fn serialize(&self, serializer: S) { - let mut seq = serializer.serialize_sequence(); - seq.serialize_element(&self.start); - seq.serialize_element(&self.end); - seq.end(); - } -} #[cfg(test)] mod tests { diff --git a/crates/oxc_estree/src/serialize/structs.rs b/crates/oxc_estree/src/serialize/structs.rs index 52b2270125984..68fb082285c4e 100644 --- a/crates/oxc_estree/src/serialize/structs.rs +++ b/crates/oxc_estree/src/serialize/structs.rs @@ -151,7 +151,7 @@ impl StructSerializer for ESTreeStructSerializer<'_, C, } fn range(&self) -> bool { - self.serializer.options.range + self.serializer.config.ranges() } } diff --git a/crates/oxc_parser/src/lib.rs b/crates/oxc_parser/src/lib.rs index b526f40426656..dd6014d62203c 100644 --- a/crates/oxc_parser/src/lib.rs +++ b/crates/oxc_parser/src/lib.rs @@ -224,7 +224,6 @@ pub struct ParseOptions { /// Controls whether the `range` information is included to each node. /// The `range` property is a [number, number] which indicates the start/end index of the node in the file contents. - /// This is similar to the `loc` property, except this is the absolute index. /// /// Default: `false` pub range: bool, diff --git a/crates/oxc_span/src/generated/derive_estree.rs b/crates/oxc_span/src/generated/derive_estree.rs index 6598fbd510f61..f82c5f70cc9ec 100644 --- a/crates/oxc_span/src/generated/derive_estree.rs +++ b/crates/oxc_span/src/generated/derive_estree.rs @@ -4,8 +4,7 @@ #![allow(unused_imports, clippy::match_same_arms, clippy::semicolon_if_nothing_returned)] use oxc_estree::{ - Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Range, Serializer, - StructSerializer, + Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Serializer, StructSerializer, }; use crate::source_type::*; diff --git a/crates/oxc_span/src/span.rs b/crates/oxc_span/src/span.rs index bebd5ed35bee3..7734d08372405 100644 --- a/crates/oxc_span/src/span.rs +++ b/crates/oxc_span/src/span.rs @@ -85,6 +85,10 @@ pub struct Span { /// The zero-based end offset of the span. This may be equal to [`start`](Span::start) if /// the span is empty, but should not be less than it. pub end: u32, + + /// A [number, number] which indicates the start/end index of the node in the file contents. + pub range: Option<[u32; 2]>, + /// Align `Span` on 8 on 64-bit platforms #[estree(skip)] _align: PointerAlign, diff --git a/crates/oxc_syntax/src/generated/derive_estree.rs b/crates/oxc_syntax/src/generated/derive_estree.rs index 0d0b7072f8d25..7e943af086ac6 100644 --- a/crates/oxc_syntax/src/generated/derive_estree.rs +++ b/crates/oxc_syntax/src/generated/derive_estree.rs @@ -4,8 +4,7 @@ #![allow(unused_imports, clippy::match_same_arms, clippy::semicolon_if_nothing_returned)] use oxc_estree::{ - Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Range, Serializer, - StructSerializer, + Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Serializer, StructSerializer, }; use crate::module_record::*; @@ -15,12 +14,11 @@ impl ESTree for NameSpan<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("value", &self.name); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -52,12 +50,11 @@ impl ESTree for ImportImportName<'_> { impl ESTree for ExportEntry<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("moduleRequest", &self.module_request); state.serialize_field("importName", &self.import_name); state.serialize_field("exportName", &self.export_name); @@ -105,12 +102,11 @@ impl ESTree for ExportLocalName<'_> { impl ESTree for DynamicImport { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("moduleRequest", &self.module_request); state.end(); } diff --git a/napi/parser/index.d.ts b/napi/parser/index.d.ts index a350735adcbf4..03640378c69dd 100644 --- a/napi/parser/index.d.ts +++ b/napi/parser/index.d.ts @@ -192,7 +192,6 @@ export interface ParserOptions { /** * Controls whether the `range` property is included on AST nodes. * The `range` property is a [number, number] which indicates the start/end index of the node in the file contents. - * This is similar to the `loc` property, except it is line/column relative. * * @default false */ diff --git a/napi/parser/src/generated/derive_estree.rs b/napi/parser/src/generated/derive_estree.rs index e1edd2b02e701..4a86d424e15ea 100644 --- a/napi/parser/src/generated/derive_estree.rs +++ b/napi/parser/src/generated/derive_estree.rs @@ -4,8 +4,7 @@ #![allow(unused_imports, clippy::match_same_arms, clippy::semicolon_if_nothing_returned)] use oxc_estree::{ - Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Range, Serializer, - StructSerializer, + Concat2, Concat3, ESTree, FlatStructSerializer, JsonSafeString, Serializer, StructSerializer, }; use crate::raw_transfer_types::*; @@ -47,12 +46,11 @@ impl ESTree for ErrorLabel<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); state.serialize_field("message", &self.message); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -72,12 +70,11 @@ impl ESTree for EcmaScriptModule<'_> { impl ESTree for StaticImport<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("moduleRequest", &self.module_request); state.serialize_field("entries", &self.entries); state.end(); @@ -87,12 +84,11 @@ impl ESTree for StaticImport<'_> { impl ESTree for StaticExport<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); - if state.range() { - let range = oxc_estree::Range::new(self.span.start, self.span.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if state.range() { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.serialize_field("entries", &self.entries); state.end(); } diff --git a/napi/parser/src/types.rs b/napi/parser/src/types.rs index 65fad57fc642a..72385f29ac3a3 100644 --- a/napi/parser/src/types.rs +++ b/napi/parser/src/types.rs @@ -25,7 +25,6 @@ pub struct ParserOptions { /// Controls whether the `range` property is included on AST nodes. /// The `range` property is a [number, number] which indicates the start/end index of the node in the file contents. - /// This is similar to the `loc` property, except it is line/column relative. /// /// @default false #[napi(ts_type = "boolean")] diff --git a/napi/parser/test/parse.test.ts b/napi/parser/test/parse.test.ts index 92e5e0017b6c2..67f9f2ce7245a 100644 --- a/napi/parser/test/parse.test.ts +++ b/napi/parser/test/parse.test.ts @@ -682,6 +682,26 @@ describe('parse', () => { expect((ret.program.body[0] as TSTypeAliasDeclaration).typeAnnotation.type).toBe('TSTypeReference'); }); }); + + describe('ranges', () => { + it('should include range when true', () => { + const ret = parseSync('test.js', '(x)', { range: true }); + expect(ret.program.body[0].start).toBe(0); + expect(ret.program.body[0].range).toEqual([0, 2]); + }); + + it('should not include range when false', () => { + const ret = parseSync('test.js', '(x)', { range: false }); + expect(ret.program.body[0].start).toBe(0); + expect(ret.program.body[0].range).toBeUndefined(); + }); + + it('should include range by default', () => { + const ret = parseSync('test.js', '(x)', { range: true }); + expect(ret.program.body[0].start).toBe(0); + expect(ret.program.body[0].range).toEqual([0, 2]); + }); + }); }); describe('UTF-16 span', () => { diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index ff049f007e4a4..5c5cdce01e4ea 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -73,9 +73,9 @@ impl Derive for DeriveESTree { ///@@line_break use oxc_estree::{ - Concat2, Concat3, ESTree, FlatStructSerializer, - JsonSafeString, Range, Serializer, StructSerializer, - }; + Concat2, Concat3, ESTree, FlatStructSerializer, + JsonSafeString, Serializer, StructSerializer, +}; } } @@ -441,12 +441,11 @@ impl<'s> StructSerializerGenerator<'s> { if let TypeDef::Struct(inner_struct_def) = field.type_def(self.schema) { if inner_struct_def.name() == "Span" && field.name() == "span" { self.stmts.extend(quote! { - if state.range() { - let range = oxc_estree::Range::new(#self_path.#field_name_ident.start, #self_path.#field_name_ident.end); - state.serialize_field("range", &range); - } state.serialize_field("start", &#self_path.#field_name_ident.start); state.serialize_field("end", &#self_path.#field_name_ident.end); + if state.range() { + state.serialize_field("range", &[#self_path.#field_name_ident.start, #self_path.#field_name_ident.end]); + } }); return; } From 274a33551ae9e3708660e4db1c8049d15560b402 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Wed, 18 Jun 2025 01:25:40 +0200 Subject: [PATCH 08/42] chore: range as array --- crates/oxc_span/src/span.rs | 6 ++--- napi/parser/src/convert.rs | 2 +- napi/parser/src/types.rs | 2 +- npm/oxc-types/types.d.ts | 1 + tasks/ast_tools/src/derives/estree.rs | 22 ++++++++++++++++++- .../src/generators/assert_layouts.rs | 4 ++++ .../ast_tools/src/generators/raw_transfer.rs | 1 + .../src/generators/raw_transfer_lazy.rs | 1 + tasks/ast_tools/src/generators/typescript.rs | 1 + tasks/ast_tools/src/parse/parse.rs | 10 ++++++++- 10 files changed, 43 insertions(+), 7 deletions(-) diff --git a/crates/oxc_span/src/span.rs b/crates/oxc_span/src/span.rs index 7734d08372405..4a7556df3a305 100644 --- a/crates/oxc_span/src/span.rs +++ b/crates/oxc_span/src/span.rs @@ -87,7 +87,7 @@ pub struct Span { pub end: u32, /// A [number, number] which indicates the start/end index of the node in the file contents. - pub range: Option<[u32; 2]>, + pub range: Option<[i32;2]>, /// Align `Span` on 8 on 64-bit platforms #[estree(skip)] @@ -104,7 +104,7 @@ impl Span { /// #[inline] pub const fn new(start: u32, end: u32) -> Self { - Self { start, end, _align: PointerAlign::new() } + Self { start, end, range: None, _align: PointerAlign::new() } } /// Create a new empty [`Span`] that starts and ends at an offset position. @@ -731,7 +731,7 @@ mod size_asserts { use super::Span; - const _: () = assert!(size_of::() == 8); + const _: () = assert!(size_of::() == 24); #[cfg(target_pointer_width = "64")] const _: () = assert!(align_of::() == 8); diff --git a/napi/parser/src/convert.rs b/napi/parser/src/convert.rs index e6d21d8c7c177..4903d9a028488 100644 --- a/napi/parser/src/convert.rs +++ b/napi/parser/src/convert.rs @@ -82,7 +82,7 @@ impl From<&oxc::span::Span> for Span { Self { start: span.start, end: span.end, - range: None, // Will be populated later based on parser options + range: span.range.map(|arr| vec![arr[0], arr[1]]), } } } diff --git a/napi/parser/src/types.rs b/napi/parser/src/types.rs index 72385f29ac3a3..8f7abc5cc4aba 100644 --- a/napi/parser/src/types.rs +++ b/napi/parser/src/types.rs @@ -105,7 +105,7 @@ pub struct Span { /// Both numbers are a 0-based index which is the position in the array of source code characters. /// The first is the start position of the node, the second is the end position of the node. #[napi(ts_type = "[number, number]")] - pub range: Option>, + pub range: Option>, } #[napi(object)] diff --git a/npm/oxc-types/types.d.ts b/npm/oxc-types/types.d.ts index a8cf8a3da531b..ab37436b5a084 100644 --- a/npm/oxc-types/types.d.ts +++ b/npm/oxc-types/types.d.ts @@ -1515,6 +1515,7 @@ export type UpdateOperator = '++' | '--'; export interface Span { start: number; end: number; + range: [number, number] | null; } export type ModuleKind = 'script' | 'module'; diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index 5c5cdce01e4ea..f67b185589a10 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -444,7 +444,9 @@ impl<'s> StructSerializerGenerator<'s> { state.serialize_field("start", &#self_path.#field_name_ident.start); state.serialize_field("end", &#self_path.#field_name_ident.end); if state.range() { - state.serialize_field("range", &[#self_path.#field_name_ident.start, #self_path.#field_name_ident.end]); + if let Some(range) = &#self_path.#field_name_ident.range { + state.serialize_field("range", range); + } } }); return; @@ -482,6 +484,24 @@ impl<'s> StructSerializerGenerator<'s> { self.add_type_field = false; } + // Special case for range field - only serialize when range() is enabled + if field_camel_name == "range" { + if let TypeDef::Option(option_def) = field.type_def(self.schema) { + if let TypeDef::Primitive(primitive_def) = option_def.inner_type(self.schema) { + if primitive_def.name() == "ArrayType" { + self.stmts.extend(quote! { + if state.range() { + if let Some(range) = &#self_path.#field_name_ident { + state.serialize_field(#field_camel_name, range); + } + } + }); + return; + } + } + } + } + let value = if let Some(converter_name) = &field.estree.via { let converter_path = get_converter_path(converter_name, self.krate, self.schema); quote!( #converter_path(#self_path) ) diff --git a/tasks/ast_tools/src/generators/assert_layouts.rs b/tasks/ast_tools/src/generators/assert_layouts.rs index dbc227bc18933..a99da2dd0ec7a 100644 --- a/tasks/ast_tools/src/generators/assert_layouts.rs +++ b/tasks/ast_tools/src/generators/assert_layouts.rs @@ -476,6 +476,10 @@ fn calculate_layout_for_primitive(primitive_def: &PrimitiveDef) -> Layout { layout_64: PlatformLayout::from_size_align(0, 8), layout_32: PlatformLayout::from_size_align(0, 4), }, + "ArrayType" => Layout { + layout_64: PlatformLayout::from_size_align(12, 4), // Option<[i32; 2]> is Option<12 bytes aligned at 4> + layout_32: PlatformLayout::from_size_align(12, 4), + }, name => panic!("Unknown primitive type: {name}"), } } diff --git a/tasks/ast_tools/src/generators/raw_transfer.rs b/tasks/ast_tools/src/generators/raw_transfer.rs index c2c31b42b6122..cdb07094545d6 100644 --- a/tasks/ast_tools/src/generators/raw_transfer.rs +++ b/tasks/ast_tools/src/generators/raw_transfer.rs @@ -477,6 +477,7 @@ fn generate_primitive(primitive_def: &PrimitiveDef, code: &mut String, schema: & "Atom" => return, // Dummy type "PointerAlign" => return, + "ArrayType" => return, "bool" => "return uint8[pos] === 1;", "u8" => "return uint8[pos];", // "u16" => "return uint16[pos >> 1];", diff --git a/tasks/ast_tools/src/generators/raw_transfer_lazy.rs b/tasks/ast_tools/src/generators/raw_transfer_lazy.rs index d2d1f1a4774b8..d6717bad78409 100644 --- a/tasks/ast_tools/src/generators/raw_transfer_lazy.rs +++ b/tasks/ast_tools/src/generators/raw_transfer_lazy.rs @@ -594,6 +594,7 @@ fn generate_primitive(primitive_def: &PrimitiveDef, code: &mut String, schema: & "Atom" => return, // Dummy type "PointerAlign" => return, + "ArrayType" => return, "bool" => "return ast.buffer[pos] === 1;", "u8" => "return ast.buffer[pos];", // "u16" => "return uint16[pos >> 1];", diff --git a/tasks/ast_tools/src/generators/typescript.rs b/tasks/ast_tools/src/generators/typescript.rs index 9592ae7d9307f..2bb778b64d5ec 100644 --- a/tasks/ast_tools/src/generators/typescript.rs +++ b/tasks/ast_tools/src/generators/typescript.rs @@ -377,6 +377,7 @@ fn ts_type_name<'s>(type_def: &'s TypeDef, schema: &'s Schema) -> Cow<'s, str> { | "f32" | "f64" => "number", "bool" => "boolean", "&str" | "Atom" => "string", + "ArrayType" => "[number, number]", name => name, }), TypeDef::Option(option_def) => { diff --git a/tasks/ast_tools/src/parse/parse.rs b/tasks/ast_tools/src/parse/parse.rs index 7a7f0662e8a4b..8dbb8d99cb469 100644 --- a/tasks/ast_tools/src/parse/parse.rs +++ b/tasks/ast_tools/src/parse/parse.rs @@ -5,7 +5,7 @@ use quote::ToTokens; use rustc_hash::FxHashMap; use syn::{ AttrStyle, Attribute, Expr, ExprLit, Field, Fields, GenericArgument, Generics, Ident, ItemEnum, - ItemStruct, Lit, Meta, MetaList, PathArguments, PathSegment, Type, TypePath, TypeReference, + ItemStruct, Lit, Meta, MetaList, PathArguments, PathSegment, Type, TypeArray, TypePath, TypeReference, Variant, Visibility as SynVisibility, punctuated::Punctuated, token::Comma, }; @@ -226,6 +226,7 @@ impl<'c> Parser<'c> { // TODO: Remove the need for this by adding // `#[cfg_attr(target_pointer_width = "64", repr(align(8)))]` to all AST types "PointerAlign" => primitive("PointerAlign"), + "ArrayType" => primitive("ArrayType"), _ => panic!("Unknown type: {name}"), }; self.create_new_type(type_def) @@ -501,6 +502,7 @@ impl<'c> Parser<'c> { match ty { Type::Path(type_path) => self.parse_type_path(type_path), Type::Reference(type_ref) => self.parse_type_reference(type_ref), + Type::Array(type_array) => self.parse_type_array(type_array), _ => None, } } @@ -583,6 +585,12 @@ impl<'c> Parser<'c> { Some(self.type_id("&str")) } + fn parse_type_array(&mut self, _type_array: &TypeArray) -> Option { + // For array types like [i32; 2], we'll create a special primitive type + // The exact name doesn't matter since the field will be skipped in ESTree + Some(self.type_id("ArrayType")) + } + /// Parse attributes on struct or enum with parsers provided by [`Derive`]s and [`Generator`]s. /// /// [`Derive`]: crate::Derive From d1ecb1cccc1ad37c8924ccde0ee3376a4992caad Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Wed, 18 Jun 2025 01:26:04 +0200 Subject: [PATCH 09/42] chore: format --- crates/oxc_ast/src/serialize/mod.rs | 4 ++-- crates/oxc_estree/src/serialize/config.rs | 10 +++++----- crates/oxc_estree/src/serialize/mod.rs | 7 +------ crates/oxc_estree/src/serialize/primitives.rs | 2 -- crates/oxc_span/src/span.rs | 2 +- napi/parser/src/convert.rs | 6 +----- napi/parser/src/lib.rs | 16 ++++++---------- tasks/ast_tools/src/derives/estree.rs | 14 +++++++------- tasks/ast_tools/src/generators/assert_layouts.rs | 2 +- tasks/ast_tools/src/parse/parse.rs | 4 ++-- 10 files changed, 26 insertions(+), 41 deletions(-) diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index 704fc36b49cda..43742bc95ea01 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -3,8 +3,8 @@ use std::cmp; use oxc_ast_macros::ast_meta; use oxc_estree::{ CompactFixesJSSerializer, CompactFixesTSSerializer, CompactJSSerializer, CompactTSSerializer, - Concat2, ConfigFixesJS, ConfigFixesTS, ESTree, JsonSafeString, PrettyFixesJSSerializer, PrettyFixesTSSerializer, - PrettyJSSerializer, PrettyTSSerializer, Serializer, StructSerializer, + Concat2, ConfigFixesJS, ConfigFixesTS, ESTree, JsonSafeString, PrettyFixesJSSerializer, + PrettyFixesTSSerializer, PrettyJSSerializer, PrettyTSSerializer, Serializer, StructSerializer, }; use oxc_span::GetSpan; diff --git a/crates/oxc_estree/src/serialize/config.rs b/crates/oxc_estree/src/serialize/config.rs index aa5bec9e48ce3..60bc44dd9e2fc 100644 --- a/crates/oxc_estree/src/serialize/config.rs +++ b/crates/oxc_estree/src/serialize/config.rs @@ -6,7 +6,7 @@ pub trait Config { const FIXES: bool; fn new() -> Self; - + /// Whether to include range information in the serialized output fn ranges(&self) -> bool; } @@ -32,7 +32,7 @@ impl Config for ConfigTS { fn new() -> Self { Self { ranges: false } } - + #[inline] fn ranges(&self) -> bool { self.ranges @@ -60,7 +60,7 @@ impl Config for ConfigJS { fn new() -> Self { Self { ranges: false } } - + #[inline] fn ranges(&self) -> bool { self.ranges @@ -88,7 +88,7 @@ impl Config for ConfigFixesTS { fn new() -> Self { Self { ranges: false } } - + #[inline] fn ranges(&self) -> bool { self.ranges @@ -116,7 +116,7 @@ impl Config for ConfigFixesJS { fn new() -> Self { Self { ranges: false } } - + #[inline] fn ranges(&self) -> bool { self.ranges diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index 41477cd20e93a..1a689f187c282 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -4,10 +4,7 @@ use std::mem; use itoa::Buffer as ItoaBuffer; -use oxc_data_structures::{ - code_buffer::CodeBuffer, - stack::NonEmptyStack, -}; +use oxc_data_structures::{code_buffer::CodeBuffer, stack::NonEmptyStack}; mod blanket; mod concat; @@ -287,5 +284,3 @@ pub enum TracePathPart { impl TracePathPart { pub const DUMMY: Self = TracePathPart::Index(0); } - - diff --git a/crates/oxc_estree/src/serialize/primitives.rs b/crates/oxc_estree/src/serialize/primitives.rs index c8d1323425b60..9b2ecec1cfca6 100644 --- a/crates/oxc_estree/src/serialize/primitives.rs +++ b/crates/oxc_estree/src/serialize/primitives.rs @@ -71,8 +71,6 @@ impl ESTree for () { } } - - #[cfg(test)] mod tests { use super::super::CompactTSSerializer; diff --git a/crates/oxc_span/src/span.rs b/crates/oxc_span/src/span.rs index 4a7556df3a305..17a58686641dc 100644 --- a/crates/oxc_span/src/span.rs +++ b/crates/oxc_span/src/span.rs @@ -87,7 +87,7 @@ pub struct Span { pub end: u32, /// A [number, number] which indicates the start/end index of the node in the file contents. - pub range: Option<[i32;2]>, + pub range: Option<[i32; 2]>, /// Align `Span` on 8 on 64-bit platforms #[estree(skip)] diff --git a/napi/parser/src/convert.rs b/napi/parser/src/convert.rs index 4903d9a028488..d9d9f025cf6e5 100644 --- a/napi/parser/src/convert.rs +++ b/napi/parser/src/convert.rs @@ -79,11 +79,7 @@ impl From<&ModuleRecord<'_>> for EcmaScriptModule { impl From<&oxc::span::Span> for Span { fn from(span: &oxc::span::Span) -> Self { - Self { - start: span.start, - end: span.end, - range: span.range.map(|arr| vec![arr[0], arr[1]]), - } + Self { start: span.start, end: span.end, range: span.range.map(|arr| vec![arr[0], arr[1]]) } } } diff --git a/napi/parser/src/lib.rs b/napi/parser/src/lib.rs index 9ae6fbdc5986a..ef632e1c9e085 100644 --- a/napi/parser/src/lib.rs +++ b/napi/parser/src/lib.rs @@ -108,20 +108,16 @@ fn parse_with_return(filename: &str, source_text: String, options: &ParserOption ); } - program.to_estree_js_json_with_fixes_and_options( - Some(&SerializationOptions { - range: options.range.unwrap_or(false), - }) - ) + program.to_estree_js_json_with_fixes_and_options(Some(&SerializationOptions { + range: options.range.unwrap_or(false), + })) } AstType::TypeScript => { // Note: `@typescript-eslint/parser` ignores hashbangs, // See: https://github.com/typescript-eslint/typescript-eslint/issues/6500 - program.to_estree_ts_json_with_fixes_and_options( - Some(&SerializationOptions { - range: options.range.unwrap_or(false), - }) - ) + program.to_estree_ts_json_with_fixes_and_options(Some(&SerializationOptions { + range: options.range.unwrap_or(false), + })) } }; diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index f67b185589a10..9a97de186cf0e 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -69,14 +69,14 @@ impl Derive for DeriveESTree { fn prelude(&self) -> TokenStream { quote! { - #![allow(unused_imports, clippy::match_same_arms, clippy::semicolon_if_nothing_returned)] + #![allow(unused_imports, clippy::match_same_arms, clippy::semicolon_if_nothing_returned)] - ///@@line_break - use oxc_estree::{ - Concat2, Concat3, ESTree, FlatStructSerializer, - JsonSafeString, Serializer, StructSerializer, -}; - } + ///@@line_break + use oxc_estree::{ + Concat2, Concat3, ESTree, FlatStructSerializer, + JsonSafeString, Serializer, StructSerializer, + }; + } } /// Generate implementation of `ESTree` for a struct or enum. diff --git a/tasks/ast_tools/src/generators/assert_layouts.rs b/tasks/ast_tools/src/generators/assert_layouts.rs index a99da2dd0ec7a..9a16e7c130feb 100644 --- a/tasks/ast_tools/src/generators/assert_layouts.rs +++ b/tasks/ast_tools/src/generators/assert_layouts.rs @@ -477,7 +477,7 @@ fn calculate_layout_for_primitive(primitive_def: &PrimitiveDef) -> Layout { layout_32: PlatformLayout::from_size_align(0, 4), }, "ArrayType" => Layout { - layout_64: PlatformLayout::from_size_align(12, 4), // Option<[i32; 2]> is Option<12 bytes aligned at 4> + layout_64: PlatformLayout::from_size_align(12, 4), // Option<[i32; 2]> is Option<12 bytes aligned at 4> layout_32: PlatformLayout::from_size_align(12, 4), }, name => panic!("Unknown primitive type: {name}"), diff --git a/tasks/ast_tools/src/parse/parse.rs b/tasks/ast_tools/src/parse/parse.rs index 8dbb8d99cb469..d37184dcaaea6 100644 --- a/tasks/ast_tools/src/parse/parse.rs +++ b/tasks/ast_tools/src/parse/parse.rs @@ -5,8 +5,8 @@ use quote::ToTokens; use rustc_hash::FxHashMap; use syn::{ AttrStyle, Attribute, Expr, ExprLit, Field, Fields, GenericArgument, Generics, Ident, ItemEnum, - ItemStruct, Lit, Meta, MetaList, PathArguments, PathSegment, Type, TypeArray, TypePath, TypeReference, - Variant, Visibility as SynVisibility, punctuated::Punctuated, token::Comma, + ItemStruct, Lit, Meta, MetaList, PathArguments, PathSegment, Type, TypeArray, TypePath, + TypeReference, Variant, Visibility as SynVisibility, punctuated::Punctuated, token::Comma, }; use crate::{ From 2a63d188d2cefb805ea0597f45853c724dfce53b Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Wed, 18 Jun 2025 01:31:51 +0200 Subject: [PATCH 10/42] chore: start cleanup --- crates/oxc_ast/src/lib.rs | 2 +- crates/oxc_estree/Cargo.toml | 2 +- crates/oxc_estree/src/lib.rs | 1 - crates/oxc_estree/src/serialize/concat.rs | 2 +- crates/oxc_estree/src/serialize/mod.rs | 15 +-------------- 5 files changed, 4 insertions(+), 18 deletions(-) diff --git a/crates/oxc_ast/src/lib.rs b/crates/oxc_ast/src/lib.rs index a035617029520..31d9e4fcf7473 100644 --- a/crates/oxc_ast/src/lib.rs +++ b/crates/oxc_ast/src/lib.rs @@ -44,7 +44,7 @@ #![warn(missing_docs)] #[cfg(feature = "serialize")] -pub mod serialize; +mod serialize; pub mod ast; mod ast_builder_impl; diff --git a/crates/oxc_estree/Cargo.toml b/crates/oxc_estree/Cargo.toml index cd4d953859faf..286825182f4b0 100644 --- a/crates/oxc_estree/Cargo.toml +++ b/crates/oxc_estree/Cargo.toml @@ -19,7 +19,7 @@ workspace = true doctest = false [dependencies] -oxc_data_structures = { workspace = true, features = ["code_buffer", "pointer_ext", "rope", "stack"], optional = true } +oxc_data_structures = { workspace = true, features = ["code_buffer", "pointer_ext", "stack"], optional = true } itoa = { workspace = true, optional = true } ryu-js = { workspace = true, optional = true } diff --git a/crates/oxc_estree/src/lib.rs b/crates/oxc_estree/src/lib.rs index 7048452fda792..ed6a304bc087a 100644 --- a/crates/oxc_estree/src/lib.rs +++ b/crates/oxc_estree/src/lib.rs @@ -1,6 +1,5 @@ #[cfg(feature = "serialize")] mod serialize; - #[cfg(feature = "serialize")] pub use serialize::*; diff --git a/crates/oxc_estree/src/serialize/concat.rs b/crates/oxc_estree/src/serialize/concat.rs index 5b8d1c758c35b..ec099b15103b6 100644 --- a/crates/oxc_estree/src/serialize/concat.rs +++ b/crates/oxc_estree/src/serialize/concat.rs @@ -1,4 +1,4 @@ -use super::{ESTree, SequenceSerializer, Serializer}; +use crate::{ESTree, SequenceSerializer, Serializer}; /// Trait for types which can be concatenated. /// diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index 1a689f187c282..ba538f5bebb6d 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -102,7 +102,7 @@ pub struct ESTreeSerializer { formatter: F, trace_path: NonEmptyStack, fixes_buffer: CodeBuffer, - source_text: Option<&'static str>, + #[expect(unused)] config: C, } @@ -114,7 +114,6 @@ impl ESTreeSerializer { formatter: F::new(), trace_path: NonEmptyStack::new(TracePathPart::Index(0)), fixes_buffer: CodeBuffer::new(), - source_text: None, config: C::new(), } } @@ -126,7 +125,6 @@ impl ESTreeSerializer { formatter: F::new(), trace_path: NonEmptyStack::new(TracePathPart::Index(0)), fixes_buffer: CodeBuffer::new(), - source_text: None, config: C::new(), } } @@ -138,21 +136,10 @@ impl ESTreeSerializer { formatter: F::new(), trace_path: NonEmptyStack::new(TracePathPart::Index(0)), fixes_buffer: CodeBuffer::new(), - source_text: None, config, } } - pub fn with_source_text(mut self, source_text: &'static str) -> Self { - self.source_text = Some(source_text); - self - } - - /// Calculate line and column position from byte offset - pub fn get_line_column(&self, _offset: u32) -> Option<(u32, u32)> { - None - } - /// Serialize `node` and output a `JSON` string containing /// `{ "node": { ... }, "fixes": [ ... ]}`, where `node` is the serialized AST node, /// and `fixes` is a list of paths to any `Literal`s which are `BigInt`s or `RegExp`s. From f3a8837f22e02f5e886f00fbe99d392fb096eec9 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Wed, 18 Jun 2025 07:52:30 +0200 Subject: [PATCH 11/42] chore: cleanup --- crates/oxc_ast/src/lib.rs | 2 +- crates/oxc_ast/src/serialize/mod.rs | 6 +----- crates/oxc_estree/src/serialize/mod.rs | 1 - napi/parser/test/parse.test.ts | 4 ++-- tasks/ast_tools/src/derives/estree.rs | 24 +++--------------------- 5 files changed, 7 insertions(+), 30 deletions(-) diff --git a/crates/oxc_ast/src/lib.rs b/crates/oxc_ast/src/lib.rs index 31d9e4fcf7473..a035617029520 100644 --- a/crates/oxc_ast/src/lib.rs +++ b/crates/oxc_ast/src/lib.rs @@ -44,7 +44,7 @@ #![warn(missing_docs)] #[cfg(feature = "serialize")] -mod serialize; +pub mod serialize; pub mod ast; mod ast_builder_impl; diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index 43742bc95ea01..10b3e1e0ce187 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -3,16 +3,12 @@ use std::cmp; use oxc_ast_macros::ast_meta; use oxc_estree::{ CompactFixesJSSerializer, CompactFixesTSSerializer, CompactJSSerializer, CompactTSSerializer, - Concat2, ConfigFixesJS, ConfigFixesTS, ESTree, JsonSafeString, PrettyFixesJSSerializer, + Concat2, ConfigFixesJS, ConfigFixesTS, ConfigJS, ConfigTS, ESTree, JsonSafeString, PrettyFixesJSSerializer, PrettyFixesTSSerializer, PrettyJSSerializer, PrettyTSSerializer, Serializer, StructSerializer, }; use oxc_span::GetSpan; use crate::ast::*; -use crate::{ - ast::{Declaration, Program}, - ast::{ExportDefaultDeclarationKind, Statement}, -}; /// Options for ESTree serialization #[derive(Clone, Copy)] diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index ba538f5bebb6d..c993b338a552a 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -102,7 +102,6 @@ pub struct ESTreeSerializer { formatter: F, trace_path: NonEmptyStack, fixes_buffer: CodeBuffer, - #[expect(unused)] config: C, } diff --git a/napi/parser/test/parse.test.ts b/napi/parser/test/parse.test.ts index 67f9f2ce7245a..1b07a90842b22 100644 --- a/napi/parser/test/parse.test.ts +++ b/napi/parser/test/parse.test.ts @@ -687,7 +687,7 @@ describe('parse', () => { it('should include range when true', () => { const ret = parseSync('test.js', '(x)', { range: true }); expect(ret.program.body[0].start).toBe(0); - expect(ret.program.body[0].range).toEqual([0, 2]); + expect(ret.program.body[0].range).toEqual([0, 3]); }); it('should not include range when false', () => { @@ -699,7 +699,7 @@ describe('parse', () => { it('should include range by default', () => { const ret = parseSync('test.js', '(x)', { range: true }); expect(ret.program.body[0].start).toBe(0); - expect(ret.program.body[0].range).toEqual([0, 2]); + expect(ret.program.body[0].range).toEqual([0, 3]); }); }); }); diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index 9a97de186cf0e..9645b353e0f3a 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -437,16 +437,14 @@ impl<'s> StructSerializerGenerator<'s> { let field_name_ident = field.ident(); - // Special case for `Span` fields - add conditional range and loc serialization + // Special case for `Span` fields - add conditional range serialization if let TypeDef::Struct(inner_struct_def) = field.type_def(self.schema) { if inner_struct_def.name() == "Span" && field.name() == "span" { self.stmts.extend(quote! { state.serialize_field("start", &#self_path.#field_name_ident.start); state.serialize_field("end", &#self_path.#field_name_ident.end); if state.range() { - if let Some(range) = &#self_path.#field_name_ident.range { - state.serialize_field("range", range); - } + state.serialize_field("range", &[#self_path.#field_name_ident.start, #self_path.#field_name_ident.end]); } }); return; @@ -484,23 +482,7 @@ impl<'s> StructSerializerGenerator<'s> { self.add_type_field = false; } - // Special case for range field - only serialize when range() is enabled - if field_camel_name == "range" { - if let TypeDef::Option(option_def) = field.type_def(self.schema) { - if let TypeDef::Primitive(primitive_def) = option_def.inner_type(self.schema) { - if primitive_def.name() == "ArrayType" { - self.stmts.extend(quote! { - if state.range() { - if let Some(range) = &#self_path.#field_name_ident { - state.serialize_field(#field_camel_name, range); - } - } - }); - return; - } - } - } - } + let value = if let Some(converter_name) = &field.estree.via { let converter_path = get_converter_path(converter_name, self.krate, self.schema); From 1ecdbdf0c4241f0b57c4bc7e038274e03d3856f1 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Wed, 18 Jun 2025 07:52:41 +0200 Subject: [PATCH 12/42] chore: format --- crates/oxc_ast/src/serialize/mod.rs | 5 +++-- tasks/ast_tools/src/derives/estree.rs | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index 10b3e1e0ce187..76316564b69cb 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -3,8 +3,9 @@ use std::cmp; use oxc_ast_macros::ast_meta; use oxc_estree::{ CompactFixesJSSerializer, CompactFixesTSSerializer, CompactJSSerializer, CompactTSSerializer, - Concat2, ConfigFixesJS, ConfigFixesTS, ConfigJS, ConfigTS, ESTree, JsonSafeString, PrettyFixesJSSerializer, - PrettyFixesTSSerializer, PrettyJSSerializer, PrettyTSSerializer, Serializer, StructSerializer, + Concat2, ConfigFixesJS, ConfigFixesTS, ConfigJS, ConfigTS, ESTree, JsonSafeString, + PrettyFixesJSSerializer, PrettyFixesTSSerializer, PrettyJSSerializer, PrettyTSSerializer, + Serializer, StructSerializer, }; use oxc_span::GetSpan; diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index 9645b353e0f3a..f8668b8947545 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -482,8 +482,6 @@ impl<'s> StructSerializerGenerator<'s> { self.add_type_field = false; } - - let value = if let Some(converter_name) = &field.estree.via { let converter_path = get_converter_path(converter_name, self.krate, self.schema); quote!( #converter_path(#self_path) ) From 862db6c7619a01bff8cbfb37e29c126dabcc76da Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Wed, 18 Jun 2025 07:54:41 +0200 Subject: [PATCH 13/42] feat: program range --- crates/oxc_ast/src/serialize/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index 76316564b69cb..fe72c8211ec78 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -200,6 +200,9 @@ impl ESTree for ProgramConverter<'_, '_> { state.serialize_field("type", &JsonSafeString("Program")); state.serialize_field("start", &span_start); state.serialize_field("end", &program.span.end); + if state.range() { + state.serialize_field("range", &[span_start, program.span.end]); + } state.serialize_field("body", &Concat2(&program.directives, &program.body)); state.serialize_field("sourceType", &program.source_type.module_kind()); state.serialize_field("hashbang", &program.hashbang); From 7ebb757ab877f1afa62932962f85fa598f56e928 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Wed, 18 Jun 2025 07:56:19 +0200 Subject: [PATCH 14/42] chore: regerenrate --- .../oxc_ast/src/generated/assert_layouts.rs | 2548 ++++++++--------- crates/oxc_ast/src/generated/derive_dummy.rs | 262 +- crates/oxc_ast/src/serialize/mod.rs | 2 +- .../src/generated/assert_layouts.rs | 220 +- .../oxc_span/src/generated/assert_layouts.rs | 6 +- .../oxc_span/src/generated/derive_estree.rs | 1 + .../src/generated/assert_layouts.rs | 80 +- napi/parser/generated/deserialize/js.js | 1020 ++++--- napi/parser/generated/deserialize/lazy.js | 2019 ++++++++++--- napi/parser/generated/deserialize/ts.js | 1112 ++++--- napi/parser/src/generated/assert_layouts.rs | 44 +- 11 files changed, 4421 insertions(+), 2893 deletions(-) diff --git a/crates/oxc_ast/src/generated/assert_layouts.rs b/crates/oxc_ast/src/generated/assert_layouts.rs index 2852f7cf02668..4f229a5281e36 100644 --- a/crates/oxc_ast/src/generated/assert_layouts.rs +++ b/crates/oxc_ast/src/generated/assert_layouts.rs @@ -10,84 +10,84 @@ use crate::ast::*; #[cfg(target_pointer_width = "64")] const _: () = { // Padding: 1 bytes - assert!(size_of::() == 128); + assert!(size_of::() == 160); assert!(align_of::() == 8); assert!(offset_of!(Program, span) == 0); - assert!(offset_of!(Program, source_type) == 124); - assert!(offset_of!(Program, source_text) == 8); - assert!(offset_of!(Program, comments) == 24); - assert!(offset_of!(Program, hashbang) == 48); - assert!(offset_of!(Program, directives) == 72); - assert!(offset_of!(Program, body) == 96); - assert!(offset_of!(Program, scope_id) == 120); + assert!(offset_of!(Program, source_type) == 156); + assert!(offset_of!(Program, source_text) == 24); + assert!(offset_of!(Program, comments) == 40); + assert!(offset_of!(Program, hashbang) == 64); + assert!(offset_of!(Program, directives) == 104); + assert!(offset_of!(Program, body) == 128); + assert!(offset_of!(Program, scope_id) == 152); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(IdentifierName, span) == 0); - assert!(offset_of!(IdentifierName, name) == 8); + assert!(offset_of!(IdentifierName, name) == 24); // Padding: 4 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(IdentifierReference, span) == 0); - assert!(offset_of!(IdentifierReference, name) == 8); - assert!(offset_of!(IdentifierReference, reference_id) == 24); + assert!(offset_of!(IdentifierReference, name) == 24); + assert!(offset_of!(IdentifierReference, reference_id) == 40); // Padding: 4 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(BindingIdentifier, span) == 0); - assert!(offset_of!(BindingIdentifier, name) == 8); - assert!(offset_of!(BindingIdentifier, symbol_id) == 24); + assert!(offset_of!(BindingIdentifier, name) == 24); + assert!(offset_of!(BindingIdentifier, symbol_id) == 40); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(LabelIdentifier, span) == 0); - assert!(offset_of!(LabelIdentifier, name) == 8); + assert!(offset_of!(LabelIdentifier, name) == 24); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(ThisExpression, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(ArrayExpression, span) == 0); - assert!(offset_of!(ArrayExpression, elements) == 8); + assert!(offset_of!(ArrayExpression, elements) == 24); - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(Elision, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(ObjectExpression, span) == 0); - assert!(offset_of!(ObjectExpression, properties) == 8); + assert!(offset_of!(ObjectExpression, properties) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 4 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(ObjectProperty, span) == 0); - assert!(offset_of!(ObjectProperty, kind) == 40); - assert!(offset_of!(ObjectProperty, key) == 8); - assert!(offset_of!(ObjectProperty, value) == 24); - assert!(offset_of!(ObjectProperty, method) == 41); - assert!(offset_of!(ObjectProperty, shorthand) == 42); - assert!(offset_of!(ObjectProperty, computed) == 43); + assert!(offset_of!(ObjectProperty, kind) == 56); + assert!(offset_of!(ObjectProperty, key) == 24); + assert!(offset_of!(ObjectProperty, value) == 40); + assert!(offset_of!(ObjectProperty, method) == 57); + assert!(offset_of!(ObjectProperty, shorthand) == 58); + assert!(offset_of!(ObjectProperty, computed) == 59); assert!(size_of::() == 16); assert!(align_of::() == 8); @@ -96,27 +96,27 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(TemplateLiteral, span) == 0); - assert!(offset_of!(TemplateLiteral, quasis) == 8); - assert!(offset_of!(TemplateLiteral, expressions) == 32); + assert!(offset_of!(TemplateLiteral, quasis) == 24); + assert!(offset_of!(TemplateLiteral, expressions) == 48); // Padding: 0 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 120); assert!(align_of::() == 8); assert!(offset_of!(TaggedTemplateExpression, span) == 0); - assert!(offset_of!(TaggedTemplateExpression, tag) == 8); - assert!(offset_of!(TaggedTemplateExpression, type_arguments) == 24); - assert!(offset_of!(TaggedTemplateExpression, quasi) == 32); + assert!(offset_of!(TaggedTemplateExpression, tag) == 24); + assert!(offset_of!(TaggedTemplateExpression, type_arguments) == 40); + assert!(offset_of!(TaggedTemplateExpression, quasi) == 48); // Padding: 6 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(TemplateElement, span) == 0); - assert!(offset_of!(TemplateElement, value) == 8); - assert!(offset_of!(TemplateElement, tail) == 40); - assert!(offset_of!(TemplateElement, lone_surrogates) == 41); + assert!(offset_of!(TemplateElement, value) == 24); + assert!(offset_of!(TemplateElement, tail) == 56); + assert!(offset_of!(TemplateElement, lone_surrogates) == 57); // Padding: 0 bytes assert!(size_of::() == 32); @@ -128,117 +128,117 @@ const _: () = { assert!(align_of::() == 8); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(ComputedMemberExpression, span) == 0); - assert!(offset_of!(ComputedMemberExpression, object) == 8); - assert!(offset_of!(ComputedMemberExpression, expression) == 24); - assert!(offset_of!(ComputedMemberExpression, optional) == 40); + assert!(offset_of!(ComputedMemberExpression, object) == 24); + assert!(offset_of!(ComputedMemberExpression, expression) == 40); + assert!(offset_of!(ComputedMemberExpression, optional) == 56); // Padding: 7 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(StaticMemberExpression, span) == 0); - assert!(offset_of!(StaticMemberExpression, object) == 8); - assert!(offset_of!(StaticMemberExpression, property) == 24); - assert!(offset_of!(StaticMemberExpression, optional) == 48); + assert!(offset_of!(StaticMemberExpression, object) == 24); + assert!(offset_of!(StaticMemberExpression, property) == 40); + assert!(offset_of!(StaticMemberExpression, optional) == 80); // Padding: 7 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(PrivateFieldExpression, span) == 0); - assert!(offset_of!(PrivateFieldExpression, object) == 8); - assert!(offset_of!(PrivateFieldExpression, field) == 24); - assert!(offset_of!(PrivateFieldExpression, optional) == 48); + assert!(offset_of!(PrivateFieldExpression, object) == 24); + assert!(offset_of!(PrivateFieldExpression, field) == 40); + assert!(offset_of!(PrivateFieldExpression, optional) == 80); // Padding: 6 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(CallExpression, span) == 0); - assert!(offset_of!(CallExpression, callee) == 8); - assert!(offset_of!(CallExpression, type_arguments) == 24); - assert!(offset_of!(CallExpression, arguments) == 32); - assert!(offset_of!(CallExpression, optional) == 56); - assert!(offset_of!(CallExpression, pure) == 57); + assert!(offset_of!(CallExpression, callee) == 24); + assert!(offset_of!(CallExpression, type_arguments) == 40); + assert!(offset_of!(CallExpression, arguments) == 48); + assert!(offset_of!(CallExpression, optional) == 72); + assert!(offset_of!(CallExpression, pure) == 73); // Padding: 7 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(NewExpression, span) == 0); - assert!(offset_of!(NewExpression, callee) == 8); - assert!(offset_of!(NewExpression, type_arguments) == 24); - assert!(offset_of!(NewExpression, arguments) == 32); - assert!(offset_of!(NewExpression, pure) == 56); + assert!(offset_of!(NewExpression, callee) == 24); + assert!(offset_of!(NewExpression, type_arguments) == 40); + assert!(offset_of!(NewExpression, arguments) == 48); + assert!(offset_of!(NewExpression, pure) == 72); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 104); assert!(align_of::() == 8); assert!(offset_of!(MetaProperty, span) == 0); - assert!(offset_of!(MetaProperty, meta) == 8); - assert!(offset_of!(MetaProperty, property) == 32); + assert!(offset_of!(MetaProperty, meta) == 24); + assert!(offset_of!(MetaProperty, property) == 64); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(SpreadElement, span) == 0); - assert!(offset_of!(SpreadElement, argument) == 8); + assert!(offset_of!(SpreadElement, argument) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 6 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(UpdateExpression, span) == 0); - assert!(offset_of!(UpdateExpression, operator) == 24); - assert!(offset_of!(UpdateExpression, prefix) == 25); - assert!(offset_of!(UpdateExpression, argument) == 8); + assert!(offset_of!(UpdateExpression, operator) == 40); + assert!(offset_of!(UpdateExpression, prefix) == 41); + assert!(offset_of!(UpdateExpression, argument) == 24); // Padding: 7 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(UnaryExpression, span) == 0); - assert!(offset_of!(UnaryExpression, operator) == 24); - assert!(offset_of!(UnaryExpression, argument) == 8); + assert!(offset_of!(UnaryExpression, operator) == 40); + assert!(offset_of!(UnaryExpression, argument) == 24); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(BinaryExpression, span) == 0); - assert!(offset_of!(BinaryExpression, left) == 8); - assert!(offset_of!(BinaryExpression, operator) == 40); - assert!(offset_of!(BinaryExpression, right) == 24); + assert!(offset_of!(BinaryExpression, left) == 24); + assert!(offset_of!(BinaryExpression, operator) == 56); + assert!(offset_of!(BinaryExpression, right) == 40); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(PrivateInExpression, span) == 0); - assert!(offset_of!(PrivateInExpression, left) == 8); - assert!(offset_of!(PrivateInExpression, right) == 32); + assert!(offset_of!(PrivateInExpression, left) == 24); + assert!(offset_of!(PrivateInExpression, right) == 64); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(LogicalExpression, span) == 0); - assert!(offset_of!(LogicalExpression, left) == 8); - assert!(offset_of!(LogicalExpression, operator) == 40); - assert!(offset_of!(LogicalExpression, right) == 24); + assert!(offset_of!(LogicalExpression, left) == 24); + assert!(offset_of!(LogicalExpression, operator) == 56); + assert!(offset_of!(LogicalExpression, right) == 40); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(ConditionalExpression, span) == 0); - assert!(offset_of!(ConditionalExpression, test) == 8); - assert!(offset_of!(ConditionalExpression, consequent) == 24); - assert!(offset_of!(ConditionalExpression, alternate) == 40); + assert!(offset_of!(ConditionalExpression, test) == 24); + assert!(offset_of!(ConditionalExpression, consequent) == 40); + assert!(offset_of!(ConditionalExpression, alternate) == 56); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(AssignmentExpression, span) == 0); - assert!(offset_of!(AssignmentExpression, operator) == 40); - assert!(offset_of!(AssignmentExpression, left) == 8); - assert!(offset_of!(AssignmentExpression, right) == 24); + assert!(offset_of!(AssignmentExpression, operator) == 56); + assert!(offset_of!(AssignmentExpression, left) == 24); + assert!(offset_of!(AssignmentExpression, right) == 40); assert!(size_of::() == 16); assert!(align_of::() == 8); @@ -250,276 +250,276 @@ const _: () = { assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(ArrayAssignmentTarget, span) == 0); - assert!(offset_of!(ArrayAssignmentTarget, elements) == 8); - assert!(offset_of!(ArrayAssignmentTarget, rest) == 32); + assert!(offset_of!(ArrayAssignmentTarget, elements) == 24); + assert!(offset_of!(ArrayAssignmentTarget, rest) == 48); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(ObjectAssignmentTarget, span) == 0); - assert!(offset_of!(ObjectAssignmentTarget, properties) == 8); - assert!(offset_of!(ObjectAssignmentTarget, rest) == 32); + assert!(offset_of!(ObjectAssignmentTarget, properties) == 24); + assert!(offset_of!(ObjectAssignmentTarget, rest) == 48); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(AssignmentTargetRest, span) == 0); - assert!(offset_of!(AssignmentTargetRest, target) == 8); + assert!(offset_of!(AssignmentTargetRest, target) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(AssignmentTargetWithDefault, span) == 0); - assert!(offset_of!(AssignmentTargetWithDefault, binding) == 8); - assert!(offset_of!(AssignmentTargetWithDefault, init) == 24); + assert!(offset_of!(AssignmentTargetWithDefault, binding) == 24); + assert!(offset_of!(AssignmentTargetWithDefault, init) == 40); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(AssignmentTargetPropertyIdentifier, span) == 0); - assert!(offset_of!(AssignmentTargetPropertyIdentifier, binding) == 8); - assert!(offset_of!(AssignmentTargetPropertyIdentifier, init) == 40); + assert!(offset_of!(AssignmentTargetPropertyIdentifier, binding) == 24); + assert!(offset_of!(AssignmentTargetPropertyIdentifier, init) == 72); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(AssignmentTargetPropertyProperty, span) == 0); - assert!(offset_of!(AssignmentTargetPropertyProperty, name) == 8); - assert!(offset_of!(AssignmentTargetPropertyProperty, binding) == 24); - assert!(offset_of!(AssignmentTargetPropertyProperty, computed) == 40); + assert!(offset_of!(AssignmentTargetPropertyProperty, name) == 24); + assert!(offset_of!(AssignmentTargetPropertyProperty, binding) == 40); + assert!(offset_of!(AssignmentTargetPropertyProperty, computed) == 56); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(SequenceExpression, span) == 0); - assert!(offset_of!(SequenceExpression, expressions) == 8); + assert!(offset_of!(SequenceExpression, expressions) == 24); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(Super, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(AwaitExpression, span) == 0); - assert!(offset_of!(AwaitExpression, argument) == 8); + assert!(offset_of!(AwaitExpression, argument) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(ChainExpression, span) == 0); - assert!(offset_of!(ChainExpression, expression) == 8); + assert!(offset_of!(ChainExpression, expression) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(ParenthesizedExpression, span) == 0); - assert!(offset_of!(ParenthesizedExpression, expression) == 8); + assert!(offset_of!(ParenthesizedExpression, expression) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 104); assert!(align_of::() == 8); assert!(offset_of!(Directive, span) == 0); - assert!(offset_of!(Directive, expression) == 8); - assert!(offset_of!(Directive, directive) == 56); + assert!(offset_of!(Directive, expression) == 24); + assert!(offset_of!(Directive, directive) == 88); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(Hashbang, span) == 0); - assert!(offset_of!(Hashbang, value) == 8); + assert!(offset_of!(Hashbang, value) == 24); // Padding: 4 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(BlockStatement, span) == 0); - assert!(offset_of!(BlockStatement, body) == 8); - assert!(offset_of!(BlockStatement, scope_id) == 32); + assert!(offset_of!(BlockStatement, body) == 24); + assert!(offset_of!(BlockStatement, scope_id) == 48); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 6 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(VariableDeclaration, span) == 0); - assert!(offset_of!(VariableDeclaration, kind) == 32); - assert!(offset_of!(VariableDeclaration, declarations) == 8); - assert!(offset_of!(VariableDeclaration, declare) == 33); + assert!(offset_of!(VariableDeclaration, kind) == 48); + assert!(offset_of!(VariableDeclaration, declarations) == 24); + assert!(offset_of!(VariableDeclaration, declare) == 49); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 6 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(VariableDeclarator, span) == 0); - assert!(offset_of!(VariableDeclarator, kind) == 56); - assert!(offset_of!(VariableDeclarator, id) == 8); - assert!(offset_of!(VariableDeclarator, init) == 40); - assert!(offset_of!(VariableDeclarator, definite) == 57); + assert!(offset_of!(VariableDeclarator, kind) == 72); + assert!(offset_of!(VariableDeclarator, id) == 24); + assert!(offset_of!(VariableDeclarator, init) == 56); + assert!(offset_of!(VariableDeclarator, definite) == 73); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(EmptyStatement, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(ExpressionStatement, span) == 0); - assert!(offset_of!(ExpressionStatement, expression) == 8); + assert!(offset_of!(ExpressionStatement, expression) == 24); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(IfStatement, span) == 0); - assert!(offset_of!(IfStatement, test) == 8); - assert!(offset_of!(IfStatement, consequent) == 24); - assert!(offset_of!(IfStatement, alternate) == 40); + assert!(offset_of!(IfStatement, test) == 24); + assert!(offset_of!(IfStatement, consequent) == 40); + assert!(offset_of!(IfStatement, alternate) == 56); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(DoWhileStatement, span) == 0); - assert!(offset_of!(DoWhileStatement, body) == 8); - assert!(offset_of!(DoWhileStatement, test) == 24); + assert!(offset_of!(DoWhileStatement, body) == 24); + assert!(offset_of!(DoWhileStatement, test) == 40); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(WhileStatement, span) == 0); - assert!(offset_of!(WhileStatement, test) == 8); - assert!(offset_of!(WhileStatement, body) == 24); + assert!(offset_of!(WhileStatement, test) == 24); + assert!(offset_of!(WhileStatement, body) == 40); // Padding: 4 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 96); assert!(align_of::() == 8); assert!(offset_of!(ForStatement, span) == 0); - assert!(offset_of!(ForStatement, init) == 8); - assert!(offset_of!(ForStatement, test) == 24); - assert!(offset_of!(ForStatement, update) == 40); - assert!(offset_of!(ForStatement, body) == 56); - assert!(offset_of!(ForStatement, scope_id) == 72); + assert!(offset_of!(ForStatement, init) == 24); + assert!(offset_of!(ForStatement, test) == 40); + assert!(offset_of!(ForStatement, update) == 56); + assert!(offset_of!(ForStatement, body) == 72); + assert!(offset_of!(ForStatement, scope_id) == 88); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 4 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(ForInStatement, span) == 0); - assert!(offset_of!(ForInStatement, left) == 8); - assert!(offset_of!(ForInStatement, right) == 24); - assert!(offset_of!(ForInStatement, body) == 40); - assert!(offset_of!(ForInStatement, scope_id) == 56); + assert!(offset_of!(ForInStatement, left) == 24); + assert!(offset_of!(ForInStatement, right) == 40); + assert!(offset_of!(ForInStatement, body) == 56); + assert!(offset_of!(ForInStatement, scope_id) == 72); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 3 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(ForOfStatement, span) == 0); - assert!(offset_of!(ForOfStatement, r#await) == 60); - assert!(offset_of!(ForOfStatement, left) == 8); - assert!(offset_of!(ForOfStatement, right) == 24); - assert!(offset_of!(ForOfStatement, body) == 40); - assert!(offset_of!(ForOfStatement, scope_id) == 56); + assert!(offset_of!(ForOfStatement, r#await) == 76); + assert!(offset_of!(ForOfStatement, left) == 24); + assert!(offset_of!(ForOfStatement, right) == 40); + assert!(offset_of!(ForOfStatement, body) == 56); + assert!(offset_of!(ForOfStatement, scope_id) == 72); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(ContinueStatement, span) == 0); - assert!(offset_of!(ContinueStatement, label) == 8); + assert!(offset_of!(ContinueStatement, label) == 24); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(BreakStatement, span) == 0); - assert!(offset_of!(BreakStatement, label) == 8); + assert!(offset_of!(BreakStatement, label) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(ReturnStatement, span) == 0); - assert!(offset_of!(ReturnStatement, argument) == 8); + assert!(offset_of!(ReturnStatement, argument) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(WithStatement, span) == 0); - assert!(offset_of!(WithStatement, object) == 8); - assert!(offset_of!(WithStatement, body) == 24); + assert!(offset_of!(WithStatement, object) == 24); + assert!(offset_of!(WithStatement, body) == 40); // Padding: 4 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(SwitchStatement, span) == 0); - assert!(offset_of!(SwitchStatement, discriminant) == 8); - assert!(offset_of!(SwitchStatement, cases) == 24); - assert!(offset_of!(SwitchStatement, scope_id) == 48); + assert!(offset_of!(SwitchStatement, discriminant) == 24); + assert!(offset_of!(SwitchStatement, cases) == 40); + assert!(offset_of!(SwitchStatement, scope_id) == 64); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(SwitchCase, span) == 0); - assert!(offset_of!(SwitchCase, test) == 8); - assert!(offset_of!(SwitchCase, consequent) == 24); + assert!(offset_of!(SwitchCase, test) == 24); + assert!(offset_of!(SwitchCase, consequent) == 40); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(LabeledStatement, span) == 0); - assert!(offset_of!(LabeledStatement, label) == 8); - assert!(offset_of!(LabeledStatement, body) == 32); + assert!(offset_of!(LabeledStatement, label) == 24); + assert!(offset_of!(LabeledStatement, body) == 64); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(ThrowStatement, span) == 0); - assert!(offset_of!(ThrowStatement, argument) == 8); + assert!(offset_of!(ThrowStatement, argument) == 24); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TryStatement, span) == 0); - assert!(offset_of!(TryStatement, block) == 8); - assert!(offset_of!(TryStatement, handler) == 16); - assert!(offset_of!(TryStatement, finalizer) == 24); + assert!(offset_of!(TryStatement, block) == 24); + assert!(offset_of!(TryStatement, handler) == 32); + assert!(offset_of!(TryStatement, finalizer) == 40); // Padding: 4 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 96); assert!(align_of::() == 8); assert!(offset_of!(CatchClause, span) == 0); - assert!(offset_of!(CatchClause, param) == 8); - assert!(offset_of!(CatchClause, body) == 48); - assert!(offset_of!(CatchClause, scope_id) == 56); + assert!(offset_of!(CatchClause, param) == 24); + assert!(offset_of!(CatchClause, body) == 80); + assert!(offset_of!(CatchClause, scope_id) == 88); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(CatchParameter, span) == 0); - assert!(offset_of!(CatchParameter, pattern) == 8); + assert!(offset_of!(CatchParameter, pattern) == 24); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(DebuggerStatement, span) == 0); @@ -534,172 +534,172 @@ const _: () = { assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(AssignmentPattern, span) == 0); - assert!(offset_of!(AssignmentPattern, left) == 8); - assert!(offset_of!(AssignmentPattern, right) == 40); + assert!(offset_of!(AssignmentPattern, left) == 24); + assert!(offset_of!(AssignmentPattern, right) == 56); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(ObjectPattern, span) == 0); - assert!(offset_of!(ObjectPattern, properties) == 8); - assert!(offset_of!(ObjectPattern, rest) == 32); + assert!(offset_of!(ObjectPattern, properties) == 24); + assert!(offset_of!(ObjectPattern, rest) == 48); // Padding: 6 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(BindingProperty, span) == 0); - assert!(offset_of!(BindingProperty, key) == 8); - assert!(offset_of!(BindingProperty, value) == 24); - assert!(offset_of!(BindingProperty, shorthand) == 56); - assert!(offset_of!(BindingProperty, computed) == 57); + assert!(offset_of!(BindingProperty, key) == 24); + assert!(offset_of!(BindingProperty, value) == 40); + assert!(offset_of!(BindingProperty, shorthand) == 72); + assert!(offset_of!(BindingProperty, computed) == 73); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(ArrayPattern, span) == 0); - assert!(offset_of!(ArrayPattern, elements) == 8); - assert!(offset_of!(ArrayPattern, rest) == 32); + assert!(offset_of!(ArrayPattern, elements) == 24); + assert!(offset_of!(ArrayPattern, rest) == 48); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(BindingRestElement, span) == 0); - assert!(offset_of!(BindingRestElement, argument) == 8); + assert!(offset_of!(BindingRestElement, argument) == 24); // Padding: 7 bytes - assert!(size_of::() == 96); + assert!(size_of::() == 128); assert!(align_of::() == 8); assert!(offset_of!(Function, span) == 0); - assert!(offset_of!(Function, r#type) == 84); - assert!(offset_of!(Function, id) == 8); - assert!(offset_of!(Function, generator) == 85); - assert!(offset_of!(Function, r#async) == 86); - assert!(offset_of!(Function, declare) == 87); - assert!(offset_of!(Function, type_parameters) == 40); - assert!(offset_of!(Function, this_param) == 48); - assert!(offset_of!(Function, params) == 56); - assert!(offset_of!(Function, return_type) == 64); - assert!(offset_of!(Function, body) == 72); - assert!(offset_of!(Function, scope_id) == 80); - assert!(offset_of!(Function, pure) == 88); + assert!(offset_of!(Function, r#type) == 116); + assert!(offset_of!(Function, id) == 24); + assert!(offset_of!(Function, generator) == 117); + assert!(offset_of!(Function, r#async) == 118); + assert!(offset_of!(Function, declare) == 119); + assert!(offset_of!(Function, type_parameters) == 72); + assert!(offset_of!(Function, this_param) == 80); + assert!(offset_of!(Function, params) == 88); + assert!(offset_of!(Function, return_type) == 96); + assert!(offset_of!(Function, body) == 104); + assert!(offset_of!(Function, scope_id) == 112); + assert!(offset_of!(Function, pure) == 120); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(FormalParameters, span) == 0); - assert!(offset_of!(FormalParameters, kind) == 40); - assert!(offset_of!(FormalParameters, items) == 8); - assert!(offset_of!(FormalParameters, rest) == 32); + assert!(offset_of!(FormalParameters, kind) == 56); + assert!(offset_of!(FormalParameters, items) == 24); + assert!(offset_of!(FormalParameters, rest) == 48); // Padding: 5 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(FormalParameter, span) == 0); - assert!(offset_of!(FormalParameter, decorators) == 8); - assert!(offset_of!(FormalParameter, pattern) == 32); - assert!(offset_of!(FormalParameter, accessibility) == 64); - assert!(offset_of!(FormalParameter, readonly) == 65); - assert!(offset_of!(FormalParameter, r#override) == 66); + assert!(offset_of!(FormalParameter, decorators) == 24); + assert!(offset_of!(FormalParameter, pattern) == 48); + assert!(offset_of!(FormalParameter, accessibility) == 80); + assert!(offset_of!(FormalParameter, readonly) == 81); + assert!(offset_of!(FormalParameter, r#override) == 82); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(FunctionBody, span) == 0); - assert!(offset_of!(FunctionBody, directives) == 8); - assert!(offset_of!(FunctionBody, statements) == 32); + assert!(offset_of!(FunctionBody, directives) == 24); + assert!(offset_of!(FunctionBody, statements) == 48); // Padding: 1 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(ArrowFunctionExpression, span) == 0); - assert!(offset_of!(ArrowFunctionExpression, expression) == 44); - assert!(offset_of!(ArrowFunctionExpression, r#async) == 45); - assert!(offset_of!(ArrowFunctionExpression, type_parameters) == 8); - assert!(offset_of!(ArrowFunctionExpression, params) == 16); - assert!(offset_of!(ArrowFunctionExpression, return_type) == 24); - assert!(offset_of!(ArrowFunctionExpression, body) == 32); - assert!(offset_of!(ArrowFunctionExpression, scope_id) == 40); - assert!(offset_of!(ArrowFunctionExpression, pure) == 46); + assert!(offset_of!(ArrowFunctionExpression, expression) == 60); + assert!(offset_of!(ArrowFunctionExpression, r#async) == 61); + assert!(offset_of!(ArrowFunctionExpression, type_parameters) == 24); + assert!(offset_of!(ArrowFunctionExpression, params) == 32); + assert!(offset_of!(ArrowFunctionExpression, return_type) == 40); + assert!(offset_of!(ArrowFunctionExpression, body) == 48); + assert!(offset_of!(ArrowFunctionExpression, scope_id) == 56); + assert!(offset_of!(ArrowFunctionExpression, pure) == 62); // Padding: 7 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(YieldExpression, span) == 0); - assert!(offset_of!(YieldExpression, delegate) == 24); - assert!(offset_of!(YieldExpression, argument) == 8); + assert!(offset_of!(YieldExpression, delegate) == 40); + assert!(offset_of!(YieldExpression, argument) == 24); // Padding: 1 bytes - assert!(size_of::() == 136); + assert!(size_of::() == 168); assert!(align_of::() == 8); assert!(offset_of!(Class, span) == 0); - assert!(offset_of!(Class, r#type) == 132); - assert!(offset_of!(Class, decorators) == 8); - assert!(offset_of!(Class, id) == 32); - assert!(offset_of!(Class, type_parameters) == 64); - assert!(offset_of!(Class, super_class) == 72); - assert!(offset_of!(Class, super_type_arguments) == 88); - assert!(offset_of!(Class, implements) == 96); - assert!(offset_of!(Class, body) == 120); - assert!(offset_of!(Class, r#abstract) == 133); - assert!(offset_of!(Class, declare) == 134); - assert!(offset_of!(Class, scope_id) == 128); + assert!(offset_of!(Class, r#type) == 164); + assert!(offset_of!(Class, decorators) == 24); + assert!(offset_of!(Class, id) == 48); + assert!(offset_of!(Class, type_parameters) == 96); + assert!(offset_of!(Class, super_class) == 104); + assert!(offset_of!(Class, super_type_arguments) == 120); + assert!(offset_of!(Class, implements) == 128); + assert!(offset_of!(Class, body) == 152); + assert!(offset_of!(Class, r#abstract) == 165); + assert!(offset_of!(Class, declare) == 166); + assert!(offset_of!(Class, scope_id) == 160); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(ClassBody, span) == 0); - assert!(offset_of!(ClassBody, body) == 8); + assert!(offset_of!(ClassBody, body) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 1 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(MethodDefinition, span) == 0); - assert!(offset_of!(MethodDefinition, r#type) == 56); - assert!(offset_of!(MethodDefinition, decorators) == 8); - assert!(offset_of!(MethodDefinition, key) == 32); - assert!(offset_of!(MethodDefinition, value) == 48); - assert!(offset_of!(MethodDefinition, kind) == 57); - assert!(offset_of!(MethodDefinition, computed) == 58); - assert!(offset_of!(MethodDefinition, r#static) == 59); - assert!(offset_of!(MethodDefinition, r#override) == 60); - assert!(offset_of!(MethodDefinition, optional) == 61); - assert!(offset_of!(MethodDefinition, accessibility) == 62); + assert!(offset_of!(MethodDefinition, r#type) == 72); + assert!(offset_of!(MethodDefinition, decorators) == 24); + assert!(offset_of!(MethodDefinition, key) == 48); + assert!(offset_of!(MethodDefinition, value) == 64); + assert!(offset_of!(MethodDefinition, kind) == 73); + assert!(offset_of!(MethodDefinition, computed) == 74); + assert!(offset_of!(MethodDefinition, r#static) == 75); + assert!(offset_of!(MethodDefinition, r#override) == 76); + assert!(offset_of!(MethodDefinition, optional) == 77); + assert!(offset_of!(MethodDefinition, accessibility) == 78); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 7 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 104); assert!(align_of::() == 8); assert!(offset_of!(PropertyDefinition, span) == 0); - assert!(offset_of!(PropertyDefinition, r#type) == 72); - assert!(offset_of!(PropertyDefinition, decorators) == 8); - assert!(offset_of!(PropertyDefinition, key) == 32); - assert!(offset_of!(PropertyDefinition, type_annotation) == 48); - assert!(offset_of!(PropertyDefinition, value) == 56); - assert!(offset_of!(PropertyDefinition, computed) == 73); - assert!(offset_of!(PropertyDefinition, r#static) == 74); - assert!(offset_of!(PropertyDefinition, declare) == 75); - assert!(offset_of!(PropertyDefinition, r#override) == 76); - assert!(offset_of!(PropertyDefinition, optional) == 77); - assert!(offset_of!(PropertyDefinition, definite) == 78); - assert!(offset_of!(PropertyDefinition, readonly) == 79); - assert!(offset_of!(PropertyDefinition, accessibility) == 80); + assert!(offset_of!(PropertyDefinition, r#type) == 88); + assert!(offset_of!(PropertyDefinition, decorators) == 24); + assert!(offset_of!(PropertyDefinition, key) == 48); + assert!(offset_of!(PropertyDefinition, type_annotation) == 64); + assert!(offset_of!(PropertyDefinition, value) == 72); + assert!(offset_of!(PropertyDefinition, computed) == 89); + assert!(offset_of!(PropertyDefinition, r#static) == 90); + assert!(offset_of!(PropertyDefinition, declare) == 91); + assert!(offset_of!(PropertyDefinition, r#override) == 92); + assert!(offset_of!(PropertyDefinition, optional) == 93); + assert!(offset_of!(PropertyDefinition, definite) == 94); + assert!(offset_of!(PropertyDefinition, readonly) == 95); + assert!(offset_of!(PropertyDefinition, accessibility) == 96); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -708,17 +708,17 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(PrivateIdentifier, span) == 0); - assert!(offset_of!(PrivateIdentifier, name) == 8); + assert!(offset_of!(PrivateIdentifier, name) == 24); // Padding: 4 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(StaticBlock, span) == 0); - assert!(offset_of!(StaticBlock, body) == 8); - assert!(offset_of!(StaticBlock, scope_id) == 32); + assert!(offset_of!(StaticBlock, body) == 24); + assert!(offset_of!(StaticBlock, scope_id) == 48); assert!(size_of::() == 16); assert!(align_of::() == 8); @@ -727,37 +727,37 @@ const _: () = { assert!(align_of::() == 1); // Padding: 2 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 96); assert!(align_of::() == 8); assert!(offset_of!(AccessorProperty, span) == 0); - assert!(offset_of!(AccessorProperty, r#type) == 72); - assert!(offset_of!(AccessorProperty, decorators) == 8); - assert!(offset_of!(AccessorProperty, key) == 32); - assert!(offset_of!(AccessorProperty, type_annotation) == 48); - assert!(offset_of!(AccessorProperty, value) == 56); - assert!(offset_of!(AccessorProperty, computed) == 73); - assert!(offset_of!(AccessorProperty, r#static) == 74); - assert!(offset_of!(AccessorProperty, r#override) == 75); - assert!(offset_of!(AccessorProperty, definite) == 76); - assert!(offset_of!(AccessorProperty, accessibility) == 77); + assert!(offset_of!(AccessorProperty, r#type) == 88); + assert!(offset_of!(AccessorProperty, decorators) == 24); + assert!(offset_of!(AccessorProperty, key) == 48); + assert!(offset_of!(AccessorProperty, type_annotation) == 64); + assert!(offset_of!(AccessorProperty, value) == 72); + assert!(offset_of!(AccessorProperty, computed) == 89); + assert!(offset_of!(AccessorProperty, r#static) == 90); + assert!(offset_of!(AccessorProperty, r#override) == 91); + assert!(offset_of!(AccessorProperty, definite) == 92); + assert!(offset_of!(AccessorProperty, accessibility) == 93); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(ImportExpression, span) == 0); - assert!(offset_of!(ImportExpression, source) == 8); - assert!(offset_of!(ImportExpression, options) == 24); - assert!(offset_of!(ImportExpression, phase) == 40); + assert!(offset_of!(ImportExpression, source) == 24); + assert!(offset_of!(ImportExpression, options) == 40); + assert!(offset_of!(ImportExpression, phase) == 56); // Padding: 6 bytes - assert!(size_of::() == 96); + assert!(size_of::() == 128); assert!(align_of::() == 8); assert!(offset_of!(ImportDeclaration, span) == 0); - assert!(offset_of!(ImportDeclaration, specifiers) == 8); - assert!(offset_of!(ImportDeclaration, source) == 32); - assert!(offset_of!(ImportDeclaration, phase) == 88); - assert!(offset_of!(ImportDeclaration, with_clause) == 80); - assert!(offset_of!(ImportDeclaration, import_kind) == 89); + assert!(offset_of!(ImportDeclaration, specifiers) == 24); + assert!(offset_of!(ImportDeclaration, source) == 48); + assert!(offset_of!(ImportDeclaration, phase) == 120); + assert!(offset_of!(ImportDeclaration, with_clause) == 112); + assert!(offset_of!(ImportDeclaration, import_kind) == 121); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -766,130 +766,130 @@ const _: () = { assert!(align_of::() == 8); // Padding: 7 bytes - assert!(size_of::() == 104); + assert!(size_of::() == 152); assert!(align_of::() == 8); assert!(offset_of!(ImportSpecifier, span) == 0); - assert!(offset_of!(ImportSpecifier, imported) == 8); - assert!(offset_of!(ImportSpecifier, local) == 64); - assert!(offset_of!(ImportSpecifier, import_kind) == 96); + assert!(offset_of!(ImportSpecifier, imported) == 24); + assert!(offset_of!(ImportSpecifier, local) == 96); + assert!(offset_of!(ImportSpecifier, import_kind) == 144); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(ImportDefaultSpecifier, span) == 0); - assert!(offset_of!(ImportDefaultSpecifier, local) == 8); + assert!(offset_of!(ImportDefaultSpecifier, local) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(ImportNamespaceSpecifier, span) == 0); - assert!(offset_of!(ImportNamespaceSpecifier, local) == 8); + assert!(offset_of!(ImportNamespaceSpecifier, local) == 24); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(WithClause, span) == 0); - assert!(offset_of!(WithClause, attributes_keyword) == 8); - assert!(offset_of!(WithClause, with_entries) == 32); + assert!(offset_of!(WithClause, attributes_keyword) == 24); + assert!(offset_of!(WithClause, with_entries) == 64); // Padding: 0 bytes - assert!(size_of::() == 112); + assert!(size_of::() == 160); assert!(align_of::() == 8); assert!(offset_of!(ImportAttribute, span) == 0); - assert!(offset_of!(ImportAttribute, key) == 8); - assert!(offset_of!(ImportAttribute, value) == 64); + assert!(offset_of!(ImportAttribute, key) == 24); + assert!(offset_of!(ImportAttribute, value) == 96); - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); // Padding: 7 bytes - assert!(size_of::() == 112); + assert!(size_of::() == 144); assert!(align_of::() == 8); assert!(offset_of!(ExportNamedDeclaration, span) == 0); - assert!(offset_of!(ExportNamedDeclaration, declaration) == 8); - assert!(offset_of!(ExportNamedDeclaration, specifiers) == 24); - assert!(offset_of!(ExportNamedDeclaration, source) == 48); - assert!(offset_of!(ExportNamedDeclaration, export_kind) == 104); - assert!(offset_of!(ExportNamedDeclaration, with_clause) == 96); + assert!(offset_of!(ExportNamedDeclaration, declaration) == 24); + assert!(offset_of!(ExportNamedDeclaration, specifiers) == 40); + assert!(offset_of!(ExportNamedDeclaration, source) == 64); + assert!(offset_of!(ExportNamedDeclaration, export_kind) == 136); + assert!(offset_of!(ExportNamedDeclaration, with_clause) == 128); // Padding: 0 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 112); assert!(align_of::() == 8); assert!(offset_of!(ExportDefaultDeclaration, span) == 0); - assert!(offset_of!(ExportDefaultDeclaration, exported) == 8); - assert!(offset_of!(ExportDefaultDeclaration, declaration) == 64); + assert!(offset_of!(ExportDefaultDeclaration, exported) == 24); + assert!(offset_of!(ExportDefaultDeclaration, declaration) == 96); // Padding: 7 bytes - assert!(size_of::() == 128); + assert!(size_of::() == 176); assert!(align_of::() == 8); assert!(offset_of!(ExportAllDeclaration, span) == 0); - assert!(offset_of!(ExportAllDeclaration, exported) == 8); - assert!(offset_of!(ExportAllDeclaration, source) == 64); - assert!(offset_of!(ExportAllDeclaration, with_clause) == 112); - assert!(offset_of!(ExportAllDeclaration, export_kind) == 120); + assert!(offset_of!(ExportAllDeclaration, exported) == 24); + assert!(offset_of!(ExportAllDeclaration, source) == 96); + assert!(offset_of!(ExportAllDeclaration, with_clause) == 160); + assert!(offset_of!(ExportAllDeclaration, export_kind) == 168); // Padding: 7 bytes - assert!(size_of::() == 128); + assert!(size_of::() == 176); assert!(align_of::() == 8); assert!(offset_of!(ExportSpecifier, span) == 0); - assert!(offset_of!(ExportSpecifier, local) == 8); - assert!(offset_of!(ExportSpecifier, exported) == 64); - assert!(offset_of!(ExportSpecifier, export_kind) == 120); + assert!(offset_of!(ExportSpecifier, local) == 24); + assert!(offset_of!(ExportSpecifier, exported) == 96); + assert!(offset_of!(ExportSpecifier, export_kind) == 168); assert!(size_of::() == 16); assert!(align_of::() == 8); - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(V8IntrinsicExpression, span) == 0); - assert!(offset_of!(V8IntrinsicExpression, name) == 8); - assert!(offset_of!(V8IntrinsicExpression, arguments) == 32); + assert!(offset_of!(V8IntrinsicExpression, name) == 24); + assert!(offset_of!(V8IntrinsicExpression, arguments) == 64); // Padding: 7 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(BooleanLiteral, span) == 0); - assert!(offset_of!(BooleanLiteral, value) == 8); + assert!(offset_of!(BooleanLiteral, value) == 24); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(NullLiteral, span) == 0); // Padding: 7 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(NumericLiteral, span) == 0); - assert!(offset_of!(NumericLiteral, value) == 8); - assert!(offset_of!(NumericLiteral, raw) == 16); - assert!(offset_of!(NumericLiteral, base) == 32); + assert!(offset_of!(NumericLiteral, value) == 24); + assert!(offset_of!(NumericLiteral, raw) == 32); + assert!(offset_of!(NumericLiteral, base) == 48); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(StringLiteral, span) == 0); - assert!(offset_of!(StringLiteral, value) == 8); - assert!(offset_of!(StringLiteral, raw) == 24); - assert!(offset_of!(StringLiteral, lone_surrogates) == 40); + assert!(offset_of!(StringLiteral, value) == 24); + assert!(offset_of!(StringLiteral, raw) == 40); + assert!(offset_of!(StringLiteral, lone_surrogates) == 56); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(BigIntLiteral, span) == 0); - assert!(offset_of!(BigIntLiteral, value) == 8); - assert!(offset_of!(BigIntLiteral, raw) == 24); - assert!(offset_of!(BigIntLiteral, base) == 40); + assert!(offset_of!(BigIntLiteral, value) == 24); + assert!(offset_of!(BigIntLiteral, raw) == 40); + assert!(offset_of!(BigIntLiteral, base) == 56); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(RegExpLiteral, span) == 0); - assert!(offset_of!(RegExpLiteral, regex) == 8); - assert!(offset_of!(RegExpLiteral, raw) == 40); + assert!(offset_of!(RegExpLiteral, regex) == 24); + assert!(offset_of!(RegExpLiteral, raw) == 56); // Padding: 7 bytes assert!(size_of::() == 32); @@ -908,42 +908,42 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(JSXElement, span) == 0); - assert!(offset_of!(JSXElement, opening_element) == 8); - assert!(offset_of!(JSXElement, children) == 16); - assert!(offset_of!(JSXElement, closing_element) == 40); + assert!(offset_of!(JSXElement, opening_element) == 24); + assert!(offset_of!(JSXElement, children) == 32); + assert!(offset_of!(JSXElement, closing_element) == 56); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(JSXOpeningElement, span) == 0); - assert!(offset_of!(JSXOpeningElement, name) == 8); - assert!(offset_of!(JSXOpeningElement, type_arguments) == 24); - assert!(offset_of!(JSXOpeningElement, attributes) == 32); + assert!(offset_of!(JSXOpeningElement, name) == 24); + assert!(offset_of!(JSXOpeningElement, type_arguments) == 40); + assert!(offset_of!(JSXOpeningElement, attributes) == 48); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(JSXClosingElement, span) == 0); - assert!(offset_of!(JSXClosingElement, name) == 8); + assert!(offset_of!(JSXClosingElement, name) == 24); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 96); assert!(align_of::() == 8); assert!(offset_of!(JSXFragment, span) == 0); - assert!(offset_of!(JSXFragment, opening_fragment) == 8); - assert!(offset_of!(JSXFragment, children) == 16); - assert!(offset_of!(JSXFragment, closing_fragment) == 40); + assert!(offset_of!(JSXFragment, opening_fragment) == 24); + assert!(offset_of!(JSXFragment, children) == 48); + assert!(offset_of!(JSXFragment, closing_fragment) == 72); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(JSXOpeningFragment, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(JSXClosingFragment, span) == 0); @@ -951,33 +951,33 @@ const _: () = { assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 104); assert!(align_of::() == 8); assert!(offset_of!(JSXNamespacedName, span) == 0); - assert!(offset_of!(JSXNamespacedName, namespace) == 8); - assert!(offset_of!(JSXNamespacedName, name) == 32); + assert!(offset_of!(JSXNamespacedName, namespace) == 24); + assert!(offset_of!(JSXNamespacedName, name) == 64); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(JSXMemberExpression, span) == 0); - assert!(offset_of!(JSXMemberExpression, object) == 8); - assert!(offset_of!(JSXMemberExpression, property) == 24); + assert!(offset_of!(JSXMemberExpression, object) == 24); + assert!(offset_of!(JSXMemberExpression, property) == 40); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(JSXExpressionContainer, span) == 0); - assert!(offset_of!(JSXExpressionContainer, expression) == 8); + assert!(offset_of!(JSXExpressionContainer, expression) == 24); - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(JSXEmptyExpression, span) == 0); @@ -985,17 +985,17 @@ const _: () = { assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(JSXAttribute, span) == 0); - assert!(offset_of!(JSXAttribute, name) == 8); - assert!(offset_of!(JSXAttribute, value) == 24); + assert!(offset_of!(JSXAttribute, name) == 24); + assert!(offset_of!(JSXAttribute, value) == 40); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(JSXSpreadAttribute, span) == 0); - assert!(offset_of!(JSXSpreadAttribute, argument) == 8); + assert!(offset_of!(JSXSpreadAttribute, argument) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); @@ -1004,71 +1004,71 @@ const _: () = { assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(JSXIdentifier, span) == 0); - assert!(offset_of!(JSXIdentifier, name) == 8); + assert!(offset_of!(JSXIdentifier, name) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(JSXSpreadChild, span) == 0); - assert!(offset_of!(JSXSpreadChild, expression) == 8); + assert!(offset_of!(JSXSpreadChild, expression) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(JSXText, span) == 0); - assert!(offset_of!(JSXText, value) == 8); - assert!(offset_of!(JSXText, raw) == 24); + assert!(offset_of!(JSXText, value) == 24); + assert!(offset_of!(JSXText, raw) == 40); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSThisParameter, span) == 0); - assert!(offset_of!(TSThisParameter, this_span) == 8); - assert!(offset_of!(TSThisParameter, type_annotation) == 16); + assert!(offset_of!(TSThisParameter, this_span) == 24); + assert!(offset_of!(TSThisParameter, type_annotation) == 48); // Padding: 2 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 128); assert!(align_of::() == 8); assert!(offset_of!(TSEnumDeclaration, span) == 0); - assert!(offset_of!(TSEnumDeclaration, id) == 8); - assert!(offset_of!(TSEnumDeclaration, body) == 40); - assert!(offset_of!(TSEnumDeclaration, r#const) == 76); - assert!(offset_of!(TSEnumDeclaration, declare) == 77); - assert!(offset_of!(TSEnumDeclaration, scope_id) == 72); + assert!(offset_of!(TSEnumDeclaration, id) == 24); + assert!(offset_of!(TSEnumDeclaration, body) == 72); + assert!(offset_of!(TSEnumDeclaration, r#const) == 124); + assert!(offset_of!(TSEnumDeclaration, declare) == 125); + assert!(offset_of!(TSEnumDeclaration, scope_id) == 120); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSEnumBody, span) == 0); - assert!(offset_of!(TSEnumBody, members) == 8); + assert!(offset_of!(TSEnumBody, members) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSEnumMember, span) == 0); - assert!(offset_of!(TSEnumMember, id) == 8); - assert!(offset_of!(TSEnumMember, initializer) == 24); + assert!(offset_of!(TSEnumMember, id) == 24); + assert!(offset_of!(TSEnumMember, initializer) == 40); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSTypeAnnotation, span) == 0); - assert!(offset_of!(TSTypeAnnotation, type_annotation) == 8); + assert!(offset_of!(TSTypeAnnotation, type_annotation) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSLiteralType, span) == 0); - assert!(offset_of!(TSLiteralType, literal) == 8); + assert!(offset_of!(TSLiteralType, literal) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); @@ -1077,499 +1077,499 @@ const _: () = { assert!(align_of::() == 8); // Padding: 4 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 96); assert!(align_of::() == 8); assert!(offset_of!(TSConditionalType, span) == 0); - assert!(offset_of!(TSConditionalType, check_type) == 8); - assert!(offset_of!(TSConditionalType, extends_type) == 24); - assert!(offset_of!(TSConditionalType, true_type) == 40); - assert!(offset_of!(TSConditionalType, false_type) == 56); - assert!(offset_of!(TSConditionalType, scope_id) == 72); + assert!(offset_of!(TSConditionalType, check_type) == 24); + assert!(offset_of!(TSConditionalType, extends_type) == 40); + assert!(offset_of!(TSConditionalType, true_type) == 56); + assert!(offset_of!(TSConditionalType, false_type) == 72); + assert!(offset_of!(TSConditionalType, scope_id) == 88); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSUnionType, span) == 0); - assert!(offset_of!(TSUnionType, types) == 8); + assert!(offset_of!(TSUnionType, types) == 24); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSIntersectionType, span) == 0); - assert!(offset_of!(TSIntersectionType, types) == 8); + assert!(offset_of!(TSIntersectionType, types) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSParenthesizedType, span) == 0); - assert!(offset_of!(TSParenthesizedType, type_annotation) == 8); + assert!(offset_of!(TSParenthesizedType, type_annotation) == 24); // Padding: 7 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSTypeOperator, span) == 0); - assert!(offset_of!(TSTypeOperator, operator) == 24); - assert!(offset_of!(TSTypeOperator, type_annotation) == 8); + assert!(offset_of!(TSTypeOperator, operator) == 40); + assert!(offset_of!(TSTypeOperator, type_annotation) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSArrayType, span) == 0); - assert!(offset_of!(TSArrayType, element_type) == 8); + assert!(offset_of!(TSArrayType, element_type) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSIndexedAccessType, span) == 0); - assert!(offset_of!(TSIndexedAccessType, object_type) == 8); - assert!(offset_of!(TSIndexedAccessType, index_type) == 24); + assert!(offset_of!(TSIndexedAccessType, object_type) == 24); + assert!(offset_of!(TSIndexedAccessType, index_type) == 40); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSTupleType, span) == 0); - assert!(offset_of!(TSTupleType, element_types) == 8); + assert!(offset_of!(TSTupleType, element_types) == 24); // Padding: 7 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(TSNamedTupleMember, span) == 0); - assert!(offset_of!(TSNamedTupleMember, label) == 8); - assert!(offset_of!(TSNamedTupleMember, element_type) == 32); - assert!(offset_of!(TSNamedTupleMember, optional) == 48); + assert!(offset_of!(TSNamedTupleMember, label) == 24); + assert!(offset_of!(TSNamedTupleMember, element_type) == 64); + assert!(offset_of!(TSNamedTupleMember, optional) == 80); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSOptionalType, span) == 0); - assert!(offset_of!(TSOptionalType, type_annotation) == 8); + assert!(offset_of!(TSOptionalType, type_annotation) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSRestType, span) == 0); - assert!(offset_of!(TSRestType, type_annotation) == 8); + assert!(offset_of!(TSRestType, type_annotation) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSAnyKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSStringKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSBooleanKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSNumberKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSNeverKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSIntrinsicKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSUnknownKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSNullKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSUndefinedKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSVoidKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSSymbolKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSThisType, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSObjectKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSBigIntKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSTypeReference, span) == 0); - assert!(offset_of!(TSTypeReference, type_name) == 8); - assert!(offset_of!(TSTypeReference, type_arguments) == 24); + assert!(offset_of!(TSTypeReference, type_name) == 24); + assert!(offset_of!(TSTypeReference, type_arguments) == 40); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(TSQualifiedName, span) == 0); - assert!(offset_of!(TSQualifiedName, left) == 8); - assert!(offset_of!(TSQualifiedName, right) == 24); + assert!(offset_of!(TSQualifiedName, left) == 24); + assert!(offset_of!(TSQualifiedName, right) == 40); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSTypeParameterInstantiation, span) == 0); - assert!(offset_of!(TSTypeParameterInstantiation, params) == 8); + assert!(offset_of!(TSTypeParameterInstantiation, params) == 24); // Padding: 5 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 112); assert!(align_of::() == 8); assert!(offset_of!(TSTypeParameter, span) == 0); - assert!(offset_of!(TSTypeParameter, name) == 8); - assert!(offset_of!(TSTypeParameter, constraint) == 40); - assert!(offset_of!(TSTypeParameter, default) == 56); - assert!(offset_of!(TSTypeParameter, r#in) == 72); - assert!(offset_of!(TSTypeParameter, out) == 73); - assert!(offset_of!(TSTypeParameter, r#const) == 74); + assert!(offset_of!(TSTypeParameter, name) == 24); + assert!(offset_of!(TSTypeParameter, constraint) == 72); + assert!(offset_of!(TSTypeParameter, default) == 88); + assert!(offset_of!(TSTypeParameter, r#in) == 104); + assert!(offset_of!(TSTypeParameter, out) == 105); + assert!(offset_of!(TSTypeParameter, r#const) == 106); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSTypeParameterDeclaration, span) == 0); - assert!(offset_of!(TSTypeParameterDeclaration, params) == 8); + assert!(offset_of!(TSTypeParameterDeclaration, params) == 24); // Padding: 3 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 104); assert!(align_of::() == 8); assert!(offset_of!(TSTypeAliasDeclaration, span) == 0); - assert!(offset_of!(TSTypeAliasDeclaration, id) == 8); - assert!(offset_of!(TSTypeAliasDeclaration, type_parameters) == 40); - assert!(offset_of!(TSTypeAliasDeclaration, type_annotation) == 48); - assert!(offset_of!(TSTypeAliasDeclaration, declare) == 68); - assert!(offset_of!(TSTypeAliasDeclaration, scope_id) == 64); + assert!(offset_of!(TSTypeAliasDeclaration, id) == 24); + assert!(offset_of!(TSTypeAliasDeclaration, type_parameters) == 72); + assert!(offset_of!(TSTypeAliasDeclaration, type_annotation) == 80); + assert!(offset_of!(TSTypeAliasDeclaration, declare) == 100); + assert!(offset_of!(TSTypeAliasDeclaration, scope_id) == 96); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSClassImplements, span) == 0); - assert!(offset_of!(TSClassImplements, expression) == 8); - assert!(offset_of!(TSClassImplements, type_arguments) == 24); + assert!(offset_of!(TSClassImplements, expression) == 24); + assert!(offset_of!(TSClassImplements, type_arguments) == 40); // Padding: 3 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 120); assert!(align_of::() == 8); assert!(offset_of!(TSInterfaceDeclaration, span) == 0); - assert!(offset_of!(TSInterfaceDeclaration, id) == 8); - assert!(offset_of!(TSInterfaceDeclaration, type_parameters) == 40); - assert!(offset_of!(TSInterfaceDeclaration, extends) == 48); - assert!(offset_of!(TSInterfaceDeclaration, body) == 72); - assert!(offset_of!(TSInterfaceDeclaration, declare) == 84); - assert!(offset_of!(TSInterfaceDeclaration, scope_id) == 80); + assert!(offset_of!(TSInterfaceDeclaration, id) == 24); + assert!(offset_of!(TSInterfaceDeclaration, type_parameters) == 72); + assert!(offset_of!(TSInterfaceDeclaration, extends) == 80); + assert!(offset_of!(TSInterfaceDeclaration, body) == 104); + assert!(offset_of!(TSInterfaceDeclaration, declare) == 116); + assert!(offset_of!(TSInterfaceDeclaration, scope_id) == 112); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSInterfaceBody, span) == 0); - assert!(offset_of!(TSInterfaceBody, body) == 8); + assert!(offset_of!(TSInterfaceBody, body) == 24); // Padding: 5 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSPropertySignature, span) == 0); - assert!(offset_of!(TSPropertySignature, computed) == 32); - assert!(offset_of!(TSPropertySignature, optional) == 33); - assert!(offset_of!(TSPropertySignature, readonly) == 34); - assert!(offset_of!(TSPropertySignature, key) == 8); - assert!(offset_of!(TSPropertySignature, type_annotation) == 24); + assert!(offset_of!(TSPropertySignature, computed) == 48); + assert!(offset_of!(TSPropertySignature, optional) == 49); + assert!(offset_of!(TSPropertySignature, readonly) == 50); + assert!(offset_of!(TSPropertySignature, key) == 24); + assert!(offset_of!(TSPropertySignature, type_annotation) == 40); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 6 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(TSIndexSignature, span) == 0); - assert!(offset_of!(TSIndexSignature, parameters) == 8); - assert!(offset_of!(TSIndexSignature, type_annotation) == 32); - assert!(offset_of!(TSIndexSignature, readonly) == 40); - assert!(offset_of!(TSIndexSignature, r#static) == 41); + assert!(offset_of!(TSIndexSignature, parameters) == 24); + assert!(offset_of!(TSIndexSignature, type_annotation) == 48); + assert!(offset_of!(TSIndexSignature, readonly) == 56); + assert!(offset_of!(TSIndexSignature, r#static) == 57); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSCallSignatureDeclaration, span) == 0); - assert!(offset_of!(TSCallSignatureDeclaration, type_parameters) == 8); - assert!(offset_of!(TSCallSignatureDeclaration, this_param) == 16); - assert!(offset_of!(TSCallSignatureDeclaration, params) == 24); - assert!(offset_of!(TSCallSignatureDeclaration, return_type) == 32); + assert!(offset_of!(TSCallSignatureDeclaration, type_parameters) == 24); + assert!(offset_of!(TSCallSignatureDeclaration, this_param) == 32); + assert!(offset_of!(TSCallSignatureDeclaration, params) == 40); + assert!(offset_of!(TSCallSignatureDeclaration, return_type) == 48); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 1 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(TSMethodSignature, span) == 0); - assert!(offset_of!(TSMethodSignature, key) == 8); - assert!(offset_of!(TSMethodSignature, computed) == 60); - assert!(offset_of!(TSMethodSignature, optional) == 61); - assert!(offset_of!(TSMethodSignature, kind) == 62); - assert!(offset_of!(TSMethodSignature, type_parameters) == 24); - assert!(offset_of!(TSMethodSignature, this_param) == 32); - assert!(offset_of!(TSMethodSignature, params) == 40); - assert!(offset_of!(TSMethodSignature, return_type) == 48); - assert!(offset_of!(TSMethodSignature, scope_id) == 56); + assert!(offset_of!(TSMethodSignature, key) == 24); + assert!(offset_of!(TSMethodSignature, computed) == 76); + assert!(offset_of!(TSMethodSignature, optional) == 77); + assert!(offset_of!(TSMethodSignature, kind) == 78); + assert!(offset_of!(TSMethodSignature, type_parameters) == 40); + assert!(offset_of!(TSMethodSignature, this_param) == 48); + assert!(offset_of!(TSMethodSignature, params) == 56); + assert!(offset_of!(TSMethodSignature, return_type) == 64); + assert!(offset_of!(TSMethodSignature, scope_id) == 72); // Padding: 4 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSConstructSignatureDeclaration, span) == 0); - assert!(offset_of!(TSConstructSignatureDeclaration, type_parameters) == 8); - assert!(offset_of!(TSConstructSignatureDeclaration, params) == 16); - assert!(offset_of!(TSConstructSignatureDeclaration, return_type) == 24); - assert!(offset_of!(TSConstructSignatureDeclaration, scope_id) == 32); + assert!(offset_of!(TSConstructSignatureDeclaration, type_parameters) == 24); + assert!(offset_of!(TSConstructSignatureDeclaration, params) == 32); + assert!(offset_of!(TSConstructSignatureDeclaration, return_type) == 40); + assert!(offset_of!(TSConstructSignatureDeclaration, scope_id) == 48); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSIndexSignatureName, span) == 0); - assert!(offset_of!(TSIndexSignatureName, name) == 8); - assert!(offset_of!(TSIndexSignatureName, type_annotation) == 24); + assert!(offset_of!(TSIndexSignatureName, name) == 24); + assert!(offset_of!(TSIndexSignatureName, type_annotation) == 40); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSInterfaceHeritage, span) == 0); - assert!(offset_of!(TSInterfaceHeritage, expression) == 8); - assert!(offset_of!(TSInterfaceHeritage, type_arguments) == 24); + assert!(offset_of!(TSInterfaceHeritage, expression) == 24); + assert!(offset_of!(TSInterfaceHeritage, type_arguments) == 40); // Padding: 7 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(TSTypePredicate, span) == 0); - assert!(offset_of!(TSTypePredicate, parameter_name) == 8); - assert!(offset_of!(TSTypePredicate, asserts) == 32); - assert!(offset_of!(TSTypePredicate, type_annotation) == 24); + assert!(offset_of!(TSTypePredicate, parameter_name) == 24); + assert!(offset_of!(TSTypePredicate, asserts) == 64); + assert!(offset_of!(TSTypePredicate, type_annotation) == 56); - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 8); // Padding: 2 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 120); assert!(align_of::() == 8); assert!(offset_of!(TSModuleDeclaration, span) == 0); - assert!(offset_of!(TSModuleDeclaration, id) == 8); - assert!(offset_of!(TSModuleDeclaration, body) == 64); - assert!(offset_of!(TSModuleDeclaration, kind) == 84); - assert!(offset_of!(TSModuleDeclaration, declare) == 85); - assert!(offset_of!(TSModuleDeclaration, scope_id) == 80); + assert!(offset_of!(TSModuleDeclaration, id) == 24); + assert!(offset_of!(TSModuleDeclaration, body) == 96); + assert!(offset_of!(TSModuleDeclaration, kind) == 116); + assert!(offset_of!(TSModuleDeclaration, declare) == 117); + assert!(offset_of!(TSModuleDeclaration, scope_id) == 112); assert!(size_of::() == 1); assert!(align_of::() == 1); - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(TSModuleBlock, span) == 0); - assert!(offset_of!(TSModuleBlock, directives) == 8); - assert!(offset_of!(TSModuleBlock, body) == 32); + assert!(offset_of!(TSModuleBlock, directives) == 24); + assert!(offset_of!(TSModuleBlock, body) == 48); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSTypeLiteral, span) == 0); - assert!(offset_of!(TSTypeLiteral, members) == 8); + assert!(offset_of!(TSTypeLiteral, members) == 24); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSInferType, span) == 0); - assert!(offset_of!(TSInferType, type_parameter) == 8); + assert!(offset_of!(TSInferType, type_parameter) == 24); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSTypeQuery, span) == 0); - assert!(offset_of!(TSTypeQuery, expr_name) == 8); - assert!(offset_of!(TSTypeQuery, type_arguments) == 24); + assert!(offset_of!(TSTypeQuery, expr_name) == 24); + assert!(offset_of!(TSTypeQuery, type_arguments) == 40); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(TSImportType, span) == 0); - assert!(offset_of!(TSImportType, argument) == 8); - assert!(offset_of!(TSImportType, options) == 24); - assert!(offset_of!(TSImportType, qualifier) == 32); - assert!(offset_of!(TSImportType, type_arguments) == 48); + assert!(offset_of!(TSImportType, argument) == 24); + assert!(offset_of!(TSImportType, options) == 40); + assert!(offset_of!(TSImportType, qualifier) == 48); + assert!(offset_of!(TSImportType, type_arguments) == 64); // Padding: 4 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(TSFunctionType, span) == 0); - assert!(offset_of!(TSFunctionType, type_parameters) == 8); - assert!(offset_of!(TSFunctionType, this_param) == 16); - assert!(offset_of!(TSFunctionType, params) == 24); - assert!(offset_of!(TSFunctionType, return_type) == 32); - assert!(offset_of!(TSFunctionType, scope_id) == 40); + assert!(offset_of!(TSFunctionType, type_parameters) == 24); + assert!(offset_of!(TSFunctionType, this_param) == 32); + assert!(offset_of!(TSFunctionType, params) == 40); + assert!(offset_of!(TSFunctionType, return_type) == 48); + assert!(offset_of!(TSFunctionType, scope_id) == 56); // Padding: 7 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSConstructorType, span) == 0); - assert!(offset_of!(TSConstructorType, r#abstract) == 32); - assert!(offset_of!(TSConstructorType, type_parameters) == 8); - assert!(offset_of!(TSConstructorType, params) == 16); - assert!(offset_of!(TSConstructorType, return_type) == 24); + assert!(offset_of!(TSConstructorType, r#abstract) == 48); + assert!(offset_of!(TSConstructorType, type_parameters) == 24); + assert!(offset_of!(TSConstructorType, params) == 32); + assert!(offset_of!(TSConstructorType, return_type) == 40); // Padding: 2 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(TSMappedType, span) == 0); - assert!(offset_of!(TSMappedType, type_parameter) == 8); - assert!(offset_of!(TSMappedType, name_type) == 16); - assert!(offset_of!(TSMappedType, type_annotation) == 32); - assert!(offset_of!(TSMappedType, optional) == 52); - assert!(offset_of!(TSMappedType, readonly) == 53); - assert!(offset_of!(TSMappedType, scope_id) == 48); + assert!(offset_of!(TSMappedType, type_parameter) == 24); + assert!(offset_of!(TSMappedType, name_type) == 32); + assert!(offset_of!(TSMappedType, type_annotation) == 48); + assert!(offset_of!(TSMappedType, optional) == 68); + assert!(offset_of!(TSMappedType, readonly) == 69); + assert!(offset_of!(TSMappedType, scope_id) == 64); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(TSTemplateLiteralType, span) == 0); - assert!(offset_of!(TSTemplateLiteralType, quasis) == 8); - assert!(offset_of!(TSTemplateLiteralType, types) == 32); + assert!(offset_of!(TSTemplateLiteralType, quasis) == 24); + assert!(offset_of!(TSTemplateLiteralType, types) == 48); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSAsExpression, span) == 0); - assert!(offset_of!(TSAsExpression, expression) == 8); - assert!(offset_of!(TSAsExpression, type_annotation) == 24); + assert!(offset_of!(TSAsExpression, expression) == 24); + assert!(offset_of!(TSAsExpression, type_annotation) == 40); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSSatisfiesExpression, span) == 0); - assert!(offset_of!(TSSatisfiesExpression, expression) == 8); - assert!(offset_of!(TSSatisfiesExpression, type_annotation) == 24); + assert!(offset_of!(TSSatisfiesExpression, expression) == 24); + assert!(offset_of!(TSSatisfiesExpression, type_annotation) == 40); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSTypeAssertion, span) == 0); - assert!(offset_of!(TSTypeAssertion, type_annotation) == 8); - assert!(offset_of!(TSTypeAssertion, expression) == 24); + assert!(offset_of!(TSTypeAssertion, type_annotation) == 24); + assert!(offset_of!(TSTypeAssertion, expression) == 40); // Padding: 7 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 96); assert!(align_of::() == 8); assert!(offset_of!(TSImportEqualsDeclaration, span) == 0); - assert!(offset_of!(TSImportEqualsDeclaration, id) == 8); - assert!(offset_of!(TSImportEqualsDeclaration, module_reference) == 40); - assert!(offset_of!(TSImportEqualsDeclaration, import_kind) == 56); + assert!(offset_of!(TSImportEqualsDeclaration, id) == 24); + assert!(offset_of!(TSImportEqualsDeclaration, module_reference) == 72); + assert!(offset_of!(TSImportEqualsDeclaration, import_kind) == 88); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(TSExternalModuleReference, span) == 0); - assert!(offset_of!(TSExternalModuleReference, expression) == 8); + assert!(offset_of!(TSExternalModuleReference, expression) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSNonNullExpression, span) == 0); - assert!(offset_of!(TSNonNullExpression, expression) == 8); + assert!(offset_of!(TSNonNullExpression, expression) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(Decorator, span) == 0); - assert!(offset_of!(Decorator, expression) == 8); + assert!(offset_of!(Decorator, expression) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSExportAssignment, span) == 0); - assert!(offset_of!(TSExportAssignment, expression) == 8); + assert!(offset_of!(TSExportAssignment, expression) == 24); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(TSNamespaceExportDeclaration, span) == 0); - assert!(offset_of!(TSNamespaceExportDeclaration, id) == 8); + assert!(offset_of!(TSNamespaceExportDeclaration, id) == 24); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSInstantiationExpression, span) == 0); - assert!(offset_of!(TSInstantiationExpression, expression) == 8); - assert!(offset_of!(TSInstantiationExpression, type_arguments) == 24); + assert!(offset_of!(TSInstantiationExpression, expression) == 24); + assert!(offset_of!(TSInstantiationExpression, type_arguments) == 40); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 7 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(JSDocNullableType, span) == 0); - assert!(offset_of!(JSDocNullableType, type_annotation) == 8); - assert!(offset_of!(JSDocNullableType, postfix) == 24); + assert!(offset_of!(JSDocNullableType, type_annotation) == 24); + assert!(offset_of!(JSDocNullableType, postfix) == 40); // Padding: 7 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(JSDocNonNullableType, span) == 0); - assert!(offset_of!(JSDocNonNullableType, type_annotation) == 8); - assert!(offset_of!(JSDocNonNullableType, postfix) == 24); + assert!(offset_of!(JSDocNonNullableType, type_annotation) == 24); + assert!(offset_of!(JSDocNonNullableType, postfix) == 40); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(JSDocUnknownType, span) == 0); @@ -1587,97 +1587,97 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(Comment, span) == 0); - assert!(offset_of!(Comment, attached_to) == 8); - assert!(offset_of!(Comment, kind) == 12); - assert!(offset_of!(Comment, position) == 13); - assert!(offset_of!(Comment, newlines) == 14); - assert!(offset_of!(Comment, content) == 15); + assert!(offset_of!(Comment, attached_to) == 24); + assert!(offset_of!(Comment, kind) == 28); + assert!(offset_of!(Comment, position) == 29); + assert!(offset_of!(Comment, newlines) == 30); + assert!(offset_of!(Comment, content) == 31); }; #[cfg(target_pointer_width = "32")] const _: () = { // Padding: 1 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 120); assert!(align_of::() == 4); assert!(offset_of!(Program, span) == 0); - assert!(offset_of!(Program, source_type) == 84); - assert!(offset_of!(Program, source_text) == 8); - assert!(offset_of!(Program, comments) == 16); - assert!(offset_of!(Program, hashbang) == 32); - assert!(offset_of!(Program, directives) == 48); - assert!(offset_of!(Program, body) == 64); - assert!(offset_of!(Program, scope_id) == 80); + assert!(offset_of!(Program, source_type) == 116); + assert!(offset_of!(Program, source_text) == 24); + assert!(offset_of!(Program, comments) == 32); + assert!(offset_of!(Program, hashbang) == 48); + assert!(offset_of!(Program, directives) == 80); + assert!(offset_of!(Program, body) == 96); + assert!(offset_of!(Program, scope_id) == 112); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(IdentifierName, span) == 0); - assert!(offset_of!(IdentifierName, name) == 8); + assert!(offset_of!(IdentifierName, name) == 24); // Padding: 0 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(IdentifierReference, span) == 0); - assert!(offset_of!(IdentifierReference, name) == 8); - assert!(offset_of!(IdentifierReference, reference_id) == 16); + assert!(offset_of!(IdentifierReference, name) == 24); + assert!(offset_of!(IdentifierReference, reference_id) == 32); // Padding: 0 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(BindingIdentifier, span) == 0); - assert!(offset_of!(BindingIdentifier, name) == 8); - assert!(offset_of!(BindingIdentifier, symbol_id) == 16); + assert!(offset_of!(BindingIdentifier, name) == 24); + assert!(offset_of!(BindingIdentifier, symbol_id) == 32); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(LabelIdentifier, span) == 0); - assert!(offset_of!(LabelIdentifier, name) == 8); + assert!(offset_of!(LabelIdentifier, name) == 24); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(ThisExpression, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(ArrayExpression, span) == 0); - assert!(offset_of!(ArrayExpression, elements) == 8); + assert!(offset_of!(ArrayExpression, elements) == 24); - assert!(size_of::() == 12); + assert!(size_of::() == 28); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(Elision, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(ObjectExpression, span) == 0); - assert!(offset_of!(ObjectExpression, properties) == 8); + assert!(offset_of!(ObjectExpression, properties) == 24); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(ObjectProperty, span) == 0); - assert!(offset_of!(ObjectProperty, kind) == 24); - assert!(offset_of!(ObjectProperty, key) == 8); - assert!(offset_of!(ObjectProperty, value) == 16); - assert!(offset_of!(ObjectProperty, method) == 25); - assert!(offset_of!(ObjectProperty, shorthand) == 26); - assert!(offset_of!(ObjectProperty, computed) == 27); + assert!(offset_of!(ObjectProperty, kind) == 40); + assert!(offset_of!(ObjectProperty, key) == 24); + assert!(offset_of!(ObjectProperty, value) == 32); + assert!(offset_of!(ObjectProperty, method) == 41); + assert!(offset_of!(ObjectProperty, shorthand) == 42); + assert!(offset_of!(ObjectProperty, computed) == 43); assert!(size_of::() == 8); assert!(align_of::() == 4); @@ -1686,27 +1686,27 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 4); assert!(offset_of!(TemplateLiteral, span) == 0); - assert!(offset_of!(TemplateLiteral, quasis) == 8); - assert!(offset_of!(TemplateLiteral, expressions) == 24); + assert!(offset_of!(TemplateLiteral, quasis) == 24); + assert!(offset_of!(TemplateLiteral, expressions) == 40); // Padding: 0 bytes - assert!(size_of::() == 60); + assert!(size_of::() == 92); assert!(align_of::() == 4); assert!(offset_of!(TaggedTemplateExpression, span) == 0); - assert!(offset_of!(TaggedTemplateExpression, tag) == 8); - assert!(offset_of!(TaggedTemplateExpression, type_arguments) == 16); - assert!(offset_of!(TaggedTemplateExpression, quasi) == 20); + assert!(offset_of!(TaggedTemplateExpression, tag) == 24); + assert!(offset_of!(TaggedTemplateExpression, type_arguments) == 32); + assert!(offset_of!(TaggedTemplateExpression, quasi) == 36); // Padding: 2 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(TemplateElement, span) == 0); - assert!(offset_of!(TemplateElement, value) == 8); - assert!(offset_of!(TemplateElement, tail) == 24); - assert!(offset_of!(TemplateElement, lone_surrogates) == 25); + assert!(offset_of!(TemplateElement, value) == 24); + assert!(offset_of!(TemplateElement, tail) == 40); + assert!(offset_of!(TemplateElement, lone_surrogates) == 41); // Padding: 0 bytes assert!(size_of::() == 16); @@ -1718,117 +1718,117 @@ const _: () = { assert!(align_of::() == 4); // Padding: 3 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(ComputedMemberExpression, span) == 0); - assert!(offset_of!(ComputedMemberExpression, object) == 8); - assert!(offset_of!(ComputedMemberExpression, expression) == 16); - assert!(offset_of!(ComputedMemberExpression, optional) == 24); + assert!(offset_of!(ComputedMemberExpression, object) == 24); + assert!(offset_of!(ComputedMemberExpression, expression) == 32); + assert!(offset_of!(ComputedMemberExpression, optional) == 40); // Padding: 3 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 68); assert!(align_of::() == 4); assert!(offset_of!(StaticMemberExpression, span) == 0); - assert!(offset_of!(StaticMemberExpression, object) == 8); - assert!(offset_of!(StaticMemberExpression, property) == 16); - assert!(offset_of!(StaticMemberExpression, optional) == 32); + assert!(offset_of!(StaticMemberExpression, object) == 24); + assert!(offset_of!(StaticMemberExpression, property) == 32); + assert!(offset_of!(StaticMemberExpression, optional) == 64); // Padding: 3 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 68); assert!(align_of::() == 4); assert!(offset_of!(PrivateFieldExpression, span) == 0); - assert!(offset_of!(PrivateFieldExpression, object) == 8); - assert!(offset_of!(PrivateFieldExpression, field) == 16); - assert!(offset_of!(PrivateFieldExpression, optional) == 32); + assert!(offset_of!(PrivateFieldExpression, object) == 24); + assert!(offset_of!(PrivateFieldExpression, field) == 32); + assert!(offset_of!(PrivateFieldExpression, optional) == 64); // Padding: 2 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 4); assert!(offset_of!(CallExpression, span) == 0); - assert!(offset_of!(CallExpression, callee) == 8); - assert!(offset_of!(CallExpression, type_arguments) == 16); - assert!(offset_of!(CallExpression, arguments) == 20); - assert!(offset_of!(CallExpression, optional) == 36); - assert!(offset_of!(CallExpression, pure) == 37); + assert!(offset_of!(CallExpression, callee) == 24); + assert!(offset_of!(CallExpression, type_arguments) == 32); + assert!(offset_of!(CallExpression, arguments) == 36); + assert!(offset_of!(CallExpression, optional) == 52); + assert!(offset_of!(CallExpression, pure) == 53); // Padding: 3 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 4); assert!(offset_of!(NewExpression, span) == 0); - assert!(offset_of!(NewExpression, callee) == 8); - assert!(offset_of!(NewExpression, type_arguments) == 16); - assert!(offset_of!(NewExpression, arguments) == 20); - assert!(offset_of!(NewExpression, pure) == 36); + assert!(offset_of!(NewExpression, callee) == 24); + assert!(offset_of!(NewExpression, type_arguments) == 32); + assert!(offset_of!(NewExpression, arguments) == 36); + assert!(offset_of!(NewExpression, pure) == 52); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 88); assert!(align_of::() == 4); assert!(offset_of!(MetaProperty, span) == 0); - assert!(offset_of!(MetaProperty, meta) == 8); - assert!(offset_of!(MetaProperty, property) == 24); + assert!(offset_of!(MetaProperty, meta) == 24); + assert!(offset_of!(MetaProperty, property) == 56); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(SpreadElement, span) == 0); - assert!(offset_of!(SpreadElement, argument) == 8); + assert!(offset_of!(SpreadElement, argument) == 24); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 2 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(UpdateExpression, span) == 0); - assert!(offset_of!(UpdateExpression, operator) == 16); - assert!(offset_of!(UpdateExpression, prefix) == 17); - assert!(offset_of!(UpdateExpression, argument) == 8); + assert!(offset_of!(UpdateExpression, operator) == 32); + assert!(offset_of!(UpdateExpression, prefix) == 33); + assert!(offset_of!(UpdateExpression, argument) == 24); // Padding: 3 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(UnaryExpression, span) == 0); - assert!(offset_of!(UnaryExpression, operator) == 16); - assert!(offset_of!(UnaryExpression, argument) == 8); + assert!(offset_of!(UnaryExpression, operator) == 32); + assert!(offset_of!(UnaryExpression, argument) == 24); // Padding: 3 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(BinaryExpression, span) == 0); - assert!(offset_of!(BinaryExpression, left) == 8); - assert!(offset_of!(BinaryExpression, operator) == 24); - assert!(offset_of!(BinaryExpression, right) == 16); + assert!(offset_of!(BinaryExpression, left) == 24); + assert!(offset_of!(BinaryExpression, operator) == 40); + assert!(offset_of!(BinaryExpression, right) == 32); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 64); assert!(align_of::() == 4); assert!(offset_of!(PrivateInExpression, span) == 0); - assert!(offset_of!(PrivateInExpression, left) == 8); - assert!(offset_of!(PrivateInExpression, right) == 24); + assert!(offset_of!(PrivateInExpression, left) == 24); + assert!(offset_of!(PrivateInExpression, right) == 56); // Padding: 3 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(LogicalExpression, span) == 0); - assert!(offset_of!(LogicalExpression, left) == 8); - assert!(offset_of!(LogicalExpression, operator) == 24); - assert!(offset_of!(LogicalExpression, right) == 16); + assert!(offset_of!(LogicalExpression, left) == 24); + assert!(offset_of!(LogicalExpression, operator) == 40); + assert!(offset_of!(LogicalExpression, right) == 32); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(ConditionalExpression, span) == 0); - assert!(offset_of!(ConditionalExpression, test) == 8); - assert!(offset_of!(ConditionalExpression, consequent) == 16); - assert!(offset_of!(ConditionalExpression, alternate) == 24); + assert!(offset_of!(ConditionalExpression, test) == 24); + assert!(offset_of!(ConditionalExpression, consequent) == 32); + assert!(offset_of!(ConditionalExpression, alternate) == 40); // Padding: 3 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(AssignmentExpression, span) == 0); - assert!(offset_of!(AssignmentExpression, operator) == 24); - assert!(offset_of!(AssignmentExpression, left) == 8); - assert!(offset_of!(AssignmentExpression, right) == 16); + assert!(offset_of!(AssignmentExpression, operator) == 40); + assert!(offset_of!(AssignmentExpression, left) == 24); + assert!(offset_of!(AssignmentExpression, right) == 32); assert!(size_of::() == 8); assert!(align_of::() == 4); @@ -1840,276 +1840,276 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 72); assert!(align_of::() == 4); assert!(offset_of!(ArrayAssignmentTarget, span) == 0); - assert!(offset_of!(ArrayAssignmentTarget, elements) == 8); - assert!(offset_of!(ArrayAssignmentTarget, rest) == 24); + assert!(offset_of!(ArrayAssignmentTarget, elements) == 24); + assert!(offset_of!(ArrayAssignmentTarget, rest) == 40); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 72); assert!(align_of::() == 4); assert!(offset_of!(ObjectAssignmentTarget, span) == 0); - assert!(offset_of!(ObjectAssignmentTarget, properties) == 8); - assert!(offset_of!(ObjectAssignmentTarget, rest) == 24); + assert!(offset_of!(ObjectAssignmentTarget, properties) == 24); + assert!(offset_of!(ObjectAssignmentTarget, rest) == 40); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(AssignmentTargetRest, span) == 0); - assert!(offset_of!(AssignmentTargetRest, target) == 8); + assert!(offset_of!(AssignmentTargetRest, target) == 24); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(AssignmentTargetWithDefault, span) == 0); - assert!(offset_of!(AssignmentTargetWithDefault, binding) == 8); - assert!(offset_of!(AssignmentTargetWithDefault, init) == 16); + assert!(offset_of!(AssignmentTargetWithDefault, binding) == 24); + assert!(offset_of!(AssignmentTargetWithDefault, init) == 32); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 68); assert!(align_of::() == 4); assert!(offset_of!(AssignmentTargetPropertyIdentifier, span) == 0); - assert!(offset_of!(AssignmentTargetPropertyIdentifier, binding) == 8); - assert!(offset_of!(AssignmentTargetPropertyIdentifier, init) == 28); + assert!(offset_of!(AssignmentTargetPropertyIdentifier, binding) == 24); + assert!(offset_of!(AssignmentTargetPropertyIdentifier, init) == 60); // Padding: 3 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(AssignmentTargetPropertyProperty, span) == 0); - assert!(offset_of!(AssignmentTargetPropertyProperty, name) == 8); - assert!(offset_of!(AssignmentTargetPropertyProperty, binding) == 16); - assert!(offset_of!(AssignmentTargetPropertyProperty, computed) == 24); + assert!(offset_of!(AssignmentTargetPropertyProperty, name) == 24); + assert!(offset_of!(AssignmentTargetPropertyProperty, binding) == 32); + assert!(offset_of!(AssignmentTargetPropertyProperty, computed) == 40); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(SequenceExpression, span) == 0); - assert!(offset_of!(SequenceExpression, expressions) == 8); + assert!(offset_of!(SequenceExpression, expressions) == 24); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(Super, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(AwaitExpression, span) == 0); - assert!(offset_of!(AwaitExpression, argument) == 8); + assert!(offset_of!(AwaitExpression, argument) == 24); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(ChainExpression, span) == 0); - assert!(offset_of!(ChainExpression, expression) == 8); + assert!(offset_of!(ChainExpression, expression) == 24); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(ParenthesizedExpression, span) == 0); - assert!(offset_of!(ParenthesizedExpression, expression) == 8); + assert!(offset_of!(ParenthesizedExpression, expression) == 24); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 76); assert!(align_of::() == 4); assert!(offset_of!(Directive, span) == 0); - assert!(offset_of!(Directive, expression) == 8); - assert!(offset_of!(Directive, directive) == 36); + assert!(offset_of!(Directive, expression) == 24); + assert!(offset_of!(Directive, directive) == 68); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(Hashbang, span) == 0); - assert!(offset_of!(Hashbang, value) == 8); + assert!(offset_of!(Hashbang, value) == 24); // Padding: 0 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(BlockStatement, span) == 0); - assert!(offset_of!(BlockStatement, body) == 8); - assert!(offset_of!(BlockStatement, scope_id) == 24); + assert!(offset_of!(BlockStatement, body) == 24); + assert!(offset_of!(BlockStatement, scope_id) == 40); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 2 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(VariableDeclaration, span) == 0); - assert!(offset_of!(VariableDeclaration, kind) == 24); - assert!(offset_of!(VariableDeclaration, declarations) == 8); - assert!(offset_of!(VariableDeclaration, declare) == 25); + assert!(offset_of!(VariableDeclaration, kind) == 40); + assert!(offset_of!(VariableDeclaration, declarations) == 24); + assert!(offset_of!(VariableDeclaration, declare) == 41); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 2 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 52); assert!(align_of::() == 4); assert!(offset_of!(VariableDeclarator, span) == 0); - assert!(offset_of!(VariableDeclarator, kind) == 32); - assert!(offset_of!(VariableDeclarator, id) == 8); - assert!(offset_of!(VariableDeclarator, init) == 24); - assert!(offset_of!(VariableDeclarator, definite) == 33); + assert!(offset_of!(VariableDeclarator, kind) == 48); + assert!(offset_of!(VariableDeclarator, id) == 24); + assert!(offset_of!(VariableDeclarator, init) == 40); + assert!(offset_of!(VariableDeclarator, definite) == 49); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(EmptyStatement, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(ExpressionStatement, span) == 0); - assert!(offset_of!(ExpressionStatement, expression) == 8); + assert!(offset_of!(ExpressionStatement, expression) == 24); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(IfStatement, span) == 0); - assert!(offset_of!(IfStatement, test) == 8); - assert!(offset_of!(IfStatement, consequent) == 16); - assert!(offset_of!(IfStatement, alternate) == 24); + assert!(offset_of!(IfStatement, test) == 24); + assert!(offset_of!(IfStatement, consequent) == 32); + assert!(offset_of!(IfStatement, alternate) == 40); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(DoWhileStatement, span) == 0); - assert!(offset_of!(DoWhileStatement, body) == 8); - assert!(offset_of!(DoWhileStatement, test) == 16); + assert!(offset_of!(DoWhileStatement, body) == 24); + assert!(offset_of!(DoWhileStatement, test) == 32); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(WhileStatement, span) == 0); - assert!(offset_of!(WhileStatement, test) == 8); - assert!(offset_of!(WhileStatement, body) == 16); + assert!(offset_of!(WhileStatement, test) == 24); + assert!(offset_of!(WhileStatement, body) == 32); // Padding: 0 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 60); assert!(align_of::() == 4); assert!(offset_of!(ForStatement, span) == 0); - assert!(offset_of!(ForStatement, init) == 8); - assert!(offset_of!(ForStatement, test) == 16); - assert!(offset_of!(ForStatement, update) == 24); - assert!(offset_of!(ForStatement, body) == 32); - assert!(offset_of!(ForStatement, scope_id) == 40); + assert!(offset_of!(ForStatement, init) == 24); + assert!(offset_of!(ForStatement, test) == 32); + assert!(offset_of!(ForStatement, update) == 40); + assert!(offset_of!(ForStatement, body) == 48); + assert!(offset_of!(ForStatement, scope_id) == 56); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 52); assert!(align_of::() == 4); assert!(offset_of!(ForInStatement, span) == 0); - assert!(offset_of!(ForInStatement, left) == 8); - assert!(offset_of!(ForInStatement, right) == 16); - assert!(offset_of!(ForInStatement, body) == 24); - assert!(offset_of!(ForInStatement, scope_id) == 32); + assert!(offset_of!(ForInStatement, left) == 24); + assert!(offset_of!(ForInStatement, right) == 32); + assert!(offset_of!(ForInStatement, body) == 40); + assert!(offset_of!(ForInStatement, scope_id) == 48); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 3 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 4); assert!(offset_of!(ForOfStatement, span) == 0); - assert!(offset_of!(ForOfStatement, r#await) == 36); - assert!(offset_of!(ForOfStatement, left) == 8); - assert!(offset_of!(ForOfStatement, right) == 16); - assert!(offset_of!(ForOfStatement, body) == 24); - assert!(offset_of!(ForOfStatement, scope_id) == 32); + assert!(offset_of!(ForOfStatement, r#await) == 52); + assert!(offset_of!(ForOfStatement, left) == 24); + assert!(offset_of!(ForOfStatement, right) == 32); + assert!(offset_of!(ForOfStatement, body) == 40); + assert!(offset_of!(ForOfStatement, scope_id) == 48); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 56); assert!(align_of::() == 4); assert!(offset_of!(ContinueStatement, span) == 0); - assert!(offset_of!(ContinueStatement, label) == 8); + assert!(offset_of!(ContinueStatement, label) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 56); assert!(align_of::() == 4); assert!(offset_of!(BreakStatement, span) == 0); - assert!(offset_of!(BreakStatement, label) == 8); + assert!(offset_of!(BreakStatement, label) == 24); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(ReturnStatement, span) == 0); - assert!(offset_of!(ReturnStatement, argument) == 8); + assert!(offset_of!(ReturnStatement, argument) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(WithStatement, span) == 0); - assert!(offset_of!(WithStatement, object) == 8); - assert!(offset_of!(WithStatement, body) == 16); + assert!(offset_of!(WithStatement, object) == 24); + assert!(offset_of!(WithStatement, body) == 32); // Padding: 0 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 52); assert!(align_of::() == 4); assert!(offset_of!(SwitchStatement, span) == 0); - assert!(offset_of!(SwitchStatement, discriminant) == 8); - assert!(offset_of!(SwitchStatement, cases) == 16); - assert!(offset_of!(SwitchStatement, scope_id) == 32); + assert!(offset_of!(SwitchStatement, discriminant) == 24); + assert!(offset_of!(SwitchStatement, cases) == 32); + assert!(offset_of!(SwitchStatement, scope_id) == 48); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(SwitchCase, span) == 0); - assert!(offset_of!(SwitchCase, test) == 8); - assert!(offset_of!(SwitchCase, consequent) == 16); + assert!(offset_of!(SwitchCase, test) == 24); + assert!(offset_of!(SwitchCase, consequent) == 32); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 64); assert!(align_of::() == 4); assert!(offset_of!(LabeledStatement, span) == 0); - assert!(offset_of!(LabeledStatement, label) == 8); - assert!(offset_of!(LabeledStatement, body) == 24); + assert!(offset_of!(LabeledStatement, label) == 24); + assert!(offset_of!(LabeledStatement, body) == 56); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(ThrowStatement, span) == 0); - assert!(offset_of!(ThrowStatement, argument) == 8); + assert!(offset_of!(ThrowStatement, argument) == 24); // Padding: 0 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(TryStatement, span) == 0); - assert!(offset_of!(TryStatement, block) == 8); - assert!(offset_of!(TryStatement, handler) == 12); - assert!(offset_of!(TryStatement, finalizer) == 16); + assert!(offset_of!(TryStatement, block) == 24); + assert!(offset_of!(TryStatement, handler) == 28); + assert!(offset_of!(TryStatement, finalizer) == 32); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 72); assert!(align_of::() == 4); assert!(offset_of!(CatchClause, span) == 0); - assert!(offset_of!(CatchClause, param) == 8); - assert!(offset_of!(CatchClause, body) == 32); - assert!(offset_of!(CatchClause, scope_id) == 36); + assert!(offset_of!(CatchClause, param) == 24); + assert!(offset_of!(CatchClause, body) == 64); + assert!(offset_of!(CatchClause, scope_id) == 68); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(CatchParameter, span) == 0); - assert!(offset_of!(CatchParameter, pattern) == 8); + assert!(offset_of!(CatchParameter, pattern) == 24); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(DebuggerStatement, span) == 0); @@ -2124,172 +2124,172 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(AssignmentPattern, span) == 0); - assert!(offset_of!(AssignmentPattern, left) == 8); - assert!(offset_of!(AssignmentPattern, right) == 24); + assert!(offset_of!(AssignmentPattern, left) == 24); + assert!(offset_of!(AssignmentPattern, right) == 40); // Padding: 0 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(ObjectPattern, span) == 0); - assert!(offset_of!(ObjectPattern, properties) == 8); - assert!(offset_of!(ObjectPattern, rest) == 24); + assert!(offset_of!(ObjectPattern, properties) == 24); + assert!(offset_of!(ObjectPattern, rest) == 40); // Padding: 2 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 52); assert!(align_of::() == 4); assert!(offset_of!(BindingProperty, span) == 0); - assert!(offset_of!(BindingProperty, key) == 8); - assert!(offset_of!(BindingProperty, value) == 16); - assert!(offset_of!(BindingProperty, shorthand) == 32); - assert!(offset_of!(BindingProperty, computed) == 33); + assert!(offset_of!(BindingProperty, key) == 24); + assert!(offset_of!(BindingProperty, value) == 32); + assert!(offset_of!(BindingProperty, shorthand) == 48); + assert!(offset_of!(BindingProperty, computed) == 49); // Padding: 0 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(ArrayPattern, span) == 0); - assert!(offset_of!(ArrayPattern, elements) == 8); - assert!(offset_of!(ArrayPattern, rest) == 24); + assert!(offset_of!(ArrayPattern, elements) == 24); + assert!(offset_of!(ArrayPattern, rest) == 40); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(BindingRestElement, span) == 0); - assert!(offset_of!(BindingRestElement, argument) == 8); + assert!(offset_of!(BindingRestElement, argument) == 24); // Padding: 3 bytes - assert!(size_of::() == 60); + assert!(size_of::() == 92); assert!(align_of::() == 4); assert!(offset_of!(Function, span) == 0); - assert!(offset_of!(Function, r#type) == 52); - assert!(offset_of!(Function, id) == 8); - assert!(offset_of!(Function, generator) == 53); - assert!(offset_of!(Function, r#async) == 54); - assert!(offset_of!(Function, declare) == 55); - assert!(offset_of!(Function, type_parameters) == 28); - assert!(offset_of!(Function, this_param) == 32); - assert!(offset_of!(Function, params) == 36); - assert!(offset_of!(Function, return_type) == 40); - assert!(offset_of!(Function, body) == 44); - assert!(offset_of!(Function, scope_id) == 48); - assert!(offset_of!(Function, pure) == 56); + assert!(offset_of!(Function, r#type) == 84); + assert!(offset_of!(Function, id) == 24); + assert!(offset_of!(Function, generator) == 85); + assert!(offset_of!(Function, r#async) == 86); + assert!(offset_of!(Function, declare) == 87); + assert!(offset_of!(Function, type_parameters) == 60); + assert!(offset_of!(Function, this_param) == 64); + assert!(offset_of!(Function, params) == 68); + assert!(offset_of!(Function, return_type) == 72); + assert!(offset_of!(Function, body) == 76); + assert!(offset_of!(Function, scope_id) == 80); + assert!(offset_of!(Function, pure) == 88); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 3 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(FormalParameters, span) == 0); - assert!(offset_of!(FormalParameters, kind) == 28); - assert!(offset_of!(FormalParameters, items) == 8); - assert!(offset_of!(FormalParameters, rest) == 24); + assert!(offset_of!(FormalParameters, kind) == 44); + assert!(offset_of!(FormalParameters, items) == 24); + assert!(offset_of!(FormalParameters, rest) == 40); // Padding: 1 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 60); assert!(align_of::() == 4); assert!(offset_of!(FormalParameter, span) == 0); - assert!(offset_of!(FormalParameter, decorators) == 8); - assert!(offset_of!(FormalParameter, pattern) == 24); - assert!(offset_of!(FormalParameter, accessibility) == 40); - assert!(offset_of!(FormalParameter, readonly) == 41); - assert!(offset_of!(FormalParameter, r#override) == 42); + assert!(offset_of!(FormalParameter, decorators) == 24); + assert!(offset_of!(FormalParameter, pattern) == 40); + assert!(offset_of!(FormalParameter, accessibility) == 56); + assert!(offset_of!(FormalParameter, readonly) == 57); + assert!(offset_of!(FormalParameter, r#override) == 58); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 4); assert!(offset_of!(FunctionBody, span) == 0); - assert!(offset_of!(FunctionBody, directives) == 8); - assert!(offset_of!(FunctionBody, statements) == 24); + assert!(offset_of!(FunctionBody, directives) == 24); + assert!(offset_of!(FunctionBody, statements) == 40); // Padding: 1 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(ArrowFunctionExpression, span) == 0); - assert!(offset_of!(ArrowFunctionExpression, expression) == 28); - assert!(offset_of!(ArrowFunctionExpression, r#async) == 29); - assert!(offset_of!(ArrowFunctionExpression, type_parameters) == 8); - assert!(offset_of!(ArrowFunctionExpression, params) == 12); - assert!(offset_of!(ArrowFunctionExpression, return_type) == 16); - assert!(offset_of!(ArrowFunctionExpression, body) == 20); - assert!(offset_of!(ArrowFunctionExpression, scope_id) == 24); - assert!(offset_of!(ArrowFunctionExpression, pure) == 30); + assert!(offset_of!(ArrowFunctionExpression, expression) == 44); + assert!(offset_of!(ArrowFunctionExpression, r#async) == 45); + assert!(offset_of!(ArrowFunctionExpression, type_parameters) == 24); + assert!(offset_of!(ArrowFunctionExpression, params) == 28); + assert!(offset_of!(ArrowFunctionExpression, return_type) == 32); + assert!(offset_of!(ArrowFunctionExpression, body) == 36); + assert!(offset_of!(ArrowFunctionExpression, scope_id) == 40); + assert!(offset_of!(ArrowFunctionExpression, pure) == 46); // Padding: 3 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(YieldExpression, span) == 0); - assert!(offset_of!(YieldExpression, delegate) == 16); - assert!(offset_of!(YieldExpression, argument) == 8); + assert!(offset_of!(YieldExpression, delegate) == 32); + assert!(offset_of!(YieldExpression, argument) == 24); // Padding: 1 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 120); assert!(align_of::() == 4); assert!(offset_of!(Class, span) == 0); - assert!(offset_of!(Class, r#type) == 84); - assert!(offset_of!(Class, decorators) == 8); - assert!(offset_of!(Class, id) == 24); - assert!(offset_of!(Class, type_parameters) == 44); - assert!(offset_of!(Class, super_class) == 48); - assert!(offset_of!(Class, super_type_arguments) == 56); - assert!(offset_of!(Class, implements) == 60); - assert!(offset_of!(Class, body) == 76); - assert!(offset_of!(Class, r#abstract) == 85); - assert!(offset_of!(Class, declare) == 86); - assert!(offset_of!(Class, scope_id) == 80); + assert!(offset_of!(Class, r#type) == 116); + assert!(offset_of!(Class, decorators) == 24); + assert!(offset_of!(Class, id) == 40); + assert!(offset_of!(Class, type_parameters) == 76); + assert!(offset_of!(Class, super_class) == 80); + assert!(offset_of!(Class, super_type_arguments) == 88); + assert!(offset_of!(Class, implements) == 92); + assert!(offset_of!(Class, body) == 108); + assert!(offset_of!(Class, r#abstract) == 117); + assert!(offset_of!(Class, declare) == 118); + assert!(offset_of!(Class, scope_id) == 112); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(ClassBody, span) == 0); - assert!(offset_of!(ClassBody, body) == 8); + assert!(offset_of!(ClassBody, body) == 24); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 1 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 60); assert!(align_of::() == 4); assert!(offset_of!(MethodDefinition, span) == 0); - assert!(offset_of!(MethodDefinition, r#type) == 36); - assert!(offset_of!(MethodDefinition, decorators) == 8); - assert!(offset_of!(MethodDefinition, key) == 24); - assert!(offset_of!(MethodDefinition, value) == 32); - assert!(offset_of!(MethodDefinition, kind) == 37); - assert!(offset_of!(MethodDefinition, computed) == 38); - assert!(offset_of!(MethodDefinition, r#static) == 39); - assert!(offset_of!(MethodDefinition, r#override) == 40); - assert!(offset_of!(MethodDefinition, optional) == 41); - assert!(offset_of!(MethodDefinition, accessibility) == 42); + assert!(offset_of!(MethodDefinition, r#type) == 52); + assert!(offset_of!(MethodDefinition, decorators) == 24); + assert!(offset_of!(MethodDefinition, key) == 40); + assert!(offset_of!(MethodDefinition, value) == 48); + assert!(offset_of!(MethodDefinition, kind) == 53); + assert!(offset_of!(MethodDefinition, computed) == 54); + assert!(offset_of!(MethodDefinition, r#static) == 55); + assert!(offset_of!(MethodDefinition, r#override) == 56); + assert!(offset_of!(MethodDefinition, optional) == 57); + assert!(offset_of!(MethodDefinition, accessibility) == 58); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 3 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 72); assert!(align_of::() == 4); assert!(offset_of!(PropertyDefinition, span) == 0); - assert!(offset_of!(PropertyDefinition, r#type) == 44); - assert!(offset_of!(PropertyDefinition, decorators) == 8); - assert!(offset_of!(PropertyDefinition, key) == 24); - assert!(offset_of!(PropertyDefinition, type_annotation) == 32); - assert!(offset_of!(PropertyDefinition, value) == 36); - assert!(offset_of!(PropertyDefinition, computed) == 45); - assert!(offset_of!(PropertyDefinition, r#static) == 46); - assert!(offset_of!(PropertyDefinition, declare) == 47); - assert!(offset_of!(PropertyDefinition, r#override) == 48); - assert!(offset_of!(PropertyDefinition, optional) == 49); - assert!(offset_of!(PropertyDefinition, definite) == 50); - assert!(offset_of!(PropertyDefinition, readonly) == 51); - assert!(offset_of!(PropertyDefinition, accessibility) == 52); + assert!(offset_of!(PropertyDefinition, r#type) == 60); + assert!(offset_of!(PropertyDefinition, decorators) == 24); + assert!(offset_of!(PropertyDefinition, key) == 40); + assert!(offset_of!(PropertyDefinition, type_annotation) == 48); + assert!(offset_of!(PropertyDefinition, value) == 52); + assert!(offset_of!(PropertyDefinition, computed) == 61); + assert!(offset_of!(PropertyDefinition, r#static) == 62); + assert!(offset_of!(PropertyDefinition, declare) == 63); + assert!(offset_of!(PropertyDefinition, r#override) == 64); + assert!(offset_of!(PropertyDefinition, optional) == 65); + assert!(offset_of!(PropertyDefinition, definite) == 66); + assert!(offset_of!(PropertyDefinition, readonly) == 67); + assert!(offset_of!(PropertyDefinition, accessibility) == 68); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -2298,17 +2298,17 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(PrivateIdentifier, span) == 0); - assert!(offset_of!(PrivateIdentifier, name) == 8); + assert!(offset_of!(PrivateIdentifier, name) == 24); // Padding: 0 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(StaticBlock, span) == 0); - assert!(offset_of!(StaticBlock, body) == 8); - assert!(offset_of!(StaticBlock, scope_id) == 24); + assert!(offset_of!(StaticBlock, body) == 24); + assert!(offset_of!(StaticBlock, scope_id) == 40); assert!(size_of::() == 8); assert!(align_of::() == 4); @@ -2317,37 +2317,37 @@ const _: () = { assert!(align_of::() == 1); // Padding: 2 bytes - assert!(size_of::() == 52); + assert!(size_of::() == 68); assert!(align_of::() == 4); assert!(offset_of!(AccessorProperty, span) == 0); - assert!(offset_of!(AccessorProperty, r#type) == 44); - assert!(offset_of!(AccessorProperty, decorators) == 8); - assert!(offset_of!(AccessorProperty, key) == 24); - assert!(offset_of!(AccessorProperty, type_annotation) == 32); - assert!(offset_of!(AccessorProperty, value) == 36); - assert!(offset_of!(AccessorProperty, computed) == 45); - assert!(offset_of!(AccessorProperty, r#static) == 46); - assert!(offset_of!(AccessorProperty, r#override) == 47); - assert!(offset_of!(AccessorProperty, definite) == 48); - assert!(offset_of!(AccessorProperty, accessibility) == 49); + assert!(offset_of!(AccessorProperty, r#type) == 60); + assert!(offset_of!(AccessorProperty, decorators) == 24); + assert!(offset_of!(AccessorProperty, key) == 40); + assert!(offset_of!(AccessorProperty, type_annotation) == 48); + assert!(offset_of!(AccessorProperty, value) == 52); + assert!(offset_of!(AccessorProperty, computed) == 61); + assert!(offset_of!(AccessorProperty, r#static) == 62); + assert!(offset_of!(AccessorProperty, r#override) == 63); + assert!(offset_of!(AccessorProperty, definite) == 64); + assert!(offset_of!(AccessorProperty, accessibility) == 65); // Padding: 3 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(ImportExpression, span) == 0); - assert!(offset_of!(ImportExpression, source) == 8); - assert!(offset_of!(ImportExpression, options) == 16); - assert!(offset_of!(ImportExpression, phase) == 24); + assert!(offset_of!(ImportExpression, source) == 24); + assert!(offset_of!(ImportExpression, options) == 32); + assert!(offset_of!(ImportExpression, phase) == 40); // Padding: 2 bytes - assert!(size_of::() == 60); + assert!(size_of::() == 92); assert!(align_of::() == 4); assert!(offset_of!(ImportDeclaration, span) == 0); - assert!(offset_of!(ImportDeclaration, specifiers) == 8); - assert!(offset_of!(ImportDeclaration, source) == 24); - assert!(offset_of!(ImportDeclaration, phase) == 56); - assert!(offset_of!(ImportDeclaration, with_clause) == 52); - assert!(offset_of!(ImportDeclaration, import_kind) == 57); + assert!(offset_of!(ImportDeclaration, specifiers) == 24); + assert!(offset_of!(ImportDeclaration, source) == 40); + assert!(offset_of!(ImportDeclaration, phase) == 88); + assert!(offset_of!(ImportDeclaration, with_clause) == 84); + assert!(offset_of!(ImportDeclaration, import_kind) == 89); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -2356,130 +2356,130 @@ const _: () = { assert!(align_of::() == 4); // Padding: 3 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 112); assert!(align_of::() == 4); assert!(offset_of!(ImportSpecifier, span) == 0); - assert!(offset_of!(ImportSpecifier, imported) == 8); - assert!(offset_of!(ImportSpecifier, local) == 40); - assert!(offset_of!(ImportSpecifier, import_kind) == 60); + assert!(offset_of!(ImportSpecifier, imported) == 24); + assert!(offset_of!(ImportSpecifier, local) == 72); + assert!(offset_of!(ImportSpecifier, import_kind) == 108); // Padding: 0 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 60); assert!(align_of::() == 4); assert!(offset_of!(ImportDefaultSpecifier, span) == 0); - assert!(offset_of!(ImportDefaultSpecifier, local) == 8); + assert!(offset_of!(ImportDefaultSpecifier, local) == 24); // Padding: 0 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 60); assert!(align_of::() == 4); assert!(offset_of!(ImportNamespaceSpecifier, span) == 0); - assert!(offset_of!(ImportNamespaceSpecifier, local) == 8); + assert!(offset_of!(ImportNamespaceSpecifier, local) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 72); assert!(align_of::() == 4); assert!(offset_of!(WithClause, span) == 0); - assert!(offset_of!(WithClause, attributes_keyword) == 8); - assert!(offset_of!(WithClause, with_entries) == 24); + assert!(offset_of!(WithClause, attributes_keyword) == 24); + assert!(offset_of!(WithClause, with_entries) == 56); // Padding: 0 bytes - assert!(size_of::() == 68); + assert!(size_of::() == 116); assert!(align_of::() == 4); assert!(offset_of!(ImportAttribute, span) == 0); - assert!(offset_of!(ImportAttribute, key) == 8); - assert!(offset_of!(ImportAttribute, value) == 40); + assert!(offset_of!(ImportAttribute, key) == 24); + assert!(offset_of!(ImportAttribute, value) == 72); - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 4); // Padding: 3 bytes - assert!(size_of::() == 68); + assert!(size_of::() == 100); assert!(align_of::() == 4); assert!(offset_of!(ExportNamedDeclaration, span) == 0); - assert!(offset_of!(ExportNamedDeclaration, declaration) == 8); - assert!(offset_of!(ExportNamedDeclaration, specifiers) == 16); - assert!(offset_of!(ExportNamedDeclaration, source) == 32); - assert!(offset_of!(ExportNamedDeclaration, export_kind) == 64); - assert!(offset_of!(ExportNamedDeclaration, with_clause) == 60); + assert!(offset_of!(ExportNamedDeclaration, declaration) == 24); + assert!(offset_of!(ExportNamedDeclaration, specifiers) == 32); + assert!(offset_of!(ExportNamedDeclaration, source) == 48); + assert!(offset_of!(ExportNamedDeclaration, export_kind) == 96); + assert!(offset_of!(ExportNamedDeclaration, with_clause) == 92); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 80); assert!(align_of::() == 4); assert!(offset_of!(ExportDefaultDeclaration, span) == 0); - assert!(offset_of!(ExportDefaultDeclaration, exported) == 8); - assert!(offset_of!(ExportDefaultDeclaration, declaration) == 40); + assert!(offset_of!(ExportDefaultDeclaration, exported) == 24); + assert!(offset_of!(ExportDefaultDeclaration, declaration) == 72); // Padding: 3 bytes - assert!(size_of::() == 76); + assert!(size_of::() == 124); assert!(align_of::() == 4); assert!(offset_of!(ExportAllDeclaration, span) == 0); - assert!(offset_of!(ExportAllDeclaration, exported) == 8); - assert!(offset_of!(ExportAllDeclaration, source) == 40); - assert!(offset_of!(ExportAllDeclaration, with_clause) == 68); - assert!(offset_of!(ExportAllDeclaration, export_kind) == 72); + assert!(offset_of!(ExportAllDeclaration, exported) == 24); + assert!(offset_of!(ExportAllDeclaration, source) == 72); + assert!(offset_of!(ExportAllDeclaration, with_clause) == 116); + assert!(offset_of!(ExportAllDeclaration, export_kind) == 120); // Padding: 3 bytes - assert!(size_of::() == 76); + assert!(size_of::() == 124); assert!(align_of::() == 4); assert!(offset_of!(ExportSpecifier, span) == 0); - assert!(offset_of!(ExportSpecifier, local) == 8); - assert!(offset_of!(ExportSpecifier, exported) == 40); - assert!(offset_of!(ExportSpecifier, export_kind) == 72); + assert!(offset_of!(ExportSpecifier, local) == 24); + assert!(offset_of!(ExportSpecifier, exported) == 72); + assert!(offset_of!(ExportSpecifier, export_kind) == 120); assert!(size_of::() == 8); assert!(align_of::() == 4); - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 72); assert!(align_of::() == 4); assert!(offset_of!(V8IntrinsicExpression, span) == 0); - assert!(offset_of!(V8IntrinsicExpression, name) == 8); - assert!(offset_of!(V8IntrinsicExpression, arguments) == 24); + assert!(offset_of!(V8IntrinsicExpression, name) == 24); + assert!(offset_of!(V8IntrinsicExpression, arguments) == 56); // Padding: 3 bytes - assert!(size_of::() == 12); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(BooleanLiteral, span) == 0); - assert!(offset_of!(BooleanLiteral, value) == 8); + assert!(offset_of!(BooleanLiteral, value) == 24); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(NullLiteral, span) == 0); // Padding: 7 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(NumericLiteral, span) == 0); - assert!(offset_of!(NumericLiteral, value) == 8); - assert!(offset_of!(NumericLiteral, raw) == 16); - assert!(offset_of!(NumericLiteral, base) == 24); + assert!(offset_of!(NumericLiteral, value) == 24); + assert!(offset_of!(NumericLiteral, raw) == 32); + assert!(offset_of!(NumericLiteral, base) == 40); // Padding: 3 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(StringLiteral, span) == 0); - assert!(offset_of!(StringLiteral, value) == 8); - assert!(offset_of!(StringLiteral, raw) == 16); - assert!(offset_of!(StringLiteral, lone_surrogates) == 24); + assert!(offset_of!(StringLiteral, value) == 24); + assert!(offset_of!(StringLiteral, raw) == 32); + assert!(offset_of!(StringLiteral, lone_surrogates) == 40); // Padding: 3 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(BigIntLiteral, span) == 0); - assert!(offset_of!(BigIntLiteral, value) == 8); - assert!(offset_of!(BigIntLiteral, raw) == 16); - assert!(offset_of!(BigIntLiteral, base) == 24); + assert!(offset_of!(BigIntLiteral, value) == 24); + assert!(offset_of!(BigIntLiteral, raw) == 32); + assert!(offset_of!(BigIntLiteral, base) == 40); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(RegExpLiteral, span) == 0); - assert!(offset_of!(RegExpLiteral, regex) == 8); - assert!(offset_of!(RegExpLiteral, raw) == 24); + assert!(offset_of!(RegExpLiteral, regex) == 24); + assert!(offset_of!(RegExpLiteral, raw) == 40); // Padding: 3 bytes assert!(size_of::() == 16); @@ -2498,42 +2498,42 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(JSXElement, span) == 0); - assert!(offset_of!(JSXElement, opening_element) == 8); - assert!(offset_of!(JSXElement, children) == 12); - assert!(offset_of!(JSXElement, closing_element) == 28); + assert!(offset_of!(JSXElement, opening_element) == 24); + assert!(offset_of!(JSXElement, children) == 28); + assert!(offset_of!(JSXElement, closing_element) == 44); // Padding: 0 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 52); assert!(align_of::() == 4); assert!(offset_of!(JSXOpeningElement, span) == 0); - assert!(offset_of!(JSXOpeningElement, name) == 8); - assert!(offset_of!(JSXOpeningElement, type_arguments) == 16); - assert!(offset_of!(JSXOpeningElement, attributes) == 20); + assert!(offset_of!(JSXOpeningElement, name) == 24); + assert!(offset_of!(JSXOpeningElement, type_arguments) == 32); + assert!(offset_of!(JSXOpeningElement, attributes) == 36); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(JSXClosingElement, span) == 0); - assert!(offset_of!(JSXClosingElement, name) == 8); + assert!(offset_of!(JSXClosingElement, name) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 88); assert!(align_of::() == 4); assert!(offset_of!(JSXFragment, span) == 0); - assert!(offset_of!(JSXFragment, opening_fragment) == 8); - assert!(offset_of!(JSXFragment, children) == 16); - assert!(offset_of!(JSXFragment, closing_fragment) == 32); + assert!(offset_of!(JSXFragment, opening_fragment) == 24); + assert!(offset_of!(JSXFragment, children) == 48); + assert!(offset_of!(JSXFragment, closing_fragment) == 64); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(JSXOpeningFragment, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(JSXClosingFragment, span) == 0); @@ -2541,33 +2541,33 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 88); assert!(align_of::() == 4); assert!(offset_of!(JSXNamespacedName, span) == 0); - assert!(offset_of!(JSXNamespacedName, namespace) == 8); - assert!(offset_of!(JSXNamespacedName, name) == 24); + assert!(offset_of!(JSXNamespacedName, namespace) == 24); + assert!(offset_of!(JSXNamespacedName, name) == 56); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 64); assert!(align_of::() == 4); assert!(offset_of!(JSXMemberExpression, span) == 0); - assert!(offset_of!(JSXMemberExpression, object) == 8); - assert!(offset_of!(JSXMemberExpression, property) == 16); + assert!(offset_of!(JSXMemberExpression, object) == 24); + assert!(offset_of!(JSXMemberExpression, property) == 32); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 52); assert!(align_of::() == 4); assert!(offset_of!(JSXExpressionContainer, span) == 0); - assert!(offset_of!(JSXExpressionContainer, expression) == 8); + assert!(offset_of!(JSXExpressionContainer, expression) == 24); - assert!(size_of::() == 12); + assert!(size_of::() == 28); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(JSXEmptyExpression, span) == 0); @@ -2575,17 +2575,17 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(JSXAttribute, span) == 0); - assert!(offset_of!(JSXAttribute, name) == 8); - assert!(offset_of!(JSXAttribute, value) == 16); + assert!(offset_of!(JSXAttribute, name) == 24); + assert!(offset_of!(JSXAttribute, value) == 32); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(JSXSpreadAttribute, span) == 0); - assert!(offset_of!(JSXSpreadAttribute, argument) == 8); + assert!(offset_of!(JSXSpreadAttribute, argument) == 24); assert!(size_of::() == 8); assert!(align_of::() == 4); @@ -2594,71 +2594,71 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(JSXIdentifier, span) == 0); - assert!(offset_of!(JSXIdentifier, name) == 8); + assert!(offset_of!(JSXIdentifier, name) == 24); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(JSXSpreadChild, span) == 0); - assert!(offset_of!(JSXSpreadChild, expression) == 8); + assert!(offset_of!(JSXSpreadChild, expression) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(JSXText, span) == 0); - assert!(offset_of!(JSXText, value) == 8); - assert!(offset_of!(JSXText, raw) == 16); + assert!(offset_of!(JSXText, value) == 24); + assert!(offset_of!(JSXText, raw) == 32); // Padding: 0 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 52); assert!(align_of::() == 4); assert!(offset_of!(TSThisParameter, span) == 0); - assert!(offset_of!(TSThisParameter, this_span) == 8); - assert!(offset_of!(TSThisParameter, type_annotation) == 16); + assert!(offset_of!(TSThisParameter, this_span) == 24); + assert!(offset_of!(TSThisParameter, type_annotation) == 48); // Padding: 2 bytes - assert!(size_of::() == 60); + assert!(size_of::() == 108); assert!(align_of::() == 4); assert!(offset_of!(TSEnumDeclaration, span) == 0); - assert!(offset_of!(TSEnumDeclaration, id) == 8); - assert!(offset_of!(TSEnumDeclaration, body) == 28); - assert!(offset_of!(TSEnumDeclaration, r#const) == 56); - assert!(offset_of!(TSEnumDeclaration, declare) == 57); - assert!(offset_of!(TSEnumDeclaration, scope_id) == 52); + assert!(offset_of!(TSEnumDeclaration, id) == 24); + assert!(offset_of!(TSEnumDeclaration, body) == 60); + assert!(offset_of!(TSEnumDeclaration, r#const) == 104); + assert!(offset_of!(TSEnumDeclaration, declare) == 105); + assert!(offset_of!(TSEnumDeclaration, scope_id) == 100); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSEnumBody, span) == 0); - assert!(offset_of!(TSEnumBody, members) == 8); + assert!(offset_of!(TSEnumBody, members) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSEnumMember, span) == 0); - assert!(offset_of!(TSEnumMember, id) == 8); - assert!(offset_of!(TSEnumMember, initializer) == 16); + assert!(offset_of!(TSEnumMember, id) == 24); + assert!(offset_of!(TSEnumMember, initializer) == 32); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(TSTypeAnnotation, span) == 0); - assert!(offset_of!(TSTypeAnnotation, type_annotation) == 8); + assert!(offset_of!(TSTypeAnnotation, type_annotation) == 24); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(TSLiteralType, span) == 0); - assert!(offset_of!(TSLiteralType, literal) == 8); + assert!(offset_of!(TSLiteralType, literal) == 24); assert!(size_of::() == 8); assert!(align_of::() == 4); @@ -2667,499 +2667,499 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 60); assert!(align_of::() == 4); assert!(offset_of!(TSConditionalType, span) == 0); - assert!(offset_of!(TSConditionalType, check_type) == 8); - assert!(offset_of!(TSConditionalType, extends_type) == 16); - assert!(offset_of!(TSConditionalType, true_type) == 24); - assert!(offset_of!(TSConditionalType, false_type) == 32); - assert!(offset_of!(TSConditionalType, scope_id) == 40); + assert!(offset_of!(TSConditionalType, check_type) == 24); + assert!(offset_of!(TSConditionalType, extends_type) == 32); + assert!(offset_of!(TSConditionalType, true_type) == 40); + assert!(offset_of!(TSConditionalType, false_type) == 48); + assert!(offset_of!(TSConditionalType, scope_id) == 56); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSUnionType, span) == 0); - assert!(offset_of!(TSUnionType, types) == 8); + assert!(offset_of!(TSUnionType, types) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSIntersectionType, span) == 0); - assert!(offset_of!(TSIntersectionType, types) == 8); + assert!(offset_of!(TSIntersectionType, types) == 24); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(TSParenthesizedType, span) == 0); - assert!(offset_of!(TSParenthesizedType, type_annotation) == 8); + assert!(offset_of!(TSParenthesizedType, type_annotation) == 24); // Padding: 3 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(TSTypeOperator, span) == 0); - assert!(offset_of!(TSTypeOperator, operator) == 16); - assert!(offset_of!(TSTypeOperator, type_annotation) == 8); + assert!(offset_of!(TSTypeOperator, operator) == 32); + assert!(offset_of!(TSTypeOperator, type_annotation) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(TSArrayType, span) == 0); - assert!(offset_of!(TSArrayType, element_type) == 8); + assert!(offset_of!(TSArrayType, element_type) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSIndexedAccessType, span) == 0); - assert!(offset_of!(TSIndexedAccessType, object_type) == 8); - assert!(offset_of!(TSIndexedAccessType, index_type) == 16); + assert!(offset_of!(TSIndexedAccessType, object_type) == 24); + assert!(offset_of!(TSIndexedAccessType, index_type) == 32); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSTupleType, span) == 0); - assert!(offset_of!(TSTupleType, element_types) == 8); + assert!(offset_of!(TSTupleType, element_types) == 24); // Padding: 3 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 68); assert!(align_of::() == 4); assert!(offset_of!(TSNamedTupleMember, span) == 0); - assert!(offset_of!(TSNamedTupleMember, label) == 8); - assert!(offset_of!(TSNamedTupleMember, element_type) == 24); - assert!(offset_of!(TSNamedTupleMember, optional) == 32); + assert!(offset_of!(TSNamedTupleMember, label) == 24); + assert!(offset_of!(TSNamedTupleMember, element_type) == 56); + assert!(offset_of!(TSNamedTupleMember, optional) == 64); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(TSOptionalType, span) == 0); - assert!(offset_of!(TSOptionalType, type_annotation) == 8); + assert!(offset_of!(TSOptionalType, type_annotation) == 24); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(TSRestType, span) == 0); - assert!(offset_of!(TSRestType, type_annotation) == 8); + assert!(offset_of!(TSRestType, type_annotation) == 24); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSAnyKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSStringKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSBooleanKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSNumberKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSNeverKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSIntrinsicKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSUnknownKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSNullKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSUndefinedKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSVoidKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSSymbolKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSThisType, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSObjectKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSBigIntKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(TSTypeReference, span) == 0); - assert!(offset_of!(TSTypeReference, type_name) == 8); - assert!(offset_of!(TSTypeReference, type_arguments) == 16); + assert!(offset_of!(TSTypeReference, type_name) == 24); + assert!(offset_of!(TSTypeReference, type_arguments) == 32); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 64); assert!(align_of::() == 4); assert!(offset_of!(TSQualifiedName, span) == 0); - assert!(offset_of!(TSQualifiedName, left) == 8); - assert!(offset_of!(TSQualifiedName, right) == 16); + assert!(offset_of!(TSQualifiedName, left) == 24); + assert!(offset_of!(TSQualifiedName, right) == 32); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSTypeParameterInstantiation, span) == 0); - assert!(offset_of!(TSTypeParameterInstantiation, params) == 8); + assert!(offset_of!(TSTypeParameterInstantiation, params) == 24); // Padding: 1 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 80); assert!(align_of::() == 4); assert!(offset_of!(TSTypeParameter, span) == 0); - assert!(offset_of!(TSTypeParameter, name) == 8); - assert!(offset_of!(TSTypeParameter, constraint) == 28); - assert!(offset_of!(TSTypeParameter, default) == 36); - assert!(offset_of!(TSTypeParameter, r#in) == 44); - assert!(offset_of!(TSTypeParameter, out) == 45); - assert!(offset_of!(TSTypeParameter, r#const) == 46); + assert!(offset_of!(TSTypeParameter, name) == 24); + assert!(offset_of!(TSTypeParameter, constraint) == 60); + assert!(offset_of!(TSTypeParameter, default) == 68); + assert!(offset_of!(TSTypeParameter, r#in) == 76); + assert!(offset_of!(TSTypeParameter, out) == 77); + assert!(offset_of!(TSTypeParameter, r#const) == 78); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSTypeParameterDeclaration, span) == 0); - assert!(offset_of!(TSTypeParameterDeclaration, params) == 8); + assert!(offset_of!(TSTypeParameterDeclaration, params) == 24); // Padding: 3 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 80); assert!(align_of::() == 4); assert!(offset_of!(TSTypeAliasDeclaration, span) == 0); - assert!(offset_of!(TSTypeAliasDeclaration, id) == 8); - assert!(offset_of!(TSTypeAliasDeclaration, type_parameters) == 28); - assert!(offset_of!(TSTypeAliasDeclaration, type_annotation) == 32); - assert!(offset_of!(TSTypeAliasDeclaration, declare) == 44); - assert!(offset_of!(TSTypeAliasDeclaration, scope_id) == 40); + assert!(offset_of!(TSTypeAliasDeclaration, id) == 24); + assert!(offset_of!(TSTypeAliasDeclaration, type_parameters) == 60); + assert!(offset_of!(TSTypeAliasDeclaration, type_annotation) == 64); + assert!(offset_of!(TSTypeAliasDeclaration, declare) == 76); + assert!(offset_of!(TSTypeAliasDeclaration, scope_id) == 72); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(TSClassImplements, span) == 0); - assert!(offset_of!(TSClassImplements, expression) == 8); - assert!(offset_of!(TSClassImplements, type_arguments) == 16); + assert!(offset_of!(TSClassImplements, expression) == 24); + assert!(offset_of!(TSClassImplements, type_arguments) == 32); // Padding: 3 bytes - assert!(size_of::() == 60); + assert!(size_of::() == 92); assert!(align_of::() == 4); assert!(offset_of!(TSInterfaceDeclaration, span) == 0); - assert!(offset_of!(TSInterfaceDeclaration, id) == 8); - assert!(offset_of!(TSInterfaceDeclaration, type_parameters) == 28); - assert!(offset_of!(TSInterfaceDeclaration, extends) == 32); - assert!(offset_of!(TSInterfaceDeclaration, body) == 48); - assert!(offset_of!(TSInterfaceDeclaration, declare) == 56); - assert!(offset_of!(TSInterfaceDeclaration, scope_id) == 52); + assert!(offset_of!(TSInterfaceDeclaration, id) == 24); + assert!(offset_of!(TSInterfaceDeclaration, type_parameters) == 60); + assert!(offset_of!(TSInterfaceDeclaration, extends) == 64); + assert!(offset_of!(TSInterfaceDeclaration, body) == 80); + assert!(offset_of!(TSInterfaceDeclaration, declare) == 88); + assert!(offset_of!(TSInterfaceDeclaration, scope_id) == 84); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSInterfaceBody, span) == 0); - assert!(offset_of!(TSInterfaceBody, body) == 8); + assert!(offset_of!(TSInterfaceBody, body) == 24); // Padding: 1 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSPropertySignature, span) == 0); - assert!(offset_of!(TSPropertySignature, computed) == 20); - assert!(offset_of!(TSPropertySignature, optional) == 21); - assert!(offset_of!(TSPropertySignature, readonly) == 22); - assert!(offset_of!(TSPropertySignature, key) == 8); - assert!(offset_of!(TSPropertySignature, type_annotation) == 16); + assert!(offset_of!(TSPropertySignature, computed) == 36); + assert!(offset_of!(TSPropertySignature, optional) == 37); + assert!(offset_of!(TSPropertySignature, readonly) == 38); + assert!(offset_of!(TSPropertySignature, key) == 24); + assert!(offset_of!(TSPropertySignature, type_annotation) == 32); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 2 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(TSIndexSignature, span) == 0); - assert!(offset_of!(TSIndexSignature, parameters) == 8); - assert!(offset_of!(TSIndexSignature, type_annotation) == 24); - assert!(offset_of!(TSIndexSignature, readonly) == 28); - assert!(offset_of!(TSIndexSignature, r#static) == 29); + assert!(offset_of!(TSIndexSignature, parameters) == 24); + assert!(offset_of!(TSIndexSignature, type_annotation) == 40); + assert!(offset_of!(TSIndexSignature, readonly) == 44); + assert!(offset_of!(TSIndexSignature, r#static) == 45); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSCallSignatureDeclaration, span) == 0); - assert!(offset_of!(TSCallSignatureDeclaration, type_parameters) == 8); - assert!(offset_of!(TSCallSignatureDeclaration, this_param) == 12); - assert!(offset_of!(TSCallSignatureDeclaration, params) == 16); - assert!(offset_of!(TSCallSignatureDeclaration, return_type) == 20); + assert!(offset_of!(TSCallSignatureDeclaration, type_parameters) == 24); + assert!(offset_of!(TSCallSignatureDeclaration, this_param) == 28); + assert!(offset_of!(TSCallSignatureDeclaration, params) == 32); + assert!(offset_of!(TSCallSignatureDeclaration, return_type) == 36); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 1 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 4); assert!(offset_of!(TSMethodSignature, span) == 0); - assert!(offset_of!(TSMethodSignature, key) == 8); - assert!(offset_of!(TSMethodSignature, computed) == 36); - assert!(offset_of!(TSMethodSignature, optional) == 37); - assert!(offset_of!(TSMethodSignature, kind) == 38); - assert!(offset_of!(TSMethodSignature, type_parameters) == 16); - assert!(offset_of!(TSMethodSignature, this_param) == 20); - assert!(offset_of!(TSMethodSignature, params) == 24); - assert!(offset_of!(TSMethodSignature, return_type) == 28); - assert!(offset_of!(TSMethodSignature, scope_id) == 32); - - // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(offset_of!(TSMethodSignature, key) == 24); + assert!(offset_of!(TSMethodSignature, computed) == 52); + assert!(offset_of!(TSMethodSignature, optional) == 53); + assert!(offset_of!(TSMethodSignature, kind) == 54); + assert!(offset_of!(TSMethodSignature, type_parameters) == 32); + assert!(offset_of!(TSMethodSignature, this_param) == 36); + assert!(offset_of!(TSMethodSignature, params) == 40); + assert!(offset_of!(TSMethodSignature, return_type) == 44); + assert!(offset_of!(TSMethodSignature, scope_id) == 48); + + // Padding: 0 bytes + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSConstructSignatureDeclaration, span) == 0); - assert!(offset_of!(TSConstructSignatureDeclaration, type_parameters) == 8); - assert!(offset_of!(TSConstructSignatureDeclaration, params) == 12); - assert!(offset_of!(TSConstructSignatureDeclaration, return_type) == 16); - assert!(offset_of!(TSConstructSignatureDeclaration, scope_id) == 20); + assert!(offset_of!(TSConstructSignatureDeclaration, type_parameters) == 24); + assert!(offset_of!(TSConstructSignatureDeclaration, params) == 28); + assert!(offset_of!(TSConstructSignatureDeclaration, return_type) == 32); + assert!(offset_of!(TSConstructSignatureDeclaration, scope_id) == 36); // Padding: 0 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(TSIndexSignatureName, span) == 0); - assert!(offset_of!(TSIndexSignatureName, name) == 8); - assert!(offset_of!(TSIndexSignatureName, type_annotation) == 16); + assert!(offset_of!(TSIndexSignatureName, name) == 24); + assert!(offset_of!(TSIndexSignatureName, type_annotation) == 32); // Padding: 0 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(TSInterfaceHeritage, span) == 0); - assert!(offset_of!(TSInterfaceHeritage, expression) == 8); - assert!(offset_of!(TSInterfaceHeritage, type_arguments) == 16); + assert!(offset_of!(TSInterfaceHeritage, expression) == 24); + assert!(offset_of!(TSInterfaceHeritage, type_arguments) == 32); // Padding: 3 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 60); assert!(align_of::() == 4); assert!(offset_of!(TSTypePredicate, span) == 0); - assert!(offset_of!(TSTypePredicate, parameter_name) == 8); - assert!(offset_of!(TSTypePredicate, asserts) == 24); - assert!(offset_of!(TSTypePredicate, type_annotation) == 20); + assert!(offset_of!(TSTypePredicate, parameter_name) == 24); + assert!(offset_of!(TSTypePredicate, asserts) == 56); + assert!(offset_of!(TSTypePredicate, type_annotation) == 52); - assert!(size_of::() == 12); + assert!(size_of::() == 28); assert!(align_of::() == 4); // Padding: 2 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 88); assert!(align_of::() == 4); assert!(offset_of!(TSModuleDeclaration, span) == 0); - assert!(offset_of!(TSModuleDeclaration, id) == 8); - assert!(offset_of!(TSModuleDeclaration, body) == 40); - assert!(offset_of!(TSModuleDeclaration, kind) == 52); - assert!(offset_of!(TSModuleDeclaration, declare) == 53); - assert!(offset_of!(TSModuleDeclaration, scope_id) == 48); + assert!(offset_of!(TSModuleDeclaration, id) == 24); + assert!(offset_of!(TSModuleDeclaration, body) == 72); + assert!(offset_of!(TSModuleDeclaration, kind) == 84); + assert!(offset_of!(TSModuleDeclaration, declare) == 85); + assert!(offset_of!(TSModuleDeclaration, scope_id) == 80); assert!(size_of::() == 1); assert!(align_of::() == 1); - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 4); assert!(offset_of!(TSModuleBlock, span) == 0); - assert!(offset_of!(TSModuleBlock, directives) == 8); - assert!(offset_of!(TSModuleBlock, body) == 24); + assert!(offset_of!(TSModuleBlock, directives) == 24); + assert!(offset_of!(TSModuleBlock, body) == 40); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSTypeLiteral, span) == 0); - assert!(offset_of!(TSTypeLiteral, members) == 8); + assert!(offset_of!(TSTypeLiteral, members) == 24); // Padding: 0 bytes - assert!(size_of::() == 12); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(TSInferType, span) == 0); - assert!(offset_of!(TSInferType, type_parameter) == 8); + assert!(offset_of!(TSInferType, type_parameter) == 24); // Padding: 0 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(TSTypeQuery, span) == 0); - assert!(offset_of!(TSTypeQuery, expr_name) == 8); - assert!(offset_of!(TSTypeQuery, type_arguments) == 16); + assert!(offset_of!(TSTypeQuery, expr_name) == 24); + assert!(offset_of!(TSTypeQuery, type_arguments) == 32); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(TSImportType, span) == 0); - assert!(offset_of!(TSImportType, argument) == 8); - assert!(offset_of!(TSImportType, options) == 16); - assert!(offset_of!(TSImportType, qualifier) == 20); - assert!(offset_of!(TSImportType, type_arguments) == 28); + assert!(offset_of!(TSImportType, argument) == 24); + assert!(offset_of!(TSImportType, options) == 32); + assert!(offset_of!(TSImportType, qualifier) == 36); + assert!(offset_of!(TSImportType, type_arguments) == 44); // Padding: 0 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(TSFunctionType, span) == 0); - assert!(offset_of!(TSFunctionType, type_parameters) == 8); - assert!(offset_of!(TSFunctionType, this_param) == 12); - assert!(offset_of!(TSFunctionType, params) == 16); - assert!(offset_of!(TSFunctionType, return_type) == 20); - assert!(offset_of!(TSFunctionType, scope_id) == 24); + assert!(offset_of!(TSFunctionType, type_parameters) == 24); + assert!(offset_of!(TSFunctionType, this_param) == 28); + assert!(offset_of!(TSFunctionType, params) == 32); + assert!(offset_of!(TSFunctionType, return_type) == 36); + assert!(offset_of!(TSFunctionType, scope_id) == 40); // Padding: 3 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSConstructorType, span) == 0); - assert!(offset_of!(TSConstructorType, r#abstract) == 20); - assert!(offset_of!(TSConstructorType, type_parameters) == 8); - assert!(offset_of!(TSConstructorType, params) == 12); - assert!(offset_of!(TSConstructorType, return_type) == 16); + assert!(offset_of!(TSConstructorType, r#abstract) == 36); + assert!(offset_of!(TSConstructorType, type_parameters) == 24); + assert!(offset_of!(TSConstructorType, params) == 28); + assert!(offset_of!(TSConstructorType, return_type) == 32); // Padding: 2 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 52); assert!(align_of::() == 4); assert!(offset_of!(TSMappedType, span) == 0); - assert!(offset_of!(TSMappedType, type_parameter) == 8); - assert!(offset_of!(TSMappedType, name_type) == 12); - assert!(offset_of!(TSMappedType, type_annotation) == 20); - assert!(offset_of!(TSMappedType, optional) == 32); - assert!(offset_of!(TSMappedType, readonly) == 33); - assert!(offset_of!(TSMappedType, scope_id) == 28); + assert!(offset_of!(TSMappedType, type_parameter) == 24); + assert!(offset_of!(TSMappedType, name_type) == 28); + assert!(offset_of!(TSMappedType, type_annotation) == 36); + assert!(offset_of!(TSMappedType, optional) == 48); + assert!(offset_of!(TSMappedType, readonly) == 49); + assert!(offset_of!(TSMappedType, scope_id) == 44); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 4); assert!(offset_of!(TSTemplateLiteralType, span) == 0); - assert!(offset_of!(TSTemplateLiteralType, quasis) == 8); - assert!(offset_of!(TSTemplateLiteralType, types) == 24); + assert!(offset_of!(TSTemplateLiteralType, quasis) == 24); + assert!(offset_of!(TSTemplateLiteralType, types) == 40); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSAsExpression, span) == 0); - assert!(offset_of!(TSAsExpression, expression) == 8); - assert!(offset_of!(TSAsExpression, type_annotation) == 16); + assert!(offset_of!(TSAsExpression, expression) == 24); + assert!(offset_of!(TSAsExpression, type_annotation) == 32); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSSatisfiesExpression, span) == 0); - assert!(offset_of!(TSSatisfiesExpression, expression) == 8); - assert!(offset_of!(TSSatisfiesExpression, type_annotation) == 16); + assert!(offset_of!(TSSatisfiesExpression, expression) == 24); + assert!(offset_of!(TSSatisfiesExpression, type_annotation) == 32); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSTypeAssertion, span) == 0); - assert!(offset_of!(TSTypeAssertion, type_annotation) == 8); - assert!(offset_of!(TSTypeAssertion, expression) == 16); + assert!(offset_of!(TSTypeAssertion, type_annotation) == 24); + assert!(offset_of!(TSTypeAssertion, expression) == 32); // Padding: 3 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 72); assert!(align_of::() == 4); assert!(offset_of!(TSImportEqualsDeclaration, span) == 0); - assert!(offset_of!(TSImportEqualsDeclaration, id) == 8); - assert!(offset_of!(TSImportEqualsDeclaration, module_reference) == 28); - assert!(offset_of!(TSImportEqualsDeclaration, import_kind) == 36); + assert!(offset_of!(TSImportEqualsDeclaration, id) == 24); + assert!(offset_of!(TSImportEqualsDeclaration, module_reference) == 60); + assert!(offset_of!(TSImportEqualsDeclaration, import_kind) == 68); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 68); assert!(align_of::() == 4); assert!(offset_of!(TSExternalModuleReference, span) == 0); - assert!(offset_of!(TSExternalModuleReference, expression) == 8); + assert!(offset_of!(TSExternalModuleReference, expression) == 24); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(TSNonNullExpression, span) == 0); - assert!(offset_of!(TSNonNullExpression, expression) == 8); + assert!(offset_of!(TSNonNullExpression, expression) == 24); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(Decorator, span) == 0); - assert!(offset_of!(Decorator, expression) == 8); + assert!(offset_of!(Decorator, expression) == 24); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(TSExportAssignment, span) == 0); - assert!(offset_of!(TSExportAssignment, expression) == 8); + assert!(offset_of!(TSExportAssignment, expression) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 56); assert!(align_of::() == 4); assert!(offset_of!(TSNamespaceExportDeclaration, span) == 0); - assert!(offset_of!(TSNamespaceExportDeclaration, id) == 8); + assert!(offset_of!(TSNamespaceExportDeclaration, id) == 24); // Padding: 0 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(TSInstantiationExpression, span) == 0); - assert!(offset_of!(TSInstantiationExpression, expression) == 8); - assert!(offset_of!(TSInstantiationExpression, type_arguments) == 16); + assert!(offset_of!(TSInstantiationExpression, expression) == 24); + assert!(offset_of!(TSInstantiationExpression, type_arguments) == 32); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 3 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(JSDocNullableType, span) == 0); - assert!(offset_of!(JSDocNullableType, type_annotation) == 8); - assert!(offset_of!(JSDocNullableType, postfix) == 16); + assert!(offset_of!(JSDocNullableType, type_annotation) == 24); + assert!(offset_of!(JSDocNullableType, postfix) == 32); // Padding: 3 bytes - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(JSDocNonNullableType, span) == 0); - assert!(offset_of!(JSDocNonNullableType, type_annotation) == 8); - assert!(offset_of!(JSDocNonNullableType, postfix) == 16); + assert!(offset_of!(JSDocNonNullableType, type_annotation) == 24); + assert!(offset_of!(JSDocNonNullableType, postfix) == 32); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(JSDocUnknownType, span) == 0); @@ -3177,14 +3177,14 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(Comment, span) == 0); - assert!(offset_of!(Comment, attached_to) == 8); - assert!(offset_of!(Comment, kind) == 12); - assert!(offset_of!(Comment, position) == 13); - assert!(offset_of!(Comment, newlines) == 14); - assert!(offset_of!(Comment, content) == 15); + assert!(offset_of!(Comment, attached_to) == 24); + assert!(offset_of!(Comment, kind) == 28); + assert!(offset_of!(Comment, position) == 29); + assert!(offset_of!(Comment, newlines) == 30); + assert!(offset_of!(Comment, content) == 31); }; #[cfg(not(any(target_pointer_width = "64", target_pointer_width = "32")))] diff --git a/crates/oxc_ast/src/generated/derive_dummy.rs b/crates/oxc_ast/src/generated/derive_dummy.rs index 12b4fd502d766..c94831ea8b9f3 100644 --- a/crates/oxc_ast/src/generated/derive_dummy.rs +++ b/crates/oxc_ast/src/generated/derive_dummy.rs @@ -31,7 +31,7 @@ impl<'a> Dummy<'a> for Program<'a> { impl<'a> Dummy<'a> for Expression<'a> { /// Create a dummy [`Expression`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::NullLiteral(Dummy::dummy(allocator)) } @@ -129,7 +129,7 @@ impl<'a> Dummy<'a> for ObjectExpression<'a> { impl<'a> Dummy<'a> for ObjectPropertyKind<'a> { /// Create a dummy [`ObjectPropertyKind`]. /// - /// Has cost of making 2 allocations (32 bytes). + /// Has cost of making 2 allocations (64 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::SpreadProperty(Dummy::dummy(allocator)) } @@ -138,7 +138,7 @@ impl<'a> Dummy<'a> for ObjectPropertyKind<'a> { impl<'a> Dummy<'a> for ObjectProperty<'a> { /// Create a dummy [`ObjectProperty`]. /// - /// Has cost of making 2 allocations (16 bytes). + /// Has cost of making 2 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -155,7 +155,7 @@ impl<'a> Dummy<'a> for ObjectProperty<'a> { impl<'a> Dummy<'a> for PropertyKey<'a> { /// Create a dummy [`PropertyKey`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::NullLiteral(Dummy::dummy(allocator)) } @@ -187,7 +187,7 @@ impl<'a> Dummy<'a> for TemplateLiteral<'a> { impl<'a> Dummy<'a> for TaggedTemplateExpression<'a> { /// Create a dummy [`TaggedTemplateExpression`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -224,7 +224,7 @@ impl<'a> Dummy<'a> for TemplateElementValue<'a> { impl<'a> Dummy<'a> for MemberExpression<'a> { /// Create a dummy [`MemberExpression`]. /// - /// Has cost of making 2 allocations (64 bytes). + /// Has cost of making 2 allocations (112 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::StaticMemberExpression(Dummy::dummy(allocator)) } @@ -233,7 +233,7 @@ impl<'a> Dummy<'a> for MemberExpression<'a> { impl<'a> Dummy<'a> for ComputedMemberExpression<'a> { /// Create a dummy [`ComputedMemberExpression`]. /// - /// Has cost of making 2 allocations (16 bytes). + /// Has cost of making 2 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -247,7 +247,7 @@ impl<'a> Dummy<'a> for ComputedMemberExpression<'a> { impl<'a> Dummy<'a> for StaticMemberExpression<'a> { /// Create a dummy [`StaticMemberExpression`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -261,7 +261,7 @@ impl<'a> Dummy<'a> for StaticMemberExpression<'a> { impl<'a> Dummy<'a> for PrivateFieldExpression<'a> { /// Create a dummy [`PrivateFieldExpression`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -275,7 +275,7 @@ impl<'a> Dummy<'a> for PrivateFieldExpression<'a> { impl<'a> Dummy<'a> for CallExpression<'a> { /// Create a dummy [`CallExpression`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -291,7 +291,7 @@ impl<'a> Dummy<'a> for CallExpression<'a> { impl<'a> Dummy<'a> for NewExpression<'a> { /// Create a dummy [`NewExpression`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -319,7 +319,7 @@ impl<'a> Dummy<'a> for MetaProperty<'a> { impl<'a> Dummy<'a> for SpreadElement<'a> { /// Create a dummy [`SpreadElement`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), argument: Dummy::dummy(allocator) } } @@ -328,7 +328,7 @@ impl<'a> Dummy<'a> for SpreadElement<'a> { impl<'a> Dummy<'a> for Argument<'a> { /// Create a dummy [`Argument`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::NullLiteral(Dummy::dummy(allocator)) } @@ -337,7 +337,7 @@ impl<'a> Dummy<'a> for Argument<'a> { impl<'a> Dummy<'a> for UpdateExpression<'a> { /// Create a dummy [`UpdateExpression`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -351,7 +351,7 @@ impl<'a> Dummy<'a> for UpdateExpression<'a> { impl<'a> Dummy<'a> for UnaryExpression<'a> { /// Create a dummy [`UnaryExpression`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -364,7 +364,7 @@ impl<'a> Dummy<'a> for UnaryExpression<'a> { impl<'a> Dummy<'a> for BinaryExpression<'a> { /// Create a dummy [`BinaryExpression`]. /// - /// Has cost of making 2 allocations (16 bytes). + /// Has cost of making 2 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -378,7 +378,7 @@ impl<'a> Dummy<'a> for BinaryExpression<'a> { impl<'a> Dummy<'a> for PrivateInExpression<'a> { /// Create a dummy [`PrivateInExpression`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -391,7 +391,7 @@ impl<'a> Dummy<'a> for PrivateInExpression<'a> { impl<'a> Dummy<'a> for LogicalExpression<'a> { /// Create a dummy [`LogicalExpression`]. /// - /// Has cost of making 2 allocations (16 bytes). + /// Has cost of making 2 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -405,7 +405,7 @@ impl<'a> Dummy<'a> for LogicalExpression<'a> { impl<'a> Dummy<'a> for ConditionalExpression<'a> { /// Create a dummy [`ConditionalExpression`]. /// - /// Has cost of making 3 allocations (24 bytes). + /// Has cost of making 3 allocations (72 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -419,7 +419,7 @@ impl<'a> Dummy<'a> for ConditionalExpression<'a> { impl<'a> Dummy<'a> for AssignmentExpression<'a> { /// Create a dummy [`AssignmentExpression`]. /// - /// Has cost of making 2 allocations (40 bytes). + /// Has cost of making 2 allocations (72 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -433,7 +433,7 @@ impl<'a> Dummy<'a> for AssignmentExpression<'a> { impl<'a> Dummy<'a> for AssignmentTarget<'a> { /// Create a dummy [`AssignmentTarget`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::AssignmentTargetIdentifier(Dummy::dummy(allocator)) } @@ -442,7 +442,7 @@ impl<'a> Dummy<'a> for AssignmentTarget<'a> { impl<'a> Dummy<'a> for SimpleAssignmentTarget<'a> { /// Create a dummy [`SimpleAssignmentTarget`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::AssignmentTargetIdentifier(Dummy::dummy(allocator)) } @@ -451,7 +451,7 @@ impl<'a> Dummy<'a> for SimpleAssignmentTarget<'a> { impl<'a> Dummy<'a> for AssignmentTargetPattern<'a> { /// Create a dummy [`AssignmentTargetPattern`]. /// - /// Has cost of making 1 allocation (56 bytes). + /// Has cost of making 1 allocation (88 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::ArrayAssignmentTarget(Dummy::dummy(allocator)) } @@ -486,7 +486,7 @@ impl<'a> Dummy<'a> for ObjectAssignmentTarget<'a> { impl<'a> Dummy<'a> for AssignmentTargetRest<'a> { /// Create a dummy [`AssignmentTargetRest`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), target: Dummy::dummy(allocator) } } @@ -495,7 +495,7 @@ impl<'a> Dummy<'a> for AssignmentTargetRest<'a> { impl<'a> Dummy<'a> for AssignmentTargetMaybeDefault<'a> { /// Create a dummy [`AssignmentTargetMaybeDefault`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::AssignmentTargetIdentifier(Dummy::dummy(allocator)) } @@ -504,7 +504,7 @@ impl<'a> Dummy<'a> for AssignmentTargetMaybeDefault<'a> { impl<'a> Dummy<'a> for AssignmentTargetWithDefault<'a> { /// Create a dummy [`AssignmentTargetWithDefault`]. /// - /// Has cost of making 2 allocations (40 bytes). + /// Has cost of making 2 allocations (72 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -517,7 +517,7 @@ impl<'a> Dummy<'a> for AssignmentTargetWithDefault<'a> { impl<'a> Dummy<'a> for AssignmentTargetProperty<'a> { /// Create a dummy [`AssignmentTargetProperty`]. /// - /// Has cost of making 1 allocation (56 bytes). + /// Has cost of making 1 allocation (88 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::AssignmentTargetPropertyIdentifier(Dummy::dummy(allocator)) } @@ -539,7 +539,7 @@ impl<'a> Dummy<'a> for AssignmentTargetPropertyIdentifier<'a> { impl<'a> Dummy<'a> for AssignmentTargetPropertyProperty<'a> { /// Create a dummy [`AssignmentTargetPropertyProperty`]. /// - /// Has cost of making 2 allocations (40 bytes). + /// Has cost of making 2 allocations (72 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -571,7 +571,7 @@ impl<'a> Dummy<'a> for Super { impl<'a> Dummy<'a> for AwaitExpression<'a> { /// Create a dummy [`AwaitExpression`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), argument: Dummy::dummy(allocator) } } @@ -580,7 +580,7 @@ impl<'a> Dummy<'a> for AwaitExpression<'a> { impl<'a> Dummy<'a> for ChainExpression<'a> { /// Create a dummy [`ChainExpression`]. /// - /// Has cost of making 2 allocations (32 bytes). + /// Has cost of making 2 allocations (64 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), expression: Dummy::dummy(allocator) } } @@ -589,7 +589,7 @@ impl<'a> Dummy<'a> for ChainExpression<'a> { impl<'a> Dummy<'a> for ChainElement<'a> { /// Create a dummy [`ChainElement`]. /// - /// Has cost of making 2 allocations (32 bytes). + /// Has cost of making 2 allocations (64 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::TSNonNullExpression(Dummy::dummy(allocator)) } @@ -598,7 +598,7 @@ impl<'a> Dummy<'a> for ChainElement<'a> { impl<'a> Dummy<'a> for ParenthesizedExpression<'a> { /// Create a dummy [`ParenthesizedExpression`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), expression: Dummy::dummy(allocator) } } @@ -607,7 +607,7 @@ impl<'a> Dummy<'a> for ParenthesizedExpression<'a> { impl<'a> Dummy<'a> for Statement<'a> { /// Create a dummy [`Statement`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::DebuggerStatement(Dummy::dummy(allocator)) } @@ -651,7 +651,7 @@ impl<'a> Dummy<'a> for BlockStatement<'a> { impl<'a> Dummy<'a> for Declaration<'a> { /// Create a dummy [`Declaration`]. /// - /// Has cost of making 1 allocation (40 bytes). + /// Has cost of making 1 allocation (56 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::VariableDeclaration(Dummy::dummy(allocator)) } @@ -684,7 +684,7 @@ impl<'a> Dummy<'a> for VariableDeclarationKind { impl<'a> Dummy<'a> for VariableDeclarator<'a> { /// Create a dummy [`VariableDeclarator`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -708,7 +708,7 @@ impl<'a> Dummy<'a> for EmptyStatement { impl<'a> Dummy<'a> for ExpressionStatement<'a> { /// Create a dummy [`ExpressionStatement`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), expression: Dummy::dummy(allocator) } } @@ -717,7 +717,7 @@ impl<'a> Dummy<'a> for ExpressionStatement<'a> { impl<'a> Dummy<'a> for IfStatement<'a> { /// Create a dummy [`IfStatement`]. /// - /// Has cost of making 2 allocations (16 bytes). + /// Has cost of making 2 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -731,7 +731,7 @@ impl<'a> Dummy<'a> for IfStatement<'a> { impl<'a> Dummy<'a> for DoWhileStatement<'a> { /// Create a dummy [`DoWhileStatement`]. /// - /// Has cost of making 2 allocations (16 bytes). + /// Has cost of making 2 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -744,7 +744,7 @@ impl<'a> Dummy<'a> for DoWhileStatement<'a> { impl<'a> Dummy<'a> for WhileStatement<'a> { /// Create a dummy [`WhileStatement`]. /// - /// Has cost of making 2 allocations (16 bytes). + /// Has cost of making 2 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -757,7 +757,7 @@ impl<'a> Dummy<'a> for WhileStatement<'a> { impl<'a> Dummy<'a> for ForStatement<'a> { /// Create a dummy [`ForStatement`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -773,7 +773,7 @@ impl<'a> Dummy<'a> for ForStatement<'a> { impl<'a> Dummy<'a> for ForStatementInit<'a> { /// Create a dummy [`ForStatementInit`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::NullLiteral(Dummy::dummy(allocator)) } @@ -782,7 +782,7 @@ impl<'a> Dummy<'a> for ForStatementInit<'a> { impl<'a> Dummy<'a> for ForInStatement<'a> { /// Create a dummy [`ForInStatement`]. /// - /// Has cost of making 3 allocations (48 bytes). + /// Has cost of making 3 allocations (96 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -797,7 +797,7 @@ impl<'a> Dummy<'a> for ForInStatement<'a> { impl<'a> Dummy<'a> for ForStatementLeft<'a> { /// Create a dummy [`ForStatementLeft`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::AssignmentTargetIdentifier(Dummy::dummy(allocator)) } @@ -806,7 +806,7 @@ impl<'a> Dummy<'a> for ForStatementLeft<'a> { impl<'a> Dummy<'a> for ForOfStatement<'a> { /// Create a dummy [`ForOfStatement`]. /// - /// Has cost of making 3 allocations (48 bytes). + /// Has cost of making 3 allocations (96 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -849,7 +849,7 @@ impl<'a> Dummy<'a> for ReturnStatement<'a> { impl<'a> Dummy<'a> for WithStatement<'a> { /// Create a dummy [`WithStatement`]. /// - /// Has cost of making 2 allocations (16 bytes). + /// Has cost of making 2 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -862,7 +862,7 @@ impl<'a> Dummy<'a> for WithStatement<'a> { impl<'a> Dummy<'a> for SwitchStatement<'a> { /// Create a dummy [`SwitchStatement`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -889,7 +889,7 @@ impl<'a> Dummy<'a> for SwitchCase<'a> { impl<'a> Dummy<'a> for LabeledStatement<'a> { /// Create a dummy [`LabeledStatement`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -902,7 +902,7 @@ impl<'a> Dummy<'a> for LabeledStatement<'a> { impl<'a> Dummy<'a> for ThrowStatement<'a> { /// Create a dummy [`ThrowStatement`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), argument: Dummy::dummy(allocator) } } @@ -911,7 +911,7 @@ impl<'a> Dummy<'a> for ThrowStatement<'a> { impl<'a> Dummy<'a> for TryStatement<'a> { /// Create a dummy [`TryStatement`]. /// - /// Has cost of making 1 allocation (40 bytes). + /// Has cost of making 1 allocation (56 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -925,7 +925,7 @@ impl<'a> Dummy<'a> for TryStatement<'a> { impl<'a> Dummy<'a> for CatchClause<'a> { /// Create a dummy [`CatchClause`]. /// - /// Has cost of making 1 allocation (40 bytes). + /// Has cost of making 1 allocation (56 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -939,7 +939,7 @@ impl<'a> Dummy<'a> for CatchClause<'a> { impl<'a> Dummy<'a> for CatchParameter<'a> { /// Create a dummy [`CatchParameter`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), pattern: Dummy::dummy(allocator) } } @@ -957,7 +957,7 @@ impl<'a> Dummy<'a> for DebuggerStatement { impl<'a> Dummy<'a> for BindingPattern<'a> { /// Create a dummy [`BindingPattern`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { kind: Dummy::dummy(allocator), @@ -970,7 +970,7 @@ impl<'a> Dummy<'a> for BindingPattern<'a> { impl<'a> Dummy<'a> for BindingPatternKind<'a> { /// Create a dummy [`BindingPatternKind`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::BindingIdentifier(Dummy::dummy(allocator)) } @@ -979,7 +979,7 @@ impl<'a> Dummy<'a> for BindingPatternKind<'a> { impl<'a> Dummy<'a> for AssignmentPattern<'a> { /// Create a dummy [`AssignmentPattern`]. /// - /// Has cost of making 2 allocations (40 bytes). + /// Has cost of making 2 allocations (72 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1005,7 +1005,7 @@ impl<'a> Dummy<'a> for ObjectPattern<'a> { impl<'a> Dummy<'a> for BindingProperty<'a> { /// Create a dummy [`BindingProperty`]. /// - /// Has cost of making 2 allocations (40 bytes). + /// Has cost of making 2 allocations (72 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1033,7 +1033,7 @@ impl<'a> Dummy<'a> for ArrayPattern<'a> { impl<'a> Dummy<'a> for BindingRestElement<'a> { /// Create a dummy [`BindingRestElement`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), argument: Dummy::dummy(allocator) } } @@ -1042,7 +1042,7 @@ impl<'a> Dummy<'a> for BindingRestElement<'a> { impl<'a> Dummy<'a> for Function<'a> { /// Create a dummy [`Function`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (64 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1089,7 +1089,7 @@ impl<'a> Dummy<'a> for FormalParameters<'a> { impl<'a> Dummy<'a> for FormalParameter<'a> { /// Create a dummy [`FormalParameter`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1128,7 +1128,7 @@ impl<'a> Dummy<'a> for FunctionBody<'a> { impl<'a> Dummy<'a> for ArrowFunctionExpression<'a> { /// Create a dummy [`ArrowFunctionExpression`]. /// - /// Has cost of making 2 allocations (104 bytes). + /// Has cost of making 2 allocations (136 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1160,7 +1160,7 @@ impl<'a> Dummy<'a> for YieldExpression<'a> { impl<'a> Dummy<'a> for Class<'a> { /// Create a dummy [`Class`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1201,7 +1201,7 @@ impl<'a> Dummy<'a> for ClassBody<'a> { impl<'a> Dummy<'a> for ClassElement<'a> { /// Create a dummy [`ClassElement`]. /// - /// Has cost of making 1 allocation (40 bytes). + /// Has cost of making 1 allocation (56 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::StaticBlock(Dummy::dummy(allocator)) } @@ -1210,7 +1210,7 @@ impl<'a> Dummy<'a> for ClassElement<'a> { impl<'a> Dummy<'a> for MethodDefinition<'a> { /// Create a dummy [`MethodDefinition`]. /// - /// Has cost of making 3 allocations (152 bytes). + /// Has cost of making 3 allocations (216 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1241,7 +1241,7 @@ impl<'a> Dummy<'a> for MethodDefinitionType { impl<'a> Dummy<'a> for PropertyDefinition<'a> { /// Create a dummy [`PropertyDefinition`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1307,7 +1307,7 @@ impl<'a> Dummy<'a> for StaticBlock<'a> { impl<'a> Dummy<'a> for ModuleDeclaration<'a> { /// Create a dummy [`ModuleDeclaration`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (64 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::TSNamespaceExportDeclaration(Dummy::dummy(allocator)) } @@ -1326,7 +1326,7 @@ impl<'a> Dummy<'a> for AccessorPropertyType { impl<'a> Dummy<'a> for AccessorProperty<'a> { /// Create a dummy [`AccessorProperty`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1347,7 +1347,7 @@ impl<'a> Dummy<'a> for AccessorProperty<'a> { impl<'a> Dummy<'a> for ImportExpression<'a> { /// Create a dummy [`ImportExpression`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1387,7 +1387,7 @@ impl<'a> Dummy<'a> for ImportPhase { impl<'a> Dummy<'a> for ImportDeclarationSpecifier<'a> { /// Create a dummy [`ImportDeclarationSpecifier`]. /// - /// Has cost of making 1 allocation (40 bytes). + /// Has cost of making 1 allocation (72 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::ImportDefaultSpecifier(Dummy::dummy(allocator)) } @@ -1479,7 +1479,7 @@ impl<'a> Dummy<'a> for ExportNamedDeclaration<'a> { impl<'a> Dummy<'a> for ExportDefaultDeclaration<'a> { /// Create a dummy [`ExportDefaultDeclaration`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1521,7 +1521,7 @@ impl<'a> Dummy<'a> for ExportSpecifier<'a> { impl<'a> Dummy<'a> for ExportDefaultDeclarationKind<'a> { /// Create a dummy [`ExportDefaultDeclarationKind`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::NullLiteral(Dummy::dummy(allocator)) } @@ -1643,7 +1643,7 @@ impl<'a> Dummy<'a> for RegExpPattern<'a> { impl<'a> Dummy<'a> for JSXElement<'a> { /// Create a dummy [`JSXElement`]. /// - /// Has cost of making 2 allocations (64 bytes). + /// Has cost of making 2 allocations (96 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1657,7 +1657,7 @@ impl<'a> Dummy<'a> for JSXElement<'a> { impl<'a> Dummy<'a> for JSXOpeningElement<'a> { /// Create a dummy [`JSXOpeningElement`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1671,7 +1671,7 @@ impl<'a> Dummy<'a> for JSXOpeningElement<'a> { impl<'a> Dummy<'a> for JSXClosingElement<'a> { /// Create a dummy [`JSXClosingElement`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), name: Dummy::dummy(allocator) } } @@ -1712,7 +1712,7 @@ impl<'a> Dummy<'a> for JSXClosingFragment { impl<'a> Dummy<'a> for JSXElementName<'a> { /// Create a dummy [`JSXElementName`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::ThisExpression(Dummy::dummy(allocator)) } @@ -1734,7 +1734,7 @@ impl<'a> Dummy<'a> for JSXNamespacedName<'a> { impl<'a> Dummy<'a> for JSXMemberExpression<'a> { /// Create a dummy [`JSXMemberExpression`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1747,7 +1747,7 @@ impl<'a> Dummy<'a> for JSXMemberExpression<'a> { impl<'a> Dummy<'a> for JSXMemberExpressionObject<'a> { /// Create a dummy [`JSXMemberExpressionObject`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::ThisExpression(Dummy::dummy(allocator)) } @@ -1783,7 +1783,7 @@ impl<'a> Dummy<'a> for JSXEmptyExpression { impl<'a> Dummy<'a> for JSXAttributeItem<'a> { /// Create a dummy [`JSXAttributeItem`]. /// - /// Has cost of making 2 allocations (32 bytes). + /// Has cost of making 2 allocations (64 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::SpreadAttribute(Dummy::dummy(allocator)) } @@ -1792,7 +1792,7 @@ impl<'a> Dummy<'a> for JSXAttributeItem<'a> { impl<'a> Dummy<'a> for JSXAttribute<'a> { /// Create a dummy [`JSXAttribute`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1805,7 +1805,7 @@ impl<'a> Dummy<'a> for JSXAttribute<'a> { impl<'a> Dummy<'a> for JSXSpreadAttribute<'a> { /// Create a dummy [`JSXSpreadAttribute`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), argument: Dummy::dummy(allocator) } } @@ -1814,7 +1814,7 @@ impl<'a> Dummy<'a> for JSXSpreadAttribute<'a> { impl<'a> Dummy<'a> for JSXAttributeName<'a> { /// Create a dummy [`JSXAttributeName`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::Identifier(Dummy::dummy(allocator)) } @@ -1823,7 +1823,7 @@ impl<'a> Dummy<'a> for JSXAttributeName<'a> { impl<'a> Dummy<'a> for JSXAttributeValue<'a> { /// Create a dummy [`JSXAttributeValue`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (56 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::ExpressionContainer(Dummy::dummy(allocator)) } @@ -1841,16 +1841,16 @@ impl<'a> Dummy<'a> for JSXIdentifier<'a> { impl<'a> Dummy<'a> for JSXChild<'a> { /// Create a dummy [`JSXChild`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (56 bytes). fn dummy(allocator: &'a Allocator) -> Self { - Self::ExpressionContainer(Dummy::dummy(allocator)) + Self::Text(Dummy::dummy(allocator)) } } impl<'a> Dummy<'a> for JSXSpreadChild<'a> { /// Create a dummy [`JSXSpreadChild`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), expression: Dummy::dummy(allocator) } } @@ -1910,7 +1910,7 @@ impl<'a> Dummy<'a> for TSEnumBody<'a> { impl<'a> Dummy<'a> for TSEnumMember<'a> { /// Create a dummy [`TSEnumMember`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1923,7 +1923,7 @@ impl<'a> Dummy<'a> for TSEnumMember<'a> { impl<'a> Dummy<'a> for TSEnumMemberName<'a> { /// Create a dummy [`TSEnumMemberName`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::Identifier(Dummy::dummy(allocator)) } @@ -1932,7 +1932,7 @@ impl<'a> Dummy<'a> for TSEnumMemberName<'a> { impl<'a> Dummy<'a> for TSTypeAnnotation<'a> { /// Create a dummy [`TSTypeAnnotation`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), type_annotation: Dummy::dummy(allocator) } } @@ -1941,7 +1941,7 @@ impl<'a> Dummy<'a> for TSTypeAnnotation<'a> { impl<'a> Dummy<'a> for TSLiteralType<'a> { /// Create a dummy [`TSLiteralType`]. /// - /// Has cost of making 1 allocation (16 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), literal: Dummy::dummy(allocator) } } @@ -1950,7 +1950,7 @@ impl<'a> Dummy<'a> for TSLiteralType<'a> { impl<'a> Dummy<'a> for TSLiteral<'a> { /// Create a dummy [`TSLiteral`]. /// - /// Has cost of making 1 allocation (16 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::BooleanLiteral(Dummy::dummy(allocator)) } @@ -1959,7 +1959,7 @@ impl<'a> Dummy<'a> for TSLiteral<'a> { impl<'a> Dummy<'a> for TSType<'a> { /// Create a dummy [`TSType`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::TSAnyKeyword(Dummy::dummy(allocator)) } @@ -1968,7 +1968,7 @@ impl<'a> Dummy<'a> for TSType<'a> { impl<'a> Dummy<'a> for TSConditionalType<'a> { /// Create a dummy [`TSConditionalType`]. /// - /// Has cost of making 4 allocations (32 bytes). + /// Has cost of making 4 allocations (96 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2002,7 +2002,7 @@ impl<'a> Dummy<'a> for TSIntersectionType<'a> { impl<'a> Dummy<'a> for TSParenthesizedType<'a> { /// Create a dummy [`TSParenthesizedType`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), type_annotation: Dummy::dummy(allocator) } } @@ -2011,7 +2011,7 @@ impl<'a> Dummy<'a> for TSParenthesizedType<'a> { impl<'a> Dummy<'a> for TSTypeOperator<'a> { /// Create a dummy [`TSTypeOperator`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2034,7 +2034,7 @@ impl<'a> Dummy<'a> for TSTypeOperatorOperator { impl<'a> Dummy<'a> for TSArrayType<'a> { /// Create a dummy [`TSArrayType`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), element_type: Dummy::dummy(allocator) } } @@ -2043,7 +2043,7 @@ impl<'a> Dummy<'a> for TSArrayType<'a> { impl<'a> Dummy<'a> for TSIndexedAccessType<'a> { /// Create a dummy [`TSIndexedAccessType`]. /// - /// Has cost of making 2 allocations (16 bytes). + /// Has cost of making 2 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2065,7 +2065,7 @@ impl<'a> Dummy<'a> for TSTupleType<'a> { impl<'a> Dummy<'a> for TSNamedTupleMember<'a> { /// Create a dummy [`TSNamedTupleMember`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2079,7 +2079,7 @@ impl<'a> Dummy<'a> for TSNamedTupleMember<'a> { impl<'a> Dummy<'a> for TSOptionalType<'a> { /// Create a dummy [`TSOptionalType`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), type_annotation: Dummy::dummy(allocator) } } @@ -2088,7 +2088,7 @@ impl<'a> Dummy<'a> for TSOptionalType<'a> { impl<'a> Dummy<'a> for TSRestType<'a> { /// Create a dummy [`TSRestType`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), type_annotation: Dummy::dummy(allocator) } } @@ -2097,7 +2097,7 @@ impl<'a> Dummy<'a> for TSRestType<'a> { impl<'a> Dummy<'a> for TSTupleElement<'a> { /// Create a dummy [`TSTupleElement`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::TSAnyKeyword(Dummy::dummy(allocator)) } @@ -2232,7 +2232,7 @@ impl<'a> Dummy<'a> for TSBigIntKeyword { impl<'a> Dummy<'a> for TSTypeReference<'a> { /// Create a dummy [`TSTypeReference`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2245,7 +2245,7 @@ impl<'a> Dummy<'a> for TSTypeReference<'a> { impl<'a> Dummy<'a> for TSTypeName<'a> { /// Create a dummy [`TSTypeName`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::IdentifierReference(Dummy::dummy(allocator)) } @@ -2254,7 +2254,7 @@ impl<'a> Dummy<'a> for TSTypeName<'a> { impl<'a> Dummy<'a> for TSQualifiedName<'a> { /// Create a dummy [`TSQualifiedName`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2302,7 +2302,7 @@ impl<'a> Dummy<'a> for TSTypeParameterDeclaration<'a> { impl<'a> Dummy<'a> for TSTypeAliasDeclaration<'a> { /// Create a dummy [`TSTypeAliasDeclaration`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2328,7 +2328,7 @@ impl<'a> Dummy<'a> for TSAccessibility { impl<'a> Dummy<'a> for TSClassImplements<'a> { /// Create a dummy [`TSClassImplements`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2341,7 +2341,7 @@ impl<'a> Dummy<'a> for TSClassImplements<'a> { impl<'a> Dummy<'a> for TSInterfaceDeclaration<'a> { /// Create a dummy [`TSInterfaceDeclaration`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2367,7 +2367,7 @@ impl<'a> Dummy<'a> for TSInterfaceBody<'a> { impl<'a> Dummy<'a> for TSPropertySignature<'a> { /// Create a dummy [`TSPropertySignature`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2383,7 +2383,7 @@ impl<'a> Dummy<'a> for TSPropertySignature<'a> { impl<'a> Dummy<'a> for TSSignature<'a> { /// Create a dummy [`TSSignature`]. /// - /// Has cost of making 2 allocations (48 bytes). + /// Has cost of making 2 allocations (80 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::TSPropertySignature(Dummy::dummy(allocator)) } @@ -2392,7 +2392,7 @@ impl<'a> Dummy<'a> for TSSignature<'a> { impl<'a> Dummy<'a> for TSIndexSignature<'a> { /// Create a dummy [`TSIndexSignature`]. /// - /// Has cost of making 2 allocations (32 bytes). + /// Has cost of making 2 allocations (64 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2407,7 +2407,7 @@ impl<'a> Dummy<'a> for TSIndexSignature<'a> { impl<'a> Dummy<'a> for TSCallSignatureDeclaration<'a> { /// Create a dummy [`TSCallSignatureDeclaration`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (64 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2432,7 +2432,7 @@ impl<'a> Dummy<'a> for TSMethodSignatureKind { impl<'a> Dummy<'a> for TSMethodSignature<'a> { /// Create a dummy [`TSMethodSignature`]. /// - /// Has cost of making 2 allocations (56 bytes). + /// Has cost of making 2 allocations (88 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2452,7 +2452,7 @@ impl<'a> Dummy<'a> for TSMethodSignature<'a> { impl<'a> Dummy<'a> for TSConstructSignatureDeclaration<'a> { /// Create a dummy [`TSConstructSignatureDeclaration`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (64 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2467,7 +2467,7 @@ impl<'a> Dummy<'a> for TSConstructSignatureDeclaration<'a> { impl<'a> Dummy<'a> for TSIndexSignatureName<'a> { /// Create a dummy [`TSIndexSignatureName`]. /// - /// Has cost of making 2 allocations (32 bytes). + /// Has cost of making 2 allocations (64 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2480,7 +2480,7 @@ impl<'a> Dummy<'a> for TSIndexSignatureName<'a> { impl<'a> Dummy<'a> for TSInterfaceHeritage<'a> { /// Create a dummy [`TSInterfaceHeritage`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2551,7 +2551,7 @@ impl<'a> Dummy<'a> for TSModuleDeclarationName<'a> { impl<'a> Dummy<'a> for TSModuleDeclarationBody<'a> { /// Create a dummy [`TSModuleDeclarationBody`]. /// - /// Has cost of making 1 allocation (56 bytes). + /// Has cost of making 1 allocation (72 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::TSModuleBlock(Dummy::dummy(allocator)) } @@ -2582,7 +2582,7 @@ impl<'a> Dummy<'a> for TSTypeLiteral<'a> { impl<'a> Dummy<'a> for TSInferType<'a> { /// Create a dummy [`TSInferType`]. /// - /// Has cost of making 1 allocation (80 bytes). + /// Has cost of making 1 allocation (112 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), type_parameter: Dummy::dummy(allocator) } } @@ -2591,7 +2591,7 @@ impl<'a> Dummy<'a> for TSInferType<'a> { impl<'a> Dummy<'a> for TSTypeQuery<'a> { /// Create a dummy [`TSTypeQuery`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2604,7 +2604,7 @@ impl<'a> Dummy<'a> for TSTypeQuery<'a> { impl<'a> Dummy<'a> for TSTypeQueryExprName<'a> { /// Create a dummy [`TSTypeQueryExprName`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::IdentifierReference(Dummy::dummy(allocator)) } @@ -2613,7 +2613,7 @@ impl<'a> Dummy<'a> for TSTypeQueryExprName<'a> { impl<'a> Dummy<'a> for TSImportType<'a> { /// Create a dummy [`TSImportType`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2628,7 +2628,7 @@ impl<'a> Dummy<'a> for TSImportType<'a> { impl<'a> Dummy<'a> for TSFunctionType<'a> { /// Create a dummy [`TSFunctionType`]. /// - /// Has cost of making 3 allocations (80 bytes). + /// Has cost of making 3 allocations (128 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2644,7 +2644,7 @@ impl<'a> Dummy<'a> for TSFunctionType<'a> { impl<'a> Dummy<'a> for TSConstructorType<'a> { /// Create a dummy [`TSConstructorType`]. /// - /// Has cost of making 3 allocations (80 bytes). + /// Has cost of making 3 allocations (128 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2659,7 +2659,7 @@ impl<'a> Dummy<'a> for TSConstructorType<'a> { impl<'a> Dummy<'a> for TSMappedType<'a> { /// Create a dummy [`TSMappedType`]. /// - /// Has cost of making 1 allocation (80 bytes). + /// Has cost of making 1 allocation (112 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2699,7 +2699,7 @@ impl<'a> Dummy<'a> for TSTemplateLiteralType<'a> { impl<'a> Dummy<'a> for TSAsExpression<'a> { /// Create a dummy [`TSAsExpression`]. /// - /// Has cost of making 2 allocations (16 bytes). + /// Has cost of making 2 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2712,7 +2712,7 @@ impl<'a> Dummy<'a> for TSAsExpression<'a> { impl<'a> Dummy<'a> for TSSatisfiesExpression<'a> { /// Create a dummy [`TSSatisfiesExpression`]. /// - /// Has cost of making 2 allocations (16 bytes). + /// Has cost of making 2 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2725,7 +2725,7 @@ impl<'a> Dummy<'a> for TSSatisfiesExpression<'a> { impl<'a> Dummy<'a> for TSTypeAssertion<'a> { /// Create a dummy [`TSTypeAssertion`]. /// - /// Has cost of making 2 allocations (16 bytes). + /// Has cost of making 2 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2738,7 +2738,7 @@ impl<'a> Dummy<'a> for TSTypeAssertion<'a> { impl<'a> Dummy<'a> for TSImportEqualsDeclaration<'a> { /// Create a dummy [`TSImportEqualsDeclaration`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2752,7 +2752,7 @@ impl<'a> Dummy<'a> for TSImportEqualsDeclaration<'a> { impl<'a> Dummy<'a> for TSModuleReference<'a> { /// Create a dummy [`TSModuleReference`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::IdentifierReference(Dummy::dummy(allocator)) } @@ -2770,7 +2770,7 @@ impl<'a> Dummy<'a> for TSExternalModuleReference<'a> { impl<'a> Dummy<'a> for TSNonNullExpression<'a> { /// Create a dummy [`TSNonNullExpression`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), expression: Dummy::dummy(allocator) } } @@ -2779,7 +2779,7 @@ impl<'a> Dummy<'a> for TSNonNullExpression<'a> { impl<'a> Dummy<'a> for Decorator<'a> { /// Create a dummy [`Decorator`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), expression: Dummy::dummy(allocator) } } @@ -2788,7 +2788,7 @@ impl<'a> Dummy<'a> for Decorator<'a> { impl<'a> Dummy<'a> for TSExportAssignment<'a> { /// Create a dummy [`TSExportAssignment`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), expression: Dummy::dummy(allocator) } } @@ -2806,7 +2806,7 @@ impl<'a> Dummy<'a> for TSNamespaceExportDeclaration<'a> { impl<'a> Dummy<'a> for TSInstantiationExpression<'a> { /// Create a dummy [`TSInstantiationExpression`]. /// - /// Has cost of making 2 allocations (40 bytes). + /// Has cost of making 2 allocations (72 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2829,7 +2829,7 @@ impl<'a> Dummy<'a> for ImportOrExportKind { impl<'a> Dummy<'a> for JSDocNullableType<'a> { /// Create a dummy [`JSDocNullableType`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2842,7 +2842,7 @@ impl<'a> Dummy<'a> for JSDocNullableType<'a> { impl<'a> Dummy<'a> for JSDocNonNullableType<'a> { /// Create a dummy [`JSDocNonNullableType`]. /// - /// Has cost of making 1 allocation (8 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index fe72c8211ec78..b1b0c78187d10 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -3,7 +3,7 @@ use std::cmp; use oxc_ast_macros::ast_meta; use oxc_estree::{ CompactFixesJSSerializer, CompactFixesTSSerializer, CompactJSSerializer, CompactTSSerializer, - Concat2, ConfigFixesJS, ConfigFixesTS, ConfigJS, ConfigTS, ESTree, JsonSafeString, + Concat2, ConfigFixesJS, ConfigFixesTS, ESTree, JsonSafeString, PrettyFixesJSSerializer, PrettyFixesTSSerializer, PrettyJSSerializer, PrettyTSSerializer, Serializer, StructSerializer, }; diff --git a/crates/oxc_regular_expression/src/generated/assert_layouts.rs b/crates/oxc_regular_expression/src/generated/assert_layouts.rs index e94f786f73416..fb78ea92db887 100644 --- a/crates/oxc_regular_expression/src/generated/assert_layouts.rs +++ b/crates/oxc_regular_expression/src/generated/assert_layouts.rs @@ -10,95 +10,95 @@ use crate::ast::*; #[cfg(target_pointer_width = "64")] const _: () = { // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(Pattern, span) == 0); - assert!(offset_of!(Pattern, body) == 8); + assert!(offset_of!(Pattern, body) == 24); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(Disjunction, span) == 0); - assert!(offset_of!(Disjunction, body) == 8); + assert!(offset_of!(Disjunction, body) == 24); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(Alternative, span) == 0); - assert!(offset_of!(Alternative, body) == 8); + assert!(offset_of!(Alternative, body) == 24); - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 8); // Padding: 7 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(BoundaryAssertion, span) == 0); - assert!(offset_of!(BoundaryAssertion, kind) == 8); + assert!(offset_of!(BoundaryAssertion, kind) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(LookAroundAssertion, span) == 0); - assert!(offset_of!(LookAroundAssertion, kind) == 40); - assert!(offset_of!(LookAroundAssertion, body) == 8); + assert!(offset_of!(LookAroundAssertion, kind) == 72); + assert!(offset_of!(LookAroundAssertion, body) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 7 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(Quantifier, span) == 0); - assert!(offset_of!(Quantifier, min) == 8); - assert!(offset_of!(Quantifier, max) == 16); - assert!(offset_of!(Quantifier, greedy) == 48); - assert!(offset_of!(Quantifier, body) == 32); + assert!(offset_of!(Quantifier, min) == 24); + assert!(offset_of!(Quantifier, max) == 32); + assert!(offset_of!(Quantifier, greedy) == 80); + assert!(offset_of!(Quantifier, body) == 48); // Padding: 3 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(Character, span) == 0); - assert!(offset_of!(Character, kind) == 12); - assert!(offset_of!(Character, value) == 8); + assert!(offset_of!(Character, kind) == 28); + assert!(offset_of!(Character, value) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 7 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(CharacterClassEscape, span) == 0); - assert!(offset_of!(CharacterClassEscape, kind) == 8); + assert!(offset_of!(CharacterClassEscape, kind) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 6 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(UnicodePropertyEscape, span) == 0); - assert!(offset_of!(UnicodePropertyEscape, negative) == 40); - assert!(offset_of!(UnicodePropertyEscape, strings) == 41); - assert!(offset_of!(UnicodePropertyEscape, name) == 8); - assert!(offset_of!(UnicodePropertyEscape, value) == 24); + assert!(offset_of!(UnicodePropertyEscape, negative) == 56); + assert!(offset_of!(UnicodePropertyEscape, strings) == 57); + assert!(offset_of!(UnicodePropertyEscape, name) == 24); + assert!(offset_of!(UnicodePropertyEscape, value) == 40); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(Dot, span) == 0); // Padding: 5 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(CharacterClass, span) == 0); - assert!(offset_of!(CharacterClass, negative) == 32); - assert!(offset_of!(CharacterClass, strings) == 33); - assert!(offset_of!(CharacterClass, kind) == 34); - assert!(offset_of!(CharacterClass, body) == 8); + assert!(offset_of!(CharacterClass, negative) == 48); + assert!(offset_of!(CharacterClass, strings) == 49); + assert!(offset_of!(CharacterClass, kind) == 50); + assert!(offset_of!(CharacterClass, body) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -107,156 +107,156 @@ const _: () = { assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(CharacterClassRange, span) == 0); - assert!(offset_of!(CharacterClassRange, min) == 8); - assert!(offset_of!(CharacterClassRange, max) == 24); + assert!(offset_of!(CharacterClassRange, min) == 24); + assert!(offset_of!(CharacterClassRange, max) == 56); // Padding: 7 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(ClassStringDisjunction, span) == 0); - assert!(offset_of!(ClassStringDisjunction, strings) == 32); - assert!(offset_of!(ClassStringDisjunction, body) == 8); + assert!(offset_of!(ClassStringDisjunction, strings) == 48); + assert!(offset_of!(ClassStringDisjunction, body) == 24); // Padding: 7 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(ClassString, span) == 0); - assert!(offset_of!(ClassString, strings) == 32); - assert!(offset_of!(ClassString, body) == 8); + assert!(offset_of!(ClassString, strings) == 48); + assert!(offset_of!(ClassString, body) == 24); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(CapturingGroup, span) == 0); - assert!(offset_of!(CapturingGroup, name) == 8); - assert!(offset_of!(CapturingGroup, body) == 24); + assert!(offset_of!(CapturingGroup, name) == 24); + assert!(offset_of!(CapturingGroup, body) == 40); // Padding: 0 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 104); assert!(align_of::() == 8); assert!(offset_of!(IgnoreGroup, span) == 0); - assert!(offset_of!(IgnoreGroup, modifiers) == 8); - assert!(offset_of!(IgnoreGroup, body) == 32); + assert!(offset_of!(IgnoreGroup, modifiers) == 24); + assert!(offset_of!(IgnoreGroup, body) == 56); // Padding: 6 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(Modifiers, span) == 0); - assert!(offset_of!(Modifiers, enabling) == 8); - assert!(offset_of!(Modifiers, disabling) == 9); + assert!(offset_of!(Modifiers, enabling) == 24); + assert!(offset_of!(Modifiers, disabling) == 25); // Padding: 0 bytes assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 4 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(IndexedReference, span) == 0); - assert!(offset_of!(IndexedReference, index) == 8); + assert!(offset_of!(IndexedReference, index) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(NamedReference, span) == 0); - assert!(offset_of!(NamedReference, name) == 8); + assert!(offset_of!(NamedReference, name) == 24); }; #[cfg(target_pointer_width = "32")] const _: () = { // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 64); assert!(align_of::() == 4); assert!(offset_of!(Pattern, span) == 0); - assert!(offset_of!(Pattern, body) == 8); + assert!(offset_of!(Pattern, body) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(Disjunction, span) == 0); - assert!(offset_of!(Disjunction, body) == 8); + assert!(offset_of!(Disjunction, body) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(Alternative, span) == 0); - assert!(offset_of!(Alternative, body) == 8); + assert!(offset_of!(Alternative, body) == 24); - assert!(size_of::() == 12); + assert!(size_of::() == 28); assert!(align_of::() == 4); // Padding: 3 bytes - assert!(size_of::() == 12); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(BoundaryAssertion, span) == 0); - assert!(offset_of!(BoundaryAssertion, kind) == 8); + assert!(offset_of!(BoundaryAssertion, kind) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 3 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 68); assert!(align_of::() == 4); assert!(offset_of!(LookAroundAssertion, span) == 0); - assert!(offset_of!(LookAroundAssertion, kind) == 32); - assert!(offset_of!(LookAroundAssertion, body) == 8); + assert!(offset_of!(LookAroundAssertion, kind) == 64); + assert!(offset_of!(LookAroundAssertion, body) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 3 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(Quantifier, span) == 0); - assert!(offset_of!(Quantifier, min) == 8); - assert!(offset_of!(Quantifier, max) == 16); - assert!(offset_of!(Quantifier, greedy) == 44); - assert!(offset_of!(Quantifier, body) == 32); + assert!(offset_of!(Quantifier, min) == 24); + assert!(offset_of!(Quantifier, max) == 32); + assert!(offset_of!(Quantifier, greedy) == 76); + assert!(offset_of!(Quantifier, body) == 48); // Padding: 3 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(Character, span) == 0); - assert!(offset_of!(Character, kind) == 12); - assert!(offset_of!(Character, value) == 8); + assert!(offset_of!(Character, kind) == 28); + assert!(offset_of!(Character, value) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 3 bytes - assert!(size_of::() == 12); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(CharacterClassEscape, span) == 0); - assert!(offset_of!(CharacterClassEscape, kind) == 8); + assert!(offset_of!(CharacterClassEscape, kind) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 2 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(UnicodePropertyEscape, span) == 0); - assert!(offset_of!(UnicodePropertyEscape, negative) == 24); - assert!(offset_of!(UnicodePropertyEscape, strings) == 25); - assert!(offset_of!(UnicodePropertyEscape, name) == 8); - assert!(offset_of!(UnicodePropertyEscape, value) == 16); + assert!(offset_of!(UnicodePropertyEscape, negative) == 40); + assert!(offset_of!(UnicodePropertyEscape, strings) == 41); + assert!(offset_of!(UnicodePropertyEscape, name) == 24); + assert!(offset_of!(UnicodePropertyEscape, value) == 32); // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(Dot, span) == 0); // Padding: 1 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(CharacterClass, span) == 0); - assert!(offset_of!(CharacterClass, negative) == 24); - assert!(offset_of!(CharacterClass, strings) == 25); - assert!(offset_of!(CharacterClass, kind) == 26); - assert!(offset_of!(CharacterClass, body) == 8); + assert!(offset_of!(CharacterClass, negative) == 40); + assert!(offset_of!(CharacterClass, strings) == 41); + assert!(offset_of!(CharacterClass, kind) == 42); + assert!(offset_of!(CharacterClass, body) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -265,62 +265,62 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 88); assert!(align_of::() == 4); assert!(offset_of!(CharacterClassRange, span) == 0); - assert!(offset_of!(CharacterClassRange, min) == 8); - assert!(offset_of!(CharacterClassRange, max) == 24); + assert!(offset_of!(CharacterClassRange, min) == 24); + assert!(offset_of!(CharacterClassRange, max) == 56); // Padding: 3 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(ClassStringDisjunction, span) == 0); - assert!(offset_of!(ClassStringDisjunction, strings) == 24); - assert!(offset_of!(ClassStringDisjunction, body) == 8); + assert!(offset_of!(ClassStringDisjunction, strings) == 40); + assert!(offset_of!(ClassStringDisjunction, body) == 24); // Padding: 3 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(ClassString, span) == 0); - assert!(offset_of!(ClassString, strings) == 24); - assert!(offset_of!(ClassString, body) == 8); + assert!(offset_of!(ClassString, strings) == 40); + assert!(offset_of!(ClassString, body) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 72); assert!(align_of::() == 4); assert!(offset_of!(CapturingGroup, span) == 0); - assert!(offset_of!(CapturingGroup, name) == 8); - assert!(offset_of!(CapturingGroup, body) == 16); + assert!(offset_of!(CapturingGroup, name) == 24); + assert!(offset_of!(CapturingGroup, body) == 32); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 92); assert!(align_of::() == 4); assert!(offset_of!(IgnoreGroup, span) == 0); - assert!(offset_of!(IgnoreGroup, modifiers) == 8); - assert!(offset_of!(IgnoreGroup, body) == 24); + assert!(offset_of!(IgnoreGroup, modifiers) == 24); + assert!(offset_of!(IgnoreGroup, body) == 52); // Padding: 2 bytes - assert!(size_of::() == 12); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(Modifiers, span) == 0); - assert!(offset_of!(Modifiers, enabling) == 8); - assert!(offset_of!(Modifiers, disabling) == 9); + assert!(offset_of!(Modifiers, enabling) == 24); + assert!(offset_of!(Modifiers, disabling) == 25); // Padding: 0 bytes assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 12); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(IndexedReference, span) == 0); - assert!(offset_of!(IndexedReference, index) == 8); + assert!(offset_of!(IndexedReference, index) == 24); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(NamedReference, span) == 0); - assert!(offset_of!(NamedReference, name) == 8); + assert!(offset_of!(NamedReference, name) == 24); }; #[cfg(not(any(target_pointer_width = "64", target_pointer_width = "32")))] diff --git a/crates/oxc_span/src/generated/assert_layouts.rs b/crates/oxc_span/src/generated/assert_layouts.rs index 2e83549e0e9ec..d8cc05b64e056 100644 --- a/crates/oxc_span/src/generated/assert_layouts.rs +++ b/crates/oxc_span/src/generated/assert_layouts.rs @@ -10,10 +10,11 @@ use crate::*; #[cfg(target_pointer_width = "64")] const _: () = { // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(Span, start) == 0); assert!(offset_of!(Span, end) == 4); + assert!(offset_of!(Span, range) == 8); // Padding: 0 bytes assert!(size_of::() == 3); @@ -35,10 +36,11 @@ const _: () = { #[cfg(target_pointer_width = "32")] const _: () = { // Padding: 0 bytes - assert!(size_of::() == 8); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(Span, start) == 0); assert!(offset_of!(Span, end) == 4); + assert!(offset_of!(Span, range) == 8); // Padding: 0 bytes assert!(size_of::() == 3); diff --git a/crates/oxc_span/src/generated/derive_estree.rs b/crates/oxc_span/src/generated/derive_estree.rs index f82c5f70cc9ec..1cea3ba639d28 100644 --- a/crates/oxc_span/src/generated/derive_estree.rs +++ b/crates/oxc_span/src/generated/derive_estree.rs @@ -15,6 +15,7 @@ impl ESTree for Span { let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.start); state.serialize_field("end", &self.end); + state.serialize_field("range", &self.range); state.end(); } } diff --git a/crates/oxc_syntax/src/generated/assert_layouts.rs b/crates/oxc_syntax/src/generated/assert_layouts.rs index 0f0d589ebca44..a391fba1d6335 100644 --- a/crates/oxc_syntax/src/generated/assert_layouts.rs +++ b/crates/oxc_syntax/src/generated/assert_layouts.rs @@ -22,48 +22,48 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); - assert!(offset_of!(NameSpan, name) == 8); + assert!(offset_of!(NameSpan, name) == 24); assert!(offset_of!(NameSpan, span) == 0); // Padding: 7 bytes - assert!(size_of::() == 96); + assert!(size_of::() == 160); assert!(align_of::() == 8); assert!(offset_of!(ImportEntry, statement_span) == 0); - assert!(offset_of!(ImportEntry, module_request) == 8); - assert!(offset_of!(ImportEntry, import_name) == 32); - assert!(offset_of!(ImportEntry, local_name) == 64); - assert!(offset_of!(ImportEntry, is_type) == 88); + assert!(offset_of!(ImportEntry, module_request) == 24); + assert!(offset_of!(ImportEntry, import_name) == 64); + assert!(offset_of!(ImportEntry, local_name) == 112); + assert!(offset_of!(ImportEntry, is_type) == 152); - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); // Padding: 7 bytes - assert!(size_of::() == 144); + assert!(size_of::() == 240); assert!(align_of::() == 8); - assert!(offset_of!(ExportEntry, statement_span) == 8); + assert!(offset_of!(ExportEntry, statement_span) == 24); assert!(offset_of!(ExportEntry, span) == 0); - assert!(offset_of!(ExportEntry, module_request) == 16); - assert!(offset_of!(ExportEntry, import_name) == 40); - assert!(offset_of!(ExportEntry, export_name) == 72); - assert!(offset_of!(ExportEntry, local_name) == 104); - assert!(offset_of!(ExportEntry, is_type) == 136); + assert!(offset_of!(ExportEntry, module_request) == 48); + assert!(offset_of!(ExportEntry, import_name) == 88); + assert!(offset_of!(ExportEntry, export_name) == 136); + assert!(offset_of!(ExportEntry, local_name) == 184); + assert!(offset_of!(ExportEntry, is_type) == 232); - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(DynamicImport, span) == 0); - assert!(offset_of!(DynamicImport, module_request) == 8); + assert!(offset_of!(DynamicImport, module_request) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -110,48 +110,48 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); - assert!(offset_of!(NameSpan, name) == 8); + assert!(offset_of!(NameSpan, name) == 24); assert!(offset_of!(NameSpan, span) == 0); // Padding: 3 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 128); assert!(align_of::() == 4); assert!(offset_of!(ImportEntry, statement_span) == 0); - assert!(offset_of!(ImportEntry, module_request) == 8); - assert!(offset_of!(ImportEntry, import_name) == 24); - assert!(offset_of!(ImportEntry, local_name) == 44); - assert!(offset_of!(ImportEntry, is_type) == 60); + assert!(offset_of!(ImportEntry, module_request) == 24); + assert!(offset_of!(ImportEntry, import_name) == 56); + assert!(offset_of!(ImportEntry, local_name) == 92); + assert!(offset_of!(ImportEntry, is_type) == 124); - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); // Padding: 3 bytes - assert!(size_of::() == 96); + assert!(size_of::() == 192); assert!(align_of::() == 4); - assert!(offset_of!(ExportEntry, statement_span) == 8); + assert!(offset_of!(ExportEntry, statement_span) == 24); assert!(offset_of!(ExportEntry, span) == 0); - assert!(offset_of!(ExportEntry, module_request) == 16); - assert!(offset_of!(ExportEntry, import_name) == 32); - assert!(offset_of!(ExportEntry, export_name) == 52); - assert!(offset_of!(ExportEntry, local_name) == 72); - assert!(offset_of!(ExportEntry, is_type) == 92); + assert!(offset_of!(ExportEntry, module_request) == 48); + assert!(offset_of!(ExportEntry, import_name) == 80); + assert!(offset_of!(ExportEntry, export_name) == 116); + assert!(offset_of!(ExportEntry, local_name) == 152); + assert!(offset_of!(ExportEntry, is_type) == 188); - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); - assert!(size_of::() == 20); + assert!(size_of::() == 36); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(DynamicImport, span) == 0); - assert!(offset_of!(DynamicImport, module_request) == 8); + assert!(offset_of!(DynamicImport, module_request) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); diff --git a/napi/parser/generated/deserialize/js.js b/napi/parser/generated/deserialize/js.js index 9fcba72deccfc..af7998dd539c9 100644 --- a/napi/parser/generated/deserialize/js.js +++ b/napi/parser/generated/deserialize/js.js @@ -35,8 +35,8 @@ function deserialize(buffer, sourceTextInput, sourceLenInput) { } function deserializeProgram(pos) { - const body = deserializeVecDirective(pos + 72); - body.push(...deserializeVecStatement(pos + 96)); + const body = deserializeVecDirective(pos + 104); + body.push(...deserializeVecStatement(pos + 128)); const start = deserializeU32(pos); const end = deserializeU32(pos + 4); @@ -46,8 +46,8 @@ function deserializeProgram(pos) { start, end, body, - sourceType: deserializeModuleKind(pos + 125), - hashbang: deserializeOptionHashbang(pos + 48), + sourceType: deserializeModuleKind(pos + 157), + hashbang: deserializeOptionHashbang(pos + 64), }; return program; } @@ -57,7 +57,8 @@ function deserializeIdentifierName(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeStr(pos + 8), + range: deserializeOptionArrayType(pos + 8), + name: deserializeStr(pos + 24), }; } @@ -66,7 +67,8 @@ function deserializeIdentifierReference(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeStr(pos + 8), + range: deserializeOptionArrayType(pos + 8), + name: deserializeStr(pos + 24), }; } @@ -75,7 +77,8 @@ function deserializeBindingIdentifier(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeStr(pos + 8), + range: deserializeOptionArrayType(pos + 8), + name: deserializeStr(pos + 24), }; } @@ -84,7 +87,8 @@ function deserializeLabelIdentifier(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeStr(pos + 8), + range: deserializeOptionArrayType(pos + 8), + name: deserializeStr(pos + 24), }; } @@ -93,6 +97,7 @@ function deserializeThisExpression(pos) { type: 'ThisExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -101,7 +106,8 @@ function deserializeArrayExpression(pos) { type: 'ArrayExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - elements: deserializeVecArrayExpressionElement(pos + 8), + range: deserializeOptionArrayType(pos + 8), + elements: deserializeVecArrayExpressionElement(pos + 24), }; } @@ -114,7 +120,8 @@ function deserializeObjectExpression(pos) { type: 'ObjectExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - properties: deserializeVecObjectPropertyKind(pos + 8), + range: deserializeOptionArrayType(pos + 8), + properties: deserializeVecObjectPropertyKind(pos + 24), }; } @@ -123,12 +130,13 @@ function deserializeObjectProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), - kind: deserializePropertyKind(pos + 40), - key: deserializePropertyKey(pos + 8), - value: deserializeExpression(pos + 24), - method: deserializeBool(pos + 41), - shorthand: deserializeBool(pos + 42), - computed: deserializeBool(pos + 43), + range: deserializeOptionArrayType(pos + 8), + kind: deserializePropertyKind(pos + 56), + key: deserializePropertyKey(pos + 24), + value: deserializeExpression(pos + 40), + method: deserializeBool(pos + 57), + shorthand: deserializeBool(pos + 58), + computed: deserializeBool(pos + 59), }; } @@ -137,8 +145,9 @@ function deserializeTemplateLiteral(pos) { type: 'TemplateLiteral', start: deserializeU32(pos), end: deserializeU32(pos + 4), - quasis: deserializeVecTemplateElement(pos + 8), - expressions: deserializeVecExpression(pos + 32), + range: deserializeOptionArrayType(pos + 8), + quasis: deserializeVecTemplateElement(pos + 24), + expressions: deserializeVecExpression(pos + 48), }; } @@ -147,17 +156,18 @@ function deserializeTaggedTemplateExpression(pos) { type: 'TaggedTemplateExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - tag: deserializeExpression(pos + 8), - quasi: deserializeTemplateLiteral(pos + 32), + range: deserializeOptionArrayType(pos + 8), + tag: deserializeExpression(pos + 24), + quasi: deserializeTemplateLiteral(pos + 48), }; } function deserializeTemplateElement(pos) { - const tail = deserializeBool(pos + 40), + const tail = deserializeBool(pos + 56), start = deserializeU32(pos), end = deserializeU32(pos + 4), - value = deserializeTemplateElementValue(pos + 8); - if (value.cooked !== null && deserializeBool(pos + 41)) { + value = deserializeTemplateElementValue(pos + 24); + if (value.cooked !== null && deserializeBool(pos + 57)) { value.cooked = value.cooked .replace(/\uFFFD(.{4})/g, (_, hex) => String.fromCodePoint(parseInt(hex, 16))); } @@ -176,9 +186,10 @@ function deserializeComputedMemberExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - object: deserializeExpression(pos + 8), - property: deserializeExpression(pos + 24), - optional: deserializeBool(pos + 40), + range: deserializeOptionArrayType(pos + 8), + object: deserializeExpression(pos + 24), + property: deserializeExpression(pos + 40), + optional: deserializeBool(pos + 56), computed: true, }; } @@ -188,9 +199,10 @@ function deserializeStaticMemberExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - object: deserializeExpression(pos + 8), - property: deserializeIdentifierName(pos + 24), - optional: deserializeBool(pos + 48), + range: deserializeOptionArrayType(pos + 8), + object: deserializeExpression(pos + 24), + property: deserializeIdentifierName(pos + 40), + optional: deserializeBool(pos + 80), computed: false, }; } @@ -200,9 +212,10 @@ function deserializePrivateFieldExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - object: deserializeExpression(pos + 8), - property: deserializePrivateIdentifier(pos + 24), - optional: deserializeBool(pos + 48), + range: deserializeOptionArrayType(pos + 8), + object: deserializeExpression(pos + 24), + property: deserializePrivateIdentifier(pos + 40), + optional: deserializeBool(pos + 80), computed: false, }; } @@ -212,9 +225,10 @@ function deserializeCallExpression(pos) { type: 'CallExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - callee: deserializeExpression(pos + 8), - arguments: deserializeVecArgument(pos + 32), - optional: deserializeBool(pos + 56), + range: deserializeOptionArrayType(pos + 8), + callee: deserializeExpression(pos + 24), + arguments: deserializeVecArgument(pos + 48), + optional: deserializeBool(pos + 72), }; } @@ -223,8 +237,9 @@ function deserializeNewExpression(pos) { type: 'NewExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - callee: deserializeExpression(pos + 8), - arguments: deserializeVecArgument(pos + 32), + range: deserializeOptionArrayType(pos + 8), + callee: deserializeExpression(pos + 24), + arguments: deserializeVecArgument(pos + 48), }; } @@ -233,8 +248,9 @@ function deserializeMetaProperty(pos) { type: 'MetaProperty', start: deserializeU32(pos), end: deserializeU32(pos + 4), - meta: deserializeIdentifierName(pos + 8), - property: deserializeIdentifierName(pos + 32), + range: deserializeOptionArrayType(pos + 8), + meta: deserializeIdentifierName(pos + 24), + property: deserializeIdentifierName(pos + 64), }; } @@ -243,7 +259,8 @@ function deserializeSpreadElement(pos) { type: 'SpreadElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + argument: deserializeExpression(pos + 24), }; } @@ -252,9 +269,10 @@ function deserializeUpdateExpression(pos) { type: 'UpdateExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - operator: deserializeUpdateOperator(pos + 24), - prefix: deserializeBool(pos + 25), - argument: deserializeSimpleAssignmentTarget(pos + 8), + range: deserializeOptionArrayType(pos + 8), + operator: deserializeUpdateOperator(pos + 40), + prefix: deserializeBool(pos + 41), + argument: deserializeSimpleAssignmentTarget(pos + 24), }; } @@ -263,8 +281,9 @@ function deserializeUnaryExpression(pos) { type: 'UnaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - operator: deserializeUnaryOperator(pos + 24), - argument: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + operator: deserializeUnaryOperator(pos + 40), + argument: deserializeExpression(pos + 24), prefix: true, }; } @@ -274,9 +293,10 @@ function deserializeBinaryExpression(pos) { type: 'BinaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - left: deserializeExpression(pos + 8), - operator: deserializeBinaryOperator(pos + 40), - right: deserializeExpression(pos + 24), + range: deserializeOptionArrayType(pos + 8), + left: deserializeExpression(pos + 24), + operator: deserializeBinaryOperator(pos + 56), + right: deserializeExpression(pos + 40), }; } @@ -285,9 +305,10 @@ function deserializePrivateInExpression(pos) { type: 'BinaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - left: deserializePrivateIdentifier(pos + 8), + range: deserializeOptionArrayType(pos + 8), + left: deserializePrivateIdentifier(pos + 24), operator: 'in', - right: deserializeExpression(pos + 32), + right: deserializeExpression(pos + 64), }; } @@ -296,9 +317,10 @@ function deserializeLogicalExpression(pos) { type: 'LogicalExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - left: deserializeExpression(pos + 8), - operator: deserializeLogicalOperator(pos + 40), - right: deserializeExpression(pos + 24), + range: deserializeOptionArrayType(pos + 8), + left: deserializeExpression(pos + 24), + operator: deserializeLogicalOperator(pos + 56), + right: deserializeExpression(pos + 40), }; } @@ -307,9 +329,10 @@ function deserializeConditionalExpression(pos) { type: 'ConditionalExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - test: deserializeExpression(pos + 8), - consequent: deserializeExpression(pos + 24), - alternate: deserializeExpression(pos + 40), + range: deserializeOptionArrayType(pos + 8), + test: deserializeExpression(pos + 24), + consequent: deserializeExpression(pos + 40), + alternate: deserializeExpression(pos + 56), }; } @@ -318,32 +341,35 @@ function deserializeAssignmentExpression(pos) { type: 'AssignmentExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - operator: deserializeAssignmentOperator(pos + 40), - left: deserializeAssignmentTarget(pos + 8), - right: deserializeExpression(pos + 24), + range: deserializeOptionArrayType(pos + 8), + operator: deserializeAssignmentOperator(pos + 56), + left: deserializeAssignmentTarget(pos + 24), + right: deserializeExpression(pos + 40), }; } function deserializeArrayAssignmentTarget(pos) { - const elements = deserializeVecOptionAssignmentTargetMaybeDefault(pos + 8); - const rest = deserializeOptionAssignmentTargetRest(pos + 32); + const elements = deserializeVecOptionAssignmentTargetMaybeDefault(pos + 24); + const rest = deserializeOptionAssignmentTargetRest(pos + 48); if (rest !== null) elements.push(rest); return { type: 'ArrayPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), elements, }; } function deserializeObjectAssignmentTarget(pos) { - const properties = deserializeVecAssignmentTargetProperty(pos + 8); - const rest = deserializeOptionAssignmentTargetRest(pos + 32); + const properties = deserializeVecAssignmentTargetProperty(pos + 24); + const rest = deserializeOptionAssignmentTargetRest(pos + 48); if (rest !== null) properties.push(rest); return { type: 'ObjectPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), properties, }; } @@ -353,7 +379,8 @@ function deserializeAssignmentTargetRest(pos) { type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeAssignmentTarget(pos + 8), + range: deserializeOptionArrayType(pos + 8), + argument: deserializeAssignmentTarget(pos + 24), }; } @@ -362,16 +389,17 @@ function deserializeAssignmentTargetWithDefault(pos) { type: 'AssignmentPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - left: deserializeAssignmentTarget(pos + 8), - right: deserializeExpression(pos + 24), + range: deserializeOptionArrayType(pos + 8), + left: deserializeAssignmentTarget(pos + 24), + right: deserializeExpression(pos + 40), }; } function deserializeAssignmentTargetPropertyIdentifier(pos) { const start = deserializeU32(pos), end = deserializeU32(pos + 4), - key = deserializeIdentifierReference(pos + 8); - const init = deserializeOptionExpression(pos + 40), + key = deserializeIdentifierReference(pos + 24); + const init = deserializeOptionExpression(pos + 72), keyCopy = { ...key }, value = init === null ? keyCopy @@ -386,6 +414,7 @@ function deserializeAssignmentTargetPropertyIdentifier(pos) { type: 'Property', start, end, + range: deserializeOptionArrayType(pos + 8), kind: 'init', key, value, @@ -400,12 +429,13 @@ function deserializeAssignmentTargetPropertyProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), kind: 'init', - key: deserializePropertyKey(pos + 8), - value: deserializeAssignmentTargetMaybeDefault(pos + 24), + key: deserializePropertyKey(pos + 24), + value: deserializeAssignmentTargetMaybeDefault(pos + 40), method: false, shorthand: false, - computed: deserializeBool(pos + 40), + computed: deserializeBool(pos + 56), }; } @@ -414,7 +444,8 @@ function deserializeSequenceExpression(pos) { type: 'SequenceExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expressions: deserializeVecExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expressions: deserializeVecExpression(pos + 24), }; } @@ -423,6 +454,7 @@ function deserializeSuper(pos) { type: 'Super', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -431,7 +463,8 @@ function deserializeAwaitExpression(pos) { type: 'AwaitExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + argument: deserializeExpression(pos + 24), }; } @@ -440,7 +473,8 @@ function deserializeChainExpression(pos) { type: 'ChainExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeChainElement(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeChainElement(pos + 24), }; } @@ -449,7 +483,8 @@ function deserializeParenthesizedExpression(pos) { type: 'ParenthesizedExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), }; } @@ -458,8 +493,9 @@ function deserializeDirective(pos) { type: 'ExpressionStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeStringLiteral(pos + 8), - directive: deserializeStr(pos + 56), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeStringLiteral(pos + 24), + directive: deserializeStr(pos + 88), }; } @@ -468,7 +504,8 @@ function deserializeHashbang(pos) { type: 'Hashbang', start: deserializeU32(pos), end: deserializeU32(pos + 4), - value: deserializeStr(pos + 8), + range: deserializeOptionArrayType(pos + 8), + value: deserializeStr(pos + 24), }; } @@ -477,7 +514,8 @@ function deserializeBlockStatement(pos) { type: 'BlockStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - body: deserializeVecStatement(pos + 8), + range: deserializeOptionArrayType(pos + 8), + body: deserializeVecStatement(pos + 24), }; } @@ -486,8 +524,9 @@ function deserializeVariableDeclaration(pos) { type: 'VariableDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - kind: deserializeVariableDeclarationKind(pos + 32), - declarations: deserializeVecVariableDeclarator(pos + 8), + range: deserializeOptionArrayType(pos + 8), + kind: deserializeVariableDeclarationKind(pos + 48), + declarations: deserializeVecVariableDeclarator(pos + 24), }; } @@ -496,8 +535,9 @@ function deserializeVariableDeclarator(pos) { type: 'VariableDeclarator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeBindingPattern(pos + 8), - init: deserializeOptionExpression(pos + 40), + range: deserializeOptionArrayType(pos + 8), + id: deserializeBindingPattern(pos + 24), + init: deserializeOptionExpression(pos + 56), }; } @@ -506,6 +546,7 @@ function deserializeEmptyStatement(pos) { type: 'EmptyStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -514,7 +555,8 @@ function deserializeExpressionStatement(pos) { type: 'ExpressionStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), }; } @@ -523,9 +565,10 @@ function deserializeIfStatement(pos) { type: 'IfStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - test: deserializeExpression(pos + 8), - consequent: deserializeStatement(pos + 24), - alternate: deserializeOptionStatement(pos + 40), + range: deserializeOptionArrayType(pos + 8), + test: deserializeExpression(pos + 24), + consequent: deserializeStatement(pos + 40), + alternate: deserializeOptionStatement(pos + 56), }; } @@ -534,8 +577,9 @@ function deserializeDoWhileStatement(pos) { type: 'DoWhileStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - body: deserializeStatement(pos + 8), - test: deserializeExpression(pos + 24), + range: deserializeOptionArrayType(pos + 8), + body: deserializeStatement(pos + 24), + test: deserializeExpression(pos + 40), }; } @@ -544,8 +588,9 @@ function deserializeWhileStatement(pos) { type: 'WhileStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - test: deserializeExpression(pos + 8), - body: deserializeStatement(pos + 24), + range: deserializeOptionArrayType(pos + 8), + test: deserializeExpression(pos + 24), + body: deserializeStatement(pos + 40), }; } @@ -554,10 +599,11 @@ function deserializeForStatement(pos) { type: 'ForStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - init: deserializeOptionForStatementInit(pos + 8), - test: deserializeOptionExpression(pos + 24), - update: deserializeOptionExpression(pos + 40), - body: deserializeStatement(pos + 56), + range: deserializeOptionArrayType(pos + 8), + init: deserializeOptionForStatementInit(pos + 24), + test: deserializeOptionExpression(pos + 40), + update: deserializeOptionExpression(pos + 56), + body: deserializeStatement(pos + 72), }; } @@ -566,9 +612,10 @@ function deserializeForInStatement(pos) { type: 'ForInStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - left: deserializeForStatementLeft(pos + 8), - right: deserializeExpression(pos + 24), - body: deserializeStatement(pos + 40), + range: deserializeOptionArrayType(pos + 8), + left: deserializeForStatementLeft(pos + 24), + right: deserializeExpression(pos + 40), + body: deserializeStatement(pos + 56), }; } @@ -577,10 +624,11 @@ function deserializeForOfStatement(pos) { type: 'ForOfStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - await: deserializeBool(pos + 60), - left: deserializeForStatementLeft(pos + 8), - right: deserializeExpression(pos + 24), - body: deserializeStatement(pos + 40), + range: deserializeOptionArrayType(pos + 8), + await: deserializeBool(pos + 76), + left: deserializeForStatementLeft(pos + 24), + right: deserializeExpression(pos + 40), + body: deserializeStatement(pos + 56), }; } @@ -589,7 +637,8 @@ function deserializeContinueStatement(pos) { type: 'ContinueStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - label: deserializeOptionLabelIdentifier(pos + 8), + range: deserializeOptionArrayType(pos + 8), + label: deserializeOptionLabelIdentifier(pos + 24), }; } @@ -598,7 +647,8 @@ function deserializeBreakStatement(pos) { type: 'BreakStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - label: deserializeOptionLabelIdentifier(pos + 8), + range: deserializeOptionArrayType(pos + 8), + label: deserializeOptionLabelIdentifier(pos + 24), }; } @@ -607,7 +657,8 @@ function deserializeReturnStatement(pos) { type: 'ReturnStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeOptionExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + argument: deserializeOptionExpression(pos + 24), }; } @@ -616,8 +667,9 @@ function deserializeWithStatement(pos) { type: 'WithStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - object: deserializeExpression(pos + 8), - body: deserializeStatement(pos + 24), + range: deserializeOptionArrayType(pos + 8), + object: deserializeExpression(pos + 24), + body: deserializeStatement(pos + 40), }; } @@ -626,8 +678,9 @@ function deserializeSwitchStatement(pos) { type: 'SwitchStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - discriminant: deserializeExpression(pos + 8), - cases: deserializeVecSwitchCase(pos + 24), + range: deserializeOptionArrayType(pos + 8), + discriminant: deserializeExpression(pos + 24), + cases: deserializeVecSwitchCase(pos + 40), }; } @@ -636,8 +689,9 @@ function deserializeSwitchCase(pos) { type: 'SwitchCase', start: deserializeU32(pos), end: deserializeU32(pos + 4), - test: deserializeOptionExpression(pos + 8), - consequent: deserializeVecStatement(pos + 24), + range: deserializeOptionArrayType(pos + 8), + test: deserializeOptionExpression(pos + 24), + consequent: deserializeVecStatement(pos + 40), }; } @@ -646,8 +700,9 @@ function deserializeLabeledStatement(pos) { type: 'LabeledStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - label: deserializeLabelIdentifier(pos + 8), - body: deserializeStatement(pos + 32), + range: deserializeOptionArrayType(pos + 8), + label: deserializeLabelIdentifier(pos + 24), + body: deserializeStatement(pos + 64), }; } @@ -656,7 +711,8 @@ function deserializeThrowStatement(pos) { type: 'ThrowStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + argument: deserializeExpression(pos + 24), }; } @@ -665,9 +721,10 @@ function deserializeTryStatement(pos) { type: 'TryStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - block: deserializeBoxBlockStatement(pos + 8), - handler: deserializeOptionBoxCatchClause(pos + 16), - finalizer: deserializeOptionBoxBlockStatement(pos + 24), + range: deserializeOptionArrayType(pos + 8), + block: deserializeBoxBlockStatement(pos + 24), + handler: deserializeOptionBoxCatchClause(pos + 32), + finalizer: deserializeOptionBoxBlockStatement(pos + 40), }; } @@ -676,13 +733,14 @@ function deserializeCatchClause(pos) { type: 'CatchClause', start: deserializeU32(pos), end: deserializeU32(pos + 4), - param: deserializeOptionCatchParameter(pos + 8), - body: deserializeBoxBlockStatement(pos + 48), + range: deserializeOptionArrayType(pos + 8), + param: deserializeOptionCatchParameter(pos + 24), + body: deserializeBoxBlockStatement(pos + 80), }; } function deserializeCatchParameter(pos) { - return deserializeBindingPattern(pos + 8); + return deserializeBindingPattern(pos + 24); } function deserializeDebuggerStatement(pos) { @@ -690,6 +748,7 @@ function deserializeDebuggerStatement(pos) { type: 'DebuggerStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -703,19 +762,21 @@ function deserializeAssignmentPattern(pos) { type: 'AssignmentPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - left: deserializeBindingPattern(pos + 8), - right: deserializeExpression(pos + 40), + range: deserializeOptionArrayType(pos + 8), + left: deserializeBindingPattern(pos + 24), + right: deserializeExpression(pos + 56), }; } function deserializeObjectPattern(pos) { - const properties = deserializeVecBindingProperty(pos + 8); - const rest = deserializeOptionBoxBindingRestElement(pos + 32); + const properties = deserializeVecBindingProperty(pos + 24); + const rest = deserializeOptionBoxBindingRestElement(pos + 48); if (rest !== null) properties.push(rest); return { type: 'ObjectPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), properties, }; } @@ -725,23 +786,25 @@ function deserializeBindingProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), kind: 'init', - key: deserializePropertyKey(pos + 8), - value: deserializeBindingPattern(pos + 24), + key: deserializePropertyKey(pos + 24), + value: deserializeBindingPattern(pos + 40), method: false, - shorthand: deserializeBool(pos + 56), - computed: deserializeBool(pos + 57), + shorthand: deserializeBool(pos + 72), + computed: deserializeBool(pos + 73), }; } function deserializeArrayPattern(pos) { - const elements = deserializeVecOptionBindingPattern(pos + 8); - const rest = deserializeOptionBoxBindingRestElement(pos + 32); + const elements = deserializeVecOptionBindingPattern(pos + 24); + const rest = deserializeOptionBoxBindingRestElement(pos + 48); if (rest !== null) elements.push(rest); return { type: 'ArrayPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), elements, }; } @@ -751,64 +814,68 @@ function deserializeBindingRestElement(pos) { type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeBindingPattern(pos + 8), + range: deserializeOptionArrayType(pos + 8), + argument: deserializeBindingPattern(pos + 24), }; } function deserializeFunction(pos) { - const params = deserializeBoxFormalParameters(pos + 56); + const params = deserializeBoxFormalParameters(pos + 88); return { - type: deserializeFunctionType(pos + 84), + type: deserializeFunctionType(pos + 116), start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeOptionBindingIdentifier(pos + 8), - generator: deserializeBool(pos + 85), - async: deserializeBool(pos + 86), + range: deserializeOptionArrayType(pos + 8), + id: deserializeOptionBindingIdentifier(pos + 24), + generator: deserializeBool(pos + 117), + async: deserializeBool(pos + 118), params, - body: deserializeOptionBoxFunctionBody(pos + 72), + body: deserializeOptionBoxFunctionBody(pos + 104), expression: false, }; } function deserializeFormalParameters(pos) { - const params = deserializeVecFormalParameter(pos + 8); - if (uint32[(pos + 32) >> 2] !== 0 && uint32[(pos + 36) >> 2] !== 0) { - pos = uint32[(pos + 32) >> 2]; + const params = deserializeVecFormalParameter(pos + 24); + if (uint32[(pos + 48) >> 2] !== 0 && uint32[(pos + 52) >> 2] !== 0) { + pos = uint32[(pos + 48) >> 2]; params.push({ type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeBindingPatternKind(pos + 8), + argument: deserializeBindingPatternKind(pos + 24), }); } return params; } function deserializeFormalParameter(pos) { - return deserializeBindingPatternKind(pos + 32); + return deserializeBindingPatternKind(pos + 48); } function deserializeFunctionBody(pos) { - const body = deserializeVecDirective(pos + 8); - body.push(...deserializeVecStatement(pos + 32)); + const body = deserializeVecDirective(pos + 24); + body.push(...deserializeVecStatement(pos + 48)); return { type: 'BlockStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), body, }; } function deserializeArrowFunctionExpression(pos) { - const expression = deserializeBool(pos + 44); - let body = deserializeBoxFunctionBody(pos + 32); + const expression = deserializeBool(pos + 60); + let body = deserializeBoxFunctionBody(pos + 48); return { type: 'ArrowFunctionExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), expression, - async: deserializeBool(pos + 45), - params: deserializeBoxFormalParameters(pos + 16), + async: deserializeBool(pos + 61), + params: deserializeBoxFormalParameters(pos + 32), body: expression ? body.body[0].expression : body, id: null, generator: false, @@ -820,20 +887,22 @@ function deserializeYieldExpression(pos) { type: 'YieldExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - delegate: deserializeBool(pos + 24), - argument: deserializeOptionExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + delegate: deserializeBool(pos + 40), + argument: deserializeOptionExpression(pos + 24), }; } function deserializeClass(pos) { return { - type: deserializeClassType(pos + 132), + type: deserializeClassType(pos + 164), start: deserializeU32(pos), end: deserializeU32(pos + 4), - decorators: deserializeVecDecorator(pos + 8), - id: deserializeOptionBindingIdentifier(pos + 32), - superClass: deserializeOptionExpression(pos + 72), - body: deserializeBoxClassBody(pos + 120), + range: deserializeOptionArrayType(pos + 8), + decorators: deserializeVecDecorator(pos + 24), + id: deserializeOptionBindingIdentifier(pos + 48), + superClass: deserializeOptionExpression(pos + 104), + body: deserializeBoxClassBody(pos + 152), }; } @@ -842,34 +911,37 @@ function deserializeClassBody(pos) { type: 'ClassBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - body: deserializeVecClassElement(pos + 8), + range: deserializeOptionArrayType(pos + 8), + body: deserializeVecClassElement(pos + 24), }; } function deserializeMethodDefinition(pos) { return { - type: deserializeMethodDefinitionType(pos + 56), + type: deserializeMethodDefinitionType(pos + 72), start: deserializeU32(pos), end: deserializeU32(pos + 4), - decorators: deserializeVecDecorator(pos + 8), - key: deserializePropertyKey(pos + 32), - value: deserializeBoxFunction(pos + 48), - kind: deserializeMethodDefinitionKind(pos + 57), - computed: deserializeBool(pos + 58), - static: deserializeBool(pos + 59), + range: deserializeOptionArrayType(pos + 8), + decorators: deserializeVecDecorator(pos + 24), + key: deserializePropertyKey(pos + 48), + value: deserializeBoxFunction(pos + 64), + kind: deserializeMethodDefinitionKind(pos + 73), + computed: deserializeBool(pos + 74), + static: deserializeBool(pos + 75), }; } function deserializePropertyDefinition(pos) { return { - type: deserializePropertyDefinitionType(pos + 72), + type: deserializePropertyDefinitionType(pos + 88), start: deserializeU32(pos), end: deserializeU32(pos + 4), - decorators: deserializeVecDecorator(pos + 8), - key: deserializePropertyKey(pos + 32), - value: deserializeOptionExpression(pos + 56), - computed: deserializeBool(pos + 73), - static: deserializeBool(pos + 74), + range: deserializeOptionArrayType(pos + 8), + decorators: deserializeVecDecorator(pos + 24), + key: deserializePropertyKey(pos + 48), + value: deserializeOptionExpression(pos + 72), + computed: deserializeBool(pos + 89), + static: deserializeBool(pos + 90), }; } @@ -878,7 +950,8 @@ function deserializePrivateIdentifier(pos) { type: 'PrivateIdentifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeStr(pos + 8), + range: deserializeOptionArrayType(pos + 8), + name: deserializeStr(pos + 24), }; } @@ -887,20 +960,22 @@ function deserializeStaticBlock(pos) { type: 'StaticBlock', start: deserializeU32(pos), end: deserializeU32(pos + 4), - body: deserializeVecStatement(pos + 8), + range: deserializeOptionArrayType(pos + 8), + body: deserializeVecStatement(pos + 24), }; } function deserializeAccessorProperty(pos) { return { - type: deserializeAccessorPropertyType(pos + 72), + type: deserializeAccessorPropertyType(pos + 88), start: deserializeU32(pos), end: deserializeU32(pos + 4), - decorators: deserializeVecDecorator(pos + 8), - key: deserializePropertyKey(pos + 32), - value: deserializeOptionExpression(pos + 56), - computed: deserializeBool(pos + 73), - static: deserializeBool(pos + 74), + range: deserializeOptionArrayType(pos + 8), + decorators: deserializeVecDecorator(pos + 24), + key: deserializePropertyKey(pos + 48), + value: deserializeOptionExpression(pos + 72), + computed: deserializeBool(pos + 89), + static: deserializeBool(pos + 90), }; } @@ -909,23 +984,25 @@ function deserializeImportExpression(pos) { type: 'ImportExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - source: deserializeExpression(pos + 8), - options: deserializeOptionExpression(pos + 24), - phase: deserializeOptionImportPhase(pos + 40), + range: deserializeOptionArrayType(pos + 8), + source: deserializeExpression(pos + 24), + options: deserializeOptionExpression(pos + 40), + phase: deserializeOptionImportPhase(pos + 56), }; } function deserializeImportDeclaration(pos) { - let specifiers = deserializeOptionVecImportDeclarationSpecifier(pos + 8); + let specifiers = deserializeOptionVecImportDeclarationSpecifier(pos + 24); if (specifiers === null) specifiers = []; - const withClause = deserializeOptionBoxWithClause(pos + 80); + const withClause = deserializeOptionBoxWithClause(pos + 112); return { type: 'ImportDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), specifiers, - source: deserializeStringLiteral(pos + 32), - phase: deserializeOptionImportPhase(pos + 88), + source: deserializeStringLiteral(pos + 48), + phase: deserializeOptionImportPhase(pos + 120), attributes: withClause === null ? [] : withClause.attributes, }; } @@ -935,8 +1012,9 @@ function deserializeImportSpecifier(pos) { type: 'ImportSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - imported: deserializeModuleExportName(pos + 8), - local: deserializeBindingIdentifier(pos + 64), + range: deserializeOptionArrayType(pos + 8), + imported: deserializeModuleExportName(pos + 24), + local: deserializeBindingIdentifier(pos + 96), }; } @@ -945,7 +1023,8 @@ function deserializeImportDefaultSpecifier(pos) { type: 'ImportDefaultSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - local: deserializeBindingIdentifier(pos + 8), + range: deserializeOptionArrayType(pos + 8), + local: deserializeBindingIdentifier(pos + 24), }; } @@ -954,13 +1033,14 @@ function deserializeImportNamespaceSpecifier(pos) { type: 'ImportNamespaceSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - local: deserializeBindingIdentifier(pos + 8), + range: deserializeOptionArrayType(pos + 8), + local: deserializeBindingIdentifier(pos + 24), }; } function deserializeWithClause(pos) { return { - attributes: deserializeVecImportAttribute(pos + 32), + attributes: deserializeVecImportAttribute(pos + 64), }; } @@ -969,20 +1049,22 @@ function deserializeImportAttribute(pos) { type: 'ImportAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - key: deserializeImportAttributeKey(pos + 8), - value: deserializeStringLiteral(pos + 64), + range: deserializeOptionArrayType(pos + 8), + key: deserializeImportAttributeKey(pos + 24), + value: deserializeStringLiteral(pos + 96), }; } function deserializeExportNamedDeclaration(pos) { - const withClause = deserializeOptionBoxWithClause(pos + 96); + const withClause = deserializeOptionBoxWithClause(pos + 128); return { type: 'ExportNamedDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - declaration: deserializeOptionDeclaration(pos + 8), - specifiers: deserializeVecExportSpecifier(pos + 24), - source: deserializeOptionStringLiteral(pos + 48), + range: deserializeOptionArrayType(pos + 8), + declaration: deserializeOptionDeclaration(pos + 24), + specifiers: deserializeVecExportSpecifier(pos + 40), + source: deserializeOptionStringLiteral(pos + 64), attributes: withClause === null ? [] : withClause.attributes, }; } @@ -992,18 +1074,20 @@ function deserializeExportDefaultDeclaration(pos) { type: 'ExportDefaultDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - declaration: deserializeExportDefaultDeclarationKind(pos + 64), + range: deserializeOptionArrayType(pos + 8), + declaration: deserializeExportDefaultDeclarationKind(pos + 96), }; } function deserializeExportAllDeclaration(pos) { - const withClause = deserializeOptionBoxWithClause(pos + 112); + const withClause = deserializeOptionBoxWithClause(pos + 160); return { type: 'ExportAllDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - exported: deserializeOptionModuleExportName(pos + 8), - source: deserializeStringLiteral(pos + 64), + range: deserializeOptionArrayType(pos + 8), + exported: deserializeOptionModuleExportName(pos + 24), + source: deserializeStringLiteral(pos + 96), attributes: withClause === null ? [] : withClause.attributes, }; } @@ -1013,8 +1097,9 @@ function deserializeExportSpecifier(pos) { type: 'ExportSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - local: deserializeModuleExportName(pos + 8), - exported: deserializeModuleExportName(pos + 64), + range: deserializeOptionArrayType(pos + 8), + local: deserializeModuleExportName(pos + 24), + exported: deserializeModuleExportName(pos + 96), }; } @@ -1023,19 +1108,21 @@ function deserializeV8IntrinsicExpression(pos) { type: 'V8IntrinsicExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeIdentifierName(pos + 8), - arguments: deserializeVecArgument(pos + 32), + range: deserializeOptionArrayType(pos + 8), + name: deserializeIdentifierName(pos + 24), + arguments: deserializeVecArgument(pos + 64), }; } function deserializeBooleanLiteral(pos) { const start = deserializeU32(pos), end = deserializeU32(pos + 4), - value = deserializeBool(pos + 8); + value = deserializeBool(pos + 24); return { type: 'Literal', start, end, + range: deserializeOptionArrayType(pos + 8), value, raw: (start === 0 && end === 0) ? null : value + '', }; @@ -1048,6 +1135,7 @@ function deserializeNullLiteral(pos) { type: 'Literal', start, end, + range: deserializeOptionArrayType(pos + 8), value: null, raw: (start === 0 && end === 0) ? null : 'null', }; @@ -1058,39 +1146,42 @@ function deserializeNumericLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - value: deserializeF64(pos + 8), - raw: deserializeOptionStr(pos + 16), + range: deserializeOptionArrayType(pos + 8), + value: deserializeF64(pos + 24), + raw: deserializeOptionStr(pos + 32), }; } function deserializeStringLiteral(pos) { - let value = deserializeStr(pos + 8); - if (deserializeBool(pos + 40)) { + let value = deserializeStr(pos + 24); + if (deserializeBool(pos + 56)) { value = value.replace(/\uFFFD(.{4})/g, (_, hex) => String.fromCodePoint(parseInt(hex, 16))); } return { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), value, - raw: deserializeOptionStr(pos + 24), + raw: deserializeOptionStr(pos + 40), }; } function deserializeBigIntLiteral(pos) { - const bigint = deserializeStr(pos + 8); + const bigint = deserializeStr(pos + 24); return { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), value: BigInt(bigint), - raw: deserializeOptionStr(pos + 24), + raw: deserializeOptionStr(pos + 40), bigint, }; } function deserializeRegExpLiteral(pos) { - const regex = deserializeRegExp(pos + 8); + const regex = deserializeRegExp(pos + 24); let value = null; try { value = new RegExp(regex.pattern, regex.flags); @@ -1099,8 +1190,9 @@ function deserializeRegExpLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), value, - raw: deserializeOptionStr(pos + 40), + raw: deserializeOptionStr(pos + 56), regex, }; } @@ -1134,15 +1226,16 @@ function deserializeRegExpFlags(pos) { } function deserializeJSXElement(pos) { - const closingElement = deserializeOptionBoxJSXClosingElement(pos + 40); - const openingElement = deserializeBoxJSXOpeningElement(pos + 8); + const closingElement = deserializeOptionBoxJSXClosingElement(pos + 56); + const openingElement = deserializeBoxJSXOpeningElement(pos + 24); if (closingElement === null) openingElement.selfClosing = true; return { type: 'JSXElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), openingElement, - children: deserializeVecJSXChild(pos + 16), + children: deserializeVecJSXChild(pos + 32), closingElement, }; } @@ -1152,8 +1245,9 @@ function deserializeJSXOpeningElement(pos) { type: 'JSXOpeningElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeJSXElementName(pos + 8), - attributes: deserializeVecJSXAttributeItem(pos + 32), + range: deserializeOptionArrayType(pos + 8), + name: deserializeJSXElementName(pos + 24), + attributes: deserializeVecJSXAttributeItem(pos + 48), selfClosing: false, }; } @@ -1163,7 +1257,8 @@ function deserializeJSXClosingElement(pos) { type: 'JSXClosingElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeJSXElementName(pos + 8), + range: deserializeOptionArrayType(pos + 8), + name: deserializeJSXElementName(pos + 24), }; } @@ -1172,9 +1267,10 @@ function deserializeJSXFragment(pos) { type: 'JSXFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - openingFragment: deserializeJSXOpeningFragment(pos + 8), - children: deserializeVecJSXChild(pos + 16), - closingFragment: deserializeJSXClosingFragment(pos + 40), + range: deserializeOptionArrayType(pos + 8), + openingFragment: deserializeJSXOpeningFragment(pos + 24), + children: deserializeVecJSXChild(pos + 48), + closingFragment: deserializeJSXClosingFragment(pos + 72), }; } @@ -1183,6 +1279,7 @@ function deserializeJSXOpeningFragment(pos) { type: 'JSXOpeningFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), attributes: [], selfClosing: false, }; @@ -1193,6 +1290,7 @@ function deserializeJSXClosingFragment(pos) { type: 'JSXClosingFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1201,8 +1299,9 @@ function deserializeJSXNamespacedName(pos) { type: 'JSXNamespacedName', start: deserializeU32(pos), end: deserializeU32(pos + 4), - namespace: deserializeJSXIdentifier(pos + 8), - name: deserializeJSXIdentifier(pos + 32), + range: deserializeOptionArrayType(pos + 8), + namespace: deserializeJSXIdentifier(pos + 24), + name: deserializeJSXIdentifier(pos + 64), }; } @@ -1211,8 +1310,9 @@ function deserializeJSXMemberExpression(pos) { type: 'JSXMemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - object: deserializeJSXMemberExpressionObject(pos + 8), - property: deserializeJSXIdentifier(pos + 24), + range: deserializeOptionArrayType(pos + 8), + object: deserializeJSXMemberExpressionObject(pos + 24), + property: deserializeJSXIdentifier(pos + 40), }; } @@ -1221,7 +1321,8 @@ function deserializeJSXExpressionContainer(pos) { type: 'JSXExpressionContainer', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeJSXExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeJSXExpression(pos + 24), }; } @@ -1230,6 +1331,7 @@ function deserializeJSXEmptyExpression(pos) { type: 'JSXEmptyExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1238,8 +1340,9 @@ function deserializeJSXAttribute(pos) { type: 'JSXAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeJSXAttributeName(pos + 8), - value: deserializeOptionJSXAttributeValue(pos + 24), + range: deserializeOptionArrayType(pos + 8), + name: deserializeJSXAttributeName(pos + 24), + value: deserializeOptionJSXAttributeValue(pos + 40), }; } @@ -1248,7 +1351,8 @@ function deserializeJSXSpreadAttribute(pos) { type: 'JSXSpreadAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + argument: deserializeExpression(pos + 24), }; } @@ -1257,7 +1361,8 @@ function deserializeJSXIdentifier(pos) { type: 'JSXIdentifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeStr(pos + 8), + range: deserializeOptionArrayType(pos + 8), + name: deserializeStr(pos + 24), }; } @@ -1266,7 +1371,8 @@ function deserializeJSXSpreadChild(pos) { type: 'JSXSpreadChild', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), }; } @@ -1275,8 +1381,9 @@ function deserializeJSXText(pos) { type: 'JSXText', start: deserializeU32(pos), end: deserializeU32(pos + 4), - value: deserializeStr(pos + 8), - raw: deserializeOptionStr(pos + 24), + range: deserializeOptionArrayType(pos + 8), + value: deserializeStr(pos + 24), + raw: deserializeOptionStr(pos + 40), }; } @@ -1285,10 +1392,11 @@ function deserializeTSThisParameter(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], name: 'this', optional: false, - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 16), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 48), }; } @@ -1297,10 +1405,11 @@ function deserializeTSEnumDeclaration(pos) { type: 'TSEnumDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeBindingIdentifier(pos + 8), - body: deserializeTSEnumBody(pos + 40), - const: deserializeBool(pos + 76), - declare: deserializeBool(pos + 77), + range: deserializeOptionArrayType(pos + 8), + id: deserializeBindingIdentifier(pos + 24), + body: deserializeTSEnumBody(pos + 72), + const: deserializeBool(pos + 124), + declare: deserializeBool(pos + 125), }; } @@ -1309,7 +1418,8 @@ function deserializeTSEnumBody(pos) { type: 'TSEnumBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - members: deserializeVecTSEnumMember(pos + 8), + range: deserializeOptionArrayType(pos + 8), + members: deserializeVecTSEnumMember(pos + 24), }; } @@ -1318,9 +1428,10 @@ function deserializeTSEnumMember(pos) { type: 'TSEnumMember', start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeTSEnumMemberName(pos + 8), - initializer: deserializeOptionExpression(pos + 24), - computed: deserializeU8(pos + 8) > 1, + range: deserializeOptionArrayType(pos + 8), + id: deserializeTSEnumMemberName(pos + 24), + initializer: deserializeOptionExpression(pos + 40), + computed: deserializeU8(pos + 24) > 1, }; } @@ -1329,7 +1440,8 @@ function deserializeTSTypeAnnotation(pos) { type: 'TSTypeAnnotation', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeAnnotation: deserializeTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1338,7 +1450,8 @@ function deserializeTSLiteralType(pos) { type: 'TSLiteralType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - literal: deserializeTSLiteral(pos + 8), + range: deserializeOptionArrayType(pos + 8), + literal: deserializeTSLiteral(pos + 24), }; } @@ -1347,10 +1460,11 @@ function deserializeTSConditionalType(pos) { type: 'TSConditionalType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - checkType: deserializeTSType(pos + 8), - extendsType: deserializeTSType(pos + 24), - trueType: deserializeTSType(pos + 40), - falseType: deserializeTSType(pos + 56), + range: deserializeOptionArrayType(pos + 8), + checkType: deserializeTSType(pos + 24), + extendsType: deserializeTSType(pos + 40), + trueType: deserializeTSType(pos + 56), + falseType: deserializeTSType(pos + 72), }; } @@ -1359,7 +1473,8 @@ function deserializeTSUnionType(pos) { type: 'TSUnionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - types: deserializeVecTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + types: deserializeVecTSType(pos + 24), }; } @@ -1368,7 +1483,8 @@ function deserializeTSIntersectionType(pos) { type: 'TSIntersectionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - types: deserializeVecTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + types: deserializeVecTSType(pos + 24), }; } @@ -1377,7 +1493,8 @@ function deserializeTSParenthesizedType(pos) { type: 'TSParenthesizedType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeAnnotation: deserializeTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1386,8 +1503,9 @@ function deserializeTSTypeOperator(pos) { type: 'TSTypeOperator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - operator: deserializeTSTypeOperatorOperator(pos + 24), - typeAnnotation: deserializeTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + operator: deserializeTSTypeOperatorOperator(pos + 40), + typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1396,7 +1514,8 @@ function deserializeTSArrayType(pos) { type: 'TSArrayType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - elementType: deserializeTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + elementType: deserializeTSType(pos + 24), }; } @@ -1405,8 +1524,9 @@ function deserializeTSIndexedAccessType(pos) { type: 'TSIndexedAccessType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - objectType: deserializeTSType(pos + 8), - indexType: deserializeTSType(pos + 24), + range: deserializeOptionArrayType(pos + 8), + objectType: deserializeTSType(pos + 24), + indexType: deserializeTSType(pos + 40), }; } @@ -1415,7 +1535,8 @@ function deserializeTSTupleType(pos) { type: 'TSTupleType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - elementTypes: deserializeVecTSTupleElement(pos + 8), + range: deserializeOptionArrayType(pos + 8), + elementTypes: deserializeVecTSTupleElement(pos + 24), }; } @@ -1424,9 +1545,10 @@ function deserializeTSNamedTupleMember(pos) { type: 'TSNamedTupleMember', start: deserializeU32(pos), end: deserializeU32(pos + 4), - label: deserializeIdentifierName(pos + 8), - elementType: deserializeTSTupleElement(pos + 32), - optional: deserializeBool(pos + 48), + range: deserializeOptionArrayType(pos + 8), + label: deserializeIdentifierName(pos + 24), + elementType: deserializeTSTupleElement(pos + 64), + optional: deserializeBool(pos + 80), }; } @@ -1435,7 +1557,8 @@ function deserializeTSOptionalType(pos) { type: 'TSOptionalType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeAnnotation: deserializeTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1444,7 +1567,8 @@ function deserializeTSRestType(pos) { type: 'TSRestType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeAnnotation: deserializeTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1453,6 +1577,7 @@ function deserializeTSAnyKeyword(pos) { type: 'TSAnyKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1461,6 +1586,7 @@ function deserializeTSStringKeyword(pos) { type: 'TSStringKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1469,6 +1595,7 @@ function deserializeTSBooleanKeyword(pos) { type: 'TSBooleanKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1477,6 +1604,7 @@ function deserializeTSNumberKeyword(pos) { type: 'TSNumberKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1485,6 +1613,7 @@ function deserializeTSNeverKeyword(pos) { type: 'TSNeverKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1493,6 +1622,7 @@ function deserializeTSIntrinsicKeyword(pos) { type: 'TSIntrinsicKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1501,6 +1631,7 @@ function deserializeTSUnknownKeyword(pos) { type: 'TSUnknownKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1509,6 +1640,7 @@ function deserializeTSNullKeyword(pos) { type: 'TSNullKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1517,6 +1649,7 @@ function deserializeTSUndefinedKeyword(pos) { type: 'TSUndefinedKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1525,6 +1658,7 @@ function deserializeTSVoidKeyword(pos) { type: 'TSVoidKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1533,6 +1667,7 @@ function deserializeTSSymbolKeyword(pos) { type: 'TSSymbolKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1541,6 +1676,7 @@ function deserializeTSThisType(pos) { type: 'TSThisType', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1549,6 +1685,7 @@ function deserializeTSObjectKeyword(pos) { type: 'TSObjectKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1557,6 +1694,7 @@ function deserializeTSBigIntKeyword(pos) { type: 'TSBigIntKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1565,8 +1703,9 @@ function deserializeTSTypeReference(pos) { type: 'TSTypeReference', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeName: deserializeTSTypeName(pos + 8), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + typeName: deserializeTSTypeName(pos + 24), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; } @@ -1575,8 +1714,9 @@ function deserializeTSQualifiedName(pos) { type: 'TSQualifiedName', start: deserializeU32(pos), end: deserializeU32(pos + 4), - left: deserializeTSTypeName(pos + 8), - right: deserializeIdentifierName(pos + 24), + range: deserializeOptionArrayType(pos + 8), + left: deserializeTSTypeName(pos + 24), + right: deserializeIdentifierName(pos + 40), }; } @@ -1585,7 +1725,8 @@ function deserializeTSTypeParameterInstantiation(pos) { type: 'TSTypeParameterInstantiation', start: deserializeU32(pos), end: deserializeU32(pos + 4), - params: deserializeVecTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + params: deserializeVecTSType(pos + 24), }; } @@ -1594,12 +1735,13 @@ function deserializeTSTypeParameter(pos) { type: 'TSTypeParameter', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeBindingIdentifier(pos + 8), - constraint: deserializeOptionTSType(pos + 40), - default: deserializeOptionTSType(pos + 56), - in: deserializeBool(pos + 72), - out: deserializeBool(pos + 73), - const: deserializeBool(pos + 74), + range: deserializeOptionArrayType(pos + 8), + name: deserializeBindingIdentifier(pos + 24), + constraint: deserializeOptionTSType(pos + 72), + default: deserializeOptionTSType(pos + 88), + in: deserializeBool(pos + 104), + out: deserializeBool(pos + 105), + const: deserializeBool(pos + 106), }; } @@ -1608,7 +1750,8 @@ function deserializeTSTypeParameterDeclaration(pos) { type: 'TSTypeParameterDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - params: deserializeVecTSTypeParameter(pos + 8), + range: deserializeOptionArrayType(pos + 8), + params: deserializeVecTSTypeParameter(pos + 24), }; } @@ -1617,15 +1760,16 @@ function deserializeTSTypeAliasDeclaration(pos) { type: 'TSTypeAliasDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeBindingIdentifier(pos + 8), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40), - typeAnnotation: deserializeTSType(pos + 48), - declare: deserializeBool(pos + 68), + range: deserializeOptionArrayType(pos + 8), + id: deserializeBindingIdentifier(pos + 24), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), + typeAnnotation: deserializeTSType(pos + 80), + declare: deserializeBool(pos + 100), }; } function deserializeTSClassImplements(pos) { - let expression = deserializeTSTypeName(pos + 8); + let expression = deserializeTSTypeName(pos + 24); if (expression.type === 'TSQualifiedName') { let parent = expression = { type: 'MemberExpression', @@ -1654,8 +1798,9 @@ function deserializeTSClassImplements(pos) { type: 'TSClassImplements', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), expression, - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; } @@ -1664,11 +1809,12 @@ function deserializeTSInterfaceDeclaration(pos) { type: 'TSInterfaceDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeBindingIdentifier(pos + 8), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40), - extends: deserializeVecTSInterfaceHeritage(pos + 48), - body: deserializeBoxTSInterfaceBody(pos + 72), - declare: deserializeBool(pos + 84), + range: deserializeOptionArrayType(pos + 8), + id: deserializeBindingIdentifier(pos + 24), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), + extends: deserializeVecTSInterfaceHeritage(pos + 80), + body: deserializeBoxTSInterfaceBody(pos + 104), + declare: deserializeBool(pos + 116), }; } @@ -1677,7 +1823,8 @@ function deserializeTSInterfaceBody(pos) { type: 'TSInterfaceBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - body: deserializeVecTSSignature(pos + 8), + range: deserializeOptionArrayType(pos + 8), + body: deserializeVecTSSignature(pos + 24), }; } @@ -1686,11 +1833,12 @@ function deserializeTSPropertySignature(pos) { type: 'TSPropertySignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - computed: deserializeBool(pos + 32), - optional: deserializeBool(pos + 33), - readonly: deserializeBool(pos + 34), - key: deserializePropertyKey(pos + 8), - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + computed: deserializeBool(pos + 48), + optional: deserializeBool(pos + 49), + readonly: deserializeBool(pos + 50), + key: deserializePropertyKey(pos + 24), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 40), accessibility: null, static: false, }; @@ -1701,43 +1849,46 @@ function deserializeTSIndexSignature(pos) { type: 'TSIndexSignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - parameters: deserializeVecTSIndexSignatureName(pos + 8), - typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 32), - readonly: deserializeBool(pos + 40), - static: deserializeBool(pos + 41), + range: deserializeOptionArrayType(pos + 8), + parameters: deserializeVecTSIndexSignatureName(pos + 24), + typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 48), + readonly: deserializeBool(pos + 56), + static: deserializeBool(pos + 57), accessibility: null, }; } function deserializeTSCallSignatureDeclaration(pos) { - const params = deserializeBoxFormalParameters(pos + 24); - const thisParam = deserializeOptionBoxTSThisParameter(pos + 16); + const params = deserializeBoxFormalParameters(pos + 40); + const thisParam = deserializeOptionBoxTSThisParameter(pos + 32); if (thisParam !== null) params.unshift(thisParam); return { type: 'TSCallSignatureDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), + range: deserializeOptionArrayType(pos + 8), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), params, - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 32), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 48), }; } function deserializeTSMethodSignature(pos) { - const params = deserializeBoxFormalParameters(pos + 40); - const thisParam = deserializeOptionBoxTSThisParameter(pos + 32); + const params = deserializeBoxFormalParameters(pos + 56); + const thisParam = deserializeOptionBoxTSThisParameter(pos + 48); if (thisParam !== null) params.unshift(thisParam); return { type: 'TSMethodSignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - key: deserializePropertyKey(pos + 8), - computed: deserializeBool(pos + 60), - optional: deserializeBool(pos + 61), - kind: deserializeTSMethodSignatureKind(pos + 62), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), + range: deserializeOptionArrayType(pos + 8), + key: deserializePropertyKey(pos + 24), + computed: deserializeBool(pos + 76), + optional: deserializeBool(pos + 77), + kind: deserializeTSMethodSignatureKind(pos + 78), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40), params, - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 48), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 64), accessibility: null, readonly: false, static: false, @@ -1749,9 +1900,10 @@ function deserializeTSConstructSignatureDeclaration(pos) { type: 'TSConstructSignatureDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), - params: deserializeBoxFormalParameters(pos + 16), - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), + params: deserializeBoxFormalParameters(pos + 32), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 40), }; } @@ -1760,10 +1912,11 @@ function deserializeTSIndexSignatureName(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], - name: deserializeStr(pos + 8), + name: deserializeStr(pos + 24), optional: false, - typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 24), + typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 40), }; } @@ -1772,8 +1925,9 @@ function deserializeTSInterfaceHeritage(pos) { type: 'TSInterfaceHeritage', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; } @@ -1782,20 +1936,21 @@ function deserializeTSTypePredicate(pos) { type: 'TSTypePredicate', start: deserializeU32(pos), end: deserializeU32(pos + 4), - parameterName: deserializeTSTypePredicateName(pos + 8), - asserts: deserializeBool(pos + 32), - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + parameterName: deserializeTSTypePredicateName(pos + 24), + asserts: deserializeBool(pos + 64), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 56), }; } function deserializeTSModuleDeclaration(pos) { - const kind = deserializeTSModuleDeclarationKind(pos + 84), + const kind = deserializeTSModuleDeclarationKind(pos + 116), global = kind === 'global', start = deserializeU32(pos), end = deserializeU32(pos + 4), - declare = deserializeBool(pos + 85); - let id = deserializeTSModuleDeclarationName(pos + 8), - body = deserializeOptionTSModuleDeclarationBody(pos + 64); + declare = deserializeBool(pos + 117); + let id = deserializeTSModuleDeclarationName(pos + 24), + body = deserializeOptionTSModuleDeclarationBody(pos + 96); // Flatten `body`, and nest `id` if (body !== null && body.type === 'TSModuleDeclaration') { @@ -1836,12 +1991,13 @@ function deserializeTSModuleDeclaration(pos) { } function deserializeTSModuleBlock(pos) { - const body = deserializeVecDirective(pos + 8); - body.push(...deserializeVecStatement(pos + 32)); + const body = deserializeVecDirective(pos + 24); + body.push(...deserializeVecStatement(pos + 48)); return { type: 'TSModuleBlock', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), body, }; } @@ -1851,7 +2007,8 @@ function deserializeTSTypeLiteral(pos) { type: 'TSTypeLiteral', start: deserializeU32(pos), end: deserializeU32(pos + 4), - members: deserializeVecTSSignature(pos + 8), + range: deserializeOptionArrayType(pos + 8), + members: deserializeVecTSSignature(pos + 24), }; } @@ -1860,7 +2017,8 @@ function deserializeTSInferType(pos) { type: 'TSInferType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeParameter: deserializeBoxTSTypeParameter(pos + 8), + range: deserializeOptionArrayType(pos + 8), + typeParameter: deserializeBoxTSTypeParameter(pos + 24), }; } @@ -1869,8 +2027,9 @@ function deserializeTSTypeQuery(pos) { type: 'TSTypeQuery', start: deserializeU32(pos), end: deserializeU32(pos + 4), - exprName: deserializeTSTypeQueryExprName(pos + 8), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + exprName: deserializeTSTypeQueryExprName(pos + 24), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; } @@ -1879,24 +2038,26 @@ function deserializeTSImportType(pos) { type: 'TSImportType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeTSType(pos + 8), - options: deserializeOptionBoxObjectExpression(pos + 24), - qualifier: deserializeOptionTSTypeName(pos + 32), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 48), + range: deserializeOptionArrayType(pos + 8), + argument: deserializeTSType(pos + 24), + options: deserializeOptionBoxObjectExpression(pos + 40), + qualifier: deserializeOptionTSTypeName(pos + 48), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 64), }; } function deserializeTSFunctionType(pos) { - const params = deserializeBoxFormalParameters(pos + 24); - const thisParam = deserializeOptionBoxTSThisParameter(pos + 16); + const params = deserializeBoxFormalParameters(pos + 40); + const thisParam = deserializeOptionBoxTSThisParameter(pos + 32); if (thisParam !== null) params.unshift(thisParam); return { type: 'TSFunctionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), + range: deserializeOptionArrayType(pos + 8), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), params, - returnType: deserializeBoxTSTypeAnnotation(pos + 32), + returnType: deserializeBoxTSTypeAnnotation(pos + 48), }; } @@ -1905,27 +2066,29 @@ function deserializeTSConstructorType(pos) { type: 'TSConstructorType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - abstract: deserializeBool(pos + 32), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), - params: deserializeBoxFormalParameters(pos + 16), - returnType: deserializeBoxTSTypeAnnotation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + abstract: deserializeBool(pos + 48), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), + params: deserializeBoxFormalParameters(pos + 32), + returnType: deserializeBoxTSTypeAnnotation(pos + 40), }; } function deserializeTSMappedType(pos) { - const typeParameter = deserializeBoxTSTypeParameter(pos + 8); - let optional = deserializeOptionTSMappedTypeModifierOperator(pos + 52); + const typeParameter = deserializeBoxTSTypeParameter(pos + 24); + let optional = deserializeOptionTSMappedTypeModifierOperator(pos + 68); if (optional === null) optional = false; return { type: 'TSMappedType', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), key: typeParameter.name, constraint: typeParameter.constraint, - nameType: deserializeOptionTSType(pos + 16), - typeAnnotation: deserializeOptionTSType(pos + 32), + nameType: deserializeOptionTSType(pos + 32), + typeAnnotation: deserializeOptionTSType(pos + 48), optional, - readonly: deserializeOptionTSMappedTypeModifierOperator(pos + 53), + readonly: deserializeOptionTSMappedTypeModifierOperator(pos + 69), }; } @@ -1934,8 +2097,9 @@ function deserializeTSTemplateLiteralType(pos) { type: 'TSTemplateLiteralType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - quasis: deserializeVecTemplateElement(pos + 8), - types: deserializeVecTSType(pos + 32), + range: deserializeOptionArrayType(pos + 8), + quasis: deserializeVecTemplateElement(pos + 24), + types: deserializeVecTSType(pos + 48), }; } @@ -1944,8 +2108,9 @@ function deserializeTSAsExpression(pos) { type: 'TSAsExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), + typeAnnotation: deserializeTSType(pos + 40), }; } @@ -1954,8 +2119,9 @@ function deserializeTSSatisfiesExpression(pos) { type: 'TSSatisfiesExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), + typeAnnotation: deserializeTSType(pos + 40), }; } @@ -1964,8 +2130,9 @@ function deserializeTSTypeAssertion(pos) { type: 'TSTypeAssertion', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeAnnotation: deserializeTSType(pos + 8), - expression: deserializeExpression(pos + 24), + range: deserializeOptionArrayType(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), + expression: deserializeExpression(pos + 40), }; } @@ -1974,9 +2141,10 @@ function deserializeTSImportEqualsDeclaration(pos) { type: 'TSImportEqualsDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeBindingIdentifier(pos + 8), - moduleReference: deserializeTSModuleReference(pos + 40), - importKind: deserializeImportOrExportKind(pos + 56), + range: deserializeOptionArrayType(pos + 8), + id: deserializeBindingIdentifier(pos + 24), + moduleReference: deserializeTSModuleReference(pos + 72), + importKind: deserializeImportOrExportKind(pos + 88), }; } @@ -1985,7 +2153,8 @@ function deserializeTSExternalModuleReference(pos) { type: 'TSExternalModuleReference', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeStringLiteral(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeStringLiteral(pos + 24), }; } @@ -1994,7 +2163,8 @@ function deserializeTSNonNullExpression(pos) { type: 'TSNonNullExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), }; } @@ -2003,7 +2173,8 @@ function deserializeDecorator(pos) { type: 'Decorator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), }; } @@ -2012,7 +2183,8 @@ function deserializeTSExportAssignment(pos) { type: 'TSExportAssignment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), }; } @@ -2021,7 +2193,8 @@ function deserializeTSNamespaceExportDeclaration(pos) { type: 'TSNamespaceExportDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeIdentifierName(pos + 8), + range: deserializeOptionArrayType(pos + 8), + id: deserializeIdentifierName(pos + 24), }; } @@ -2030,8 +2203,9 @@ function deserializeTSInstantiationExpression(pos) { type: 'TSInstantiationExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), - typeArguments: deserializeBoxTSTypeParameterInstantiation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), + typeArguments: deserializeBoxTSTypeParameterInstantiation(pos + 40), }; } @@ -2040,8 +2214,9 @@ function deserializeJSDocNullableType(pos) { type: 'TSJSDocNullableType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeAnnotation: deserializeTSType(pos + 8), - postfix: deserializeBool(pos + 24), + range: deserializeOptionArrayType(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), + postfix: deserializeBool(pos + 40), }; } @@ -2050,8 +2225,9 @@ function deserializeJSDocNonNullableType(pos) { type: 'TSJSDocNonNullableType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeAnnotation: deserializeTSType(pos + 8), - postfix: deserializeBool(pos + 24), + range: deserializeOptionArrayType(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), + postfix: deserializeBool(pos + 40), }; } @@ -2060,11 +2236,12 @@ function deserializeJSDocUnknownType(pos) { type: 'TSJSDocUnknownType', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } function deserializeComment(pos) { - const type = deserializeCommentKind(pos + 12), + const type = deserializeCommentKind(pos + 28), start = deserializeU32(pos), end = deserializeU32(pos + 4); const endCut = type === 'Line' ? 0 : 2; @@ -2073,22 +2250,24 @@ function deserializeComment(pos) { value: sourceText.slice(start + 2, end - endCut), start, end, + range: deserializeOptionArrayType(pos + 8), }; } function deserializeNameSpan(pos) { return { - value: deserializeStr(pos + 8), + value: deserializeStr(pos + 24), start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } function deserializeImportEntry(pos) { return { - importName: deserializeImportImportName(pos + 32), - localName: deserializeNameSpan(pos + 64), - isType: deserializeBool(pos + 88), + importName: deserializeImportImportName(pos + 64), + localName: deserializeNameSpan(pos + 112), + isType: deserializeBool(pos + 152), }; } @@ -2096,11 +2275,12 @@ function deserializeExportEntry(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - moduleRequest: deserializeOptionNameSpan(pos + 16), - importName: deserializeExportImportName(pos + 40), - exportName: deserializeExportExportName(pos + 72), - localName: deserializeExportLocalName(pos + 104), - isType: deserializeBool(pos + 136), + range: deserializeOptionArrayType(pos + 8), + moduleRequest: deserializeOptionNameSpan(pos + 48), + importName: deserializeExportImportName(pos + 88), + exportName: deserializeExportExportName(pos + 136), + localName: deserializeExportLocalName(pos + 184), + isType: deserializeBool(pos + 232), }; } @@ -2108,7 +2288,8 @@ function deserializeDynamicImport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - moduleRequest: deserializeSpan(pos + 8), + range: deserializeOptionArrayType(pos + 8), + moduleRequest: deserializeSpan(pos + 24), }; } @@ -2116,6 +2297,7 @@ function deserializeSpan(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -2128,9 +2310,9 @@ function deserializeSourceType(pos) { function deserializeRawTransferData(pos) { return { program: deserializeProgram(pos), - comments: deserializeVecComment(pos + 128), - module: deserializeEcmaScriptModule(pos + 152), - errors: deserializeVecError(pos + 256), + comments: deserializeVecComment(pos + 160), + module: deserializeEcmaScriptModule(pos + 184), + errors: deserializeVecError(pos + 288), }; } @@ -2146,9 +2328,10 @@ function deserializeError(pos) { function deserializeErrorLabel(pos) { return { - message: deserializeOptionStr(pos + 8), + message: deserializeOptionStr(pos + 24), start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -2166,8 +2349,9 @@ function deserializeStaticImport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - moduleRequest: deserializeNameSpan(pos + 8), - entries: deserializeVecImportEntry(pos + 32), + range: deserializeOptionArrayType(pos + 8), + moduleRequest: deserializeNameSpan(pos + 24), + entries: deserializeVecImportEntry(pos + 64), }; } @@ -2175,7 +2359,8 @@ function deserializeStaticExport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - entries: deserializeVecExportEntry(pos + 8), + range: deserializeOptionArrayType(pos + 8), + entries: deserializeVecExportEntry(pos + 24), }; } @@ -4057,13 +4242,13 @@ function deserializeVecComment(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeComment(pos)); - pos += 16; + pos += 32; } return arr; } function deserializeOptionHashbang(pos) { - if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; + if (uint8[pos + 8] === 2) return null; return deserializeHashbang(pos); } @@ -4074,7 +4259,7 @@ function deserializeVecDirective(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeDirective(pos)); - pos += 72; + pos += 104; } return arr; } @@ -4258,7 +4443,7 @@ function deserializeVecArrayExpressionElement(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeArrayExpressionElement(pos)); - pos += 16; + pos += 32; } return arr; } @@ -4302,7 +4487,7 @@ function deserializeVecTemplateElement(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeTemplateElement(pos)); - pos += 48; + pos += 64; } return arr; } @@ -4383,7 +4568,7 @@ function deserializeVecOptionAssignmentTargetMaybeDefault(pos) { } function deserializeOptionAssignmentTargetRest(pos) { - if (uint8[pos + 8] === 51) return null; + if (uint8[pos + 8] === 2) return null; return deserializeAssignmentTargetRest(pos); } @@ -4519,7 +4704,7 @@ function deserializeVecVariableDeclarator(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeVariableDeclarator(pos)); - pos += 64; + pos += 80; } return arr; } @@ -4535,7 +4720,7 @@ function deserializeOptionForStatementInit(pos) { } function deserializeOptionLabelIdentifier(pos) { - if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; + if (uint8[pos + 8] === 2) return null; return deserializeLabelIdentifier(pos); } @@ -4546,7 +4731,7 @@ function deserializeVecSwitchCase(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeSwitchCase(pos)); - pos += 48; + pos += 64; } return arr; } @@ -4566,7 +4751,7 @@ function deserializeOptionBoxBlockStatement(pos) { } function deserializeOptionCatchParameter(pos) { - if (uint8[pos + 32] === 2) return null; + if (uint8[pos + 8] === 2) return null; return deserializeCatchParameter(pos); } @@ -4602,7 +4787,7 @@ function deserializeVecBindingProperty(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeBindingProperty(pos)); - pos += 64; + pos += 80; } return arr; } @@ -4634,7 +4819,7 @@ function deserializeVecOptionBindingPattern(pos) { } function deserializeOptionBindingIdentifier(pos) { - if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; + if (uint8[pos + 8] === 2) return null; return deserializeBindingIdentifier(pos); } @@ -4676,7 +4861,7 @@ function deserializeVecFormalParameter(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeFormalParameter(pos)); - pos += 72; + pos += 88; } return arr; } @@ -4688,7 +4873,7 @@ function deserializeVecDecorator(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeDecorator(pos)); - pos += 24; + pos += 40; } return arr; } @@ -4705,7 +4890,7 @@ function deserializeVecTSClassImplements(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeTSClassImplements(pos)); - pos += 32; + pos += 48; } return arr; } @@ -4820,7 +5005,7 @@ function deserializeVecImportAttribute(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeImportAttribute(pos)); - pos += 112; + pos += 160; } return arr; } @@ -4837,13 +5022,13 @@ function deserializeVecExportSpecifier(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeExportSpecifier(pos)); - pos += 128; + pos += 176; } return arr; } function deserializeOptionStringLiteral(pos) { - if (uint8[pos + 40] === 2) return null; + if (uint8[pos + 8] === 2) return null; return deserializeStringLiteral(pos); } @@ -4941,7 +5126,7 @@ function deserializeVecTSEnumMember(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeTSEnumMember(pos)); - pos += 40; + pos += 56; } return arr; } @@ -5142,7 +5327,7 @@ function deserializeVecTSTypeParameter(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeTSTypeParameter(pos)); - pos += 80; + pos += 112; } return arr; } @@ -5154,7 +5339,7 @@ function deserializeVecTSInterfaceHeritage(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeTSInterfaceHeritage(pos)); - pos += 32; + pos += 48; } return arr; } @@ -5198,7 +5383,7 @@ function deserializeVecTSIndexSignatureName(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeTSIndexSignatureName(pos)); - pos += 32; + pos += 48; } return arr; } @@ -5240,10 +5425,15 @@ function deserializeU32(pos) { } function deserializeOptionNameSpan(pos) { - if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; + if (uint8[pos + 8] === 2) return null; return deserializeNameSpan(pos); } +function deserializeOptionArrayType(pos) { + if (uint8[pos] === 0) return null; + return deserializeArrayType(pos + 4); +} + function deserializeU64(pos) { const pos32 = pos >> 2; return uint32[pos32] + uint32[pos32 + 1] * 4294967296; @@ -5273,7 +5463,7 @@ function deserializeVecErrorLabel(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeErrorLabel(pos)); - pos += 24; + pos += 40; } return arr; } @@ -5285,7 +5475,7 @@ function deserializeVecStaticImport(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeStaticImport(pos)); - pos += 56; + pos += 88; } return arr; } @@ -5297,7 +5487,7 @@ function deserializeVecStaticExport(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeStaticExport(pos)); - pos += 32; + pos += 48; } return arr; } @@ -5309,7 +5499,7 @@ function deserializeVecDynamicImport(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeDynamicImport(pos)); - pos += 16; + pos += 48; } return arr; } @@ -5321,7 +5511,7 @@ function deserializeVecSpan(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeSpan(pos)); - pos += 8; + pos += 24; } return arr; } @@ -5333,7 +5523,7 @@ function deserializeVecImportEntry(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeImportEntry(pos)); - pos += 96; + pos += 160; } return arr; } @@ -5345,7 +5535,7 @@ function deserializeVecExportEntry(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeExportEntry(pos)); - pos += 144; + pos += 240; } return arr; } diff --git a/napi/parser/generated/deserialize/lazy.js b/napi/parser/generated/deserialize/lazy.js index 0f77b709fabf8..763d964204742 100644 --- a/napi/parser/generated/deserialize/lazy.js +++ b/napi/parser/generated/deserialize/lazy.js @@ -45,21 +45,26 @@ class Program { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get sourceType() { const internal = this.#internal; - return new SourceType(internal.pos + 124, internal.ast); + return new SourceType(internal.pos + 156, internal.ast); } get hashbang() { const internal = this.#internal; - return constructOptionHashbang(internal.pos + 48, internal.ast); + return constructOptionHashbang(internal.pos + 64, internal.ast); } get body() { const internal = this.#internal, cached = internal.$body; if (cached !== void 0) return cached; - return internal.$body = constructVecStatement(internal.pos + 96, internal.ast); + return internal.$body = constructVecStatement(internal.pos + 128, internal.ast); } toJSON() { @@ -67,6 +72,7 @@ class Program { type: 'Program', start: this.start, end: this.end, + range: this.range, sourceType: this.sourceType, hashbang: this.hashbang, body: this.body, @@ -198,11 +204,16 @@ class IdentifierName { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get name() { const internal = this.#internal, cached = internal.$name; if (cached !== void 0) return cached; - return internal.$name = constructStr(internal.pos + 8, internal.ast); + return internal.$name = constructStr(internal.pos + 24, internal.ast); } toJSON() { @@ -210,6 +221,7 @@ class IdentifierName { type: 'IdentifierName', start: this.start, end: this.end, + range: this.range, name: this.name, }; } @@ -246,11 +258,16 @@ class IdentifierReference { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get name() { const internal = this.#internal, cached = internal.$name; if (cached !== void 0) return cached; - return internal.$name = constructStr(internal.pos + 8, internal.ast); + return internal.$name = constructStr(internal.pos + 24, internal.ast); } toJSON() { @@ -258,6 +275,7 @@ class IdentifierReference { type: 'IdentifierReference', start: this.start, end: this.end, + range: this.range, name: this.name, }; } @@ -294,11 +312,16 @@ class BindingIdentifier { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get name() { const internal = this.#internal, cached = internal.$name; if (cached !== void 0) return cached; - return internal.$name = constructStr(internal.pos + 8, internal.ast); + return internal.$name = constructStr(internal.pos + 24, internal.ast); } toJSON() { @@ -306,6 +329,7 @@ class BindingIdentifier { type: 'BindingIdentifier', start: this.start, end: this.end, + range: this.range, name: this.name, }; } @@ -342,11 +366,16 @@ class LabelIdentifier { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get name() { const internal = this.#internal, cached = internal.$name; if (cached !== void 0) return cached; - return internal.$name = constructStr(internal.pos + 8, internal.ast); + return internal.$name = constructStr(internal.pos + 24, internal.ast); } toJSON() { @@ -354,6 +383,7 @@ class LabelIdentifier { type: 'LabelIdentifier', start: this.start, end: this.end, + range: this.range, name: this.name, }; } @@ -390,11 +420,17 @@ class ThisExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'ThisExpression', start: this.start, end: this.end, + range: this.range, }; } @@ -430,11 +466,16 @@ class ArrayExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get elements() { const internal = this.#internal, cached = internal.$elements; if (cached !== void 0) return cached; - return internal.$elements = constructVecArrayExpressionElement(internal.pos + 8, internal.ast); + return internal.$elements = constructVecArrayExpressionElement(internal.pos + 24, internal.ast); } toJSON() { @@ -442,6 +483,7 @@ class ArrayExpression { type: 'ArrayExpression', start: this.start, end: this.end, + range: this.range, elements: this.elements, }; } @@ -575,11 +617,17 @@ class Elision { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'Elision', start: this.start, end: this.end, + range: this.range, }; } @@ -615,11 +663,16 @@ class ObjectExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get properties() { const internal = this.#internal, cached = internal.$properties; if (cached !== void 0) return cached; - return internal.$properties = constructVecObjectPropertyKind(internal.pos + 8, internal.ast); + return internal.$properties = constructVecObjectPropertyKind(internal.pos + 24, internal.ast); } toJSON() { @@ -627,6 +680,7 @@ class ObjectExpression { type: 'ObjectExpression', start: this.start, end: this.end, + range: this.range, properties: this.properties, }; } @@ -674,34 +728,39 @@ class ObjectProperty { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get kind() { const internal = this.#internal; - return constructPropertyKind(internal.pos + 40, internal.ast); + return constructPropertyKind(internal.pos + 56, internal.ast); } get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 8, internal.ast); + return constructPropertyKey(internal.pos + 24, internal.ast); } get value() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 40, internal.ast); } get method() { const internal = this.#internal; - return constructBool(internal.pos + 41, internal.ast); + return constructBool(internal.pos + 57, internal.ast); } get shorthand() { const internal = this.#internal; - return constructBool(internal.pos + 42, internal.ast); + return constructBool(internal.pos + 58, internal.ast); } get computed() { const internal = this.#internal; - return constructBool(internal.pos + 43, internal.ast); + return constructBool(internal.pos + 59, internal.ast); } toJSON() { @@ -709,6 +768,7 @@ class ObjectProperty { type: 'ObjectProperty', start: this.start, end: this.end, + range: this.range, kind: this.kind, key: this.key, value: this.value, @@ -860,18 +920,23 @@ class TemplateLiteral { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get quasis() { const internal = this.#internal, cached = internal.$quasis; if (cached !== void 0) return cached; - return internal.$quasis = constructVecTemplateElement(internal.pos + 8, internal.ast); + return internal.$quasis = constructVecTemplateElement(internal.pos + 24, internal.ast); } get expressions() { const internal = this.#internal, cached = internal.$expressions; if (cached !== void 0) return cached; - return internal.$expressions = constructVecExpression(internal.pos + 32, internal.ast); + return internal.$expressions = constructVecExpression(internal.pos + 48, internal.ast); } toJSON() { @@ -879,6 +944,7 @@ class TemplateLiteral { type: 'TemplateLiteral', start: this.start, end: this.end, + range: this.range, quasis: this.quasis, expressions: this.expressions, }; @@ -916,19 +982,24 @@ class TaggedTemplateExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get tag() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); } get quasi() { const internal = this.#internal; - return new TemplateLiteral(internal.pos + 32, internal.ast); + return new TemplateLiteral(internal.pos + 48, internal.ast); } toJSON() { @@ -936,6 +1007,7 @@ class TaggedTemplateExpression { type: 'TaggedTemplateExpression', start: this.start, end: this.end, + range: this.range, tag: this.tag, typeArguments: this.typeArguments, quasi: this.quasi, @@ -974,14 +1046,19 @@ class TemplateElement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get value() { const internal = this.#internal; - return new TemplateElementValue(internal.pos + 8, internal.ast); + return new TemplateElementValue(internal.pos + 24, internal.ast); } get tail() { const internal = this.#internal; - return constructBool(internal.pos + 40, internal.ast); + return constructBool(internal.pos + 56, internal.ast); } toJSON() { @@ -989,6 +1066,7 @@ class TemplateElement { type: 'TemplateElement', start: this.start, end: this.end, + range: this.range, value: this.value, tail: this.tail, }; @@ -1081,19 +1159,24 @@ class ComputedMemberExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get object() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get property() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 40, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 40, internal.ast); + return constructBool(internal.pos + 56, internal.ast); } toJSON() { @@ -1101,6 +1184,7 @@ class ComputedMemberExpression { type: 'ComputedMemberExpression', start: this.start, end: this.end, + range: this.range, object: this.object, property: this.property, optional: this.optional, @@ -1139,19 +1223,24 @@ class StaticMemberExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get object() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get property() { const internal = this.#internal; - return new IdentifierName(internal.pos + 24, internal.ast); + return new IdentifierName(internal.pos + 40, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 48, internal.ast); + return constructBool(internal.pos + 80, internal.ast); } toJSON() { @@ -1159,6 +1248,7 @@ class StaticMemberExpression { type: 'StaticMemberExpression', start: this.start, end: this.end, + range: this.range, object: this.object, property: this.property, optional: this.optional, @@ -1197,19 +1287,24 @@ class PrivateFieldExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get object() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get property() { const internal = this.#internal; - return new PrivateIdentifier(internal.pos + 24, internal.ast); + return new PrivateIdentifier(internal.pos + 40, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 48, internal.ast); + return constructBool(internal.pos + 80, internal.ast); } toJSON() { @@ -1217,6 +1312,7 @@ class PrivateFieldExpression { type: 'PrivateFieldExpression', start: this.start, end: this.end, + range: this.range, object: this.object, property: this.property, optional: this.optional, @@ -1255,26 +1351,31 @@ class CallExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get callee() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); } get arguments() { const internal = this.#internal, cached = internal.$arguments; if (cached !== void 0) return cached; - return internal.$arguments = constructVecArgument(internal.pos + 32, internal.ast); + return internal.$arguments = constructVecArgument(internal.pos + 48, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 56, internal.ast); + return constructBool(internal.pos + 72, internal.ast); } toJSON() { @@ -1282,6 +1383,7 @@ class CallExpression { type: 'CallExpression', start: this.start, end: this.end, + range: this.range, callee: this.callee, typeArguments: this.typeArguments, arguments: this.arguments, @@ -1321,21 +1423,26 @@ class NewExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get callee() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); } get arguments() { const internal = this.#internal, cached = internal.$arguments; if (cached !== void 0) return cached; - return internal.$arguments = constructVecArgument(internal.pos + 32, internal.ast); + return internal.$arguments = constructVecArgument(internal.pos + 48, internal.ast); } toJSON() { @@ -1343,6 +1450,7 @@ class NewExpression { type: 'NewExpression', start: this.start, end: this.end, + range: this.range, callee: this.callee, typeArguments: this.typeArguments, arguments: this.arguments, @@ -1381,14 +1489,19 @@ class MetaProperty { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get meta() { const internal = this.#internal; - return new IdentifierName(internal.pos + 8, internal.ast); + return new IdentifierName(internal.pos + 24, internal.ast); } get property() { const internal = this.#internal; - return new IdentifierName(internal.pos + 32, internal.ast); + return new IdentifierName(internal.pos + 64, internal.ast); } toJSON() { @@ -1396,6 +1509,7 @@ class MetaProperty { type: 'MetaProperty', start: this.start, end: this.end, + range: this.range, meta: this.meta, property: this.property, }; @@ -1433,9 +1547,14 @@ class SpreadElement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get argument() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -1443,6 +1562,7 @@ class SpreadElement { type: 'SpreadElement', start: this.start, end: this.end, + range: this.range, argument: this.argument, }; } @@ -1574,19 +1694,24 @@ class UpdateExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get operator() { const internal = this.#internal; - return constructUpdateOperator(internal.pos + 24, internal.ast); + return constructUpdateOperator(internal.pos + 40, internal.ast); } get prefix() { const internal = this.#internal; - return constructBool(internal.pos + 25, internal.ast); + return constructBool(internal.pos + 41, internal.ast); } get argument() { const internal = this.#internal; - return constructSimpleAssignmentTarget(internal.pos + 8, internal.ast); + return constructSimpleAssignmentTarget(internal.pos + 24, internal.ast); } toJSON() { @@ -1594,6 +1719,7 @@ class UpdateExpression { type: 'UpdateExpression', start: this.start, end: this.end, + range: this.range, operator: this.operator, prefix: this.prefix, argument: this.argument, @@ -1632,14 +1758,19 @@ class UnaryExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get operator() { const internal = this.#internal; - return constructUnaryOperator(internal.pos + 24, internal.ast); + return constructUnaryOperator(internal.pos + 40, internal.ast); } get argument() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -1647,6 +1778,7 @@ class UnaryExpression { type: 'UnaryExpression', start: this.start, end: this.end, + range: this.range, operator: this.operator, argument: this.argument, }; @@ -1684,19 +1816,24 @@ class BinaryExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get left() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get operator() { const internal = this.#internal; - return constructBinaryOperator(internal.pos + 40, internal.ast); + return constructBinaryOperator(internal.pos + 56, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 40, internal.ast); } toJSON() { @@ -1704,6 +1841,7 @@ class BinaryExpression { type: 'BinaryExpression', start: this.start, end: this.end, + range: this.range, left: this.left, operator: this.operator, right: this.right, @@ -1742,14 +1880,19 @@ class PrivateInExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get left() { const internal = this.#internal; - return new PrivateIdentifier(internal.pos + 8, internal.ast); + return new PrivateIdentifier(internal.pos + 24, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 32, internal.ast); + return constructExpression(internal.pos + 64, internal.ast); } toJSON() { @@ -1757,6 +1900,7 @@ class PrivateInExpression { type: 'PrivateInExpression', start: this.start, end: this.end, + range: this.range, left: this.left, right: this.right, }; @@ -1794,19 +1938,24 @@ class LogicalExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get left() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get operator() { const internal = this.#internal; - return constructLogicalOperator(internal.pos + 40, internal.ast); + return constructLogicalOperator(internal.pos + 56, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 40, internal.ast); } toJSON() { @@ -1814,6 +1963,7 @@ class LogicalExpression { type: 'LogicalExpression', start: this.start, end: this.end, + range: this.range, left: this.left, operator: this.operator, right: this.right, @@ -1852,19 +2002,24 @@ class ConditionalExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get test() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get consequent() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 40, internal.ast); } get alternate() { const internal = this.#internal; - return constructExpression(internal.pos + 40, internal.ast); + return constructExpression(internal.pos + 56, internal.ast); } toJSON() { @@ -1872,6 +2027,7 @@ class ConditionalExpression { type: 'ConditionalExpression', start: this.start, end: this.end, + range: this.range, test: this.test, consequent: this.consequent, alternate: this.alternate, @@ -1910,19 +2066,24 @@ class AssignmentExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get operator() { const internal = this.#internal; - return constructAssignmentOperator(internal.pos + 40, internal.ast); + return constructAssignmentOperator(internal.pos + 56, internal.ast); } get left() { const internal = this.#internal; - return constructAssignmentTarget(internal.pos + 8, internal.ast); + return constructAssignmentTarget(internal.pos + 24, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 40, internal.ast); } toJSON() { @@ -1930,6 +2091,7 @@ class AssignmentExpression { type: 'AssignmentExpression', start: this.start, end: this.end, + range: this.range, operator: this.operator, left: this.left, right: this.right, @@ -2029,11 +2191,16 @@ class ArrayAssignmentTarget { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get elements() { const internal = this.#internal, cached = internal.$elements; if (cached !== void 0) return cached; - return internal.$elements = constructVecOptionAssignmentTargetMaybeDefault(internal.pos + 8, internal.ast); + return internal.$elements = constructVecOptionAssignmentTargetMaybeDefault(internal.pos + 24, internal.ast); } toJSON() { @@ -2041,6 +2208,7 @@ class ArrayAssignmentTarget { type: 'ArrayAssignmentTarget', start: this.start, end: this.end, + range: this.range, elements: this.elements, }; } @@ -2077,11 +2245,16 @@ class ObjectAssignmentTarget { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get properties() { const internal = this.#internal, cached = internal.$properties; if (cached !== void 0) return cached; - return internal.$properties = constructVecAssignmentTargetProperty(internal.pos + 8, internal.ast); + return internal.$properties = constructVecAssignmentTargetProperty(internal.pos + 24, internal.ast); } toJSON() { @@ -2089,6 +2262,7 @@ class ObjectAssignmentTarget { type: 'ObjectAssignmentTarget', start: this.start, end: this.end, + range: this.range, properties: this.properties, }; } @@ -2125,9 +2299,14 @@ class AssignmentTargetRest { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get argument() { const internal = this.#internal; - return constructAssignmentTarget(internal.pos + 8, internal.ast); + return constructAssignmentTarget(internal.pos + 24, internal.ast); } toJSON() { @@ -2135,6 +2314,7 @@ class AssignmentTargetRest { type: 'AssignmentTargetRest', start: this.start, end: this.end, + range: this.range, argument: this.argument, }; } @@ -2200,14 +2380,19 @@ class AssignmentTargetWithDefault { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get left() { const internal = this.#internal; - return constructAssignmentTarget(internal.pos + 8, internal.ast); + return constructAssignmentTarget(internal.pos + 24, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 40, internal.ast); } toJSON() { @@ -2215,6 +2400,7 @@ class AssignmentTargetWithDefault { type: 'AssignmentTargetWithDefault', start: this.start, end: this.end, + range: this.range, left: this.left, right: this.right, }; @@ -2263,14 +2449,19 @@ class AssignmentTargetPropertyIdentifier { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get key() { const internal = this.#internal; - return new IdentifierReference(internal.pos + 8, internal.ast); + return new IdentifierReference(internal.pos + 24, internal.ast); } get value() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 40, internal.ast); + return constructOptionExpression(internal.pos + 72, internal.ast); } toJSON() { @@ -2278,6 +2469,7 @@ class AssignmentTargetPropertyIdentifier { type: 'AssignmentTargetPropertyIdentifier', start: this.start, end: this.end, + range: this.range, key: this.key, value: this.value, }; @@ -2315,19 +2507,24 @@ class AssignmentTargetPropertyProperty { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 8, internal.ast); + return constructPropertyKey(internal.pos + 24, internal.ast); } get value() { const internal = this.#internal; - return constructAssignmentTargetMaybeDefault(internal.pos + 24, internal.ast); + return constructAssignmentTargetMaybeDefault(internal.pos + 40, internal.ast); } get computed() { const internal = this.#internal; - return constructBool(internal.pos + 40, internal.ast); + return constructBool(internal.pos + 56, internal.ast); } toJSON() { @@ -2335,6 +2532,7 @@ class AssignmentTargetPropertyProperty { type: 'AssignmentTargetPropertyProperty', start: this.start, end: this.end, + range: this.range, key: this.key, value: this.value, computed: this.computed, @@ -2373,11 +2571,16 @@ class SequenceExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expressions() { const internal = this.#internal, cached = internal.$expressions; if (cached !== void 0) return cached; - return internal.$expressions = constructVecExpression(internal.pos + 8, internal.ast); + return internal.$expressions = constructVecExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -2385,6 +2588,7 @@ class SequenceExpression { type: 'SequenceExpression', start: this.start, end: this.end, + range: this.range, expressions: this.expressions, }; } @@ -2421,11 +2625,17 @@ class Super { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'Super', start: this.start, end: this.end, + range: this.range, }; } @@ -2461,9 +2671,14 @@ class AwaitExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get argument() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -2471,6 +2686,7 @@ class AwaitExpression { type: 'AwaitExpression', start: this.start, end: this.end, + range: this.range, argument: this.argument, }; } @@ -2507,9 +2723,14 @@ class ChainExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return constructChainElement(internal.pos + 8, internal.ast); + return constructChainElement(internal.pos + 24, internal.ast); } toJSON() { @@ -2517,6 +2738,7 @@ class ChainExpression { type: 'ChainExpression', start: this.start, end: this.end, + range: this.range, expression: this.expression, }; } @@ -2570,9 +2792,14 @@ class ParenthesizedExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -2580,6 +2807,7 @@ class ParenthesizedExpression { type: 'ParenthesizedExpression', start: this.start, end: this.end, + range: this.range, expression: this.expression, }; } @@ -2687,16 +2915,21 @@ class Directive { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return new StringLiteral(internal.pos + 8, internal.ast); + return new StringLiteral(internal.pos + 24, internal.ast); } get directive() { const internal = this.#internal, cached = internal.$directive; if (cached !== void 0) return cached; - return internal.$directive = constructStr(internal.pos + 56, internal.ast); + return internal.$directive = constructStr(internal.pos + 88, internal.ast); } toJSON() { @@ -2704,6 +2937,7 @@ class Directive { type: 'Directive', start: this.start, end: this.end, + range: this.range, expression: this.expression, directive: this.directive, }; @@ -2741,11 +2975,16 @@ class Hashbang { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get value() { const internal = this.#internal, cached = internal.$value; if (cached !== void 0) return cached; - return internal.$value = constructStr(internal.pos + 8, internal.ast); + return internal.$value = constructStr(internal.pos + 24, internal.ast); } toJSON() { @@ -2753,6 +2992,7 @@ class Hashbang { type: 'Hashbang', start: this.start, end: this.end, + range: this.range, value: this.value, }; } @@ -2789,11 +3029,16 @@ class BlockStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get body() { const internal = this.#internal, cached = internal.$body; if (cached !== void 0) return cached; - return internal.$body = constructVecStatement(internal.pos + 8, internal.ast); + return internal.$body = constructVecStatement(internal.pos + 24, internal.ast); } toJSON() { @@ -2801,6 +3046,7 @@ class BlockStatement { type: 'BlockStatement', start: this.start, end: this.end, + range: this.range, body: this.body, }; } @@ -2860,21 +3106,26 @@ class VariableDeclaration { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get kind() { const internal = this.#internal; - return constructVariableDeclarationKind(internal.pos + 32, internal.ast); + return constructVariableDeclarationKind(internal.pos + 48, internal.ast); } get declarations() { const internal = this.#internal, cached = internal.$declarations; if (cached !== void 0) return cached; - return internal.$declarations = constructVecVariableDeclarator(internal.pos + 8, internal.ast); + return internal.$declarations = constructVecVariableDeclarator(internal.pos + 24, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 33, internal.ast); + return constructBool(internal.pos + 49, internal.ast); } toJSON() { @@ -2882,6 +3133,7 @@ class VariableDeclaration { type: 'VariableDeclaration', start: this.start, end: this.end, + range: this.range, kind: this.kind, declarations: this.declarations, declare: this.declare, @@ -2937,19 +3189,24 @@ class VariableDeclarator { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get id() { const internal = this.#internal; - return new BindingPattern(internal.pos + 8, internal.ast); + return new BindingPattern(internal.pos + 24, internal.ast); } get init() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 40, internal.ast); + return constructOptionExpression(internal.pos + 56, internal.ast); } get definite() { const internal = this.#internal; - return constructBool(internal.pos + 57, internal.ast); + return constructBool(internal.pos + 73, internal.ast); } toJSON() { @@ -2957,6 +3214,7 @@ class VariableDeclarator { type: 'VariableDeclarator', start: this.start, end: this.end, + range: this.range, id: this.id, init: this.init, definite: this.definite, @@ -2995,11 +3253,17 @@ class EmptyStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'EmptyStatement', start: this.start, end: this.end, + range: this.range, }; } @@ -3035,9 +3299,14 @@ class ExpressionStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -3045,6 +3314,7 @@ class ExpressionStatement { type: 'ExpressionStatement', start: this.start, end: this.end, + range: this.range, expression: this.expression, }; } @@ -3081,19 +3351,24 @@ class IfStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get test() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get consequent() { const internal = this.#internal; - return constructStatement(internal.pos + 24, internal.ast); + return constructStatement(internal.pos + 40, internal.ast); } get alternate() { const internal = this.#internal; - return constructOptionStatement(internal.pos + 40, internal.ast); + return constructOptionStatement(internal.pos + 56, internal.ast); } toJSON() { @@ -3101,6 +3376,7 @@ class IfStatement { type: 'IfStatement', start: this.start, end: this.end, + range: this.range, test: this.test, consequent: this.consequent, alternate: this.alternate, @@ -3139,14 +3415,19 @@ class DoWhileStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get body() { const internal = this.#internal; - return constructStatement(internal.pos + 8, internal.ast); + return constructStatement(internal.pos + 24, internal.ast); } get test() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 40, internal.ast); } toJSON() { @@ -3154,6 +3435,7 @@ class DoWhileStatement { type: 'DoWhileStatement', start: this.start, end: this.end, + range: this.range, body: this.body, test: this.test, }; @@ -3191,14 +3473,19 @@ class WhileStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get test() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get body() { const internal = this.#internal; - return constructStatement(internal.pos + 24, internal.ast); + return constructStatement(internal.pos + 40, internal.ast); } toJSON() { @@ -3206,6 +3493,7 @@ class WhileStatement { type: 'WhileStatement', start: this.start, end: this.end, + range: this.range, test: this.test, body: this.body, }; @@ -3243,24 +3531,29 @@ class ForStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get init() { const internal = this.#internal; - return constructOptionForStatementInit(internal.pos + 8, internal.ast); + return constructOptionForStatementInit(internal.pos + 24, internal.ast); } get test() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 24, internal.ast); + return constructOptionExpression(internal.pos + 40, internal.ast); } get update() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 40, internal.ast); + return constructOptionExpression(internal.pos + 56, internal.ast); } get body() { const internal = this.#internal; - return constructStatement(internal.pos + 56, internal.ast); + return constructStatement(internal.pos + 72, internal.ast); } toJSON() { @@ -3268,6 +3561,7 @@ class ForStatement { type: 'ForStatement', start: this.start, end: this.end, + range: this.range, init: this.init, test: this.test, update: this.update, @@ -3402,19 +3696,24 @@ class ForInStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get left() { const internal = this.#internal; - return constructForStatementLeft(internal.pos + 8, internal.ast); + return constructForStatementLeft(internal.pos + 24, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 40, internal.ast); } get body() { const internal = this.#internal; - return constructStatement(internal.pos + 40, internal.ast); + return constructStatement(internal.pos + 56, internal.ast); } toJSON() { @@ -3422,6 +3721,7 @@ class ForInStatement { type: 'ForInStatement', start: this.start, end: this.end, + range: this.range, left: this.left, right: this.right, body: this.body, @@ -3489,24 +3789,29 @@ class ForOfStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get await() { const internal = this.#internal; - return constructBool(internal.pos + 60, internal.ast); + return constructBool(internal.pos + 76, internal.ast); } get left() { const internal = this.#internal; - return constructForStatementLeft(internal.pos + 8, internal.ast); + return constructForStatementLeft(internal.pos + 24, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 40, internal.ast); } get body() { const internal = this.#internal; - return constructStatement(internal.pos + 40, internal.ast); + return constructStatement(internal.pos + 56, internal.ast); } toJSON() { @@ -3514,6 +3819,7 @@ class ForOfStatement { type: 'ForOfStatement', start: this.start, end: this.end, + range: this.range, await: this.await, left: this.left, right: this.right, @@ -3553,9 +3859,14 @@ class ContinueStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get label() { const internal = this.#internal; - return constructOptionLabelIdentifier(internal.pos + 8, internal.ast); + return constructOptionLabelIdentifier(internal.pos + 24, internal.ast); } toJSON() { @@ -3563,6 +3874,7 @@ class ContinueStatement { type: 'ContinueStatement', start: this.start, end: this.end, + range: this.range, label: this.label, }; } @@ -3599,9 +3911,14 @@ class BreakStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get label() { const internal = this.#internal; - return constructOptionLabelIdentifier(internal.pos + 8, internal.ast); + return constructOptionLabelIdentifier(internal.pos + 24, internal.ast); } toJSON() { @@ -3609,6 +3926,7 @@ class BreakStatement { type: 'BreakStatement', start: this.start, end: this.end, + range: this.range, label: this.label, }; } @@ -3645,9 +3963,14 @@ class ReturnStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get argument() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 8, internal.ast); + return constructOptionExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -3655,6 +3978,7 @@ class ReturnStatement { type: 'ReturnStatement', start: this.start, end: this.end, + range: this.range, argument: this.argument, }; } @@ -3691,14 +4015,19 @@ class WithStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get object() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get body() { const internal = this.#internal; - return constructStatement(internal.pos + 24, internal.ast); + return constructStatement(internal.pos + 40, internal.ast); } toJSON() { @@ -3706,6 +4035,7 @@ class WithStatement { type: 'WithStatement', start: this.start, end: this.end, + range: this.range, object: this.object, body: this.body, }; @@ -3743,16 +4073,21 @@ class SwitchStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get discriminant() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get cases() { const internal = this.#internal, cached = internal.$cases; if (cached !== void 0) return cached; - return internal.$cases = constructVecSwitchCase(internal.pos + 24, internal.ast); + return internal.$cases = constructVecSwitchCase(internal.pos + 40, internal.ast); } toJSON() { @@ -3760,6 +4095,7 @@ class SwitchStatement { type: 'SwitchStatement', start: this.start, end: this.end, + range: this.range, discriminant: this.discriminant, cases: this.cases, }; @@ -3797,16 +4133,21 @@ class SwitchCase { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get test() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 8, internal.ast); + return constructOptionExpression(internal.pos + 24, internal.ast); } get consequent() { const internal = this.#internal, cached = internal.$consequent; if (cached !== void 0) return cached; - return internal.$consequent = constructVecStatement(internal.pos + 24, internal.ast); + return internal.$consequent = constructVecStatement(internal.pos + 40, internal.ast); } toJSON() { @@ -3814,6 +4155,7 @@ class SwitchCase { type: 'SwitchCase', start: this.start, end: this.end, + range: this.range, test: this.test, consequent: this.consequent, }; @@ -3851,14 +4193,19 @@ class LabeledStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get label() { const internal = this.#internal; - return new LabelIdentifier(internal.pos + 8, internal.ast); + return new LabelIdentifier(internal.pos + 24, internal.ast); } get body() { const internal = this.#internal; - return constructStatement(internal.pos + 32, internal.ast); + return constructStatement(internal.pos + 64, internal.ast); } toJSON() { @@ -3866,6 +4213,7 @@ class LabeledStatement { type: 'LabeledStatement', start: this.start, end: this.end, + range: this.range, label: this.label, body: this.body, }; @@ -3903,9 +4251,14 @@ class ThrowStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get argument() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -3913,6 +4266,7 @@ class ThrowStatement { type: 'ThrowStatement', start: this.start, end: this.end, + range: this.range, argument: this.argument, }; } @@ -3949,19 +4303,24 @@ class TryStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get block() { const internal = this.#internal; - return constructBoxBlockStatement(internal.pos + 8, internal.ast); + return constructBoxBlockStatement(internal.pos + 24, internal.ast); } get handler() { const internal = this.#internal; - return constructOptionBoxCatchClause(internal.pos + 16, internal.ast); + return constructOptionBoxCatchClause(internal.pos + 32, internal.ast); } get finalizer() { const internal = this.#internal; - return constructOptionBoxBlockStatement(internal.pos + 24, internal.ast); + return constructOptionBoxBlockStatement(internal.pos + 40, internal.ast); } toJSON() { @@ -3969,6 +4328,7 @@ class TryStatement { type: 'TryStatement', start: this.start, end: this.end, + range: this.range, block: this.block, handler: this.handler, finalizer: this.finalizer, @@ -4007,14 +4367,19 @@ class CatchClause { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get param() { const internal = this.#internal; - return constructOptionCatchParameter(internal.pos + 8, internal.ast); + return constructOptionCatchParameter(internal.pos + 24, internal.ast); } get body() { const internal = this.#internal; - return constructBoxBlockStatement(internal.pos + 48, internal.ast); + return constructBoxBlockStatement(internal.pos + 80, internal.ast); } toJSON() { @@ -4022,6 +4387,7 @@ class CatchClause { type: 'CatchClause', start: this.start, end: this.end, + range: this.range, param: this.param, body: this.body, }; @@ -4050,7 +4416,7 @@ class CatchParameter { get pattern() { const internal = this.#internal; - return new BindingPattern(internal.pos + 8, internal.ast); + return new BindingPattern(internal.pos + 24, internal.ast); } toJSON() { @@ -4091,11 +4457,17 @@ class DebuggerStatement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'DebuggerStatement', start: this.start, end: this.end, + range: this.range, }; } @@ -4190,14 +4562,19 @@ class AssignmentPattern { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get left() { const internal = this.#internal; - return new BindingPattern(internal.pos + 8, internal.ast); + return new BindingPattern(internal.pos + 24, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 40, internal.ast); + return constructExpression(internal.pos + 56, internal.ast); } toJSON() { @@ -4205,6 +4582,7 @@ class AssignmentPattern { type: 'AssignmentPattern', start: this.start, end: this.end, + range: this.range, left: this.left, right: this.right, }; @@ -4242,11 +4620,16 @@ class ObjectPattern { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get properties() { const internal = this.#internal, cached = internal.$properties; if (cached !== void 0) return cached; - return internal.$properties = constructVecBindingProperty(internal.pos + 8, internal.ast); + return internal.$properties = constructVecBindingProperty(internal.pos + 24, internal.ast); } toJSON() { @@ -4254,6 +4637,7 @@ class ObjectPattern { type: 'ObjectPattern', start: this.start, end: this.end, + range: this.range, properties: this.properties, }; } @@ -4290,24 +4674,29 @@ class BindingProperty { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 8, internal.ast); + return constructPropertyKey(internal.pos + 24, internal.ast); } get value() { const internal = this.#internal; - return new BindingPattern(internal.pos + 24, internal.ast); + return new BindingPattern(internal.pos + 40, internal.ast); } get shorthand() { const internal = this.#internal; - return constructBool(internal.pos + 56, internal.ast); + return constructBool(internal.pos + 72, internal.ast); } get computed() { const internal = this.#internal; - return constructBool(internal.pos + 57, internal.ast); + return constructBool(internal.pos + 73, internal.ast); } toJSON() { @@ -4315,6 +4704,7 @@ class BindingProperty { type: 'BindingProperty', start: this.start, end: this.end, + range: this.range, key: this.key, value: this.value, shorthand: this.shorthand, @@ -4354,11 +4744,16 @@ class ArrayPattern { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get elements() { const internal = this.#internal, cached = internal.$elements; if (cached !== void 0) return cached; - return internal.$elements = constructVecOptionBindingPattern(internal.pos + 8, internal.ast); + return internal.$elements = constructVecOptionBindingPattern(internal.pos + 24, internal.ast); } toJSON() { @@ -4366,6 +4761,7 @@ class ArrayPattern { type: 'ArrayPattern', start: this.start, end: this.end, + range: this.range, elements: this.elements, }; } @@ -4402,9 +4798,14 @@ class BindingRestElement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get argument() { const internal = this.#internal; - return new BindingPattern(internal.pos + 8, internal.ast); + return new BindingPattern(internal.pos + 24, internal.ast); } toJSON() { @@ -4412,6 +4813,7 @@ class BindingRestElement { type: 'BindingRestElement', start: this.start, end: this.end, + range: this.range, argument: this.argument, }; } @@ -4447,55 +4849,61 @@ class Function { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get type() { const internal = this.#internal; - return constructFunctionType(internal.pos + 84, internal.ast); + return constructFunctionType(internal.pos + 116, internal.ast); } get id() { const internal = this.#internal; - return constructOptionBindingIdentifier(internal.pos + 8, internal.ast); + return constructOptionBindingIdentifier(internal.pos + 24, internal.ast); } get generator() { const internal = this.#internal; - return constructBool(internal.pos + 85, internal.ast); + return constructBool(internal.pos + 117, internal.ast); } get async() { const internal = this.#internal; - return constructBool(internal.pos + 86, internal.ast); + return constructBool(internal.pos + 118, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 87, internal.ast); + return constructBool(internal.pos + 119, internal.ast); } get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 72, internal.ast); } get params() { const internal = this.#internal; - return constructBoxFormalParameters(internal.pos + 56, internal.ast); + return constructBoxFormalParameters(internal.pos + 88, internal.ast); } get returnType() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 64, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 96, internal.ast); } get body() { const internal = this.#internal; - return constructOptionBoxFunctionBody(internal.pos + 72, internal.ast); + return constructOptionBoxFunctionBody(internal.pos + 104, internal.ast); } toJSON() { return { start: this.start, end: this.end, + range: this.range, type: this.type, id: this.id, generator: this.generator, @@ -4555,16 +4963,21 @@ class FormalParameters { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get kind() { const internal = this.#internal; - return constructFormalParameterKind(internal.pos + 40, internal.ast); + return constructFormalParameterKind(internal.pos + 56, internal.ast); } get items() { const internal = this.#internal, cached = internal.$items; if (cached !== void 0) return cached; - return internal.$items = constructVecFormalParameter(internal.pos + 8, internal.ast); + return internal.$items = constructVecFormalParameter(internal.pos + 24, internal.ast); } toJSON() { @@ -4572,6 +4985,7 @@ class FormalParameters { type: 'FormalParameters', start: this.start, end: this.end, + range: this.range, kind: this.kind, items: this.items, }; @@ -4602,12 +5016,12 @@ class FormalParameter { const internal = this.#internal, cached = internal.$decorators; if (cached !== void 0) return cached; - return internal.$decorators = constructVecDecorator(internal.pos + 8, internal.ast); + return internal.$decorators = constructVecDecorator(internal.pos + 24, internal.ast); } get pattern() { const internal = this.#internal; - return new BindingPattern(internal.pos + 32, internal.ast); + return new BindingPattern(internal.pos + 48, internal.ast); } toJSON() { @@ -4664,11 +5078,16 @@ class FunctionBody { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get body() { const internal = this.#internal, cached = internal.$body; if (cached !== void 0) return cached; - return internal.$body = constructVecStatement(internal.pos + 32, internal.ast); + return internal.$body = constructVecStatement(internal.pos + 48, internal.ast); } toJSON() { @@ -4676,6 +5095,7 @@ class FunctionBody { type: 'FunctionBody', start: this.start, end: this.end, + range: this.range, body: this.body, }; } @@ -4712,34 +5132,39 @@ class ArrowFunctionExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return constructBool(internal.pos + 44, internal.ast); + return constructBool(internal.pos + 60, internal.ast); } get async() { const internal = this.#internal; - return constructBool(internal.pos + 45, internal.ast); + return constructBool(internal.pos + 61, internal.ast); } get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 8, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 24, internal.ast); } get params() { const internal = this.#internal; - return constructBoxFormalParameters(internal.pos + 16, internal.ast); + return constructBoxFormalParameters(internal.pos + 32, internal.ast); } get returnType() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 40, internal.ast); } get body() { const internal = this.#internal; - return constructBoxFunctionBody(internal.pos + 32, internal.ast); + return constructBoxFunctionBody(internal.pos + 48, internal.ast); } toJSON() { @@ -4747,6 +5172,7 @@ class ArrowFunctionExpression { type: 'ArrowFunctionExpression', start: this.start, end: this.end, + range: this.range, expression: this.expression, async: this.async, typeParameters: this.typeParameters, @@ -4788,14 +5214,19 @@ class YieldExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get delegate() { const internal = this.#internal; - return constructBool(internal.pos + 24, internal.ast); + return constructBool(internal.pos + 40, internal.ast); } get argument() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 8, internal.ast); + return constructOptionExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -4803,6 +5234,7 @@ class YieldExpression { type: 'YieldExpression', start: this.start, end: this.end, + range: this.range, delegate: this.delegate, argument: this.argument, }; @@ -4839,64 +5271,70 @@ class Class { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get type() { const internal = this.#internal; - return constructClassType(internal.pos + 132, internal.ast); + return constructClassType(internal.pos + 164, internal.ast); } get decorators() { const internal = this.#internal, cached = internal.$decorators; if (cached !== void 0) return cached; - return internal.$decorators = constructVecDecorator(internal.pos + 8, internal.ast); + return internal.$decorators = constructVecDecorator(internal.pos + 24, internal.ast); } get id() { const internal = this.#internal; - return constructOptionBindingIdentifier(internal.pos + 32, internal.ast); + return constructOptionBindingIdentifier(internal.pos + 48, internal.ast); } get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 64, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 96, internal.ast); } get superClass() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 72, internal.ast); + return constructOptionExpression(internal.pos + 104, internal.ast); } get superTypeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 88, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 120, internal.ast); } get implements() { const internal = this.#internal, cached = internal.$implements; if (cached !== void 0) return cached; - return internal.$implements = constructVecTSClassImplements(internal.pos + 96, internal.ast); + return internal.$implements = constructVecTSClassImplements(internal.pos + 128, internal.ast); } get body() { const internal = this.#internal; - return constructBoxClassBody(internal.pos + 120, internal.ast); + return constructBoxClassBody(internal.pos + 152, internal.ast); } get abstract() { const internal = this.#internal; - return constructBool(internal.pos + 133, internal.ast); + return constructBool(internal.pos + 165, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 134, internal.ast); + return constructBool(internal.pos + 166, internal.ast); } toJSON() { return { start: this.start, end: this.end, + range: this.range, type: this.type, decorators: this.decorators, id: this.id, @@ -4953,11 +5391,16 @@ class ClassBody { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get body() { const internal = this.#internal, cached = internal.$body; if (cached !== void 0) return cached; - return internal.$body = constructVecClassElement(internal.pos + 8, internal.ast); + return internal.$body = constructVecClassElement(internal.pos + 24, internal.ast); } toJSON() { @@ -4965,6 +5408,7 @@ class ClassBody { type: 'ClassBody', start: this.start, end: this.end, + range: this.range, body: this.body, }; } @@ -5017,62 +5461,68 @@ class MethodDefinition { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get type() { const internal = this.#internal; - return constructMethodDefinitionType(internal.pos + 56, internal.ast); + return constructMethodDefinitionType(internal.pos + 72, internal.ast); } get decorators() { const internal = this.#internal, cached = internal.$decorators; if (cached !== void 0) return cached; - return internal.$decorators = constructVecDecorator(internal.pos + 8, internal.ast); + return internal.$decorators = constructVecDecorator(internal.pos + 24, internal.ast); } get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 32, internal.ast); + return constructPropertyKey(internal.pos + 48, internal.ast); } get value() { const internal = this.#internal; - return constructBoxFunction(internal.pos + 48, internal.ast); + return constructBoxFunction(internal.pos + 64, internal.ast); } get kind() { const internal = this.#internal; - return constructMethodDefinitionKind(internal.pos + 57, internal.ast); + return constructMethodDefinitionKind(internal.pos + 73, internal.ast); } get computed() { const internal = this.#internal; - return constructBool(internal.pos + 58, internal.ast); + return constructBool(internal.pos + 74, internal.ast); } get static() { const internal = this.#internal; - return constructBool(internal.pos + 59, internal.ast); + return constructBool(internal.pos + 75, internal.ast); } get override() { const internal = this.#internal; - return constructBool(internal.pos + 60, internal.ast); + return constructBool(internal.pos + 76, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 61, internal.ast); + return constructBool(internal.pos + 77, internal.ast); } get accessibility() { const internal = this.#internal; - return constructOptionTSAccessibility(internal.pos + 62, internal.ast); + return constructOptionTSAccessibility(internal.pos + 78, internal.ast); } toJSON() { return { start: this.start, end: this.end, + range: this.range, type: this.type, decorators: this.decorators, key: this.key, @@ -5128,77 +5578,83 @@ class PropertyDefinition { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get type() { const internal = this.#internal; - return constructPropertyDefinitionType(internal.pos + 72, internal.ast); + return constructPropertyDefinitionType(internal.pos + 88, internal.ast); } get decorators() { const internal = this.#internal, cached = internal.$decorators; if (cached !== void 0) return cached; - return internal.$decorators = constructVecDecorator(internal.pos + 8, internal.ast); + return internal.$decorators = constructVecDecorator(internal.pos + 24, internal.ast); } get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 32, internal.ast); + return constructPropertyKey(internal.pos + 48, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 48, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 64, internal.ast); } get value() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 56, internal.ast); + return constructOptionExpression(internal.pos + 72, internal.ast); } get computed() { const internal = this.#internal; - return constructBool(internal.pos + 73, internal.ast); + return constructBool(internal.pos + 89, internal.ast); } get static() { const internal = this.#internal; - return constructBool(internal.pos + 74, internal.ast); + return constructBool(internal.pos + 90, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 75, internal.ast); + return constructBool(internal.pos + 91, internal.ast); } get override() { const internal = this.#internal; - return constructBool(internal.pos + 76, internal.ast); + return constructBool(internal.pos + 92, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 77, internal.ast); + return constructBool(internal.pos + 93, internal.ast); } get definite() { const internal = this.#internal; - return constructBool(internal.pos + 78, internal.ast); + return constructBool(internal.pos + 94, internal.ast); } get readonly() { const internal = this.#internal; - return constructBool(internal.pos + 79, internal.ast); + return constructBool(internal.pos + 95, internal.ast); } get accessibility() { const internal = this.#internal; - return constructOptionTSAccessibility(internal.pos + 80, internal.ast); + return constructOptionTSAccessibility(internal.pos + 96, internal.ast); } toJSON() { return { start: this.start, end: this.end, + range: this.range, type: this.type, decorators: this.decorators, key: this.key, @@ -5273,11 +5729,16 @@ class PrivateIdentifier { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get name() { const internal = this.#internal, cached = internal.$name; if (cached !== void 0) return cached; - return internal.$name = constructStr(internal.pos + 8, internal.ast); + return internal.$name = constructStr(internal.pos + 24, internal.ast); } toJSON() { @@ -5285,6 +5746,7 @@ class PrivateIdentifier { type: 'PrivateIdentifier', start: this.start, end: this.end, + range: this.range, name: this.name, }; } @@ -5321,11 +5783,16 @@ class StaticBlock { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get body() { const internal = this.#internal, cached = internal.$body; if (cached !== void 0) return cached; - return internal.$body = constructVecStatement(internal.pos + 8, internal.ast); + return internal.$body = constructVecStatement(internal.pos + 24, internal.ast); } toJSON() { @@ -5333,6 +5800,7 @@ class StaticBlock { type: 'StaticBlock', start: this.start, end: this.end, + range: this.range, body: this.body, }; } @@ -5398,62 +5866,68 @@ class AccessorProperty { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get type() { const internal = this.#internal; - return constructAccessorPropertyType(internal.pos + 72, internal.ast); + return constructAccessorPropertyType(internal.pos + 88, internal.ast); } get decorators() { const internal = this.#internal, cached = internal.$decorators; if (cached !== void 0) return cached; - return internal.$decorators = constructVecDecorator(internal.pos + 8, internal.ast); + return internal.$decorators = constructVecDecorator(internal.pos + 24, internal.ast); } get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 32, internal.ast); + return constructPropertyKey(internal.pos + 48, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 48, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 64, internal.ast); } get value() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 56, internal.ast); + return constructOptionExpression(internal.pos + 72, internal.ast); } get computed() { const internal = this.#internal; - return constructBool(internal.pos + 73, internal.ast); + return constructBool(internal.pos + 89, internal.ast); } get static() { const internal = this.#internal; - return constructBool(internal.pos + 74, internal.ast); + return constructBool(internal.pos + 90, internal.ast); } get override() { const internal = this.#internal; - return constructBool(internal.pos + 75, internal.ast); + return constructBool(internal.pos + 91, internal.ast); } get definite() { const internal = this.#internal; - return constructBool(internal.pos + 76, internal.ast); + return constructBool(internal.pos + 92, internal.ast); } get accessibility() { const internal = this.#internal; - return constructOptionTSAccessibility(internal.pos + 77, internal.ast); + return constructOptionTSAccessibility(internal.pos + 93, internal.ast); } toJSON() { return { start: this.start, end: this.end, + range: this.range, type: this.type, decorators: this.decorators, key: this.key, @@ -5499,19 +5973,24 @@ class ImportExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get source() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get options() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 24, internal.ast); + return constructOptionExpression(internal.pos + 40, internal.ast); } get phase() { const internal = this.#internal; - return constructOptionImportPhase(internal.pos + 40, internal.ast); + return constructOptionImportPhase(internal.pos + 56, internal.ast); } toJSON() { @@ -5519,6 +5998,7 @@ class ImportExpression { type: 'ImportExpression', start: this.start, end: this.end, + range: this.range, source: this.source, options: this.options, phase: this.phase, @@ -5557,31 +6037,36 @@ class ImportDeclaration { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get specifiers() { const internal = this.#internal, cached = internal.$specifiers; if (cached !== void 0) return cached; - return internal.$specifiers = constructOptionVecImportDeclarationSpecifier(internal.pos + 8, internal.ast); + return internal.$specifiers = constructOptionVecImportDeclarationSpecifier(internal.pos + 24, internal.ast); } get source() { const internal = this.#internal; - return new StringLiteral(internal.pos + 32, internal.ast); + return new StringLiteral(internal.pos + 48, internal.ast); } get phase() { const internal = this.#internal; - return constructOptionImportPhase(internal.pos + 88, internal.ast); + return constructOptionImportPhase(internal.pos + 120, internal.ast); } get attributes() { const internal = this.#internal; - return constructOptionBoxWithClause(internal.pos + 80, internal.ast); + return constructOptionBoxWithClause(internal.pos + 112, internal.ast); } get importKind() { const internal = this.#internal; - return constructImportOrExportKind(internal.pos + 89, internal.ast); + return constructImportOrExportKind(internal.pos + 121, internal.ast); } toJSON() { @@ -5589,6 +6074,7 @@ class ImportDeclaration { type: 'ImportDeclaration', start: this.start, end: this.end, + range: this.range, specifiers: this.specifiers, source: this.source, phase: this.phase, @@ -5653,19 +6139,24 @@ class ImportSpecifier { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get imported() { const internal = this.#internal; - return constructModuleExportName(internal.pos + 8, internal.ast); + return constructModuleExportName(internal.pos + 24, internal.ast); } get local() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 64, internal.ast); + return new BindingIdentifier(internal.pos + 96, internal.ast); } get importKind() { const internal = this.#internal; - return constructImportOrExportKind(internal.pos + 96, internal.ast); + return constructImportOrExportKind(internal.pos + 144, internal.ast); } toJSON() { @@ -5673,6 +6164,7 @@ class ImportSpecifier { type: 'ImportSpecifier', start: this.start, end: this.end, + range: this.range, imported: this.imported, local: this.local, importKind: this.importKind, @@ -5711,9 +6203,14 @@ class ImportDefaultSpecifier { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get local() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 8, internal.ast); + return new BindingIdentifier(internal.pos + 24, internal.ast); } toJSON() { @@ -5721,6 +6218,7 @@ class ImportDefaultSpecifier { type: 'ImportDefaultSpecifier', start: this.start, end: this.end, + range: this.range, local: this.local, }; } @@ -5757,9 +6255,14 @@ class ImportNamespaceSpecifier { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get local() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 8, internal.ast); + return new BindingIdentifier(internal.pos + 24, internal.ast); } toJSON() { @@ -5767,6 +6270,7 @@ class ImportNamespaceSpecifier { type: 'ImportNamespaceSpecifier', start: this.start, end: this.end, + range: this.range, local: this.local, }; } @@ -5796,7 +6300,7 @@ class WithClause { const internal = this.#internal, cached = internal.$attributes; if (cached !== void 0) return cached; - return internal.$attributes = constructVecImportAttribute(internal.pos + 32, internal.ast); + return internal.$attributes = constructVecImportAttribute(internal.pos + 64, internal.ast); } toJSON() { @@ -5837,14 +6341,19 @@ class ImportAttribute { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get key() { const internal = this.#internal; - return constructImportAttributeKey(internal.pos + 8, internal.ast); + return constructImportAttributeKey(internal.pos + 24, internal.ast); } get value() { const internal = this.#internal; - return new StringLiteral(internal.pos + 64, internal.ast); + return new StringLiteral(internal.pos + 96, internal.ast); } toJSON() { @@ -5852,6 +6361,7 @@ class ImportAttribute { type: 'ImportAttribute', start: this.start, end: this.end, + range: this.range, key: this.key, value: this.value, }; @@ -5900,31 +6410,36 @@ class ExportNamedDeclaration { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get declaration() { const internal = this.#internal; - return constructOptionDeclaration(internal.pos + 8, internal.ast); + return constructOptionDeclaration(internal.pos + 24, internal.ast); } get specifiers() { const internal = this.#internal, cached = internal.$specifiers; if (cached !== void 0) return cached; - return internal.$specifiers = constructVecExportSpecifier(internal.pos + 24, internal.ast); + return internal.$specifiers = constructVecExportSpecifier(internal.pos + 40, internal.ast); } get source() { const internal = this.#internal; - return constructOptionStringLiteral(internal.pos + 48, internal.ast); + return constructOptionStringLiteral(internal.pos + 64, internal.ast); } get exportKind() { const internal = this.#internal; - return constructImportOrExportKind(internal.pos + 104, internal.ast); + return constructImportOrExportKind(internal.pos + 136, internal.ast); } get attributes() { const internal = this.#internal; - return constructOptionBoxWithClause(internal.pos + 96, internal.ast); + return constructOptionBoxWithClause(internal.pos + 128, internal.ast); } toJSON() { @@ -5932,6 +6447,7 @@ class ExportNamedDeclaration { type: 'ExportNamedDeclaration', start: this.start, end: this.end, + range: this.range, declaration: this.declaration, specifiers: this.specifiers, source: this.source, @@ -5972,9 +6488,14 @@ class ExportDefaultDeclaration { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get declaration() { const internal = this.#internal; - return constructExportDefaultDeclarationKind(internal.pos + 64, internal.ast); + return constructExportDefaultDeclarationKind(internal.pos + 96, internal.ast); } toJSON() { @@ -5982,6 +6503,7 @@ class ExportDefaultDeclaration { type: 'ExportDefaultDeclaration', start: this.start, end: this.end, + range: this.range, declaration: this.declaration, }; } @@ -6018,24 +6540,29 @@ class ExportAllDeclaration { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get exported() { const internal = this.#internal; - return constructOptionModuleExportName(internal.pos + 8, internal.ast); + return constructOptionModuleExportName(internal.pos + 24, internal.ast); } get source() { const internal = this.#internal; - return new StringLiteral(internal.pos + 64, internal.ast); + return new StringLiteral(internal.pos + 96, internal.ast); } get attributes() { const internal = this.#internal; - return constructOptionBoxWithClause(internal.pos + 112, internal.ast); + return constructOptionBoxWithClause(internal.pos + 160, internal.ast); } get exportKind() { const internal = this.#internal; - return constructImportOrExportKind(internal.pos + 120, internal.ast); + return constructImportOrExportKind(internal.pos + 168, internal.ast); } toJSON() { @@ -6043,6 +6570,7 @@ class ExportAllDeclaration { type: 'ExportAllDeclaration', start: this.start, end: this.end, + range: this.range, exported: this.exported, source: this.source, attributes: this.attributes, @@ -6082,19 +6610,24 @@ class ExportSpecifier { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get local() { const internal = this.#internal; - return constructModuleExportName(internal.pos + 8, internal.ast); + return constructModuleExportName(internal.pos + 24, internal.ast); } get exported() { const internal = this.#internal; - return constructModuleExportName(internal.pos + 64, internal.ast); + return constructModuleExportName(internal.pos + 96, internal.ast); } get exportKind() { const internal = this.#internal; - return constructImportOrExportKind(internal.pos + 120, internal.ast); + return constructImportOrExportKind(internal.pos + 168, internal.ast); } toJSON() { @@ -6102,6 +6635,7 @@ class ExportSpecifier { type: 'ExportSpecifier', start: this.start, end: this.end, + range: this.range, local: this.local, exported: this.exported, exportKind: this.exportKind, @@ -6252,16 +6786,21 @@ class V8IntrinsicExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get name() { const internal = this.#internal; - return new IdentifierName(internal.pos + 8, internal.ast); + return new IdentifierName(internal.pos + 24, internal.ast); } get arguments() { const internal = this.#internal, cached = internal.$arguments; if (cached !== void 0) return cached; - return internal.$arguments = constructVecArgument(internal.pos + 32, internal.ast); + return internal.$arguments = constructVecArgument(internal.pos + 64, internal.ast); } toJSON() { @@ -6269,6 +6808,7 @@ class V8IntrinsicExpression { type: 'V8IntrinsicExpression', start: this.start, end: this.end, + range: this.range, name: this.name, arguments: this.arguments, }; @@ -6306,9 +6846,14 @@ class BooleanLiteral { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get value() { const internal = this.#internal; - return constructBool(internal.pos + 8, internal.ast); + return constructBool(internal.pos + 24, internal.ast); } toJSON() { @@ -6316,6 +6861,7 @@ class BooleanLiteral { type: 'BooleanLiteral', start: this.start, end: this.end, + range: this.range, value: this.value, }; } @@ -6352,11 +6898,17 @@ class NullLiteral { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'NullLiteral', start: this.start, end: this.end, + range: this.range, }; } @@ -6392,16 +6944,21 @@ class NumericLiteral { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get value() { const internal = this.#internal; - return constructF64(internal.pos + 8, internal.ast); + return constructF64(internal.pos + 24, internal.ast); } get raw() { const internal = this.#internal, cached = internal.$raw; if (cached !== void 0) return cached; - return internal.$raw = constructOptionStr(internal.pos + 16, internal.ast); + return internal.$raw = constructOptionStr(internal.pos + 32, internal.ast); } toJSON() { @@ -6409,6 +6966,7 @@ class NumericLiteral { type: 'NumericLiteral', start: this.start, end: this.end, + range: this.range, value: this.value, raw: this.raw, }; @@ -6446,18 +7004,23 @@ class StringLiteral { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get value() { const internal = this.#internal, cached = internal.$value; if (cached !== void 0) return cached; - return internal.$value = constructStr(internal.pos + 8, internal.ast); + return internal.$value = constructStr(internal.pos + 24, internal.ast); } get raw() { const internal = this.#internal, cached = internal.$raw; if (cached !== void 0) return cached; - return internal.$raw = constructOptionStr(internal.pos + 24, internal.ast); + return internal.$raw = constructOptionStr(internal.pos + 40, internal.ast); } toJSON() { @@ -6465,6 +7028,7 @@ class StringLiteral { type: 'StringLiteral', start: this.start, end: this.end, + range: this.range, value: this.value, raw: this.raw, }; @@ -6502,18 +7066,23 @@ class BigIntLiteral { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get value() { const internal = this.#internal, cached = internal.$value; if (cached !== void 0) return cached; - return internal.$value = constructStr(internal.pos + 8, internal.ast); + return internal.$value = constructStr(internal.pos + 24, internal.ast); } get raw() { const internal = this.#internal, cached = internal.$raw; if (cached !== void 0) return cached; - return internal.$raw = constructOptionStr(internal.pos + 24, internal.ast); + return internal.$raw = constructOptionStr(internal.pos + 40, internal.ast); } toJSON() { @@ -6521,6 +7090,7 @@ class BigIntLiteral { type: 'BigIntLiteral', start: this.start, end: this.end, + range: this.range, value: this.value, raw: this.raw, }; @@ -6558,16 +7128,21 @@ class RegExpLiteral { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get regex() { const internal = this.#internal; - return new RegExp(internal.pos + 8, internal.ast); + return new RegExp(internal.pos + 24, internal.ast); } get raw() { const internal = this.#internal, cached = internal.$raw; if (cached !== void 0) return cached; - return internal.$raw = constructOptionStr(internal.pos + 40, internal.ast); + return internal.$raw = constructOptionStr(internal.pos + 56, internal.ast); } toJSON() { @@ -6575,6 +7150,7 @@ class RegExpLiteral { type: 'RegExpLiteral', start: this.start, end: this.end, + range: this.range, regex: this.regex, raw: this.raw, }; @@ -6718,21 +7294,26 @@ class JSXElement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get openingElement() { const internal = this.#internal; - return constructBoxJSXOpeningElement(internal.pos + 8, internal.ast); + return constructBoxJSXOpeningElement(internal.pos + 24, internal.ast); } get children() { const internal = this.#internal, cached = internal.$children; if (cached !== void 0) return cached; - return internal.$children = constructVecJSXChild(internal.pos + 16, internal.ast); + return internal.$children = constructVecJSXChild(internal.pos + 32, internal.ast); } get closingElement() { const internal = this.#internal; - return constructOptionBoxJSXClosingElement(internal.pos + 40, internal.ast); + return constructOptionBoxJSXClosingElement(internal.pos + 56, internal.ast); } toJSON() { @@ -6740,6 +7321,7 @@ class JSXElement { type: 'JSXElement', start: this.start, end: this.end, + range: this.range, openingElement: this.openingElement, children: this.children, closingElement: this.closingElement, @@ -6778,21 +7360,26 @@ class JSXOpeningElement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get name() { const internal = this.#internal; - return constructJSXElementName(internal.pos + 8, internal.ast); + return constructJSXElementName(internal.pos + 24, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); } get attributes() { const internal = this.#internal, cached = internal.$attributes; if (cached !== void 0) return cached; - return internal.$attributes = constructVecJSXAttributeItem(internal.pos + 32, internal.ast); + return internal.$attributes = constructVecJSXAttributeItem(internal.pos + 48, internal.ast); } toJSON() { @@ -6800,6 +7387,7 @@ class JSXOpeningElement { type: 'JSXOpeningElement', start: this.start, end: this.end, + range: this.range, name: this.name, typeArguments: this.typeArguments, attributes: this.attributes, @@ -6838,9 +7426,14 @@ class JSXClosingElement { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get name() { const internal = this.#internal; - return constructJSXElementName(internal.pos + 8, internal.ast); + return constructJSXElementName(internal.pos + 24, internal.ast); } toJSON() { @@ -6848,6 +7441,7 @@ class JSXClosingElement { type: 'JSXClosingElement', start: this.start, end: this.end, + range: this.range, name: this.name, }; } @@ -6884,21 +7478,26 @@ class JSXFragment { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get openingFragment() { const internal = this.#internal; - return new JSXOpeningFragment(internal.pos + 8, internal.ast); + return new JSXOpeningFragment(internal.pos + 24, internal.ast); } get children() { const internal = this.#internal, cached = internal.$children; if (cached !== void 0) return cached; - return internal.$children = constructVecJSXChild(internal.pos + 16, internal.ast); + return internal.$children = constructVecJSXChild(internal.pos + 48, internal.ast); } get closingFragment() { const internal = this.#internal; - return new JSXClosingFragment(internal.pos + 40, internal.ast); + return new JSXClosingFragment(internal.pos + 72, internal.ast); } toJSON() { @@ -6906,6 +7505,7 @@ class JSXFragment { type: 'JSXFragment', start: this.start, end: this.end, + range: this.range, openingFragment: this.openingFragment, children: this.children, closingFragment: this.closingFragment, @@ -6944,11 +7544,17 @@ class JSXOpeningFragment { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'JSXOpeningFragment', start: this.start, end: this.end, + range: this.range, }; } @@ -6984,11 +7590,17 @@ class JSXClosingFragment { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'JSXClosingFragment', start: this.start, end: this.end, + range: this.range, }; } @@ -7041,14 +7653,19 @@ class JSXNamespacedName { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get namespace() { const internal = this.#internal; - return new JSXIdentifier(internal.pos + 8, internal.ast); + return new JSXIdentifier(internal.pos + 24, internal.ast); } get name() { const internal = this.#internal; - return new JSXIdentifier(internal.pos + 32, internal.ast); + return new JSXIdentifier(internal.pos + 64, internal.ast); } toJSON() { @@ -7056,6 +7673,7 @@ class JSXNamespacedName { type: 'JSXNamespacedName', start: this.start, end: this.end, + range: this.range, namespace: this.namespace, name: this.name, }; @@ -7093,14 +7711,19 @@ class JSXMemberExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get object() { const internal = this.#internal; - return constructJSXMemberExpressionObject(internal.pos + 8, internal.ast); + return constructJSXMemberExpressionObject(internal.pos + 24, internal.ast); } get property() { const internal = this.#internal; - return new JSXIdentifier(internal.pos + 24, internal.ast); + return new JSXIdentifier(internal.pos + 40, internal.ast); } toJSON() { @@ -7108,6 +7731,7 @@ class JSXMemberExpression { type: 'JSXMemberExpression', start: this.start, end: this.end, + range: this.range, object: this.object, property: this.property, }; @@ -7158,9 +7782,14 @@ class JSXExpressionContainer { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return constructJSXExpression(internal.pos + 8, internal.ast); + return constructJSXExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -7168,6 +7797,7 @@ class JSXExpressionContainer { type: 'JSXExpressionContainer', start: this.start, end: this.end, + range: this.range, expression: this.expression, }; } @@ -7299,11 +7929,17 @@ class JSXEmptyExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'JSXEmptyExpression', start: this.start, end: this.end, + range: this.range, }; } @@ -7350,14 +7986,19 @@ class JSXAttribute { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get name() { const internal = this.#internal; - return constructJSXAttributeName(internal.pos + 8, internal.ast); + return constructJSXAttributeName(internal.pos + 24, internal.ast); } get value() { const internal = this.#internal; - return constructOptionJSXAttributeValue(internal.pos + 24, internal.ast); + return constructOptionJSXAttributeValue(internal.pos + 40, internal.ast); } toJSON() { @@ -7365,6 +8006,7 @@ class JSXAttribute { type: 'JSXAttribute', start: this.start, end: this.end, + range: this.range, name: this.name, value: this.value, }; @@ -7402,9 +8044,14 @@ class JSXSpreadAttribute { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get argument() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -7412,6 +8059,7 @@ class JSXSpreadAttribute { type: 'JSXSpreadAttribute', start: this.start, end: this.end, + range: this.range, argument: this.argument, }; } @@ -7474,11 +8122,16 @@ class JSXIdentifier { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get name() { const internal = this.#internal, cached = internal.$name; if (cached !== void 0) return cached; - return internal.$name = constructStr(internal.pos + 8, internal.ast); + return internal.$name = constructStr(internal.pos + 24, internal.ast); } toJSON() { @@ -7486,6 +8139,7 @@ class JSXIdentifier { type: 'JSXIdentifier', start: this.start, end: this.end, + range: this.range, name: this.name, }; } @@ -7539,9 +8193,14 @@ class JSXSpreadChild { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -7549,6 +8208,7 @@ class JSXSpreadChild { type: 'JSXSpreadChild', start: this.start, end: this.end, + range: this.range, expression: this.expression, }; } @@ -7585,18 +8245,23 @@ class JSXText { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get value() { const internal = this.#internal, cached = internal.$value; if (cached !== void 0) return cached; - return internal.$value = constructStr(internal.pos + 8, internal.ast); + return internal.$value = constructStr(internal.pos + 24, internal.ast); } get raw() { const internal = this.#internal, cached = internal.$raw; if (cached !== void 0) return cached; - return internal.$raw = constructOptionStr(internal.pos + 24, internal.ast); + return internal.$raw = constructOptionStr(internal.pos + 40, internal.ast); } toJSON() { @@ -7604,6 +8269,7 @@ class JSXText { type: 'JSXText', start: this.start, end: this.end, + range: this.range, value: this.value, raw: this.raw, }; @@ -7641,9 +8307,14 @@ class TSThisParameter { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get typeAnnotation() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 16, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 48, internal.ast); } toJSON() { @@ -7651,6 +8322,7 @@ class TSThisParameter { type: 'TSThisParameter', start: this.start, end: this.end, + range: this.range, typeAnnotation: this.typeAnnotation, }; } @@ -7687,24 +8359,29 @@ class TSEnumDeclaration { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get id() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 8, internal.ast); + return new BindingIdentifier(internal.pos + 24, internal.ast); } get body() { const internal = this.#internal; - return new TSEnumBody(internal.pos + 40, internal.ast); + return new TSEnumBody(internal.pos + 72, internal.ast); } get const() { const internal = this.#internal; - return constructBool(internal.pos + 76, internal.ast); + return constructBool(internal.pos + 124, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 77, internal.ast); + return constructBool(internal.pos + 125, internal.ast); } toJSON() { @@ -7712,6 +8389,7 @@ class TSEnumDeclaration { type: 'TSEnumDeclaration', start: this.start, end: this.end, + range: this.range, id: this.id, body: this.body, const: this.const, @@ -7751,11 +8429,16 @@ class TSEnumBody { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get members() { const internal = this.#internal, cached = internal.$members; if (cached !== void 0) return cached; - return internal.$members = constructVecTSEnumMember(internal.pos + 8, internal.ast); + return internal.$members = constructVecTSEnumMember(internal.pos + 24, internal.ast); } toJSON() { @@ -7763,6 +8446,7 @@ class TSEnumBody { type: 'TSEnumBody', start: this.start, end: this.end, + range: this.range, members: this.members, }; } @@ -7799,14 +8483,19 @@ class TSEnumMember { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get id() { const internal = this.#internal; - return constructTSEnumMemberName(internal.pos + 8, internal.ast); + return constructTSEnumMemberName(internal.pos + 24, internal.ast); } get initializer() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 24, internal.ast); + return constructOptionExpression(internal.pos + 40, internal.ast); } toJSON() { @@ -7814,6 +8503,7 @@ class TSEnumMember { type: 'TSEnumMember', start: this.start, end: this.end, + range: this.range, id: this.id, initializer: this.initializer, }; @@ -7866,9 +8556,14 @@ class TSTypeAnnotation { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 8, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } toJSON() { @@ -7876,6 +8571,7 @@ class TSTypeAnnotation { type: 'TSTypeAnnotation', start: this.start, end: this.end, + range: this.range, typeAnnotation: this.typeAnnotation, }; } @@ -7912,9 +8608,14 @@ class TSLiteralType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get literal() { const internal = this.#internal; - return constructTSLiteral(internal.pos + 8, internal.ast); + return constructTSLiteral(internal.pos + 24, internal.ast); } toJSON() { @@ -7922,6 +8623,7 @@ class TSLiteralType { type: 'TSLiteralType', start: this.start, end: this.end, + range: this.range, literal: this.literal, }; } @@ -8058,24 +8760,29 @@ class TSConditionalType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get checkType() { const internal = this.#internal; - return constructTSType(internal.pos + 8, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } get extendsType() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 40, internal.ast); } get trueType() { const internal = this.#internal; - return constructTSType(internal.pos + 40, internal.ast); + return constructTSType(internal.pos + 56, internal.ast); } get falseType() { const internal = this.#internal; - return constructTSType(internal.pos + 56, internal.ast); + return constructTSType(internal.pos + 72, internal.ast); } toJSON() { @@ -8083,6 +8790,7 @@ class TSConditionalType { type: 'TSConditionalType', start: this.start, end: this.end, + range: this.range, checkType: this.checkType, extendsType: this.extendsType, trueType: this.trueType, @@ -8122,11 +8830,16 @@ class TSUnionType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get types() { const internal = this.#internal, cached = internal.$types; if (cached !== void 0) return cached; - return internal.$types = constructVecTSType(internal.pos + 8, internal.ast); + return internal.$types = constructVecTSType(internal.pos + 24, internal.ast); } toJSON() { @@ -8134,6 +8847,7 @@ class TSUnionType { type: 'TSUnionType', start: this.start, end: this.end, + range: this.range, types: this.types, }; } @@ -8170,11 +8884,16 @@ class TSIntersectionType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get types() { const internal = this.#internal, cached = internal.$types; if (cached !== void 0) return cached; - return internal.$types = constructVecTSType(internal.pos + 8, internal.ast); + return internal.$types = constructVecTSType(internal.pos + 24, internal.ast); } toJSON() { @@ -8182,6 +8901,7 @@ class TSIntersectionType { type: 'TSIntersectionType', start: this.start, end: this.end, + range: this.range, types: this.types, }; } @@ -8218,9 +8938,14 @@ class TSParenthesizedType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 8, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } toJSON() { @@ -8228,6 +8953,7 @@ class TSParenthesizedType { type: 'TSParenthesizedType', start: this.start, end: this.end, + range: this.range, typeAnnotation: this.typeAnnotation, }; } @@ -8264,14 +8990,19 @@ class TSTypeOperator { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get operator() { const internal = this.#internal; - return constructTSTypeOperatorOperator(internal.pos + 24, internal.ast); + return constructTSTypeOperatorOperator(internal.pos + 40, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 8, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } toJSON() { @@ -8279,6 +9010,7 @@ class TSTypeOperator { type: 'TSTypeOperator', start: this.start, end: this.end, + range: this.range, operator: this.operator, typeAnnotation: this.typeAnnotation, }; @@ -8329,9 +9061,14 @@ class TSArrayType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get elementType() { const internal = this.#internal; - return constructTSType(internal.pos + 8, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } toJSON() { @@ -8339,6 +9076,7 @@ class TSArrayType { type: 'TSArrayType', start: this.start, end: this.end, + range: this.range, elementType: this.elementType, }; } @@ -8375,14 +9113,19 @@ class TSIndexedAccessType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get objectType() { const internal = this.#internal; - return constructTSType(internal.pos + 8, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } get indexType() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 40, internal.ast); } toJSON() { @@ -8390,6 +9133,7 @@ class TSIndexedAccessType { type: 'TSIndexedAccessType', start: this.start, end: this.end, + range: this.range, objectType: this.objectType, indexType: this.indexType, }; @@ -8427,11 +9171,16 @@ class TSTupleType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get elementTypes() { const internal = this.#internal, cached = internal.$elementTypes; if (cached !== void 0) return cached; - return internal.$elementTypes = constructVecTSTupleElement(internal.pos + 8, internal.ast); + return internal.$elementTypes = constructVecTSTupleElement(internal.pos + 24, internal.ast); } toJSON() { @@ -8439,6 +9188,7 @@ class TSTupleType { type: 'TSTupleType', start: this.start, end: this.end, + range: this.range, elementTypes: this.elementTypes, }; } @@ -8475,19 +9225,24 @@ class TSNamedTupleMember { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get label() { const internal = this.#internal; - return new IdentifierName(internal.pos + 8, internal.ast); + return new IdentifierName(internal.pos + 24, internal.ast); } get elementType() { const internal = this.#internal; - return constructTSTupleElement(internal.pos + 32, internal.ast); + return constructTSTupleElement(internal.pos + 64, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 48, internal.ast); + return constructBool(internal.pos + 80, internal.ast); } toJSON() { @@ -8495,6 +9250,7 @@ class TSNamedTupleMember { type: 'TSNamedTupleMember', start: this.start, end: this.end, + range: this.range, label: this.label, elementType: this.elementType, optional: this.optional, @@ -8533,9 +9289,14 @@ class TSOptionalType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 8, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } toJSON() { @@ -8543,6 +9304,7 @@ class TSOptionalType { type: 'TSOptionalType', start: this.start, end: this.end, + range: this.range, typeAnnotation: this.typeAnnotation, }; } @@ -8579,9 +9341,14 @@ class TSRestType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 8, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } toJSON() { @@ -8589,6 +9356,7 @@ class TSRestType { type: 'TSRestType', start: this.start, end: this.end, + range: this.range, typeAnnotation: this.typeAnnotation, }; } @@ -8710,11 +9478,17 @@ class TSAnyKeyword { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'TSAnyKeyword', start: this.start, end: this.end, + range: this.range, }; } @@ -8750,11 +9524,17 @@ class TSStringKeyword { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'TSStringKeyword', start: this.start, end: this.end, + range: this.range, }; } @@ -8790,11 +9570,17 @@ class TSBooleanKeyword { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'TSBooleanKeyword', start: this.start, end: this.end, + range: this.range, }; } @@ -8830,11 +9616,17 @@ class TSNumberKeyword { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'TSNumberKeyword', start: this.start, end: this.end, + range: this.range, }; } @@ -8870,11 +9662,17 @@ class TSNeverKeyword { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'TSNeverKeyword', start: this.start, end: this.end, + range: this.range, }; } @@ -8910,11 +9708,17 @@ class TSIntrinsicKeyword { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'TSIntrinsicKeyword', start: this.start, end: this.end, + range: this.range, }; } @@ -8945,9 +9749,14 @@ class TSUnknownKeyword { return constructU32(internal.pos, internal.ast); } - get end() { + get end() { + const internal = this.#internal; + return constructU32(internal.pos + 4, internal.ast); + } + + get range() { const internal = this.#internal; - return constructU32(internal.pos + 4, internal.ast); + return constructOptionArrayType(internal.pos + 8, internal.ast); } toJSON() { @@ -8955,6 +9764,7 @@ class TSUnknownKeyword { type: 'TSUnknownKeyword', start: this.start, end: this.end, + range: this.range, }; } @@ -8990,11 +9800,17 @@ class TSNullKeyword { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'TSNullKeyword', start: this.start, end: this.end, + range: this.range, }; } @@ -9030,11 +9846,17 @@ class TSUndefinedKeyword { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'TSUndefinedKeyword', start: this.start, end: this.end, + range: this.range, }; } @@ -9070,11 +9892,17 @@ class TSVoidKeyword { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'TSVoidKeyword', start: this.start, end: this.end, + range: this.range, }; } @@ -9110,11 +9938,17 @@ class TSSymbolKeyword { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'TSSymbolKeyword', start: this.start, end: this.end, + range: this.range, }; } @@ -9150,11 +9984,17 @@ class TSThisType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'TSThisType', start: this.start, end: this.end, + range: this.range, }; } @@ -9190,11 +10030,17 @@ class TSObjectKeyword { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'TSObjectKeyword', start: this.start, end: this.end, + range: this.range, }; } @@ -9230,11 +10076,17 @@ class TSBigIntKeyword { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'TSBigIntKeyword', start: this.start, end: this.end, + range: this.range, }; } @@ -9270,14 +10122,19 @@ class TSTypeReference { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get typeName() { const internal = this.#internal; - return constructTSTypeName(internal.pos + 8, internal.ast); + return constructTSTypeName(internal.pos + 24, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); } toJSON() { @@ -9285,6 +10142,7 @@ class TSTypeReference { type: 'TSTypeReference', start: this.start, end: this.end, + range: this.range, typeName: this.typeName, typeArguments: this.typeArguments, }; @@ -9333,14 +10191,19 @@ class TSQualifiedName { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get left() { const internal = this.#internal; - return constructTSTypeName(internal.pos + 8, internal.ast); + return constructTSTypeName(internal.pos + 24, internal.ast); } get right() { const internal = this.#internal; - return new IdentifierName(internal.pos + 24, internal.ast); + return new IdentifierName(internal.pos + 40, internal.ast); } toJSON() { @@ -9348,6 +10211,7 @@ class TSQualifiedName { type: 'TSQualifiedName', start: this.start, end: this.end, + range: this.range, left: this.left, right: this.right, }; @@ -9385,11 +10249,16 @@ class TSTypeParameterInstantiation { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get params() { const internal = this.#internal, cached = internal.$params; if (cached !== void 0) return cached; - return internal.$params = constructVecTSType(internal.pos + 8, internal.ast); + return internal.$params = constructVecTSType(internal.pos + 24, internal.ast); } toJSON() { @@ -9397,6 +10266,7 @@ class TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', start: this.start, end: this.end, + range: this.range, params: this.params, }; } @@ -9433,34 +10303,39 @@ class TSTypeParameter { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get name() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 8, internal.ast); + return new BindingIdentifier(internal.pos + 24, internal.ast); } get constraint() { const internal = this.#internal; - return constructOptionTSType(internal.pos + 40, internal.ast); + return constructOptionTSType(internal.pos + 72, internal.ast); } get default() { const internal = this.#internal; - return constructOptionTSType(internal.pos + 56, internal.ast); + return constructOptionTSType(internal.pos + 88, internal.ast); } get in() { const internal = this.#internal; - return constructBool(internal.pos + 72, internal.ast); + return constructBool(internal.pos + 104, internal.ast); } get out() { const internal = this.#internal; - return constructBool(internal.pos + 73, internal.ast); + return constructBool(internal.pos + 105, internal.ast); } get const() { const internal = this.#internal; - return constructBool(internal.pos + 74, internal.ast); + return constructBool(internal.pos + 106, internal.ast); } toJSON() { @@ -9468,6 +10343,7 @@ class TSTypeParameter { type: 'TSTypeParameter', start: this.start, end: this.end, + range: this.range, name: this.name, constraint: this.constraint, default: this.default, @@ -9509,11 +10385,16 @@ class TSTypeParameterDeclaration { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get params() { const internal = this.#internal, cached = internal.$params; if (cached !== void 0) return cached; - return internal.$params = constructVecTSTypeParameter(internal.pos + 8, internal.ast); + return internal.$params = constructVecTSTypeParameter(internal.pos + 24, internal.ast); } toJSON() { @@ -9521,6 +10402,7 @@ class TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', start: this.start, end: this.end, + range: this.range, params: this.params, }; } @@ -9557,24 +10439,29 @@ class TSTypeAliasDeclaration { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get id() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 8, internal.ast); + return new BindingIdentifier(internal.pos + 24, internal.ast); } get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 72, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 48, internal.ast); + return constructTSType(internal.pos + 80, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 68, internal.ast); + return constructBool(internal.pos + 100, internal.ast); } toJSON() { @@ -9582,6 +10469,7 @@ class TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', start: this.start, end: this.end, + range: this.range, id: this.id, typeParameters: this.typeParameters, typeAnnotation: this.typeAnnotation, @@ -9634,14 +10522,19 @@ class TSClassImplements { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return constructTSTypeName(internal.pos + 8, internal.ast); + return constructTSTypeName(internal.pos + 24, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); } toJSON() { @@ -9649,6 +10542,7 @@ class TSClassImplements { type: 'TSClassImplements', start: this.start, end: this.end, + range: this.range, expression: this.expression, typeArguments: this.typeArguments, }; @@ -9686,31 +10580,36 @@ class TSInterfaceDeclaration { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get id() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 8, internal.ast); + return new BindingIdentifier(internal.pos + 24, internal.ast); } get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 72, internal.ast); } get extends() { const internal = this.#internal, cached = internal.$extends; if (cached !== void 0) return cached; - return internal.$extends = constructVecTSInterfaceHeritage(internal.pos + 48, internal.ast); + return internal.$extends = constructVecTSInterfaceHeritage(internal.pos + 80, internal.ast); } get body() { const internal = this.#internal; - return constructBoxTSInterfaceBody(internal.pos + 72, internal.ast); + return constructBoxTSInterfaceBody(internal.pos + 104, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 84, internal.ast); + return constructBool(internal.pos + 116, internal.ast); } toJSON() { @@ -9718,6 +10617,7 @@ class TSInterfaceDeclaration { type: 'TSInterfaceDeclaration', start: this.start, end: this.end, + range: this.range, id: this.id, typeParameters: this.typeParameters, extends: this.extends, @@ -9758,11 +10658,16 @@ class TSInterfaceBody { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get body() { const internal = this.#internal, cached = internal.$body; if (cached !== void 0) return cached; - return internal.$body = constructVecTSSignature(internal.pos + 8, internal.ast); + return internal.$body = constructVecTSSignature(internal.pos + 24, internal.ast); } toJSON() { @@ -9770,6 +10675,7 @@ class TSInterfaceBody { type: 'TSInterfaceBody', start: this.start, end: this.end, + range: this.range, body: this.body, }; } @@ -9806,29 +10712,34 @@ class TSPropertySignature { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get computed() { const internal = this.#internal; - return constructBool(internal.pos + 32, internal.ast); + return constructBool(internal.pos + 48, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 33, internal.ast); + return constructBool(internal.pos + 49, internal.ast); } get readonly() { const internal = this.#internal; - return constructBool(internal.pos + 34, internal.ast); + return constructBool(internal.pos + 50, internal.ast); } get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 8, internal.ast); + return constructPropertyKey(internal.pos + 24, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 40, internal.ast); } toJSON() { @@ -9836,6 +10747,7 @@ class TSPropertySignature { type: 'TSPropertySignature', start: this.start, end: this.end, + range: this.range, computed: this.computed, optional: this.optional, readonly: this.readonly, @@ -9893,26 +10805,31 @@ class TSIndexSignature { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get parameters() { const internal = this.#internal, cached = internal.$parameters; if (cached !== void 0) return cached; - return internal.$parameters = constructVecTSIndexSignatureName(internal.pos + 8, internal.ast); + return internal.$parameters = constructVecTSIndexSignatureName(internal.pos + 24, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructBoxTSTypeAnnotation(internal.pos + 32, internal.ast); + return constructBoxTSTypeAnnotation(internal.pos + 48, internal.ast); } get readonly() { const internal = this.#internal; - return constructBool(internal.pos + 40, internal.ast); + return constructBool(internal.pos + 56, internal.ast); } get static() { const internal = this.#internal; - return constructBool(internal.pos + 41, internal.ast); + return constructBool(internal.pos + 57, internal.ast); } toJSON() { @@ -9920,6 +10837,7 @@ class TSIndexSignature { type: 'TSIndexSignature', start: this.start, end: this.end, + range: this.range, parameters: this.parameters, typeAnnotation: this.typeAnnotation, readonly: this.readonly, @@ -9959,19 +10877,24 @@ class TSCallSignatureDeclaration { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 8, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 24, internal.ast); } get params() { const internal = this.#internal; - return constructBoxFormalParameters(internal.pos + 24, internal.ast); + return constructBoxFormalParameters(internal.pos + 40, internal.ast); } get returnType() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 32, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 48, internal.ast); } toJSON() { @@ -9979,6 +10902,7 @@ class TSCallSignatureDeclaration { type: 'TSCallSignatureDeclaration', start: this.start, end: this.end, + range: this.range, typeParameters: this.typeParameters, params: this.params, returnType: this.returnType, @@ -10030,39 +10954,44 @@ class TSMethodSignature { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 8, internal.ast); + return constructPropertyKey(internal.pos + 24, internal.ast); } get computed() { const internal = this.#internal; - return constructBool(internal.pos + 60, internal.ast); + return constructBool(internal.pos + 76, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 61, internal.ast); + return constructBool(internal.pos + 77, internal.ast); } get kind() { const internal = this.#internal; - return constructTSMethodSignatureKind(internal.pos + 62, internal.ast); + return constructTSMethodSignatureKind(internal.pos + 78, internal.ast); } get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 40, internal.ast); } get params() { const internal = this.#internal; - return constructBoxFormalParameters(internal.pos + 40, internal.ast); + return constructBoxFormalParameters(internal.pos + 56, internal.ast); } get returnType() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 48, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 64, internal.ast); } toJSON() { @@ -10070,6 +10999,7 @@ class TSMethodSignature { type: 'TSMethodSignature', start: this.start, end: this.end, + range: this.range, key: this.key, computed: this.computed, optional: this.optional, @@ -10112,19 +11042,24 @@ class TSConstructSignatureDeclaration { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 8, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 24, internal.ast); } get params() { const internal = this.#internal; - return constructBoxFormalParameters(internal.pos + 16, internal.ast); + return constructBoxFormalParameters(internal.pos + 32, internal.ast); } get returnType() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 40, internal.ast); } toJSON() { @@ -10132,6 +11067,7 @@ class TSConstructSignatureDeclaration { type: 'TSConstructSignatureDeclaration', start: this.start, end: this.end, + range: this.range, typeParameters: this.typeParameters, params: this.params, returnType: this.returnType, @@ -10170,16 +11106,21 @@ class TSIndexSignatureName { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get name() { const internal = this.#internal, cached = internal.$name; if (cached !== void 0) return cached; - return internal.$name = constructStr(internal.pos + 8, internal.ast); + return internal.$name = constructStr(internal.pos + 24, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructBoxTSTypeAnnotation(internal.pos + 24, internal.ast); + return constructBoxTSTypeAnnotation(internal.pos + 40, internal.ast); } toJSON() { @@ -10187,6 +11128,7 @@ class TSIndexSignatureName { type: 'TSIndexSignatureName', start: this.start, end: this.end, + range: this.range, name: this.name, typeAnnotation: this.typeAnnotation, }; @@ -10224,14 +11166,19 @@ class TSInterfaceHeritage { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); } toJSON() { @@ -10239,6 +11186,7 @@ class TSInterfaceHeritage { type: 'TSInterfaceHeritage', start: this.start, end: this.end, + range: this.range, expression: this.expression, typeArguments: this.typeArguments, }; @@ -10276,19 +11224,24 @@ class TSTypePredicate { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get parameterName() { const internal = this.#internal; - return constructTSTypePredicateName(internal.pos + 8, internal.ast); + return constructTSTypePredicateName(internal.pos + 24, internal.ast); } get asserts() { const internal = this.#internal; - return constructBool(internal.pos + 32, internal.ast); + return constructBool(internal.pos + 64, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 56, internal.ast); } toJSON() { @@ -10296,6 +11249,7 @@ class TSTypePredicate { type: 'TSTypePredicate', start: this.start, end: this.end, + range: this.range, parameterName: this.parameterName, asserts: this.asserts, typeAnnotation: this.typeAnnotation, @@ -10345,24 +11299,29 @@ class TSModuleDeclaration { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get id() { const internal = this.#internal; - return constructTSModuleDeclarationName(internal.pos + 8, internal.ast); + return constructTSModuleDeclarationName(internal.pos + 24, internal.ast); } get body() { const internal = this.#internal; - return constructOptionTSModuleDeclarationBody(internal.pos + 64, internal.ast); + return constructOptionTSModuleDeclarationBody(internal.pos + 96, internal.ast); } get kind() { const internal = this.#internal; - return constructTSModuleDeclarationKind(internal.pos + 84, internal.ast); + return constructTSModuleDeclarationKind(internal.pos + 116, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 85, internal.ast); + return constructBool(internal.pos + 117, internal.ast); } toJSON() { @@ -10370,6 +11329,7 @@ class TSModuleDeclaration { type: 'TSModuleDeclaration', start: this.start, end: this.end, + range: this.range, id: this.id, body: this.body, kind: this.kind, @@ -10444,11 +11404,16 @@ class TSModuleBlock { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get body() { const internal = this.#internal, cached = internal.$body; if (cached !== void 0) return cached; - return internal.$body = constructVecStatement(internal.pos + 32, internal.ast); + return internal.$body = constructVecStatement(internal.pos + 48, internal.ast); } toJSON() { @@ -10456,6 +11421,7 @@ class TSModuleBlock { type: 'TSModuleBlock', start: this.start, end: this.end, + range: this.range, body: this.body, }; } @@ -10492,11 +11458,16 @@ class TSTypeLiteral { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get members() { const internal = this.#internal, cached = internal.$members; if (cached !== void 0) return cached; - return internal.$members = constructVecTSSignature(internal.pos + 8, internal.ast); + return internal.$members = constructVecTSSignature(internal.pos + 24, internal.ast); } toJSON() { @@ -10504,6 +11475,7 @@ class TSTypeLiteral { type: 'TSTypeLiteral', start: this.start, end: this.end, + range: this.range, members: this.members, }; } @@ -10540,9 +11512,14 @@ class TSInferType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get typeParameter() { const internal = this.#internal; - return constructBoxTSTypeParameter(internal.pos + 8, internal.ast); + return constructBoxTSTypeParameter(internal.pos + 24, internal.ast); } toJSON() { @@ -10550,6 +11527,7 @@ class TSInferType { type: 'TSInferType', start: this.start, end: this.end, + range: this.range, typeParameter: this.typeParameter, }; } @@ -10586,14 +11564,19 @@ class TSTypeQuery { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get exprName() { const internal = this.#internal; - return constructTSTypeQueryExprName(internal.pos + 8, internal.ast); + return constructTSTypeQueryExprName(internal.pos + 24, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); } toJSON() { @@ -10601,6 +11584,7 @@ class TSTypeQuery { type: 'TSTypeQuery', start: this.start, end: this.end, + range: this.range, exprName: this.exprName, typeArguments: this.typeArguments, }; @@ -10651,24 +11635,29 @@ class TSImportType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get argument() { const internal = this.#internal; - return constructTSType(internal.pos + 8, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } get options() { const internal = this.#internal; - return constructOptionBoxObjectExpression(internal.pos + 24, internal.ast); + return constructOptionBoxObjectExpression(internal.pos + 40, internal.ast); } get qualifier() { const internal = this.#internal; - return constructOptionTSTypeName(internal.pos + 32, internal.ast); + return constructOptionTSTypeName(internal.pos + 48, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 48, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 64, internal.ast); } toJSON() { @@ -10676,6 +11665,7 @@ class TSImportType { type: 'TSImportType', start: this.start, end: this.end, + range: this.range, argument: this.argument, options: this.options, qualifier: this.qualifier, @@ -10715,19 +11705,24 @@ class TSFunctionType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 8, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 24, internal.ast); } get params() { const internal = this.#internal; - return constructBoxFormalParameters(internal.pos + 24, internal.ast); + return constructBoxFormalParameters(internal.pos + 40, internal.ast); } get returnType() { const internal = this.#internal; - return constructBoxTSTypeAnnotation(internal.pos + 32, internal.ast); + return constructBoxTSTypeAnnotation(internal.pos + 48, internal.ast); } toJSON() { @@ -10735,6 +11730,7 @@ class TSFunctionType { type: 'TSFunctionType', start: this.start, end: this.end, + range: this.range, typeParameters: this.typeParameters, params: this.params, returnType: this.returnType, @@ -10773,24 +11769,29 @@ class TSConstructorType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get abstract() { const internal = this.#internal; - return constructBool(internal.pos + 32, internal.ast); + return constructBool(internal.pos + 48, internal.ast); } get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 8, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 24, internal.ast); } get params() { const internal = this.#internal; - return constructBoxFormalParameters(internal.pos + 16, internal.ast); + return constructBoxFormalParameters(internal.pos + 32, internal.ast); } get returnType() { const internal = this.#internal; - return constructBoxTSTypeAnnotation(internal.pos + 24, internal.ast); + return constructBoxTSTypeAnnotation(internal.pos + 40, internal.ast); } toJSON() { @@ -10798,6 +11799,7 @@ class TSConstructorType { type: 'TSConstructorType', start: this.start, end: this.end, + range: this.range, abstract: this.abstract, typeParameters: this.typeParameters, params: this.params, @@ -10837,24 +11839,29 @@ class TSMappedType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get nameType() { const internal = this.#internal; - return constructOptionTSType(internal.pos + 16, internal.ast); + return constructOptionTSType(internal.pos + 32, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructOptionTSType(internal.pos + 32, internal.ast); + return constructOptionTSType(internal.pos + 48, internal.ast); } get optional() { const internal = this.#internal; - return constructOptionTSMappedTypeModifierOperator(internal.pos + 52, internal.ast); + return constructOptionTSMappedTypeModifierOperator(internal.pos + 68, internal.ast); } get readonly() { const internal = this.#internal; - return constructOptionTSMappedTypeModifierOperator(internal.pos + 53, internal.ast); + return constructOptionTSMappedTypeModifierOperator(internal.pos + 69, internal.ast); } toJSON() { @@ -10862,6 +11869,7 @@ class TSMappedType { type: 'TSMappedType', start: this.start, end: this.end, + range: this.range, nameType: this.nameType, typeAnnotation: this.typeAnnotation, optional: this.optional, @@ -10914,18 +11922,23 @@ class TSTemplateLiteralType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get quasis() { const internal = this.#internal, cached = internal.$quasis; if (cached !== void 0) return cached; - return internal.$quasis = constructVecTemplateElement(internal.pos + 8, internal.ast); + return internal.$quasis = constructVecTemplateElement(internal.pos + 24, internal.ast); } get types() { const internal = this.#internal, cached = internal.$types; if (cached !== void 0) return cached; - return internal.$types = constructVecTSType(internal.pos + 32, internal.ast); + return internal.$types = constructVecTSType(internal.pos + 48, internal.ast); } toJSON() { @@ -10933,6 +11946,7 @@ class TSTemplateLiteralType { type: 'TSTemplateLiteralType', start: this.start, end: this.end, + range: this.range, quasis: this.quasis, types: this.types, }; @@ -10970,14 +11984,19 @@ class TSAsExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 40, internal.ast); } toJSON() { @@ -10985,6 +12004,7 @@ class TSAsExpression { type: 'TSAsExpression', start: this.start, end: this.end, + range: this.range, expression: this.expression, typeAnnotation: this.typeAnnotation, }; @@ -11022,14 +12042,19 @@ class TSSatisfiesExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 40, internal.ast); } toJSON() { @@ -11037,6 +12062,7 @@ class TSSatisfiesExpression { type: 'TSSatisfiesExpression', start: this.start, end: this.end, + range: this.range, expression: this.expression, typeAnnotation: this.typeAnnotation, }; @@ -11074,14 +12100,19 @@ class TSTypeAssertion { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 8, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 40, internal.ast); } toJSON() { @@ -11089,6 +12120,7 @@ class TSTypeAssertion { type: 'TSTypeAssertion', start: this.start, end: this.end, + range: this.range, typeAnnotation: this.typeAnnotation, expression: this.expression, }; @@ -11126,19 +12158,24 @@ class TSImportEqualsDeclaration { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get id() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 8, internal.ast); + return new BindingIdentifier(internal.pos + 24, internal.ast); } get moduleReference() { const internal = this.#internal; - return constructTSModuleReference(internal.pos + 40, internal.ast); + return constructTSModuleReference(internal.pos + 72, internal.ast); } get importKind() { const internal = this.#internal; - return constructImportOrExportKind(internal.pos + 56, internal.ast); + return constructImportOrExportKind(internal.pos + 88, internal.ast); } toJSON() { @@ -11146,6 +12183,7 @@ class TSImportEqualsDeclaration { type: 'TSImportEqualsDeclaration', start: this.start, end: this.end, + range: this.range, id: this.id, moduleReference: this.moduleReference, importKind: this.importKind, @@ -11197,9 +12235,14 @@ class TSExternalModuleReference { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return new StringLiteral(internal.pos + 8, internal.ast); + return new StringLiteral(internal.pos + 24, internal.ast); } toJSON() { @@ -11207,6 +12250,7 @@ class TSExternalModuleReference { type: 'TSExternalModuleReference', start: this.start, end: this.end, + range: this.range, expression: this.expression, }; } @@ -11243,9 +12287,14 @@ class TSNonNullExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -11253,6 +12302,7 @@ class TSNonNullExpression { type: 'TSNonNullExpression', start: this.start, end: this.end, + range: this.range, expression: this.expression, }; } @@ -11289,9 +12339,14 @@ class Decorator { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -11299,6 +12354,7 @@ class Decorator { type: 'Decorator', start: this.start, end: this.end, + range: this.range, expression: this.expression, }; } @@ -11335,9 +12391,14 @@ class TSExportAssignment { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -11345,6 +12406,7 @@ class TSExportAssignment { type: 'TSExportAssignment', start: this.start, end: this.end, + range: this.range, expression: this.expression, }; } @@ -11381,9 +12443,14 @@ class TSNamespaceExportDeclaration { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get id() { const internal = this.#internal; - return new IdentifierName(internal.pos + 8, internal.ast); + return new IdentifierName(internal.pos + 24, internal.ast); } toJSON() { @@ -11391,6 +12458,7 @@ class TSNamespaceExportDeclaration { type: 'TSNamespaceExportDeclaration', start: this.start, end: this.end, + range: this.range, id: this.id, }; } @@ -11427,14 +12495,19 @@ class TSInstantiationExpression { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 8, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); + return constructBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); } toJSON() { @@ -11442,6 +12515,7 @@ class TSInstantiationExpression { type: 'TSInstantiationExpression', start: this.start, end: this.end, + range: this.range, expression: this.expression, typeArguments: this.typeArguments, }; @@ -11490,14 +12564,19 @@ class JSDocNullableType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 8, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } get postfix() { const internal = this.#internal; - return constructBool(internal.pos + 24, internal.ast); + return constructBool(internal.pos + 40, internal.ast); } toJSON() { @@ -11505,6 +12584,7 @@ class JSDocNullableType { type: 'JSDocNullableType', start: this.start, end: this.end, + range: this.range, typeAnnotation: this.typeAnnotation, postfix: this.postfix, }; @@ -11542,14 +12622,19 @@ class JSDocNonNullableType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 8, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } get postfix() { const internal = this.#internal; - return constructBool(internal.pos + 24, internal.ast); + return constructBool(internal.pos + 40, internal.ast); } toJSON() { @@ -11557,6 +12642,7 @@ class JSDocNonNullableType { type: 'JSDocNonNullableType', start: this.start, end: this.end, + range: this.range, typeAnnotation: this.typeAnnotation, postfix: this.postfix, }; @@ -11594,11 +12680,17 @@ class JSDocUnknownType { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { type: 'JSDocUnknownType', start: this.start, end: this.end, + range: this.range, }; } @@ -11644,15 +12736,21 @@ class Comment { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get type() { const internal = this.#internal; - return constructCommentKind(internal.pos + 12, internal.ast); + return constructCommentKind(internal.pos + 28, internal.ast); } toJSON() { return { start: this.start, end: this.end, + range: this.range, type: this.type, }; } @@ -11682,7 +12780,7 @@ class NameSpan { const internal = this.#internal, cached = internal.$value; if (cached !== void 0) return cached; - return internal.$value = constructStr(internal.pos + 8, internal.ast); + return internal.$value = constructStr(internal.pos + 24, internal.ast); } get start() { @@ -11695,11 +12793,17 @@ class NameSpan { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { value: this.value, start: this.start, end: this.end, + range: this.range, }; } @@ -11726,17 +12830,17 @@ class ImportEntry { get importName() { const internal = this.#internal; - return constructImportImportName(internal.pos + 32, internal.ast); + return constructImportImportName(internal.pos + 64, internal.ast); } get localName() { const internal = this.#internal; - return new NameSpan(internal.pos + 64, internal.ast); + return new NameSpan(internal.pos + 112, internal.ast); } get isType() { const internal = this.#internal; - return constructBool(internal.pos + 88, internal.ast); + return constructBool(internal.pos + 152, internal.ast); } toJSON() { @@ -11791,35 +12895,41 @@ class ExportEntry { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get moduleRequest() { const internal = this.#internal; - return constructOptionNameSpan(internal.pos + 16, internal.ast); + return constructOptionNameSpan(internal.pos + 48, internal.ast); } get importName() { const internal = this.#internal; - return constructExportImportName(internal.pos + 40, internal.ast); + return constructExportImportName(internal.pos + 88, internal.ast); } get exportName() { const internal = this.#internal; - return constructExportExportName(internal.pos + 72, internal.ast); + return constructExportExportName(internal.pos + 136, internal.ast); } get localName() { const internal = this.#internal; - return constructExportLocalName(internal.pos + 104, internal.ast); + return constructExportLocalName(internal.pos + 184, internal.ast); } get isType() { const internal = this.#internal; - return constructBool(internal.pos + 136, internal.ast); + return constructBool(internal.pos + 232, internal.ast); } toJSON() { return { start: this.start, end: this.end, + range: this.range, moduleRequest: this.moduleRequest, importName: this.importName, exportName: this.exportName, @@ -11900,15 +13010,21 @@ class DynamicImport { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get moduleRequest() { const internal = this.#internal; - return new Span(internal.pos + 8, internal.ast); + return new Span(internal.pos + 24, internal.ast); } toJSON() { return { start: this.start, end: this.end, + range: this.range, moduleRequest: this.moduleRequest, }; } @@ -12079,10 +13195,16 @@ class Span { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { start: this.start, end: this.end, + range: this.range, }; } @@ -12160,19 +13282,19 @@ class RawTransferData { const internal = this.#internal, cached = internal.$comments; if (cached !== void 0) return cached; - return internal.$comments = constructVecComment(internal.pos + 128, internal.ast); + return internal.$comments = constructVecComment(internal.pos + 160, internal.ast); } get module() { const internal = this.#internal; - return new EcmaScriptModule(internal.pos + 152, internal.ast); + return new EcmaScriptModule(internal.pos + 184, internal.ast); } get errors() { const internal = this.#internal, cached = internal.$errors; if (cached !== void 0) return cached; - return internal.$errors = constructVecError(internal.pos + 256, internal.ast); + return internal.$errors = constructVecError(internal.pos + 288, internal.ast); } toJSON() { @@ -12286,7 +13408,7 @@ class ErrorLabel { const internal = this.#internal, cached = internal.$message; if (cached !== void 0) return cached; - return internal.$message = constructOptionStr(internal.pos + 8, internal.ast); + return internal.$message = constructOptionStr(internal.pos + 24, internal.ast); } get start() { @@ -12299,11 +13421,17 @@ class ErrorLabel { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + toJSON() { return { message: this.message, start: this.start, end: this.end, + range: this.range, }; } @@ -12409,22 +13537,28 @@ class StaticImport { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get moduleRequest() { const internal = this.#internal; - return new NameSpan(internal.pos + 8, internal.ast); + return new NameSpan(internal.pos + 24, internal.ast); } get entries() { const internal = this.#internal, cached = internal.$entries; if (cached !== void 0) return cached; - return internal.$entries = constructVecImportEntry(internal.pos + 32, internal.ast); + return internal.$entries = constructVecImportEntry(internal.pos + 64, internal.ast); } toJSON() { return { start: this.start, end: this.end, + range: this.range, moduleRequest: this.moduleRequest, entries: this.entries, }; @@ -12461,17 +13595,23 @@ class StaticExport { return constructU32(internal.pos + 4, internal.ast); } + get range() { + const internal = this.#internal; + return constructOptionArrayType(internal.pos + 8, internal.ast); + } + get entries() { const internal = this.#internal, cached = internal.$entries; if (cached !== void 0) return cached; - return internal.$entries = constructVecExportEntry(internal.pos + 8, internal.ast); + return internal.$entries = constructVecExportEntry(internal.pos + 24, internal.ast); } toJSON() { return { start: this.start, end: this.end, + range: this.range, entries: this.entries, }; } @@ -12520,7 +13660,7 @@ function constructVecComment(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 16, + 32, constructComment, ast, ); @@ -12531,7 +13671,7 @@ function constructComment(pos, ast) { } function constructOptionHashbang(pos, ast) { - if (ast.buffer.uint32[(pos + 8) >> 2] === 0 && ast.buffer.uint32[(pos + 12) >> 2] === 0) return null; + if (ast.buffer[pos + 8] === 2) return null; return new Hashbang(pos, ast); } @@ -12541,7 +13681,7 @@ function constructVecDirective(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 72, + 104, constructDirective, ast, ); @@ -12729,7 +13869,7 @@ function constructVecArrayExpressionElement(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 16, + 32, constructArrayExpressionElement, ast, ); @@ -12773,7 +13913,7 @@ function constructVecTemplateElement(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 48, + 64, constructTemplateElement, ast, ); @@ -12859,7 +13999,7 @@ function constructVecOptionAssignmentTargetMaybeDefault(pos, ast) { } function constructOptionAssignmentTargetRest(pos, ast) { - if (ast.buffer[pos + 8] === 51) return null; + if (ast.buffer[pos + 8] === 2) return null; return new AssignmentTargetRest(pos, ast); } @@ -12994,7 +14134,7 @@ function constructVecVariableDeclarator(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 64, + 80, constructVariableDeclarator, ast, ); @@ -13015,7 +14155,7 @@ function constructOptionForStatementInit(pos, ast) { } function constructOptionLabelIdentifier(pos, ast) { - if (ast.buffer.uint32[(pos + 8) >> 2] === 0 && ast.buffer.uint32[(pos + 12) >> 2] === 0) return null; + if (ast.buffer[pos + 8] === 2) return null; return new LabelIdentifier(pos, ast); } @@ -13025,7 +14165,7 @@ function constructVecSwitchCase(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 48, + 64, constructSwitchCase, ast, ); @@ -13050,7 +14190,7 @@ function constructOptionBoxBlockStatement(pos, ast) { } function constructOptionCatchParameter(pos, ast) { - if (ast.buffer[pos + 32] === 2) return null; + if (ast.buffer[pos + 8] === 2) return null; return new CatchParameter(pos, ast); } @@ -13085,7 +14225,7 @@ function constructVecBindingProperty(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 64, + 80, constructBindingProperty, ast, ); @@ -13122,7 +14262,7 @@ function constructVecOptionBindingPattern(pos, ast) { } function constructOptionBindingIdentifier(pos, ast) { - if (ast.buffer.uint32[(pos + 8) >> 2] === 0 && ast.buffer.uint32[(pos + 12) >> 2] === 0) return null; + if (ast.buffer[pos + 8] === 2) return null; return new BindingIdentifier(pos, ast); } @@ -13163,7 +14303,7 @@ function constructVecFormalParameter(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 72, + 88, constructFormalParameter, ast, ); @@ -13179,7 +14319,7 @@ function constructVecDecorator(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 24, + 40, constructDecorator, ast, ); @@ -13200,7 +14340,7 @@ function constructVecTSClassImplements(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 32, + 48, constructTSClassImplements, ast, ); @@ -13319,7 +14459,7 @@ function constructVecImportAttribute(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 112, + 160, constructImportAttribute, ast, ); @@ -13340,7 +14480,7 @@ function constructVecExportSpecifier(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 128, + 176, constructExportSpecifier, ast, ); @@ -13351,7 +14491,7 @@ function constructExportSpecifier(pos, ast) { } function constructOptionStringLiteral(pos, ast) { - if (ast.buffer[pos + 40] === 2) return null; + if (ast.buffer[pos + 8] === 2) return null; return new StringLiteral(pos, ast); } @@ -13448,7 +14588,7 @@ function constructVecTSEnumMember(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 40, + 56, constructTSEnumMember, ast, ); @@ -13653,7 +14793,7 @@ function constructVecTSTypeParameter(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 80, + 112, constructTSTypeParameter, ast, ); @@ -13669,7 +14809,7 @@ function constructVecTSInterfaceHeritage(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 32, + 48, constructTSInterfaceHeritage, ast, ); @@ -13717,7 +14857,7 @@ function constructVecTSIndexSignatureName(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 32, + 48, constructTSIndexSignatureName, ast, ); @@ -13764,10 +14904,15 @@ function constructU32(pos, ast) { } function constructOptionNameSpan(pos, ast) { - if (ast.buffer.uint32[(pos + 8) >> 2] === 0 && ast.buffer.uint32[(pos + 12) >> 2] === 0) return null; + if (ast.buffer[pos + 8] === 2) return null; return new NameSpan(pos, ast); } +function constructOptionArrayType(pos, ast) { + if (ast.buffer[pos] === 0) return null; + return constructArrayType(pos + 4, ast); +} + function constructU64(pos, ast) { const { uint32 } = ast.buffer, pos32 = pos >> 2; @@ -13801,7 +14946,7 @@ function constructVecErrorLabel(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 24, + 40, constructErrorLabel, ast, ); @@ -13817,7 +14962,7 @@ function constructVecStaticImport(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 56, + 88, constructStaticImport, ast, ); @@ -13833,7 +14978,7 @@ function constructVecStaticExport(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 32, + 48, constructStaticExport, ast, ); @@ -13849,7 +14994,7 @@ function constructVecDynamicImport(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 16, + 48, constructDynamicImport, ast, ); @@ -13865,7 +15010,7 @@ function constructVecSpan(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 8, + 24, constructSpan, ast, ); @@ -13881,7 +15026,7 @@ function constructVecImportEntry(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 96, + 160, constructImportEntry, ast, ); @@ -13897,7 +15042,7 @@ function constructVecExportEntry(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 144, + 240, constructExportEntry, ast, ); diff --git a/napi/parser/generated/deserialize/ts.js b/napi/parser/generated/deserialize/ts.js index 3b0cd4b7dc8a2..9413048992d77 100644 --- a/napi/parser/generated/deserialize/ts.js +++ b/napi/parser/generated/deserialize/ts.js @@ -35,8 +35,8 @@ function deserialize(buffer, sourceTextInput, sourceLenInput) { } function deserializeProgram(pos) { - const body = deserializeVecDirective(pos + 72); - body.push(...deserializeVecStatement(pos + 96)); + const body = deserializeVecDirective(pos + 104); + body.push(...deserializeVecStatement(pos + 128)); const end = deserializeU32(pos + 4); @@ -62,8 +62,8 @@ function deserializeProgram(pos) { start, end, body, - sourceType: deserializeModuleKind(pos + 125), - hashbang: deserializeOptionHashbang(pos + 48), + sourceType: deserializeModuleKind(pos + 157), + hashbang: deserializeOptionHashbang(pos + 64), }; return program; } @@ -73,8 +73,9 @@ function deserializeIdentifierName(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], - name: deserializeStr(pos + 8), + name: deserializeStr(pos + 24), optional: false, typeAnnotation: null, }; @@ -85,8 +86,9 @@ function deserializeIdentifierReference(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], - name: deserializeStr(pos + 8), + name: deserializeStr(pos + 24), optional: false, typeAnnotation: null, }; @@ -97,8 +99,9 @@ function deserializeBindingIdentifier(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], - name: deserializeStr(pos + 8), + name: deserializeStr(pos + 24), optional: false, typeAnnotation: null, }; @@ -109,8 +112,9 @@ function deserializeLabelIdentifier(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], - name: deserializeStr(pos + 8), + name: deserializeStr(pos + 24), optional: false, typeAnnotation: null, }; @@ -121,6 +125,7 @@ function deserializeThisExpression(pos) { type: 'ThisExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -129,7 +134,8 @@ function deserializeArrayExpression(pos) { type: 'ArrayExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - elements: deserializeVecArrayExpressionElement(pos + 8), + range: deserializeOptionArrayType(pos + 8), + elements: deserializeVecArrayExpressionElement(pos + 24), }; } @@ -142,7 +148,8 @@ function deserializeObjectExpression(pos) { type: 'ObjectExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - properties: deserializeVecObjectPropertyKind(pos + 8), + range: deserializeOptionArrayType(pos + 8), + properties: deserializeVecObjectPropertyKind(pos + 24), }; } @@ -151,12 +158,13 @@ function deserializeObjectProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), - kind: deserializePropertyKind(pos + 40), - key: deserializePropertyKey(pos + 8), - value: deserializeExpression(pos + 24), - method: deserializeBool(pos + 41), - shorthand: deserializeBool(pos + 42), - computed: deserializeBool(pos + 43), + range: deserializeOptionArrayType(pos + 8), + kind: deserializePropertyKind(pos + 56), + key: deserializePropertyKey(pos + 24), + value: deserializeExpression(pos + 40), + method: deserializeBool(pos + 57), + shorthand: deserializeBool(pos + 58), + computed: deserializeBool(pos + 59), optional: false, }; } @@ -166,8 +174,9 @@ function deserializeTemplateLiteral(pos) { type: 'TemplateLiteral', start: deserializeU32(pos), end: deserializeU32(pos + 4), - quasis: deserializeVecTemplateElement(pos + 8), - expressions: deserializeVecExpression(pos + 32), + range: deserializeOptionArrayType(pos + 8), + quasis: deserializeVecTemplateElement(pos + 24), + expressions: deserializeVecExpression(pos + 48), }; } @@ -176,18 +185,19 @@ function deserializeTaggedTemplateExpression(pos) { type: 'TaggedTemplateExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - tag: deserializeExpression(pos + 8), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), - quasi: deserializeTemplateLiteral(pos + 32), + range: deserializeOptionArrayType(pos + 8), + tag: deserializeExpression(pos + 24), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), + quasi: deserializeTemplateLiteral(pos + 48), }; } function deserializeTemplateElement(pos) { - const tail = deserializeBool(pos + 40), + const tail = deserializeBool(pos + 56), start = deserializeU32(pos) - 1, end = deserializeU32(pos + 4) + 2 - tail, - value = deserializeTemplateElementValue(pos + 8); - if (value.cooked !== null && deserializeBool(pos + 41)) { + value = deserializeTemplateElementValue(pos + 24); + if (value.cooked !== null && deserializeBool(pos + 57)) { value.cooked = value.cooked .replace(/\uFFFD(.{4})/g, (_, hex) => String.fromCodePoint(parseInt(hex, 16))); } @@ -206,9 +216,10 @@ function deserializeComputedMemberExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - object: deserializeExpression(pos + 8), - property: deserializeExpression(pos + 24), - optional: deserializeBool(pos + 40), + range: deserializeOptionArrayType(pos + 8), + object: deserializeExpression(pos + 24), + property: deserializeExpression(pos + 40), + optional: deserializeBool(pos + 56), computed: true, }; } @@ -218,9 +229,10 @@ function deserializeStaticMemberExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - object: deserializeExpression(pos + 8), - property: deserializeIdentifierName(pos + 24), - optional: deserializeBool(pos + 48), + range: deserializeOptionArrayType(pos + 8), + object: deserializeExpression(pos + 24), + property: deserializeIdentifierName(pos + 40), + optional: deserializeBool(pos + 80), computed: false, }; } @@ -230,9 +242,10 @@ function deserializePrivateFieldExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - object: deserializeExpression(pos + 8), - property: deserializePrivateIdentifier(pos + 24), - optional: deserializeBool(pos + 48), + range: deserializeOptionArrayType(pos + 8), + object: deserializeExpression(pos + 24), + property: deserializePrivateIdentifier(pos + 40), + optional: deserializeBool(pos + 80), computed: false, }; } @@ -242,10 +255,11 @@ function deserializeCallExpression(pos) { type: 'CallExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - callee: deserializeExpression(pos + 8), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), - arguments: deserializeVecArgument(pos + 32), - optional: deserializeBool(pos + 56), + range: deserializeOptionArrayType(pos + 8), + callee: deserializeExpression(pos + 24), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), + arguments: deserializeVecArgument(pos + 48), + optional: deserializeBool(pos + 72), }; } @@ -254,9 +268,10 @@ function deserializeNewExpression(pos) { type: 'NewExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - callee: deserializeExpression(pos + 8), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), - arguments: deserializeVecArgument(pos + 32), + range: deserializeOptionArrayType(pos + 8), + callee: deserializeExpression(pos + 24), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), + arguments: deserializeVecArgument(pos + 48), }; } @@ -265,8 +280,9 @@ function deserializeMetaProperty(pos) { type: 'MetaProperty', start: deserializeU32(pos), end: deserializeU32(pos + 4), - meta: deserializeIdentifierName(pos + 8), - property: deserializeIdentifierName(pos + 32), + range: deserializeOptionArrayType(pos + 8), + meta: deserializeIdentifierName(pos + 24), + property: deserializeIdentifierName(pos + 64), }; } @@ -275,7 +291,8 @@ function deserializeSpreadElement(pos) { type: 'SpreadElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + argument: deserializeExpression(pos + 24), }; } @@ -284,9 +301,10 @@ function deserializeUpdateExpression(pos) { type: 'UpdateExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - operator: deserializeUpdateOperator(pos + 24), - prefix: deserializeBool(pos + 25), - argument: deserializeSimpleAssignmentTarget(pos + 8), + range: deserializeOptionArrayType(pos + 8), + operator: deserializeUpdateOperator(pos + 40), + prefix: deserializeBool(pos + 41), + argument: deserializeSimpleAssignmentTarget(pos + 24), }; } @@ -295,8 +313,9 @@ function deserializeUnaryExpression(pos) { type: 'UnaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - operator: deserializeUnaryOperator(pos + 24), - argument: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + operator: deserializeUnaryOperator(pos + 40), + argument: deserializeExpression(pos + 24), prefix: true, }; } @@ -306,9 +325,10 @@ function deserializeBinaryExpression(pos) { type: 'BinaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - left: deserializeExpression(pos + 8), - operator: deserializeBinaryOperator(pos + 40), - right: deserializeExpression(pos + 24), + range: deserializeOptionArrayType(pos + 8), + left: deserializeExpression(pos + 24), + operator: deserializeBinaryOperator(pos + 56), + right: deserializeExpression(pos + 40), }; } @@ -317,9 +337,10 @@ function deserializePrivateInExpression(pos) { type: 'BinaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - left: deserializePrivateIdentifier(pos + 8), + range: deserializeOptionArrayType(pos + 8), + left: deserializePrivateIdentifier(pos + 24), operator: 'in', - right: deserializeExpression(pos + 32), + right: deserializeExpression(pos + 64), }; } @@ -328,9 +349,10 @@ function deserializeLogicalExpression(pos) { type: 'LogicalExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - left: deserializeExpression(pos + 8), - operator: deserializeLogicalOperator(pos + 40), - right: deserializeExpression(pos + 24), + range: deserializeOptionArrayType(pos + 8), + left: deserializeExpression(pos + 24), + operator: deserializeLogicalOperator(pos + 56), + right: deserializeExpression(pos + 40), }; } @@ -339,9 +361,10 @@ function deserializeConditionalExpression(pos) { type: 'ConditionalExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - test: deserializeExpression(pos + 8), - consequent: deserializeExpression(pos + 24), - alternate: deserializeExpression(pos + 40), + range: deserializeOptionArrayType(pos + 8), + test: deserializeExpression(pos + 24), + consequent: deserializeExpression(pos + 40), + alternate: deserializeExpression(pos + 56), }; } @@ -350,20 +373,22 @@ function deserializeAssignmentExpression(pos) { type: 'AssignmentExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - operator: deserializeAssignmentOperator(pos + 40), - left: deserializeAssignmentTarget(pos + 8), - right: deserializeExpression(pos + 24), + range: deserializeOptionArrayType(pos + 8), + operator: deserializeAssignmentOperator(pos + 56), + left: deserializeAssignmentTarget(pos + 24), + right: deserializeExpression(pos + 40), }; } function deserializeArrayAssignmentTarget(pos) { - const elements = deserializeVecOptionAssignmentTargetMaybeDefault(pos + 8); - const rest = deserializeOptionAssignmentTargetRest(pos + 32); + const elements = deserializeVecOptionAssignmentTargetMaybeDefault(pos + 24); + const rest = deserializeOptionAssignmentTargetRest(pos + 48); if (rest !== null) elements.push(rest); return { type: 'ArrayPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], elements, optional: false, @@ -372,13 +397,14 @@ function deserializeArrayAssignmentTarget(pos) { } function deserializeObjectAssignmentTarget(pos) { - const properties = deserializeVecAssignmentTargetProperty(pos + 8); - const rest = deserializeOptionAssignmentTargetRest(pos + 32); + const properties = deserializeVecAssignmentTargetProperty(pos + 24); + const rest = deserializeOptionAssignmentTargetRest(pos + 48); if (rest !== null) properties.push(rest); return { type: 'ObjectPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], properties, optional: false, @@ -391,8 +417,9 @@ function deserializeAssignmentTargetRest(pos) { type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], - argument: deserializeAssignmentTarget(pos + 8), + argument: deserializeAssignmentTarget(pos + 24), optional: false, typeAnnotation: null, value: null, @@ -404,9 +431,10 @@ function deserializeAssignmentTargetWithDefault(pos) { type: 'AssignmentPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], - left: deserializeAssignmentTarget(pos + 8), - right: deserializeExpression(pos + 24), + left: deserializeAssignmentTarget(pos + 24), + right: deserializeExpression(pos + 40), optional: false, typeAnnotation: null, }; @@ -415,8 +443,8 @@ function deserializeAssignmentTargetWithDefault(pos) { function deserializeAssignmentTargetPropertyIdentifier(pos) { const start = deserializeU32(pos), end = deserializeU32(pos + 4), - key = deserializeIdentifierReference(pos + 8); - const init = deserializeOptionExpression(pos + 40), + key = deserializeIdentifierReference(pos + 24); + const init = deserializeOptionExpression(pos + 72), keyCopy = { ...key }, value = init === null ? keyCopy @@ -434,6 +462,7 @@ function deserializeAssignmentTargetPropertyIdentifier(pos) { type: 'Property', start, end, + range: deserializeOptionArrayType(pos + 8), kind: 'init', key, value, @@ -449,12 +478,13 @@ function deserializeAssignmentTargetPropertyProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), kind: 'init', - key: deserializePropertyKey(pos + 8), - value: deserializeAssignmentTargetMaybeDefault(pos + 24), + key: deserializePropertyKey(pos + 24), + value: deserializeAssignmentTargetMaybeDefault(pos + 40), method: false, shorthand: false, - computed: deserializeBool(pos + 40), + computed: deserializeBool(pos + 56), optional: false, }; } @@ -464,7 +494,8 @@ function deserializeSequenceExpression(pos) { type: 'SequenceExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expressions: deserializeVecExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expressions: deserializeVecExpression(pos + 24), }; } @@ -473,6 +504,7 @@ function deserializeSuper(pos) { type: 'Super', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -481,7 +513,8 @@ function deserializeAwaitExpression(pos) { type: 'AwaitExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + argument: deserializeExpression(pos + 24), }; } @@ -490,7 +523,8 @@ function deserializeChainExpression(pos) { type: 'ChainExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeChainElement(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeChainElement(pos + 24), }; } @@ -499,7 +533,8 @@ function deserializeParenthesizedExpression(pos) { type: 'ParenthesizedExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), }; } @@ -508,8 +543,9 @@ function deserializeDirective(pos) { type: 'ExpressionStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeStringLiteral(pos + 8), - directive: deserializeStr(pos + 56), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeStringLiteral(pos + 24), + directive: deserializeStr(pos + 88), }; } @@ -518,7 +554,8 @@ function deserializeHashbang(pos) { type: 'Hashbang', start: deserializeU32(pos), end: deserializeU32(pos + 4), - value: deserializeStr(pos + 8), + range: deserializeOptionArrayType(pos + 8), + value: deserializeStr(pos + 24), }; } @@ -527,7 +564,8 @@ function deserializeBlockStatement(pos) { type: 'BlockStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - body: deserializeVecStatement(pos + 8), + range: deserializeOptionArrayType(pos + 8), + body: deserializeVecStatement(pos + 24), }; } @@ -536,9 +574,10 @@ function deserializeVariableDeclaration(pos) { type: 'VariableDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - kind: deserializeVariableDeclarationKind(pos + 32), - declarations: deserializeVecVariableDeclarator(pos + 8), - declare: deserializeBool(pos + 33), + range: deserializeOptionArrayType(pos + 8), + kind: deserializeVariableDeclarationKind(pos + 48), + declarations: deserializeVecVariableDeclarator(pos + 24), + declare: deserializeBool(pos + 49), }; } @@ -547,9 +586,10 @@ function deserializeVariableDeclarator(pos) { type: 'VariableDeclarator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeBindingPattern(pos + 8), - init: deserializeOptionExpression(pos + 40), - definite: deserializeBool(pos + 57), + range: deserializeOptionArrayType(pos + 8), + id: deserializeBindingPattern(pos + 24), + init: deserializeOptionExpression(pos + 56), + definite: deserializeBool(pos + 73), }; } @@ -558,6 +598,7 @@ function deserializeEmptyStatement(pos) { type: 'EmptyStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -566,7 +607,8 @@ function deserializeExpressionStatement(pos) { type: 'ExpressionStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), directive: null, }; } @@ -576,9 +618,10 @@ function deserializeIfStatement(pos) { type: 'IfStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - test: deserializeExpression(pos + 8), - consequent: deserializeStatement(pos + 24), - alternate: deserializeOptionStatement(pos + 40), + range: deserializeOptionArrayType(pos + 8), + test: deserializeExpression(pos + 24), + consequent: deserializeStatement(pos + 40), + alternate: deserializeOptionStatement(pos + 56), }; } @@ -587,8 +630,9 @@ function deserializeDoWhileStatement(pos) { type: 'DoWhileStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - body: deserializeStatement(pos + 8), - test: deserializeExpression(pos + 24), + range: deserializeOptionArrayType(pos + 8), + body: deserializeStatement(pos + 24), + test: deserializeExpression(pos + 40), }; } @@ -597,8 +641,9 @@ function deserializeWhileStatement(pos) { type: 'WhileStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - test: deserializeExpression(pos + 8), - body: deserializeStatement(pos + 24), + range: deserializeOptionArrayType(pos + 8), + test: deserializeExpression(pos + 24), + body: deserializeStatement(pos + 40), }; } @@ -607,10 +652,11 @@ function deserializeForStatement(pos) { type: 'ForStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - init: deserializeOptionForStatementInit(pos + 8), - test: deserializeOptionExpression(pos + 24), - update: deserializeOptionExpression(pos + 40), - body: deserializeStatement(pos + 56), + range: deserializeOptionArrayType(pos + 8), + init: deserializeOptionForStatementInit(pos + 24), + test: deserializeOptionExpression(pos + 40), + update: deserializeOptionExpression(pos + 56), + body: deserializeStatement(pos + 72), }; } @@ -619,9 +665,10 @@ function deserializeForInStatement(pos) { type: 'ForInStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - left: deserializeForStatementLeft(pos + 8), - right: deserializeExpression(pos + 24), - body: deserializeStatement(pos + 40), + range: deserializeOptionArrayType(pos + 8), + left: deserializeForStatementLeft(pos + 24), + right: deserializeExpression(pos + 40), + body: deserializeStatement(pos + 56), }; } @@ -630,10 +677,11 @@ function deserializeForOfStatement(pos) { type: 'ForOfStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - await: deserializeBool(pos + 60), - left: deserializeForStatementLeft(pos + 8), - right: deserializeExpression(pos + 24), - body: deserializeStatement(pos + 40), + range: deserializeOptionArrayType(pos + 8), + await: deserializeBool(pos + 76), + left: deserializeForStatementLeft(pos + 24), + right: deserializeExpression(pos + 40), + body: deserializeStatement(pos + 56), }; } @@ -642,7 +690,8 @@ function deserializeContinueStatement(pos) { type: 'ContinueStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - label: deserializeOptionLabelIdentifier(pos + 8), + range: deserializeOptionArrayType(pos + 8), + label: deserializeOptionLabelIdentifier(pos + 24), }; } @@ -651,7 +700,8 @@ function deserializeBreakStatement(pos) { type: 'BreakStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - label: deserializeOptionLabelIdentifier(pos + 8), + range: deserializeOptionArrayType(pos + 8), + label: deserializeOptionLabelIdentifier(pos + 24), }; } @@ -660,7 +710,8 @@ function deserializeReturnStatement(pos) { type: 'ReturnStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeOptionExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + argument: deserializeOptionExpression(pos + 24), }; } @@ -669,8 +720,9 @@ function deserializeWithStatement(pos) { type: 'WithStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - object: deserializeExpression(pos + 8), - body: deserializeStatement(pos + 24), + range: deserializeOptionArrayType(pos + 8), + object: deserializeExpression(pos + 24), + body: deserializeStatement(pos + 40), }; } @@ -679,8 +731,9 @@ function deserializeSwitchStatement(pos) { type: 'SwitchStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - discriminant: deserializeExpression(pos + 8), - cases: deserializeVecSwitchCase(pos + 24), + range: deserializeOptionArrayType(pos + 8), + discriminant: deserializeExpression(pos + 24), + cases: deserializeVecSwitchCase(pos + 40), }; } @@ -689,8 +742,9 @@ function deserializeSwitchCase(pos) { type: 'SwitchCase', start: deserializeU32(pos), end: deserializeU32(pos + 4), - test: deserializeOptionExpression(pos + 8), - consequent: deserializeVecStatement(pos + 24), + range: deserializeOptionArrayType(pos + 8), + test: deserializeOptionExpression(pos + 24), + consequent: deserializeVecStatement(pos + 40), }; } @@ -699,8 +753,9 @@ function deserializeLabeledStatement(pos) { type: 'LabeledStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - label: deserializeLabelIdentifier(pos + 8), - body: deserializeStatement(pos + 32), + range: deserializeOptionArrayType(pos + 8), + label: deserializeLabelIdentifier(pos + 24), + body: deserializeStatement(pos + 64), }; } @@ -709,7 +764,8 @@ function deserializeThrowStatement(pos) { type: 'ThrowStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + argument: deserializeExpression(pos + 24), }; } @@ -718,9 +774,10 @@ function deserializeTryStatement(pos) { type: 'TryStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - block: deserializeBoxBlockStatement(pos + 8), - handler: deserializeOptionBoxCatchClause(pos + 16), - finalizer: deserializeOptionBoxBlockStatement(pos + 24), + range: deserializeOptionArrayType(pos + 8), + block: deserializeBoxBlockStatement(pos + 24), + handler: deserializeOptionBoxCatchClause(pos + 32), + finalizer: deserializeOptionBoxBlockStatement(pos + 40), }; } @@ -729,13 +786,14 @@ function deserializeCatchClause(pos) { type: 'CatchClause', start: deserializeU32(pos), end: deserializeU32(pos + 4), - param: deserializeOptionCatchParameter(pos + 8), - body: deserializeBoxBlockStatement(pos + 48), + range: deserializeOptionArrayType(pos + 8), + param: deserializeOptionCatchParameter(pos + 24), + body: deserializeBoxBlockStatement(pos + 80), }; } function deserializeCatchParameter(pos) { - return deserializeBindingPattern(pos + 8); + return deserializeBindingPattern(pos + 24); } function deserializeDebuggerStatement(pos) { @@ -743,6 +801,7 @@ function deserializeDebuggerStatement(pos) { type: 'DebuggerStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -758,22 +817,24 @@ function deserializeAssignmentPattern(pos) { type: 'AssignmentPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], - left: deserializeBindingPattern(pos + 8), - right: deserializeExpression(pos + 40), + left: deserializeBindingPattern(pos + 24), + right: deserializeExpression(pos + 56), optional: false, typeAnnotation: null, }; } function deserializeObjectPattern(pos) { - const properties = deserializeVecBindingProperty(pos + 8); - const rest = deserializeOptionBoxBindingRestElement(pos + 32); + const properties = deserializeVecBindingProperty(pos + 24); + const rest = deserializeOptionBoxBindingRestElement(pos + 48); if (rest !== null) properties.push(rest); return { type: 'ObjectPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], properties, optional: false, @@ -786,24 +847,26 @@ function deserializeBindingProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), kind: 'init', - key: deserializePropertyKey(pos + 8), - value: deserializeBindingPattern(pos + 24), + key: deserializePropertyKey(pos + 24), + value: deserializeBindingPattern(pos + 40), method: false, - shorthand: deserializeBool(pos + 56), - computed: deserializeBool(pos + 57), + shorthand: deserializeBool(pos + 72), + computed: deserializeBool(pos + 73), optional: false, }; } function deserializeArrayPattern(pos) { - const elements = deserializeVecOptionBindingPattern(pos + 8); - const rest = deserializeOptionBoxBindingRestElement(pos + 32); + const elements = deserializeVecOptionBindingPattern(pos + 24); + const rest = deserializeOptionBoxBindingRestElement(pos + 48); if (rest !== null) elements.push(rest); return { type: 'ArrayPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], elements, optional: false, @@ -816,8 +879,9 @@ function deserializeBindingRestElement(pos) { type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], - argument: deserializeBindingPattern(pos + 8), + argument: deserializeBindingPattern(pos + 24), optional: false, typeAnnotation: null, value: null, @@ -825,38 +889,39 @@ function deserializeBindingRestElement(pos) { } function deserializeFunction(pos) { - const params = deserializeBoxFormalParameters(pos + 56); - const thisParam = deserializeOptionBoxTSThisParameter(pos + 48); + const params = deserializeBoxFormalParameters(pos + 88); + const thisParam = deserializeOptionBoxTSThisParameter(pos + 80); if (thisParam !== null) params.unshift(thisParam); return { - type: deserializeFunctionType(pos + 84), + type: deserializeFunctionType(pos + 116), start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeOptionBindingIdentifier(pos + 8), - generator: deserializeBool(pos + 85), - async: deserializeBool(pos + 86), - declare: deserializeBool(pos + 87), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40), + range: deserializeOptionArrayType(pos + 8), + id: deserializeOptionBindingIdentifier(pos + 24), + generator: deserializeBool(pos + 117), + async: deserializeBool(pos + 118), + declare: deserializeBool(pos + 119), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), params, - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 64), - body: deserializeOptionBoxFunctionBody(pos + 72), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 96), + body: deserializeOptionBoxFunctionBody(pos + 104), expression: false, }; } function deserializeFormalParameters(pos) { - const params = deserializeVecFormalParameter(pos + 8); - if (uint32[(pos + 32) >> 2] !== 0 && uint32[(pos + 36) >> 2] !== 0) { - pos = uint32[(pos + 32) >> 2]; + const params = deserializeVecFormalParameter(pos + 24); + if (uint32[(pos + 48) >> 2] !== 0 && uint32[(pos + 52) >> 2] !== 0) { + pos = uint32[(pos + 48) >> 2]; params.push({ type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), decorators: [], - argument: deserializeBindingPatternKind(pos + 8), - optional: deserializeBool(pos + 32), + argument: deserializeBindingPatternKind(pos + 24), + optional: deserializeBool(pos + 48), typeAnnotation: deserializeOptionBoxTSTypeAnnotation( - pos + 24, + pos + 40, ), value: null, }); @@ -865,24 +930,24 @@ function deserializeFormalParameters(pos) { } function deserializeFormalParameter(pos) { - const accessibility = deserializeOptionTSAccessibility(pos + 64), - readonly = deserializeBool(pos + 65), - override = deserializeBool(pos + 66); + const accessibility = deserializeOptionTSAccessibility(pos + 80), + readonly = deserializeBool(pos + 81), + override = deserializeBool(pos + 82); let param; if (accessibility === null && !readonly && !override) { - param = deserializeBindingPatternKind(pos + 32); - param.decorators = deserializeVecDecorator(pos + 8); - param.optional = deserializeBool(pos + 56); - param.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 48); + param = deserializeBindingPatternKind(pos + 48); + param.decorators = deserializeVecDecorator(pos + 24); + param.optional = deserializeBool(pos + 72); + param.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 64); } else { param = { type: 'TSParameterProperty', start: deserializeU32(pos), end: deserializeU32(pos + 4), accessibility, - decorators: deserializeVecDecorator(pos + 8), + decorators: deserializeVecDecorator(pos + 24), override, - parameter: deserializeBindingPattern(pos + 32), + parameter: deserializeBindingPattern(pos + 48), readonly, static: false, }; @@ -891,28 +956,30 @@ function deserializeFormalParameter(pos) { } function deserializeFunctionBody(pos) { - const body = deserializeVecDirective(pos + 8); - body.push(...deserializeVecStatement(pos + 32)); + const body = deserializeVecDirective(pos + 24); + body.push(...deserializeVecStatement(pos + 48)); return { type: 'BlockStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), body, }; } function deserializeArrowFunctionExpression(pos) { - const expression = deserializeBool(pos + 44); - let body = deserializeBoxFunctionBody(pos + 32); + const expression = deserializeBool(pos + 60); + let body = deserializeBoxFunctionBody(pos + 48); return { type: 'ArrowFunctionExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), expression, - async: deserializeBool(pos + 45), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), - params: deserializeBoxFormalParameters(pos + 16), - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 24), + async: deserializeBool(pos + 61), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), + params: deserializeBoxFormalParameters(pos + 32), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 40), body: expression ? body.body[0].expression : body, id: null, generator: false, @@ -924,25 +991,27 @@ function deserializeYieldExpression(pos) { type: 'YieldExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - delegate: deserializeBool(pos + 24), - argument: deserializeOptionExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + delegate: deserializeBool(pos + 40), + argument: deserializeOptionExpression(pos + 24), }; } function deserializeClass(pos) { return { - type: deserializeClassType(pos + 132), + type: deserializeClassType(pos + 164), start: deserializeU32(pos), end: deserializeU32(pos + 4), - decorators: deserializeVecDecorator(pos + 8), - id: deserializeOptionBindingIdentifier(pos + 32), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 64), - superClass: deserializeOptionExpression(pos + 72), - superTypeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 88), - implements: deserializeVecTSClassImplements(pos + 96), - body: deserializeBoxClassBody(pos + 120), - abstract: deserializeBool(pos + 133), - declare: deserializeBool(pos + 134), + range: deserializeOptionArrayType(pos + 8), + decorators: deserializeVecDecorator(pos + 24), + id: deserializeOptionBindingIdentifier(pos + 48), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 96), + superClass: deserializeOptionExpression(pos + 104), + superTypeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 120), + implements: deserializeVecTSClassImplements(pos + 128), + body: deserializeBoxClassBody(pos + 152), + abstract: deserializeBool(pos + 165), + declare: deserializeBool(pos + 166), }; } @@ -951,44 +1020,47 @@ function deserializeClassBody(pos) { type: 'ClassBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - body: deserializeVecClassElement(pos + 8), + range: deserializeOptionArrayType(pos + 8), + body: deserializeVecClassElement(pos + 24), }; } function deserializeMethodDefinition(pos) { return { - type: deserializeMethodDefinitionType(pos + 56), + type: deserializeMethodDefinitionType(pos + 72), start: deserializeU32(pos), end: deserializeU32(pos + 4), - decorators: deserializeVecDecorator(pos + 8), - key: deserializePropertyKey(pos + 32), - value: deserializeBoxFunction(pos + 48), - kind: deserializeMethodDefinitionKind(pos + 57), - computed: deserializeBool(pos + 58), - static: deserializeBool(pos + 59), - override: deserializeBool(pos + 60), - optional: deserializeBool(pos + 61), - accessibility: deserializeOptionTSAccessibility(pos + 62), + range: deserializeOptionArrayType(pos + 8), + decorators: deserializeVecDecorator(pos + 24), + key: deserializePropertyKey(pos + 48), + value: deserializeBoxFunction(pos + 64), + kind: deserializeMethodDefinitionKind(pos + 73), + computed: deserializeBool(pos + 74), + static: deserializeBool(pos + 75), + override: deserializeBool(pos + 76), + optional: deserializeBool(pos + 77), + accessibility: deserializeOptionTSAccessibility(pos + 78), }; } function deserializePropertyDefinition(pos) { return { - type: deserializePropertyDefinitionType(pos + 72), + type: deserializePropertyDefinitionType(pos + 88), start: deserializeU32(pos), end: deserializeU32(pos + 4), - decorators: deserializeVecDecorator(pos + 8), - key: deserializePropertyKey(pos + 32), - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 48), - value: deserializeOptionExpression(pos + 56), - computed: deserializeBool(pos + 73), - static: deserializeBool(pos + 74), - declare: deserializeBool(pos + 75), - override: deserializeBool(pos + 76), - optional: deserializeBool(pos + 77), - definite: deserializeBool(pos + 78), - readonly: deserializeBool(pos + 79), - accessibility: deserializeOptionTSAccessibility(pos + 80), + range: deserializeOptionArrayType(pos + 8), + decorators: deserializeVecDecorator(pos + 24), + key: deserializePropertyKey(pos + 48), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 64), + value: deserializeOptionExpression(pos + 72), + computed: deserializeBool(pos + 89), + static: deserializeBool(pos + 90), + declare: deserializeBool(pos + 91), + override: deserializeBool(pos + 92), + optional: deserializeBool(pos + 93), + definite: deserializeBool(pos + 94), + readonly: deserializeBool(pos + 95), + accessibility: deserializeOptionTSAccessibility(pos + 96), }; } @@ -997,7 +1069,8 @@ function deserializePrivateIdentifier(pos) { type: 'PrivateIdentifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeStr(pos + 8), + range: deserializeOptionArrayType(pos + 8), + name: deserializeStr(pos + 24), }; } @@ -1006,24 +1079,26 @@ function deserializeStaticBlock(pos) { type: 'StaticBlock', start: deserializeU32(pos), end: deserializeU32(pos + 4), - body: deserializeVecStatement(pos + 8), + range: deserializeOptionArrayType(pos + 8), + body: deserializeVecStatement(pos + 24), }; } function deserializeAccessorProperty(pos) { return { - type: deserializeAccessorPropertyType(pos + 72), + type: deserializeAccessorPropertyType(pos + 88), start: deserializeU32(pos), end: deserializeU32(pos + 4), - decorators: deserializeVecDecorator(pos + 8), - key: deserializePropertyKey(pos + 32), - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 48), - value: deserializeOptionExpression(pos + 56), - computed: deserializeBool(pos + 73), - static: deserializeBool(pos + 74), - override: deserializeBool(pos + 75), - definite: deserializeBool(pos + 76), - accessibility: deserializeOptionTSAccessibility(pos + 77), + range: deserializeOptionArrayType(pos + 8), + decorators: deserializeVecDecorator(pos + 24), + key: deserializePropertyKey(pos + 48), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 64), + value: deserializeOptionExpression(pos + 72), + computed: deserializeBool(pos + 89), + static: deserializeBool(pos + 90), + override: deserializeBool(pos + 91), + definite: deserializeBool(pos + 92), + accessibility: deserializeOptionTSAccessibility(pos + 93), declare: false, optional: false, readonly: false, @@ -1035,25 +1110,27 @@ function deserializeImportExpression(pos) { type: 'ImportExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - source: deserializeExpression(pos + 8), - options: deserializeOptionExpression(pos + 24), - phase: deserializeOptionImportPhase(pos + 40), + range: deserializeOptionArrayType(pos + 8), + source: deserializeExpression(pos + 24), + options: deserializeOptionExpression(pos + 40), + phase: deserializeOptionImportPhase(pos + 56), }; } function deserializeImportDeclaration(pos) { - let specifiers = deserializeOptionVecImportDeclarationSpecifier(pos + 8); + let specifiers = deserializeOptionVecImportDeclarationSpecifier(pos + 24); if (specifiers === null) specifiers = []; - const withClause = deserializeOptionBoxWithClause(pos + 80); + const withClause = deserializeOptionBoxWithClause(pos + 112); return { type: 'ImportDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), specifiers, - source: deserializeStringLiteral(pos + 32), - phase: deserializeOptionImportPhase(pos + 88), + source: deserializeStringLiteral(pos + 48), + phase: deserializeOptionImportPhase(pos + 120), attributes: withClause === null ? [] : withClause.attributes, - importKind: deserializeImportOrExportKind(pos + 89), + importKind: deserializeImportOrExportKind(pos + 121), }; } @@ -1062,9 +1139,10 @@ function deserializeImportSpecifier(pos) { type: 'ImportSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - imported: deserializeModuleExportName(pos + 8), - local: deserializeBindingIdentifier(pos + 64), - importKind: deserializeImportOrExportKind(pos + 96), + range: deserializeOptionArrayType(pos + 8), + imported: deserializeModuleExportName(pos + 24), + local: deserializeBindingIdentifier(pos + 96), + importKind: deserializeImportOrExportKind(pos + 144), }; } @@ -1073,7 +1151,8 @@ function deserializeImportDefaultSpecifier(pos) { type: 'ImportDefaultSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - local: deserializeBindingIdentifier(pos + 8), + range: deserializeOptionArrayType(pos + 8), + local: deserializeBindingIdentifier(pos + 24), }; } @@ -1082,13 +1161,14 @@ function deserializeImportNamespaceSpecifier(pos) { type: 'ImportNamespaceSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - local: deserializeBindingIdentifier(pos + 8), + range: deserializeOptionArrayType(pos + 8), + local: deserializeBindingIdentifier(pos + 24), }; } function deserializeWithClause(pos) { return { - attributes: deserializeVecImportAttribute(pos + 32), + attributes: deserializeVecImportAttribute(pos + 64), }; } @@ -1097,21 +1177,23 @@ function deserializeImportAttribute(pos) { type: 'ImportAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - key: deserializeImportAttributeKey(pos + 8), - value: deserializeStringLiteral(pos + 64), + range: deserializeOptionArrayType(pos + 8), + key: deserializeImportAttributeKey(pos + 24), + value: deserializeStringLiteral(pos + 96), }; } function deserializeExportNamedDeclaration(pos) { - const withClause = deserializeOptionBoxWithClause(pos + 96); + const withClause = deserializeOptionBoxWithClause(pos + 128); return { type: 'ExportNamedDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - declaration: deserializeOptionDeclaration(pos + 8), - specifiers: deserializeVecExportSpecifier(pos + 24), - source: deserializeOptionStringLiteral(pos + 48), - exportKind: deserializeImportOrExportKind(pos + 104), + range: deserializeOptionArrayType(pos + 8), + declaration: deserializeOptionDeclaration(pos + 24), + specifiers: deserializeVecExportSpecifier(pos + 40), + source: deserializeOptionStringLiteral(pos + 64), + exportKind: deserializeImportOrExportKind(pos + 136), attributes: withClause === null ? [] : withClause.attributes, }; } @@ -1121,21 +1203,23 @@ function deserializeExportDefaultDeclaration(pos) { type: 'ExportDefaultDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - declaration: deserializeExportDefaultDeclarationKind(pos + 64), + range: deserializeOptionArrayType(pos + 8), + declaration: deserializeExportDefaultDeclarationKind(pos + 96), exportKind: 'value', }; } function deserializeExportAllDeclaration(pos) { - const withClause = deserializeOptionBoxWithClause(pos + 112); + const withClause = deserializeOptionBoxWithClause(pos + 160); return { type: 'ExportAllDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - exported: deserializeOptionModuleExportName(pos + 8), - source: deserializeStringLiteral(pos + 64), + range: deserializeOptionArrayType(pos + 8), + exported: deserializeOptionModuleExportName(pos + 24), + source: deserializeStringLiteral(pos + 96), attributes: withClause === null ? [] : withClause.attributes, - exportKind: deserializeImportOrExportKind(pos + 120), + exportKind: deserializeImportOrExportKind(pos + 168), }; } @@ -1144,9 +1228,10 @@ function deserializeExportSpecifier(pos) { type: 'ExportSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - local: deserializeModuleExportName(pos + 8), - exported: deserializeModuleExportName(pos + 64), - exportKind: deserializeImportOrExportKind(pos + 120), + range: deserializeOptionArrayType(pos + 8), + local: deserializeModuleExportName(pos + 24), + exported: deserializeModuleExportName(pos + 96), + exportKind: deserializeImportOrExportKind(pos + 168), }; } @@ -1155,19 +1240,21 @@ function deserializeV8IntrinsicExpression(pos) { type: 'V8IntrinsicExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeIdentifierName(pos + 8), - arguments: deserializeVecArgument(pos + 32), + range: deserializeOptionArrayType(pos + 8), + name: deserializeIdentifierName(pos + 24), + arguments: deserializeVecArgument(pos + 64), }; } function deserializeBooleanLiteral(pos) { const start = deserializeU32(pos), end = deserializeU32(pos + 4), - value = deserializeBool(pos + 8); + value = deserializeBool(pos + 24); return { type: 'Literal', start, end, + range: deserializeOptionArrayType(pos + 8), value, raw: (start === 0 && end === 0) ? null : value + '', }; @@ -1180,6 +1267,7 @@ function deserializeNullLiteral(pos) { type: 'Literal', start, end, + range: deserializeOptionArrayType(pos + 8), value: null, raw: (start === 0 && end === 0) ? null : 'null', }; @@ -1190,39 +1278,42 @@ function deserializeNumericLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - value: deserializeF64(pos + 8), - raw: deserializeOptionStr(pos + 16), + range: deserializeOptionArrayType(pos + 8), + value: deserializeF64(pos + 24), + raw: deserializeOptionStr(pos + 32), }; } function deserializeStringLiteral(pos) { - let value = deserializeStr(pos + 8); - if (deserializeBool(pos + 40)) { + let value = deserializeStr(pos + 24); + if (deserializeBool(pos + 56)) { value = value.replace(/\uFFFD(.{4})/g, (_, hex) => String.fromCodePoint(parseInt(hex, 16))); } return { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), value, - raw: deserializeOptionStr(pos + 24), + raw: deserializeOptionStr(pos + 40), }; } function deserializeBigIntLiteral(pos) { - const bigint = deserializeStr(pos + 8); + const bigint = deserializeStr(pos + 24); return { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), value: BigInt(bigint), - raw: deserializeOptionStr(pos + 24), + raw: deserializeOptionStr(pos + 40), bigint, }; } function deserializeRegExpLiteral(pos) { - const regex = deserializeRegExp(pos + 8); + const regex = deserializeRegExp(pos + 24); let value = null; try { value = new RegExp(regex.pattern, regex.flags); @@ -1231,8 +1322,9 @@ function deserializeRegExpLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), value, - raw: deserializeOptionStr(pos + 40), + raw: deserializeOptionStr(pos + 56), regex, }; } @@ -1266,15 +1358,16 @@ function deserializeRegExpFlags(pos) { } function deserializeJSXElement(pos) { - const closingElement = deserializeOptionBoxJSXClosingElement(pos + 40); - const openingElement = deserializeBoxJSXOpeningElement(pos + 8); + const closingElement = deserializeOptionBoxJSXClosingElement(pos + 56); + const openingElement = deserializeBoxJSXOpeningElement(pos + 24); if (closingElement === null) openingElement.selfClosing = true; return { type: 'JSXElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), openingElement, - children: deserializeVecJSXChild(pos + 16), + children: deserializeVecJSXChild(pos + 32), closingElement, }; } @@ -1284,9 +1377,10 @@ function deserializeJSXOpeningElement(pos) { type: 'JSXOpeningElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeJSXElementName(pos + 8), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), - attributes: deserializeVecJSXAttributeItem(pos + 32), + range: deserializeOptionArrayType(pos + 8), + name: deserializeJSXElementName(pos + 24), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), + attributes: deserializeVecJSXAttributeItem(pos + 48), selfClosing: false, }; } @@ -1296,7 +1390,8 @@ function deserializeJSXClosingElement(pos) { type: 'JSXClosingElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeJSXElementName(pos + 8), + range: deserializeOptionArrayType(pos + 8), + name: deserializeJSXElementName(pos + 24), }; } @@ -1305,9 +1400,10 @@ function deserializeJSXFragment(pos) { type: 'JSXFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - openingFragment: deserializeJSXOpeningFragment(pos + 8), - children: deserializeVecJSXChild(pos + 16), - closingFragment: deserializeJSXClosingFragment(pos + 40), + range: deserializeOptionArrayType(pos + 8), + openingFragment: deserializeJSXOpeningFragment(pos + 24), + children: deserializeVecJSXChild(pos + 48), + closingFragment: deserializeJSXClosingFragment(pos + 72), }; } @@ -1316,6 +1412,7 @@ function deserializeJSXOpeningFragment(pos) { type: 'JSXOpeningFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1324,6 +1421,7 @@ function deserializeJSXClosingFragment(pos) { type: 'JSXClosingFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1332,8 +1430,9 @@ function deserializeJSXNamespacedName(pos) { type: 'JSXNamespacedName', start: deserializeU32(pos), end: deserializeU32(pos + 4), - namespace: deserializeJSXIdentifier(pos + 8), - name: deserializeJSXIdentifier(pos + 32), + range: deserializeOptionArrayType(pos + 8), + namespace: deserializeJSXIdentifier(pos + 24), + name: deserializeJSXIdentifier(pos + 64), }; } @@ -1342,8 +1441,9 @@ function deserializeJSXMemberExpression(pos) { type: 'JSXMemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - object: deserializeJSXMemberExpressionObject(pos + 8), - property: deserializeJSXIdentifier(pos + 24), + range: deserializeOptionArrayType(pos + 8), + object: deserializeJSXMemberExpressionObject(pos + 24), + property: deserializeJSXIdentifier(pos + 40), }; } @@ -1352,7 +1452,8 @@ function deserializeJSXExpressionContainer(pos) { type: 'JSXExpressionContainer', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeJSXExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeJSXExpression(pos + 24), }; } @@ -1361,6 +1462,7 @@ function deserializeJSXEmptyExpression(pos) { type: 'JSXEmptyExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1369,8 +1471,9 @@ function deserializeJSXAttribute(pos) { type: 'JSXAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeJSXAttributeName(pos + 8), - value: deserializeOptionJSXAttributeValue(pos + 24), + range: deserializeOptionArrayType(pos + 8), + name: deserializeJSXAttributeName(pos + 24), + value: deserializeOptionJSXAttributeValue(pos + 40), }; } @@ -1379,7 +1482,8 @@ function deserializeJSXSpreadAttribute(pos) { type: 'JSXSpreadAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + argument: deserializeExpression(pos + 24), }; } @@ -1388,7 +1492,8 @@ function deserializeJSXIdentifier(pos) { type: 'JSXIdentifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeStr(pos + 8), + range: deserializeOptionArrayType(pos + 8), + name: deserializeStr(pos + 24), }; } @@ -1397,7 +1502,8 @@ function deserializeJSXSpreadChild(pos) { type: 'JSXSpreadChild', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), }; } @@ -1406,8 +1512,9 @@ function deserializeJSXText(pos) { type: 'JSXText', start: deserializeU32(pos), end: deserializeU32(pos + 4), - value: deserializeStr(pos + 8), - raw: deserializeOptionStr(pos + 24), + range: deserializeOptionArrayType(pos + 8), + value: deserializeStr(pos + 24), + raw: deserializeOptionStr(pos + 40), }; } @@ -1416,10 +1523,11 @@ function deserializeTSThisParameter(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], name: 'this', optional: false, - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 16), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 48), }; } @@ -1428,10 +1536,11 @@ function deserializeTSEnumDeclaration(pos) { type: 'TSEnumDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeBindingIdentifier(pos + 8), - body: deserializeTSEnumBody(pos + 40), - const: deserializeBool(pos + 76), - declare: deserializeBool(pos + 77), + range: deserializeOptionArrayType(pos + 8), + id: deserializeBindingIdentifier(pos + 24), + body: deserializeTSEnumBody(pos + 72), + const: deserializeBool(pos + 124), + declare: deserializeBool(pos + 125), }; } @@ -1440,7 +1549,8 @@ function deserializeTSEnumBody(pos) { type: 'TSEnumBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - members: deserializeVecTSEnumMember(pos + 8), + range: deserializeOptionArrayType(pos + 8), + members: deserializeVecTSEnumMember(pos + 24), }; } @@ -1449,9 +1559,10 @@ function deserializeTSEnumMember(pos) { type: 'TSEnumMember', start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeTSEnumMemberName(pos + 8), - initializer: deserializeOptionExpression(pos + 24), - computed: deserializeU8(pos + 8) > 1, + range: deserializeOptionArrayType(pos + 8), + id: deserializeTSEnumMemberName(pos + 24), + initializer: deserializeOptionExpression(pos + 40), + computed: deserializeU8(pos + 24) > 1, }; } @@ -1460,7 +1571,8 @@ function deserializeTSTypeAnnotation(pos) { type: 'TSTypeAnnotation', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeAnnotation: deserializeTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1469,7 +1581,8 @@ function deserializeTSLiteralType(pos) { type: 'TSLiteralType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - literal: deserializeTSLiteral(pos + 8), + range: deserializeOptionArrayType(pos + 8), + literal: deserializeTSLiteral(pos + 24), }; } @@ -1478,10 +1591,11 @@ function deserializeTSConditionalType(pos) { type: 'TSConditionalType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - checkType: deserializeTSType(pos + 8), - extendsType: deserializeTSType(pos + 24), - trueType: deserializeTSType(pos + 40), - falseType: deserializeTSType(pos + 56), + range: deserializeOptionArrayType(pos + 8), + checkType: deserializeTSType(pos + 24), + extendsType: deserializeTSType(pos + 40), + trueType: deserializeTSType(pos + 56), + falseType: deserializeTSType(pos + 72), }; } @@ -1490,7 +1604,8 @@ function deserializeTSUnionType(pos) { type: 'TSUnionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - types: deserializeVecTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + types: deserializeVecTSType(pos + 24), }; } @@ -1499,7 +1614,8 @@ function deserializeTSIntersectionType(pos) { type: 'TSIntersectionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - types: deserializeVecTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + types: deserializeVecTSType(pos + 24), }; } @@ -1508,7 +1624,8 @@ function deserializeTSParenthesizedType(pos) { type: 'TSParenthesizedType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeAnnotation: deserializeTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1517,8 +1634,9 @@ function deserializeTSTypeOperator(pos) { type: 'TSTypeOperator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - operator: deserializeTSTypeOperatorOperator(pos + 24), - typeAnnotation: deserializeTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + operator: deserializeTSTypeOperatorOperator(pos + 40), + typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1527,7 +1645,8 @@ function deserializeTSArrayType(pos) { type: 'TSArrayType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - elementType: deserializeTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + elementType: deserializeTSType(pos + 24), }; } @@ -1536,8 +1655,9 @@ function deserializeTSIndexedAccessType(pos) { type: 'TSIndexedAccessType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - objectType: deserializeTSType(pos + 8), - indexType: deserializeTSType(pos + 24), + range: deserializeOptionArrayType(pos + 8), + objectType: deserializeTSType(pos + 24), + indexType: deserializeTSType(pos + 40), }; } @@ -1546,7 +1666,8 @@ function deserializeTSTupleType(pos) { type: 'TSTupleType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - elementTypes: deserializeVecTSTupleElement(pos + 8), + range: deserializeOptionArrayType(pos + 8), + elementTypes: deserializeVecTSTupleElement(pos + 24), }; } @@ -1555,9 +1676,10 @@ function deserializeTSNamedTupleMember(pos) { type: 'TSNamedTupleMember', start: deserializeU32(pos), end: deserializeU32(pos + 4), - label: deserializeIdentifierName(pos + 8), - elementType: deserializeTSTupleElement(pos + 32), - optional: deserializeBool(pos + 48), + range: deserializeOptionArrayType(pos + 8), + label: deserializeIdentifierName(pos + 24), + elementType: deserializeTSTupleElement(pos + 64), + optional: deserializeBool(pos + 80), }; } @@ -1566,7 +1688,8 @@ function deserializeTSOptionalType(pos) { type: 'TSOptionalType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeAnnotation: deserializeTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1575,7 +1698,8 @@ function deserializeTSRestType(pos) { type: 'TSRestType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeAnnotation: deserializeTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1584,6 +1708,7 @@ function deserializeTSAnyKeyword(pos) { type: 'TSAnyKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1592,6 +1717,7 @@ function deserializeTSStringKeyword(pos) { type: 'TSStringKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1600,6 +1726,7 @@ function deserializeTSBooleanKeyword(pos) { type: 'TSBooleanKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1608,6 +1735,7 @@ function deserializeTSNumberKeyword(pos) { type: 'TSNumberKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1616,6 +1744,7 @@ function deserializeTSNeverKeyword(pos) { type: 'TSNeverKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1624,6 +1753,7 @@ function deserializeTSIntrinsicKeyword(pos) { type: 'TSIntrinsicKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1632,6 +1762,7 @@ function deserializeTSUnknownKeyword(pos) { type: 'TSUnknownKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1640,6 +1771,7 @@ function deserializeTSNullKeyword(pos) { type: 'TSNullKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1648,6 +1780,7 @@ function deserializeTSUndefinedKeyword(pos) { type: 'TSUndefinedKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1656,6 +1789,7 @@ function deserializeTSVoidKeyword(pos) { type: 'TSVoidKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1664,6 +1798,7 @@ function deserializeTSSymbolKeyword(pos) { type: 'TSSymbolKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1672,6 +1807,7 @@ function deserializeTSThisType(pos) { type: 'TSThisType', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1680,6 +1816,7 @@ function deserializeTSObjectKeyword(pos) { type: 'TSObjectKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1688,6 +1825,7 @@ function deserializeTSBigIntKeyword(pos) { type: 'TSBigIntKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -1696,8 +1834,9 @@ function deserializeTSTypeReference(pos) { type: 'TSTypeReference', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeName: deserializeTSTypeName(pos + 8), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + typeName: deserializeTSTypeName(pos + 24), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; } @@ -1706,8 +1845,9 @@ function deserializeTSQualifiedName(pos) { type: 'TSQualifiedName', start: deserializeU32(pos), end: deserializeU32(pos + 4), - left: deserializeTSTypeName(pos + 8), - right: deserializeIdentifierName(pos + 24), + range: deserializeOptionArrayType(pos + 8), + left: deserializeTSTypeName(pos + 24), + right: deserializeIdentifierName(pos + 40), }; } @@ -1716,7 +1856,8 @@ function deserializeTSTypeParameterInstantiation(pos) { type: 'TSTypeParameterInstantiation', start: deserializeU32(pos), end: deserializeU32(pos + 4), - params: deserializeVecTSType(pos + 8), + range: deserializeOptionArrayType(pos + 8), + params: deserializeVecTSType(pos + 24), }; } @@ -1725,12 +1866,13 @@ function deserializeTSTypeParameter(pos) { type: 'TSTypeParameter', start: deserializeU32(pos), end: deserializeU32(pos + 4), - name: deserializeBindingIdentifier(pos + 8), - constraint: deserializeOptionTSType(pos + 40), - default: deserializeOptionTSType(pos + 56), - in: deserializeBool(pos + 72), - out: deserializeBool(pos + 73), - const: deserializeBool(pos + 74), + range: deserializeOptionArrayType(pos + 8), + name: deserializeBindingIdentifier(pos + 24), + constraint: deserializeOptionTSType(pos + 72), + default: deserializeOptionTSType(pos + 88), + in: deserializeBool(pos + 104), + out: deserializeBool(pos + 105), + const: deserializeBool(pos + 106), }; } @@ -1739,7 +1881,8 @@ function deserializeTSTypeParameterDeclaration(pos) { type: 'TSTypeParameterDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - params: deserializeVecTSTypeParameter(pos + 8), + range: deserializeOptionArrayType(pos + 8), + params: deserializeVecTSTypeParameter(pos + 24), }; } @@ -1748,15 +1891,16 @@ function deserializeTSTypeAliasDeclaration(pos) { type: 'TSTypeAliasDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeBindingIdentifier(pos + 8), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40), - typeAnnotation: deserializeTSType(pos + 48), - declare: deserializeBool(pos + 68), + range: deserializeOptionArrayType(pos + 8), + id: deserializeBindingIdentifier(pos + 24), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), + typeAnnotation: deserializeTSType(pos + 80), + declare: deserializeBool(pos + 100), }; } function deserializeTSClassImplements(pos) { - let expression = deserializeTSTypeName(pos + 8); + let expression = deserializeTSTypeName(pos + 24); if (expression.type === 'TSQualifiedName') { let parent = expression = { type: 'MemberExpression', @@ -1785,8 +1929,9 @@ function deserializeTSClassImplements(pos) { type: 'TSClassImplements', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), expression, - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; } @@ -1795,11 +1940,12 @@ function deserializeTSInterfaceDeclaration(pos) { type: 'TSInterfaceDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeBindingIdentifier(pos + 8), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40), - extends: deserializeVecTSInterfaceHeritage(pos + 48), - body: deserializeBoxTSInterfaceBody(pos + 72), - declare: deserializeBool(pos + 84), + range: deserializeOptionArrayType(pos + 8), + id: deserializeBindingIdentifier(pos + 24), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), + extends: deserializeVecTSInterfaceHeritage(pos + 80), + body: deserializeBoxTSInterfaceBody(pos + 104), + declare: deserializeBool(pos + 116), }; } @@ -1808,7 +1954,8 @@ function deserializeTSInterfaceBody(pos) { type: 'TSInterfaceBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - body: deserializeVecTSSignature(pos + 8), + range: deserializeOptionArrayType(pos + 8), + body: deserializeVecTSSignature(pos + 24), }; } @@ -1817,11 +1964,12 @@ function deserializeTSPropertySignature(pos) { type: 'TSPropertySignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - computed: deserializeBool(pos + 32), - optional: deserializeBool(pos + 33), - readonly: deserializeBool(pos + 34), - key: deserializePropertyKey(pos + 8), - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + computed: deserializeBool(pos + 48), + optional: deserializeBool(pos + 49), + readonly: deserializeBool(pos + 50), + key: deserializePropertyKey(pos + 24), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 40), accessibility: null, static: false, }; @@ -1832,43 +1980,46 @@ function deserializeTSIndexSignature(pos) { type: 'TSIndexSignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - parameters: deserializeVecTSIndexSignatureName(pos + 8), - typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 32), - readonly: deserializeBool(pos + 40), - static: deserializeBool(pos + 41), + range: deserializeOptionArrayType(pos + 8), + parameters: deserializeVecTSIndexSignatureName(pos + 24), + typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 48), + readonly: deserializeBool(pos + 56), + static: deserializeBool(pos + 57), accessibility: null, }; } function deserializeTSCallSignatureDeclaration(pos) { - const params = deserializeBoxFormalParameters(pos + 24); - const thisParam = deserializeOptionBoxTSThisParameter(pos + 16); + const params = deserializeBoxFormalParameters(pos + 40); + const thisParam = deserializeOptionBoxTSThisParameter(pos + 32); if (thisParam !== null) params.unshift(thisParam); return { type: 'TSCallSignatureDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), + range: deserializeOptionArrayType(pos + 8), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), params, - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 32), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 48), }; } function deserializeTSMethodSignature(pos) { - const params = deserializeBoxFormalParameters(pos + 40); - const thisParam = deserializeOptionBoxTSThisParameter(pos + 32); + const params = deserializeBoxFormalParameters(pos + 56); + const thisParam = deserializeOptionBoxTSThisParameter(pos + 48); if (thisParam !== null) params.unshift(thisParam); return { type: 'TSMethodSignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - key: deserializePropertyKey(pos + 8), - computed: deserializeBool(pos + 60), - optional: deserializeBool(pos + 61), - kind: deserializeTSMethodSignatureKind(pos + 62), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), + range: deserializeOptionArrayType(pos + 8), + key: deserializePropertyKey(pos + 24), + computed: deserializeBool(pos + 76), + optional: deserializeBool(pos + 77), + kind: deserializeTSMethodSignatureKind(pos + 78), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40), params, - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 48), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 64), accessibility: null, readonly: false, static: false, @@ -1880,9 +2031,10 @@ function deserializeTSConstructSignatureDeclaration(pos) { type: 'TSConstructSignatureDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), - params: deserializeBoxFormalParameters(pos + 16), - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), + params: deserializeBoxFormalParameters(pos + 32), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 40), }; } @@ -1891,10 +2043,11 @@ function deserializeTSIndexSignatureName(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), decorators: [], - name: deserializeStr(pos + 8), + name: deserializeStr(pos + 24), optional: false, - typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 24), + typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 40), }; } @@ -1903,8 +2056,9 @@ function deserializeTSInterfaceHeritage(pos) { type: 'TSInterfaceHeritage', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; } @@ -1913,20 +2067,21 @@ function deserializeTSTypePredicate(pos) { type: 'TSTypePredicate', start: deserializeU32(pos), end: deserializeU32(pos + 4), - parameterName: deserializeTSTypePredicateName(pos + 8), - asserts: deserializeBool(pos + 32), - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + parameterName: deserializeTSTypePredicateName(pos + 24), + asserts: deserializeBool(pos + 64), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 56), }; } function deserializeTSModuleDeclaration(pos) { - const kind = deserializeTSModuleDeclarationKind(pos + 84), + const kind = deserializeTSModuleDeclarationKind(pos + 116), global = kind === 'global', start = deserializeU32(pos), end = deserializeU32(pos + 4), - declare = deserializeBool(pos + 85); - let id = deserializeTSModuleDeclarationName(pos + 8), - body = deserializeOptionTSModuleDeclarationBody(pos + 64); + declare = deserializeBool(pos + 117); + let id = deserializeTSModuleDeclarationName(pos + 24), + body = deserializeOptionTSModuleDeclarationBody(pos + 96); // Flatten `body`, and nest `id` if (body !== null && body.type === 'TSModuleDeclaration') { @@ -1967,12 +2122,13 @@ function deserializeTSModuleDeclaration(pos) { } function deserializeTSModuleBlock(pos) { - const body = deserializeVecDirective(pos + 8); - body.push(...deserializeVecStatement(pos + 32)); + const body = deserializeVecDirective(pos + 24); + body.push(...deserializeVecStatement(pos + 48)); return { type: 'TSModuleBlock', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), body, }; } @@ -1982,7 +2138,8 @@ function deserializeTSTypeLiteral(pos) { type: 'TSTypeLiteral', start: deserializeU32(pos), end: deserializeU32(pos + 4), - members: deserializeVecTSSignature(pos + 8), + range: deserializeOptionArrayType(pos + 8), + members: deserializeVecTSSignature(pos + 24), }; } @@ -1991,7 +2148,8 @@ function deserializeTSInferType(pos) { type: 'TSInferType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeParameter: deserializeBoxTSTypeParameter(pos + 8), + range: deserializeOptionArrayType(pos + 8), + typeParameter: deserializeBoxTSTypeParameter(pos + 24), }; } @@ -2000,8 +2158,9 @@ function deserializeTSTypeQuery(pos) { type: 'TSTypeQuery', start: deserializeU32(pos), end: deserializeU32(pos + 4), - exprName: deserializeTSTypeQueryExprName(pos + 8), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + exprName: deserializeTSTypeQueryExprName(pos + 24), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; } @@ -2010,24 +2169,26 @@ function deserializeTSImportType(pos) { type: 'TSImportType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeTSType(pos + 8), - options: deserializeOptionBoxObjectExpression(pos + 24), - qualifier: deserializeOptionTSTypeName(pos + 32), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 48), + range: deserializeOptionArrayType(pos + 8), + argument: deserializeTSType(pos + 24), + options: deserializeOptionBoxObjectExpression(pos + 40), + qualifier: deserializeOptionTSTypeName(pos + 48), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 64), }; } function deserializeTSFunctionType(pos) { - const params = deserializeBoxFormalParameters(pos + 24); - const thisParam = deserializeOptionBoxTSThisParameter(pos + 16); + const params = deserializeBoxFormalParameters(pos + 40); + const thisParam = deserializeOptionBoxTSThisParameter(pos + 32); if (thisParam !== null) params.unshift(thisParam); return { type: 'TSFunctionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), + range: deserializeOptionArrayType(pos + 8), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), params, - returnType: deserializeBoxTSTypeAnnotation(pos + 32), + returnType: deserializeBoxTSTypeAnnotation(pos + 48), }; } @@ -2036,27 +2197,29 @@ function deserializeTSConstructorType(pos) { type: 'TSConstructorType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - abstract: deserializeBool(pos + 32), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), - params: deserializeBoxFormalParameters(pos + 16), - returnType: deserializeBoxTSTypeAnnotation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + abstract: deserializeBool(pos + 48), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), + params: deserializeBoxFormalParameters(pos + 32), + returnType: deserializeBoxTSTypeAnnotation(pos + 40), }; } function deserializeTSMappedType(pos) { - const typeParameter = deserializeBoxTSTypeParameter(pos + 8); - let optional = deserializeOptionTSMappedTypeModifierOperator(pos + 52); + const typeParameter = deserializeBoxTSTypeParameter(pos + 24); + let optional = deserializeOptionTSMappedTypeModifierOperator(pos + 68); if (optional === null) optional = false; return { type: 'TSMappedType', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), key: typeParameter.name, constraint: typeParameter.constraint, - nameType: deserializeOptionTSType(pos + 16), - typeAnnotation: deserializeOptionTSType(pos + 32), + nameType: deserializeOptionTSType(pos + 32), + typeAnnotation: deserializeOptionTSType(pos + 48), optional, - readonly: deserializeOptionTSMappedTypeModifierOperator(pos + 53), + readonly: deserializeOptionTSMappedTypeModifierOperator(pos + 69), }; } @@ -2065,8 +2228,9 @@ function deserializeTSTemplateLiteralType(pos) { type: 'TSTemplateLiteralType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - quasis: deserializeVecTemplateElement(pos + 8), - types: deserializeVecTSType(pos + 32), + range: deserializeOptionArrayType(pos + 8), + quasis: deserializeVecTemplateElement(pos + 24), + types: deserializeVecTSType(pos + 48), }; } @@ -2075,8 +2239,9 @@ function deserializeTSAsExpression(pos) { type: 'TSAsExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), + typeAnnotation: deserializeTSType(pos + 40), }; } @@ -2085,8 +2250,9 @@ function deserializeTSSatisfiesExpression(pos) { type: 'TSSatisfiesExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), + typeAnnotation: deserializeTSType(pos + 40), }; } @@ -2095,8 +2261,9 @@ function deserializeTSTypeAssertion(pos) { type: 'TSTypeAssertion', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeAnnotation: deserializeTSType(pos + 8), - expression: deserializeExpression(pos + 24), + range: deserializeOptionArrayType(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), + expression: deserializeExpression(pos + 40), }; } @@ -2105,9 +2272,10 @@ function deserializeTSImportEqualsDeclaration(pos) { type: 'TSImportEqualsDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeBindingIdentifier(pos + 8), - moduleReference: deserializeTSModuleReference(pos + 40), - importKind: deserializeImportOrExportKind(pos + 56), + range: deserializeOptionArrayType(pos + 8), + id: deserializeBindingIdentifier(pos + 24), + moduleReference: deserializeTSModuleReference(pos + 72), + importKind: deserializeImportOrExportKind(pos + 88), }; } @@ -2116,7 +2284,8 @@ function deserializeTSExternalModuleReference(pos) { type: 'TSExternalModuleReference', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeStringLiteral(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeStringLiteral(pos + 24), }; } @@ -2125,7 +2294,8 @@ function deserializeTSNonNullExpression(pos) { type: 'TSNonNullExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), }; } @@ -2134,7 +2304,8 @@ function deserializeDecorator(pos) { type: 'Decorator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), }; } @@ -2143,7 +2314,8 @@ function deserializeTSExportAssignment(pos) { type: 'TSExportAssignment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), }; } @@ -2152,7 +2324,8 @@ function deserializeTSNamespaceExportDeclaration(pos) { type: 'TSNamespaceExportDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - id: deserializeIdentifierName(pos + 8), + range: deserializeOptionArrayType(pos + 8), + id: deserializeIdentifierName(pos + 24), }; } @@ -2161,8 +2334,9 @@ function deserializeTSInstantiationExpression(pos) { type: 'TSInstantiationExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - expression: deserializeExpression(pos + 8), - typeArguments: deserializeBoxTSTypeParameterInstantiation(pos + 24), + range: deserializeOptionArrayType(pos + 8), + expression: deserializeExpression(pos + 24), + typeArguments: deserializeBoxTSTypeParameterInstantiation(pos + 40), }; } @@ -2171,8 +2345,9 @@ function deserializeJSDocNullableType(pos) { type: 'TSJSDocNullableType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeAnnotation: deserializeTSType(pos + 8), - postfix: deserializeBool(pos + 24), + range: deserializeOptionArrayType(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), + postfix: deserializeBool(pos + 40), }; } @@ -2181,8 +2356,9 @@ function deserializeJSDocNonNullableType(pos) { type: 'TSJSDocNonNullableType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - typeAnnotation: deserializeTSType(pos + 8), - postfix: deserializeBool(pos + 24), + range: deserializeOptionArrayType(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), + postfix: deserializeBool(pos + 40), }; } @@ -2191,11 +2367,12 @@ function deserializeJSDocUnknownType(pos) { type: 'TSJSDocUnknownType', start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } function deserializeComment(pos) { - const type = deserializeCommentKind(pos + 12), + const type = deserializeCommentKind(pos + 28), start = deserializeU32(pos), end = deserializeU32(pos + 4); const endCut = type === 'Line' ? 0 : 2; @@ -2204,22 +2381,24 @@ function deserializeComment(pos) { value: sourceText.slice(start + 2, end - endCut), start, end, + range: deserializeOptionArrayType(pos + 8), }; } function deserializeNameSpan(pos) { return { - value: deserializeStr(pos + 8), + value: deserializeStr(pos + 24), start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } function deserializeImportEntry(pos) { return { - importName: deserializeImportImportName(pos + 32), - localName: deserializeNameSpan(pos + 64), - isType: deserializeBool(pos + 88), + importName: deserializeImportImportName(pos + 64), + localName: deserializeNameSpan(pos + 112), + isType: deserializeBool(pos + 152), }; } @@ -2227,11 +2406,12 @@ function deserializeExportEntry(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - moduleRequest: deserializeOptionNameSpan(pos + 16), - importName: deserializeExportImportName(pos + 40), - exportName: deserializeExportExportName(pos + 72), - localName: deserializeExportLocalName(pos + 104), - isType: deserializeBool(pos + 136), + range: deserializeOptionArrayType(pos + 8), + moduleRequest: deserializeOptionNameSpan(pos + 48), + importName: deserializeExportImportName(pos + 88), + exportName: deserializeExportExportName(pos + 136), + localName: deserializeExportLocalName(pos + 184), + isType: deserializeBool(pos + 232), }; } @@ -2239,7 +2419,8 @@ function deserializeDynamicImport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - moduleRequest: deserializeSpan(pos + 8), + range: deserializeOptionArrayType(pos + 8), + moduleRequest: deserializeSpan(pos + 24), }; } @@ -2247,6 +2428,7 @@ function deserializeSpan(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -2259,9 +2441,9 @@ function deserializeSourceType(pos) { function deserializeRawTransferData(pos) { return { program: deserializeProgram(pos), - comments: deserializeVecComment(pos + 128), - module: deserializeEcmaScriptModule(pos + 152), - errors: deserializeVecError(pos + 256), + comments: deserializeVecComment(pos + 160), + module: deserializeEcmaScriptModule(pos + 184), + errors: deserializeVecError(pos + 288), }; } @@ -2277,9 +2459,10 @@ function deserializeError(pos) { function deserializeErrorLabel(pos) { return { - message: deserializeOptionStr(pos + 8), + message: deserializeOptionStr(pos + 24), start: deserializeU32(pos), end: deserializeU32(pos + 4), + range: deserializeOptionArrayType(pos + 8), }; } @@ -2297,8 +2480,9 @@ function deserializeStaticImport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - moduleRequest: deserializeNameSpan(pos + 8), - entries: deserializeVecImportEntry(pos + 32), + range: deserializeOptionArrayType(pos + 8), + moduleRequest: deserializeNameSpan(pos + 24), + entries: deserializeVecImportEntry(pos + 64), }; } @@ -2306,7 +2490,8 @@ function deserializeStaticExport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - entries: deserializeVecExportEntry(pos + 8), + range: deserializeOptionArrayType(pos + 8), + entries: deserializeVecExportEntry(pos + 24), }; } @@ -4188,13 +4373,13 @@ function deserializeVecComment(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeComment(pos)); - pos += 16; + pos += 32; } return arr; } function deserializeOptionHashbang(pos) { - if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; + if (uint8[pos + 8] === 2) return null; return deserializeHashbang(pos); } @@ -4205,7 +4390,7 @@ function deserializeVecDirective(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeDirective(pos)); - pos += 72; + pos += 104; } return arr; } @@ -4389,7 +4574,7 @@ function deserializeVecArrayExpressionElement(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeArrayExpressionElement(pos)); - pos += 16; + pos += 32; } return arr; } @@ -4433,7 +4618,7 @@ function deserializeVecTemplateElement(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeTemplateElement(pos)); - pos += 48; + pos += 64; } return arr; } @@ -4514,7 +4699,7 @@ function deserializeVecOptionAssignmentTargetMaybeDefault(pos) { } function deserializeOptionAssignmentTargetRest(pos) { - if (uint8[pos + 8] === 51) return null; + if (uint8[pos + 8] === 2) return null; return deserializeAssignmentTargetRest(pos); } @@ -4650,7 +4835,7 @@ function deserializeVecVariableDeclarator(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeVariableDeclarator(pos)); - pos += 64; + pos += 80; } return arr; } @@ -4666,7 +4851,7 @@ function deserializeOptionForStatementInit(pos) { } function deserializeOptionLabelIdentifier(pos) { - if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; + if (uint8[pos + 8] === 2) return null; return deserializeLabelIdentifier(pos); } @@ -4677,7 +4862,7 @@ function deserializeVecSwitchCase(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeSwitchCase(pos)); - pos += 48; + pos += 64; } return arr; } @@ -4697,7 +4882,7 @@ function deserializeOptionBoxBlockStatement(pos) { } function deserializeOptionCatchParameter(pos) { - if (uint8[pos + 32] === 2) return null; + if (uint8[pos + 8] === 2) return null; return deserializeCatchParameter(pos); } @@ -4733,7 +4918,7 @@ function deserializeVecBindingProperty(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeBindingProperty(pos)); - pos += 64; + pos += 80; } return arr; } @@ -4765,7 +4950,7 @@ function deserializeVecOptionBindingPattern(pos) { } function deserializeOptionBindingIdentifier(pos) { - if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; + if (uint8[pos + 8] === 2) return null; return deserializeBindingIdentifier(pos); } @@ -4807,7 +4992,7 @@ function deserializeVecFormalParameter(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeFormalParameter(pos)); - pos += 72; + pos += 88; } return arr; } @@ -4819,7 +5004,7 @@ function deserializeVecDecorator(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeDecorator(pos)); - pos += 24; + pos += 40; } return arr; } @@ -4836,7 +5021,7 @@ function deserializeVecTSClassImplements(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeTSClassImplements(pos)); - pos += 32; + pos += 48; } return arr; } @@ -4951,7 +5136,7 @@ function deserializeVecImportAttribute(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeImportAttribute(pos)); - pos += 112; + pos += 160; } return arr; } @@ -4968,13 +5153,13 @@ function deserializeVecExportSpecifier(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeExportSpecifier(pos)); - pos += 128; + pos += 176; } return arr; } function deserializeOptionStringLiteral(pos) { - if (uint8[pos + 40] === 2) return null; + if (uint8[pos + 8] === 2) return null; return deserializeStringLiteral(pos); } @@ -5072,7 +5257,7 @@ function deserializeVecTSEnumMember(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeTSEnumMember(pos)); - pos += 40; + pos += 56; } return arr; } @@ -5273,7 +5458,7 @@ function deserializeVecTSTypeParameter(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeTSTypeParameter(pos)); - pos += 80; + pos += 112; } return arr; } @@ -5285,7 +5470,7 @@ function deserializeVecTSInterfaceHeritage(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeTSInterfaceHeritage(pos)); - pos += 32; + pos += 48; } return arr; } @@ -5329,7 +5514,7 @@ function deserializeVecTSIndexSignatureName(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeTSIndexSignatureName(pos)); - pos += 32; + pos += 48; } return arr; } @@ -5371,10 +5556,15 @@ function deserializeU32(pos) { } function deserializeOptionNameSpan(pos) { - if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; + if (uint8[pos + 8] === 2) return null; return deserializeNameSpan(pos); } +function deserializeOptionArrayType(pos) { + if (uint8[pos] === 0) return null; + return deserializeArrayType(pos + 4); +} + function deserializeU64(pos) { const pos32 = pos >> 2; return uint32[pos32] + uint32[pos32 + 1] * 4294967296; @@ -5404,7 +5594,7 @@ function deserializeVecErrorLabel(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeErrorLabel(pos)); - pos += 24; + pos += 40; } return arr; } @@ -5416,7 +5606,7 @@ function deserializeVecStaticImport(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeStaticImport(pos)); - pos += 56; + pos += 88; } return arr; } @@ -5428,7 +5618,7 @@ function deserializeVecStaticExport(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeStaticExport(pos)); - pos += 32; + pos += 48; } return arr; } @@ -5440,7 +5630,7 @@ function deserializeVecDynamicImport(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeDynamicImport(pos)); - pos += 16; + pos += 48; } return arr; } @@ -5452,7 +5642,7 @@ function deserializeVecSpan(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeSpan(pos)); - pos += 8; + pos += 24; } return arr; } @@ -5464,7 +5654,7 @@ function deserializeVecImportEntry(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeImportEntry(pos)); - pos += 96; + pos += 160; } return arr; } @@ -5476,7 +5666,7 @@ function deserializeVecExportEntry(pos) { pos = uint32[pos32]; for (let i = 0; i < len; i++) { arr.push(deserializeExportEntry(pos)); - pos += 144; + pos += 240; } return arr; } diff --git a/napi/parser/src/generated/assert_layouts.rs b/napi/parser/src/generated/assert_layouts.rs index 09ef615c73394..85e4b0e77f689 100644 --- a/napi/parser/src/generated/assert_layouts.rs +++ b/napi/parser/src/generated/assert_layouts.rs @@ -10,12 +10,12 @@ use crate::raw_transfer_types::*; #[cfg(target_pointer_width = "64")] const _: () = { // Padding: 0 bytes - assert!(size_of::() == 280); + assert!(size_of::() == 312); assert!(align_of::() == 8); assert!(offset_of!(RawTransferData, program) == 0); - assert!(offset_of!(RawTransferData, comments) == 128); - assert!(offset_of!(RawTransferData, module) == 152); - assert!(offset_of!(RawTransferData, errors) == 256); + assert!(offset_of!(RawTransferData, comments) == 160); + assert!(offset_of!(RawTransferData, module) == 184); + assert!(offset_of!(RawTransferData, errors) == 288); // Padding: 7 bytes assert!(size_of::() == 80); @@ -30,9 +30,9 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 8); - assert!(offset_of!(ErrorLabel, message) == 8); + assert!(offset_of!(ErrorLabel, message) == 24); assert!(offset_of!(ErrorLabel, span) == 0); // Padding: 7 bytes @@ -45,28 +45,28 @@ const _: () = { assert!(offset_of!(EcmaScriptModule, import_metas) == 72); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(StaticImport, span) == 0); - assert!(offset_of!(StaticImport, module_request) == 8); - assert!(offset_of!(StaticImport, entries) == 32); + assert!(offset_of!(StaticImport, module_request) == 24); + assert!(offset_of!(StaticImport, entries) == 64); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(StaticExport, span) == 0); - assert!(offset_of!(StaticExport, entries) == 8); + assert!(offset_of!(StaticExport, entries) == 24); }; #[cfg(target_pointer_width = "32")] const _: () = { // Padding: 0 bytes - assert!(size_of::() == 188); + assert!(size_of::() == 220); assert!(align_of::() == 4); assert!(offset_of!(RawTransferData, program) == 0); - assert!(offset_of!(RawTransferData, comments) == 88); - assert!(offset_of!(RawTransferData, module) == 104); - assert!(offset_of!(RawTransferData, errors) == 172); + assert!(offset_of!(RawTransferData, comments) == 120); + assert!(offset_of!(RawTransferData, module) == 136); + assert!(offset_of!(RawTransferData, errors) == 204); // Padding: 3 bytes assert!(size_of::() == 44); @@ -81,9 +81,9 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(align_of::() == 4); - assert!(offset_of!(ErrorLabel, message) == 8); + assert!(offset_of!(ErrorLabel, message) == 24); assert!(offset_of!(ErrorLabel, span) == 0); // Padding: 3 bytes @@ -96,17 +96,17 @@ const _: () = { assert!(offset_of!(EcmaScriptModule, import_metas) == 48); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 72); assert!(align_of::() == 4); assert!(offset_of!(StaticImport, span) == 0); - assert!(offset_of!(StaticImport, module_request) == 8); - assert!(offset_of!(StaticImport, entries) == 24); + assert!(offset_of!(StaticImport, module_request) == 24); + assert!(offset_of!(StaticImport, entries) == 56); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(StaticExport, span) == 0); - assert!(offset_of!(StaticExport, entries) == 8); + assert!(offset_of!(StaticExport, entries) == 24); }; #[cfg(not(any(target_pointer_width = "64", target_pointer_width = "32")))] From 038d4aa9270ebeb61e52b02ac5f88978b807b5f0 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Wed, 18 Jun 2025 07:59:06 +0200 Subject: [PATCH 15/42] chore: 16 to 32 --- crates/oxc_ast/src/serialize/mod.rs | 5 ++--- crates/oxc_regular_expression/src/ast.rs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index b1b0c78187d10..f8259d6b77050 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -3,9 +3,8 @@ use std::cmp; use oxc_ast_macros::ast_meta; use oxc_estree::{ CompactFixesJSSerializer, CompactFixesTSSerializer, CompactJSSerializer, CompactTSSerializer, - Concat2, ConfigFixesJS, ConfigFixesTS, ESTree, JsonSafeString, - PrettyFixesJSSerializer, PrettyFixesTSSerializer, PrettyJSSerializer, PrettyTSSerializer, - Serializer, StructSerializer, + Concat2, ConfigFixesJS, ConfigFixesTS, ESTree, JsonSafeString, PrettyFixesJSSerializer, + PrettyFixesTSSerializer, PrettyJSSerializer, PrettyTSSerializer, Serializer, StructSerializer, }; use oxc_span::GetSpan; diff --git a/crates/oxc_regular_expression/src/ast.rs b/crates/oxc_regular_expression/src/ast.rs index af0a51e199618..0e09efdcfb1a8 100644 --- a/crates/oxc_regular_expression/src/ast.rs +++ b/crates/oxc_regular_expression/src/ast.rs @@ -332,6 +332,6 @@ pub struct NamedReference<'a> { fn size_asserts() { use std::mem::size_of; - assert!(size_of::() == 16); + assert!(size_of::() == 32); assert!(size_of::() == 16); } From 3b54cb1c61fa79c9c1d9468c35191bccabf659c6 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Wed, 18 Jun 2025 08:01:52 +0200 Subject: [PATCH 16/42] chore: unnecessary wrapping --- tasks/ast_tools/src/parse/parse.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/ast_tools/src/parse/parse.rs b/tasks/ast_tools/src/parse/parse.rs index d37184dcaaea6..02a53ceeec289 100644 --- a/tasks/ast_tools/src/parse/parse.rs +++ b/tasks/ast_tools/src/parse/parse.rs @@ -585,10 +585,10 @@ impl<'c> Parser<'c> { Some(self.type_id("&str")) } - fn parse_type_array(&mut self, _type_array: &TypeArray) -> Option { + fn parse_type_array(&mut self, _type_array: &TypeArray) -> TypeId { // For array types like [i32; 2], we'll create a special primitive type // The exact name doesn't matter since the field will be skipped in ESTree - Some(self.type_id("ArrayType")) + self.type_id("ArrayType") } /// Parse attributes on struct or enum with parsers provided by [`Derive`]s and [`Generator`]s. From 5d3177c1a6e75f307c68bb637431575e019c92fe Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Wed, 18 Jun 2025 08:02:13 +0200 Subject: [PATCH 17/42] chore: unnecessary wrapping --- tasks/ast_tools/src/parse/parse.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/ast_tools/src/parse/parse.rs b/tasks/ast_tools/src/parse/parse.rs index 02a53ceeec289..840c1198581aa 100644 --- a/tasks/ast_tools/src/parse/parse.rs +++ b/tasks/ast_tools/src/parse/parse.rs @@ -502,7 +502,7 @@ impl<'c> Parser<'c> { match ty { Type::Path(type_path) => self.parse_type_path(type_path), Type::Reference(type_ref) => self.parse_type_reference(type_ref), - Type::Array(type_array) => self.parse_type_array(type_array), + Type::Array(type_array) => Some(self.parse_type_array(type_array)), _ => None, } } From 307f59ada8cf902d5b0be16ef3030486a88eb658 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Wed, 18 Jun 2025 08:09:04 +0200 Subject: [PATCH 18/42] chore: last self review --- tasks/ast_tools/src/derives/estree.rs | 4 +--- tasks/ast_tools/src/parse/parse.rs | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index f8668b8947545..f23e849eea4bf 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -412,9 +412,7 @@ impl<'s> StructSerializerGenerator<'s> { fn generate_stmts_for_struct(&mut self, struct_def: &StructDef, self_path: &TokenStream) { for &field_index in &struct_def.estree.field_indices { let field_index = field_index as usize; - if field_index < struct_def.fields.len() { - // Real field - let field = &struct_def.fields[field_index]; + if let Some(field) = struct_def.fields.get(field_index) { self.generate_stmts_for_field(field, struct_def, self_path); } else { let (field_name, converter_name) = diff --git a/tasks/ast_tools/src/parse/parse.rs b/tasks/ast_tools/src/parse/parse.rs index 840c1198581aa..3036b635799cf 100644 --- a/tasks/ast_tools/src/parse/parse.rs +++ b/tasks/ast_tools/src/parse/parse.rs @@ -586,8 +586,6 @@ impl<'c> Parser<'c> { } fn parse_type_array(&mut self, _type_array: &TypeArray) -> TypeId { - // For array types like [i32; 2], we'll create a special primitive type - // The exact name doesn't matter since the field will be skipped in ESTree self.type_id("ArrayType") } From 1f1d625e806befc5092a0becb8273400064cac21 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Wed, 18 Jun 2025 08:15:14 +0200 Subject: [PATCH 19/42] chore: rename to range array --- napi/parser/generated/deserialize/js.js | 374 ++++++++--------- napi/parser/generated/deserialize/lazy.js | 384 +++++++++--------- napi/parser/generated/deserialize/ts.js | 374 ++++++++--------- .../src/generators/assert_layouts.rs | 2 +- .../ast_tools/src/generators/raw_transfer.rs | 3 +- .../src/generators/raw_transfer_lazy.rs | 2 +- tasks/ast_tools/src/generators/typescript.rs | 2 +- tasks/ast_tools/src/parse/parse.rs | 4 +- 8 files changed, 572 insertions(+), 573 deletions(-) diff --git a/napi/parser/generated/deserialize/js.js b/napi/parser/generated/deserialize/js.js index af7998dd539c9..4641d3f3404c1 100644 --- a/napi/parser/generated/deserialize/js.js +++ b/napi/parser/generated/deserialize/js.js @@ -57,7 +57,7 @@ function deserializeIdentifierName(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeStr(pos + 24), }; } @@ -67,7 +67,7 @@ function deserializeIdentifierReference(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeStr(pos + 24), }; } @@ -77,7 +77,7 @@ function deserializeBindingIdentifier(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeStr(pos + 24), }; } @@ -87,7 +87,7 @@ function deserializeLabelIdentifier(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeStr(pos + 24), }; } @@ -97,7 +97,7 @@ function deserializeThisExpression(pos) { type: 'ThisExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -106,7 +106,7 @@ function deserializeArrayExpression(pos) { type: 'ArrayExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), elements: deserializeVecArrayExpressionElement(pos + 24), }; } @@ -120,7 +120,7 @@ function deserializeObjectExpression(pos) { type: 'ObjectExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), properties: deserializeVecObjectPropertyKind(pos + 24), }; } @@ -130,7 +130,7 @@ function deserializeObjectProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), kind: deserializePropertyKind(pos + 56), key: deserializePropertyKey(pos + 24), value: deserializeExpression(pos + 40), @@ -145,7 +145,7 @@ function deserializeTemplateLiteral(pos) { type: 'TemplateLiteral', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), quasis: deserializeVecTemplateElement(pos + 24), expressions: deserializeVecExpression(pos + 48), }; @@ -156,7 +156,7 @@ function deserializeTaggedTemplateExpression(pos) { type: 'TaggedTemplateExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), tag: deserializeExpression(pos + 24), quasi: deserializeTemplateLiteral(pos + 48), }; @@ -186,7 +186,7 @@ function deserializeComputedMemberExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), object: deserializeExpression(pos + 24), property: deserializeExpression(pos + 40), optional: deserializeBool(pos + 56), @@ -199,7 +199,7 @@ function deserializeStaticMemberExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), object: deserializeExpression(pos + 24), property: deserializeIdentifierName(pos + 40), optional: deserializeBool(pos + 80), @@ -212,7 +212,7 @@ function deserializePrivateFieldExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), object: deserializeExpression(pos + 24), property: deserializePrivateIdentifier(pos + 40), optional: deserializeBool(pos + 80), @@ -225,7 +225,7 @@ function deserializeCallExpression(pos) { type: 'CallExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), callee: deserializeExpression(pos + 24), arguments: deserializeVecArgument(pos + 48), optional: deserializeBool(pos + 72), @@ -237,7 +237,7 @@ function deserializeNewExpression(pos) { type: 'NewExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), callee: deserializeExpression(pos + 24), arguments: deserializeVecArgument(pos + 48), }; @@ -248,7 +248,7 @@ function deserializeMetaProperty(pos) { type: 'MetaProperty', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), meta: deserializeIdentifierName(pos + 24), property: deserializeIdentifierName(pos + 64), }; @@ -259,7 +259,7 @@ function deserializeSpreadElement(pos) { type: 'SpreadElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), argument: deserializeExpression(pos + 24), }; } @@ -269,7 +269,7 @@ function deserializeUpdateExpression(pos) { type: 'UpdateExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), operator: deserializeUpdateOperator(pos + 40), prefix: deserializeBool(pos + 41), argument: deserializeSimpleAssignmentTarget(pos + 24), @@ -281,7 +281,7 @@ function deserializeUnaryExpression(pos) { type: 'UnaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), operator: deserializeUnaryOperator(pos + 40), argument: deserializeExpression(pos + 24), prefix: true, @@ -293,7 +293,7 @@ function deserializeBinaryExpression(pos) { type: 'BinaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), left: deserializeExpression(pos + 24), operator: deserializeBinaryOperator(pos + 56), right: deserializeExpression(pos + 40), @@ -305,7 +305,7 @@ function deserializePrivateInExpression(pos) { type: 'BinaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), left: deserializePrivateIdentifier(pos + 24), operator: 'in', right: deserializeExpression(pos + 64), @@ -317,7 +317,7 @@ function deserializeLogicalExpression(pos) { type: 'LogicalExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), left: deserializeExpression(pos + 24), operator: deserializeLogicalOperator(pos + 56), right: deserializeExpression(pos + 40), @@ -329,7 +329,7 @@ function deserializeConditionalExpression(pos) { type: 'ConditionalExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), test: deserializeExpression(pos + 24), consequent: deserializeExpression(pos + 40), alternate: deserializeExpression(pos + 56), @@ -341,7 +341,7 @@ function deserializeAssignmentExpression(pos) { type: 'AssignmentExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), operator: deserializeAssignmentOperator(pos + 56), left: deserializeAssignmentTarget(pos + 24), right: deserializeExpression(pos + 40), @@ -356,7 +356,7 @@ function deserializeArrayAssignmentTarget(pos) { type: 'ArrayPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), elements, }; } @@ -369,7 +369,7 @@ function deserializeObjectAssignmentTarget(pos) { type: 'ObjectPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), properties, }; } @@ -379,7 +379,7 @@ function deserializeAssignmentTargetRest(pos) { type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), argument: deserializeAssignmentTarget(pos + 24), }; } @@ -389,7 +389,7 @@ function deserializeAssignmentTargetWithDefault(pos) { type: 'AssignmentPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), left: deserializeAssignmentTarget(pos + 24), right: deserializeExpression(pos + 40), }; @@ -414,7 +414,7 @@ function deserializeAssignmentTargetPropertyIdentifier(pos) { type: 'Property', start, end, - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), kind: 'init', key, value, @@ -429,7 +429,7 @@ function deserializeAssignmentTargetPropertyProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), kind: 'init', key: deserializePropertyKey(pos + 24), value: deserializeAssignmentTargetMaybeDefault(pos + 40), @@ -444,7 +444,7 @@ function deserializeSequenceExpression(pos) { type: 'SequenceExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expressions: deserializeVecExpression(pos + 24), }; } @@ -454,7 +454,7 @@ function deserializeSuper(pos) { type: 'Super', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -463,7 +463,7 @@ function deserializeAwaitExpression(pos) { type: 'AwaitExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), argument: deserializeExpression(pos + 24), }; } @@ -473,7 +473,7 @@ function deserializeChainExpression(pos) { type: 'ChainExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeChainElement(pos + 24), }; } @@ -483,7 +483,7 @@ function deserializeParenthesizedExpression(pos) { type: 'ParenthesizedExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), }; } @@ -493,7 +493,7 @@ function deserializeDirective(pos) { type: 'ExpressionStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeStringLiteral(pos + 24), directive: deserializeStr(pos + 88), }; @@ -504,7 +504,7 @@ function deserializeHashbang(pos) { type: 'Hashbang', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value: deserializeStr(pos + 24), }; } @@ -514,7 +514,7 @@ function deserializeBlockStatement(pos) { type: 'BlockStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), body: deserializeVecStatement(pos + 24), }; } @@ -524,7 +524,7 @@ function deserializeVariableDeclaration(pos) { type: 'VariableDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), kind: deserializeVariableDeclarationKind(pos + 48), declarations: deserializeVecVariableDeclarator(pos + 24), }; @@ -535,7 +535,7 @@ function deserializeVariableDeclarator(pos) { type: 'VariableDeclarator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeBindingPattern(pos + 24), init: deserializeOptionExpression(pos + 56), }; @@ -546,7 +546,7 @@ function deserializeEmptyStatement(pos) { type: 'EmptyStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -555,7 +555,7 @@ function deserializeExpressionStatement(pos) { type: 'ExpressionStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), }; } @@ -565,7 +565,7 @@ function deserializeIfStatement(pos) { type: 'IfStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), test: deserializeExpression(pos + 24), consequent: deserializeStatement(pos + 40), alternate: deserializeOptionStatement(pos + 56), @@ -577,7 +577,7 @@ function deserializeDoWhileStatement(pos) { type: 'DoWhileStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), body: deserializeStatement(pos + 24), test: deserializeExpression(pos + 40), }; @@ -588,7 +588,7 @@ function deserializeWhileStatement(pos) { type: 'WhileStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), test: deserializeExpression(pos + 24), body: deserializeStatement(pos + 40), }; @@ -599,7 +599,7 @@ function deserializeForStatement(pos) { type: 'ForStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), init: deserializeOptionForStatementInit(pos + 24), test: deserializeOptionExpression(pos + 40), update: deserializeOptionExpression(pos + 56), @@ -612,7 +612,7 @@ function deserializeForInStatement(pos) { type: 'ForInStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), left: deserializeForStatementLeft(pos + 24), right: deserializeExpression(pos + 40), body: deserializeStatement(pos + 56), @@ -624,7 +624,7 @@ function deserializeForOfStatement(pos) { type: 'ForOfStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), await: deserializeBool(pos + 76), left: deserializeForStatementLeft(pos + 24), right: deserializeExpression(pos + 40), @@ -637,7 +637,7 @@ function deserializeContinueStatement(pos) { type: 'ContinueStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), label: deserializeOptionLabelIdentifier(pos + 24), }; } @@ -647,7 +647,7 @@ function deserializeBreakStatement(pos) { type: 'BreakStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), label: deserializeOptionLabelIdentifier(pos + 24), }; } @@ -657,7 +657,7 @@ function deserializeReturnStatement(pos) { type: 'ReturnStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), argument: deserializeOptionExpression(pos + 24), }; } @@ -667,7 +667,7 @@ function deserializeWithStatement(pos) { type: 'WithStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), object: deserializeExpression(pos + 24), body: deserializeStatement(pos + 40), }; @@ -678,7 +678,7 @@ function deserializeSwitchStatement(pos) { type: 'SwitchStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), discriminant: deserializeExpression(pos + 24), cases: deserializeVecSwitchCase(pos + 40), }; @@ -689,7 +689,7 @@ function deserializeSwitchCase(pos) { type: 'SwitchCase', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), test: deserializeOptionExpression(pos + 24), consequent: deserializeVecStatement(pos + 40), }; @@ -700,7 +700,7 @@ function deserializeLabeledStatement(pos) { type: 'LabeledStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), label: deserializeLabelIdentifier(pos + 24), body: deserializeStatement(pos + 64), }; @@ -711,7 +711,7 @@ function deserializeThrowStatement(pos) { type: 'ThrowStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), argument: deserializeExpression(pos + 24), }; } @@ -721,7 +721,7 @@ function deserializeTryStatement(pos) { type: 'TryStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), block: deserializeBoxBlockStatement(pos + 24), handler: deserializeOptionBoxCatchClause(pos + 32), finalizer: deserializeOptionBoxBlockStatement(pos + 40), @@ -733,7 +733,7 @@ function deserializeCatchClause(pos) { type: 'CatchClause', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), param: deserializeOptionCatchParameter(pos + 24), body: deserializeBoxBlockStatement(pos + 80), }; @@ -748,7 +748,7 @@ function deserializeDebuggerStatement(pos) { type: 'DebuggerStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -762,7 +762,7 @@ function deserializeAssignmentPattern(pos) { type: 'AssignmentPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), left: deserializeBindingPattern(pos + 24), right: deserializeExpression(pos + 56), }; @@ -776,7 +776,7 @@ function deserializeObjectPattern(pos) { type: 'ObjectPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), properties, }; } @@ -786,7 +786,7 @@ function deserializeBindingProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), kind: 'init', key: deserializePropertyKey(pos + 24), value: deserializeBindingPattern(pos + 40), @@ -804,7 +804,7 @@ function deserializeArrayPattern(pos) { type: 'ArrayPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), elements, }; } @@ -814,7 +814,7 @@ function deserializeBindingRestElement(pos) { type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), argument: deserializeBindingPattern(pos + 24), }; } @@ -825,7 +825,7 @@ function deserializeFunction(pos) { type: deserializeFunctionType(pos + 116), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeOptionBindingIdentifier(pos + 24), generator: deserializeBool(pos + 117), async: deserializeBool(pos + 118), @@ -860,7 +860,7 @@ function deserializeFunctionBody(pos) { type: 'BlockStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), body, }; } @@ -872,7 +872,7 @@ function deserializeArrowFunctionExpression(pos) { type: 'ArrowFunctionExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression, async: deserializeBool(pos + 61), params: deserializeBoxFormalParameters(pos + 32), @@ -887,7 +887,7 @@ function deserializeYieldExpression(pos) { type: 'YieldExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), delegate: deserializeBool(pos + 40), argument: deserializeOptionExpression(pos + 24), }; @@ -898,7 +898,7 @@ function deserializeClass(pos) { type: deserializeClassType(pos + 164), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: deserializeVecDecorator(pos + 24), id: deserializeOptionBindingIdentifier(pos + 48), superClass: deserializeOptionExpression(pos + 104), @@ -911,7 +911,7 @@ function deserializeClassBody(pos) { type: 'ClassBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), body: deserializeVecClassElement(pos + 24), }; } @@ -921,7 +921,7 @@ function deserializeMethodDefinition(pos) { type: deserializeMethodDefinitionType(pos + 72), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: deserializeVecDecorator(pos + 24), key: deserializePropertyKey(pos + 48), value: deserializeBoxFunction(pos + 64), @@ -936,7 +936,7 @@ function deserializePropertyDefinition(pos) { type: deserializePropertyDefinitionType(pos + 88), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: deserializeVecDecorator(pos + 24), key: deserializePropertyKey(pos + 48), value: deserializeOptionExpression(pos + 72), @@ -950,7 +950,7 @@ function deserializePrivateIdentifier(pos) { type: 'PrivateIdentifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeStr(pos + 24), }; } @@ -960,7 +960,7 @@ function deserializeStaticBlock(pos) { type: 'StaticBlock', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), body: deserializeVecStatement(pos + 24), }; } @@ -970,7 +970,7 @@ function deserializeAccessorProperty(pos) { type: deserializeAccessorPropertyType(pos + 88), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: deserializeVecDecorator(pos + 24), key: deserializePropertyKey(pos + 48), value: deserializeOptionExpression(pos + 72), @@ -984,7 +984,7 @@ function deserializeImportExpression(pos) { type: 'ImportExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), source: deserializeExpression(pos + 24), options: deserializeOptionExpression(pos + 40), phase: deserializeOptionImportPhase(pos + 56), @@ -999,7 +999,7 @@ function deserializeImportDeclaration(pos) { type: 'ImportDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), specifiers, source: deserializeStringLiteral(pos + 48), phase: deserializeOptionImportPhase(pos + 120), @@ -1012,7 +1012,7 @@ function deserializeImportSpecifier(pos) { type: 'ImportSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), imported: deserializeModuleExportName(pos + 24), local: deserializeBindingIdentifier(pos + 96), }; @@ -1023,7 +1023,7 @@ function deserializeImportDefaultSpecifier(pos) { type: 'ImportDefaultSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), local: deserializeBindingIdentifier(pos + 24), }; } @@ -1033,7 +1033,7 @@ function deserializeImportNamespaceSpecifier(pos) { type: 'ImportNamespaceSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), local: deserializeBindingIdentifier(pos + 24), }; } @@ -1049,7 +1049,7 @@ function deserializeImportAttribute(pos) { type: 'ImportAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), key: deserializeImportAttributeKey(pos + 24), value: deserializeStringLiteral(pos + 96), }; @@ -1061,7 +1061,7 @@ function deserializeExportNamedDeclaration(pos) { type: 'ExportNamedDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), declaration: deserializeOptionDeclaration(pos + 24), specifiers: deserializeVecExportSpecifier(pos + 40), source: deserializeOptionStringLiteral(pos + 64), @@ -1074,7 +1074,7 @@ function deserializeExportDefaultDeclaration(pos) { type: 'ExportDefaultDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), declaration: deserializeExportDefaultDeclarationKind(pos + 96), }; } @@ -1085,7 +1085,7 @@ function deserializeExportAllDeclaration(pos) { type: 'ExportAllDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), exported: deserializeOptionModuleExportName(pos + 24), source: deserializeStringLiteral(pos + 96), attributes: withClause === null ? [] : withClause.attributes, @@ -1097,7 +1097,7 @@ function deserializeExportSpecifier(pos) { type: 'ExportSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), local: deserializeModuleExportName(pos + 24), exported: deserializeModuleExportName(pos + 96), }; @@ -1108,7 +1108,7 @@ function deserializeV8IntrinsicExpression(pos) { type: 'V8IntrinsicExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeIdentifierName(pos + 24), arguments: deserializeVecArgument(pos + 64), }; @@ -1122,7 +1122,7 @@ function deserializeBooleanLiteral(pos) { type: 'Literal', start, end, - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value, raw: (start === 0 && end === 0) ? null : value + '', }; @@ -1135,7 +1135,7 @@ function deserializeNullLiteral(pos) { type: 'Literal', start, end, - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value: null, raw: (start === 0 && end === 0) ? null : 'null', }; @@ -1146,7 +1146,7 @@ function deserializeNumericLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value: deserializeF64(pos + 24), raw: deserializeOptionStr(pos + 32), }; @@ -1161,7 +1161,7 @@ function deserializeStringLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value, raw: deserializeOptionStr(pos + 40), }; @@ -1173,7 +1173,7 @@ function deserializeBigIntLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value: BigInt(bigint), raw: deserializeOptionStr(pos + 40), bigint, @@ -1190,7 +1190,7 @@ function deserializeRegExpLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value, raw: deserializeOptionStr(pos + 56), regex, @@ -1233,7 +1233,7 @@ function deserializeJSXElement(pos) { type: 'JSXElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), openingElement, children: deserializeVecJSXChild(pos + 32), closingElement, @@ -1245,7 +1245,7 @@ function deserializeJSXOpeningElement(pos) { type: 'JSXOpeningElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeJSXElementName(pos + 24), attributes: deserializeVecJSXAttributeItem(pos + 48), selfClosing: false, @@ -1257,7 +1257,7 @@ function deserializeJSXClosingElement(pos) { type: 'JSXClosingElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeJSXElementName(pos + 24), }; } @@ -1267,7 +1267,7 @@ function deserializeJSXFragment(pos) { type: 'JSXFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), openingFragment: deserializeJSXOpeningFragment(pos + 24), children: deserializeVecJSXChild(pos + 48), closingFragment: deserializeJSXClosingFragment(pos + 72), @@ -1279,7 +1279,7 @@ function deserializeJSXOpeningFragment(pos) { type: 'JSXOpeningFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), attributes: [], selfClosing: false, }; @@ -1290,7 +1290,7 @@ function deserializeJSXClosingFragment(pos) { type: 'JSXClosingFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1299,7 +1299,7 @@ function deserializeJSXNamespacedName(pos) { type: 'JSXNamespacedName', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), namespace: deserializeJSXIdentifier(pos + 24), name: deserializeJSXIdentifier(pos + 64), }; @@ -1310,7 +1310,7 @@ function deserializeJSXMemberExpression(pos) { type: 'JSXMemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), object: deserializeJSXMemberExpressionObject(pos + 24), property: deserializeJSXIdentifier(pos + 40), }; @@ -1321,7 +1321,7 @@ function deserializeJSXExpressionContainer(pos) { type: 'JSXExpressionContainer', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeJSXExpression(pos + 24), }; } @@ -1331,7 +1331,7 @@ function deserializeJSXEmptyExpression(pos) { type: 'JSXEmptyExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1340,7 +1340,7 @@ function deserializeJSXAttribute(pos) { type: 'JSXAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeJSXAttributeName(pos + 24), value: deserializeOptionJSXAttributeValue(pos + 40), }; @@ -1351,7 +1351,7 @@ function deserializeJSXSpreadAttribute(pos) { type: 'JSXSpreadAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), argument: deserializeExpression(pos + 24), }; } @@ -1361,7 +1361,7 @@ function deserializeJSXIdentifier(pos) { type: 'JSXIdentifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeStr(pos + 24), }; } @@ -1371,7 +1371,7 @@ function deserializeJSXSpreadChild(pos) { type: 'JSXSpreadChild', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), }; } @@ -1381,7 +1381,7 @@ function deserializeJSXText(pos) { type: 'JSXText', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value: deserializeStr(pos + 24), raw: deserializeOptionStr(pos + 40), }; @@ -1392,7 +1392,7 @@ function deserializeTSThisParameter(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], name: 'this', optional: false, @@ -1405,7 +1405,7 @@ function deserializeTSEnumDeclaration(pos) { type: 'TSEnumDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeBindingIdentifier(pos + 24), body: deserializeTSEnumBody(pos + 72), const: deserializeBool(pos + 124), @@ -1418,7 +1418,7 @@ function deserializeTSEnumBody(pos) { type: 'TSEnumBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), members: deserializeVecTSEnumMember(pos + 24), }; } @@ -1428,7 +1428,7 @@ function deserializeTSEnumMember(pos) { type: 'TSEnumMember', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeTSEnumMemberName(pos + 24), initializer: deserializeOptionExpression(pos + 40), computed: deserializeU8(pos + 24) > 1, @@ -1440,7 +1440,7 @@ function deserializeTSTypeAnnotation(pos) { type: 'TSTypeAnnotation', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1450,7 +1450,7 @@ function deserializeTSLiteralType(pos) { type: 'TSLiteralType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), literal: deserializeTSLiteral(pos + 24), }; } @@ -1460,7 +1460,7 @@ function deserializeTSConditionalType(pos) { type: 'TSConditionalType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), checkType: deserializeTSType(pos + 24), extendsType: deserializeTSType(pos + 40), trueType: deserializeTSType(pos + 56), @@ -1473,7 +1473,7 @@ function deserializeTSUnionType(pos) { type: 'TSUnionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), types: deserializeVecTSType(pos + 24), }; } @@ -1483,7 +1483,7 @@ function deserializeTSIntersectionType(pos) { type: 'TSIntersectionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), types: deserializeVecTSType(pos + 24), }; } @@ -1493,7 +1493,7 @@ function deserializeTSParenthesizedType(pos) { type: 'TSParenthesizedType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1503,7 +1503,7 @@ function deserializeTSTypeOperator(pos) { type: 'TSTypeOperator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), operator: deserializeTSTypeOperatorOperator(pos + 40), typeAnnotation: deserializeTSType(pos + 24), }; @@ -1514,7 +1514,7 @@ function deserializeTSArrayType(pos) { type: 'TSArrayType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), elementType: deserializeTSType(pos + 24), }; } @@ -1524,7 +1524,7 @@ function deserializeTSIndexedAccessType(pos) { type: 'TSIndexedAccessType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), objectType: deserializeTSType(pos + 24), indexType: deserializeTSType(pos + 40), }; @@ -1535,7 +1535,7 @@ function deserializeTSTupleType(pos) { type: 'TSTupleType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), elementTypes: deserializeVecTSTupleElement(pos + 24), }; } @@ -1545,7 +1545,7 @@ function deserializeTSNamedTupleMember(pos) { type: 'TSNamedTupleMember', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), label: deserializeIdentifierName(pos + 24), elementType: deserializeTSTupleElement(pos + 64), optional: deserializeBool(pos + 80), @@ -1557,7 +1557,7 @@ function deserializeTSOptionalType(pos) { type: 'TSOptionalType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1567,7 +1567,7 @@ function deserializeTSRestType(pos) { type: 'TSRestType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1577,7 +1577,7 @@ function deserializeTSAnyKeyword(pos) { type: 'TSAnyKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1586,7 +1586,7 @@ function deserializeTSStringKeyword(pos) { type: 'TSStringKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1595,7 +1595,7 @@ function deserializeTSBooleanKeyword(pos) { type: 'TSBooleanKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1604,7 +1604,7 @@ function deserializeTSNumberKeyword(pos) { type: 'TSNumberKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1613,7 +1613,7 @@ function deserializeTSNeverKeyword(pos) { type: 'TSNeverKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1622,7 +1622,7 @@ function deserializeTSIntrinsicKeyword(pos) { type: 'TSIntrinsicKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1631,7 +1631,7 @@ function deserializeTSUnknownKeyword(pos) { type: 'TSUnknownKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1640,7 +1640,7 @@ function deserializeTSNullKeyword(pos) { type: 'TSNullKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1649,7 +1649,7 @@ function deserializeTSUndefinedKeyword(pos) { type: 'TSUndefinedKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1658,7 +1658,7 @@ function deserializeTSVoidKeyword(pos) { type: 'TSVoidKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1667,7 +1667,7 @@ function deserializeTSSymbolKeyword(pos) { type: 'TSSymbolKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1676,7 +1676,7 @@ function deserializeTSThisType(pos) { type: 'TSThisType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1685,7 +1685,7 @@ function deserializeTSObjectKeyword(pos) { type: 'TSObjectKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1694,7 +1694,7 @@ function deserializeTSBigIntKeyword(pos) { type: 'TSBigIntKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1703,7 +1703,7 @@ function deserializeTSTypeReference(pos) { type: 'TSTypeReference', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeName: deserializeTSTypeName(pos + 24), typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; @@ -1714,7 +1714,7 @@ function deserializeTSQualifiedName(pos) { type: 'TSQualifiedName', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), left: deserializeTSTypeName(pos + 24), right: deserializeIdentifierName(pos + 40), }; @@ -1725,7 +1725,7 @@ function deserializeTSTypeParameterInstantiation(pos) { type: 'TSTypeParameterInstantiation', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), params: deserializeVecTSType(pos + 24), }; } @@ -1735,7 +1735,7 @@ function deserializeTSTypeParameter(pos) { type: 'TSTypeParameter', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeBindingIdentifier(pos + 24), constraint: deserializeOptionTSType(pos + 72), default: deserializeOptionTSType(pos + 88), @@ -1750,7 +1750,7 @@ function deserializeTSTypeParameterDeclaration(pos) { type: 'TSTypeParameterDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), params: deserializeVecTSTypeParameter(pos + 24), }; } @@ -1760,7 +1760,7 @@ function deserializeTSTypeAliasDeclaration(pos) { type: 'TSTypeAliasDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeBindingIdentifier(pos + 24), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), typeAnnotation: deserializeTSType(pos + 80), @@ -1798,7 +1798,7 @@ function deserializeTSClassImplements(pos) { type: 'TSClassImplements', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression, typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; @@ -1809,7 +1809,7 @@ function deserializeTSInterfaceDeclaration(pos) { type: 'TSInterfaceDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeBindingIdentifier(pos + 24), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), extends: deserializeVecTSInterfaceHeritage(pos + 80), @@ -1823,7 +1823,7 @@ function deserializeTSInterfaceBody(pos) { type: 'TSInterfaceBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), body: deserializeVecTSSignature(pos + 24), }; } @@ -1833,7 +1833,7 @@ function deserializeTSPropertySignature(pos) { type: 'TSPropertySignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), computed: deserializeBool(pos + 48), optional: deserializeBool(pos + 49), readonly: deserializeBool(pos + 50), @@ -1849,7 +1849,7 @@ function deserializeTSIndexSignature(pos) { type: 'TSIndexSignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), parameters: deserializeVecTSIndexSignatureName(pos + 24), typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 48), readonly: deserializeBool(pos + 56), @@ -1866,7 +1866,7 @@ function deserializeTSCallSignatureDeclaration(pos) { type: 'TSCallSignatureDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), params, returnType: deserializeOptionBoxTSTypeAnnotation(pos + 48), @@ -1881,7 +1881,7 @@ function deserializeTSMethodSignature(pos) { type: 'TSMethodSignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), key: deserializePropertyKey(pos + 24), computed: deserializeBool(pos + 76), optional: deserializeBool(pos + 77), @@ -1900,7 +1900,7 @@ function deserializeTSConstructSignatureDeclaration(pos) { type: 'TSConstructSignatureDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), params: deserializeBoxFormalParameters(pos + 32), returnType: deserializeOptionBoxTSTypeAnnotation(pos + 40), @@ -1912,7 +1912,7 @@ function deserializeTSIndexSignatureName(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], name: deserializeStr(pos + 24), optional: false, @@ -1925,7 +1925,7 @@ function deserializeTSInterfaceHeritage(pos) { type: 'TSInterfaceHeritage', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; @@ -1936,7 +1936,7 @@ function deserializeTSTypePredicate(pos) { type: 'TSTypePredicate', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), parameterName: deserializeTSTypePredicateName(pos + 24), asserts: deserializeBool(pos + 64), typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 56), @@ -1997,7 +1997,7 @@ function deserializeTSModuleBlock(pos) { type: 'TSModuleBlock', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), body, }; } @@ -2007,7 +2007,7 @@ function deserializeTSTypeLiteral(pos) { type: 'TSTypeLiteral', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), members: deserializeVecTSSignature(pos + 24), }; } @@ -2017,7 +2017,7 @@ function deserializeTSInferType(pos) { type: 'TSInferType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeParameter: deserializeBoxTSTypeParameter(pos + 24), }; } @@ -2027,7 +2027,7 @@ function deserializeTSTypeQuery(pos) { type: 'TSTypeQuery', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), exprName: deserializeTSTypeQueryExprName(pos + 24), typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; @@ -2038,7 +2038,7 @@ function deserializeTSImportType(pos) { type: 'TSImportType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), argument: deserializeTSType(pos + 24), options: deserializeOptionBoxObjectExpression(pos + 40), qualifier: deserializeOptionTSTypeName(pos + 48), @@ -2054,7 +2054,7 @@ function deserializeTSFunctionType(pos) { type: 'TSFunctionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), params, returnType: deserializeBoxTSTypeAnnotation(pos + 48), @@ -2066,7 +2066,7 @@ function deserializeTSConstructorType(pos) { type: 'TSConstructorType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), abstract: deserializeBool(pos + 48), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), params: deserializeBoxFormalParameters(pos + 32), @@ -2082,7 +2082,7 @@ function deserializeTSMappedType(pos) { type: 'TSMappedType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), key: typeParameter.name, constraint: typeParameter.constraint, nameType: deserializeOptionTSType(pos + 32), @@ -2097,7 +2097,7 @@ function deserializeTSTemplateLiteralType(pos) { type: 'TSTemplateLiteralType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), quasis: deserializeVecTemplateElement(pos + 24), types: deserializeVecTSType(pos + 48), }; @@ -2108,7 +2108,7 @@ function deserializeTSAsExpression(pos) { type: 'TSAsExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), typeAnnotation: deserializeTSType(pos + 40), }; @@ -2119,7 +2119,7 @@ function deserializeTSSatisfiesExpression(pos) { type: 'TSSatisfiesExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), typeAnnotation: deserializeTSType(pos + 40), }; @@ -2130,7 +2130,7 @@ function deserializeTSTypeAssertion(pos) { type: 'TSTypeAssertion', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeAnnotation: deserializeTSType(pos + 24), expression: deserializeExpression(pos + 40), }; @@ -2141,7 +2141,7 @@ function deserializeTSImportEqualsDeclaration(pos) { type: 'TSImportEqualsDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeBindingIdentifier(pos + 24), moduleReference: deserializeTSModuleReference(pos + 72), importKind: deserializeImportOrExportKind(pos + 88), @@ -2153,7 +2153,7 @@ function deserializeTSExternalModuleReference(pos) { type: 'TSExternalModuleReference', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeStringLiteral(pos + 24), }; } @@ -2163,7 +2163,7 @@ function deserializeTSNonNullExpression(pos) { type: 'TSNonNullExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), }; } @@ -2173,7 +2173,7 @@ function deserializeDecorator(pos) { type: 'Decorator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), }; } @@ -2183,7 +2183,7 @@ function deserializeTSExportAssignment(pos) { type: 'TSExportAssignment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), }; } @@ -2193,7 +2193,7 @@ function deserializeTSNamespaceExportDeclaration(pos) { type: 'TSNamespaceExportDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeIdentifierName(pos + 24), }; } @@ -2203,7 +2203,7 @@ function deserializeTSInstantiationExpression(pos) { type: 'TSInstantiationExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), typeArguments: deserializeBoxTSTypeParameterInstantiation(pos + 40), }; @@ -2214,7 +2214,7 @@ function deserializeJSDocNullableType(pos) { type: 'TSJSDocNullableType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeAnnotation: deserializeTSType(pos + 24), postfix: deserializeBool(pos + 40), }; @@ -2225,7 +2225,7 @@ function deserializeJSDocNonNullableType(pos) { type: 'TSJSDocNonNullableType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeAnnotation: deserializeTSType(pos + 24), postfix: deserializeBool(pos + 40), }; @@ -2236,7 +2236,7 @@ function deserializeJSDocUnknownType(pos) { type: 'TSJSDocUnknownType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -2250,7 +2250,7 @@ function deserializeComment(pos) { value: sourceText.slice(start + 2, end - endCut), start, end, - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -2259,7 +2259,7 @@ function deserializeNameSpan(pos) { value: deserializeStr(pos + 24), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -2275,7 +2275,7 @@ function deserializeExportEntry(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), moduleRequest: deserializeOptionNameSpan(pos + 48), importName: deserializeExportImportName(pos + 88), exportName: deserializeExportExportName(pos + 136), @@ -2288,7 +2288,7 @@ function deserializeDynamicImport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), moduleRequest: deserializeSpan(pos + 24), }; } @@ -2297,7 +2297,7 @@ function deserializeSpan(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -2331,7 +2331,7 @@ function deserializeErrorLabel(pos) { message: deserializeOptionStr(pos + 24), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -2349,7 +2349,7 @@ function deserializeStaticImport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), moduleRequest: deserializeNameSpan(pos + 24), entries: deserializeVecImportEntry(pos + 64), }; @@ -2359,7 +2359,7 @@ function deserializeStaticExport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), entries: deserializeVecExportEntry(pos + 24), }; } @@ -5429,9 +5429,9 @@ function deserializeOptionNameSpan(pos) { return deserializeNameSpan(pos); } -function deserializeOptionArrayType(pos) { +function deserializeOptionRangeArray(pos) { if (uint8[pos] === 0) return null; - return deserializeArrayType(pos + 4); + return deserializeRangeArray(pos + 4); } function deserializeU64(pos) { diff --git a/napi/parser/generated/deserialize/lazy.js b/napi/parser/generated/deserialize/lazy.js index 763d964204742..548d3427b4b2c 100644 --- a/napi/parser/generated/deserialize/lazy.js +++ b/napi/parser/generated/deserialize/lazy.js @@ -47,7 +47,7 @@ class Program { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get sourceType() { @@ -206,7 +206,7 @@ class IdentifierName { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get name() { @@ -260,7 +260,7 @@ class IdentifierReference { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get name() { @@ -314,7 +314,7 @@ class BindingIdentifier { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get name() { @@ -368,7 +368,7 @@ class LabelIdentifier { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get name() { @@ -422,7 +422,7 @@ class ThisExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -468,7 +468,7 @@ class ArrayExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get elements() { @@ -619,7 +619,7 @@ class Elision { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -665,7 +665,7 @@ class ObjectExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get properties() { @@ -730,7 +730,7 @@ class ObjectProperty { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get kind() { @@ -922,7 +922,7 @@ class TemplateLiteral { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get quasis() { @@ -984,7 +984,7 @@ class TaggedTemplateExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get tag() { @@ -1048,7 +1048,7 @@ class TemplateElement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get value() { @@ -1161,7 +1161,7 @@ class ComputedMemberExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get object() { @@ -1225,7 +1225,7 @@ class StaticMemberExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get object() { @@ -1289,7 +1289,7 @@ class PrivateFieldExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get object() { @@ -1353,7 +1353,7 @@ class CallExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get callee() { @@ -1425,7 +1425,7 @@ class NewExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get callee() { @@ -1491,7 +1491,7 @@ class MetaProperty { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get meta() { @@ -1549,7 +1549,7 @@ class SpreadElement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get argument() { @@ -1696,7 +1696,7 @@ class UpdateExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get operator() { @@ -1760,7 +1760,7 @@ class UnaryExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get operator() { @@ -1818,7 +1818,7 @@ class BinaryExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get left() { @@ -1882,7 +1882,7 @@ class PrivateInExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get left() { @@ -1940,7 +1940,7 @@ class LogicalExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get left() { @@ -2004,7 +2004,7 @@ class ConditionalExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get test() { @@ -2068,7 +2068,7 @@ class AssignmentExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get operator() { @@ -2193,7 +2193,7 @@ class ArrayAssignmentTarget { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get elements() { @@ -2247,7 +2247,7 @@ class ObjectAssignmentTarget { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get properties() { @@ -2301,7 +2301,7 @@ class AssignmentTargetRest { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get argument() { @@ -2382,7 +2382,7 @@ class AssignmentTargetWithDefault { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get left() { @@ -2451,7 +2451,7 @@ class AssignmentTargetPropertyIdentifier { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get key() { @@ -2509,7 +2509,7 @@ class AssignmentTargetPropertyProperty { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get key() { @@ -2573,7 +2573,7 @@ class SequenceExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expressions() { @@ -2627,7 +2627,7 @@ class Super { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -2673,7 +2673,7 @@ class AwaitExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get argument() { @@ -2725,7 +2725,7 @@ class ChainExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -2794,7 +2794,7 @@ class ParenthesizedExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -2917,7 +2917,7 @@ class Directive { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -2977,7 +2977,7 @@ class Hashbang { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get value() { @@ -3031,7 +3031,7 @@ class BlockStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get body() { @@ -3108,7 +3108,7 @@ class VariableDeclaration { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get kind() { @@ -3191,7 +3191,7 @@ class VariableDeclarator { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get id() { @@ -3255,7 +3255,7 @@ class EmptyStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -3301,7 +3301,7 @@ class ExpressionStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -3353,7 +3353,7 @@ class IfStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get test() { @@ -3417,7 +3417,7 @@ class DoWhileStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get body() { @@ -3475,7 +3475,7 @@ class WhileStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get test() { @@ -3533,7 +3533,7 @@ class ForStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get init() { @@ -3698,7 +3698,7 @@ class ForInStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get left() { @@ -3791,7 +3791,7 @@ class ForOfStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get await() { @@ -3861,7 +3861,7 @@ class ContinueStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get label() { @@ -3913,7 +3913,7 @@ class BreakStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get label() { @@ -3965,7 +3965,7 @@ class ReturnStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get argument() { @@ -4017,7 +4017,7 @@ class WithStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get object() { @@ -4075,7 +4075,7 @@ class SwitchStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get discriminant() { @@ -4135,7 +4135,7 @@ class SwitchCase { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get test() { @@ -4195,7 +4195,7 @@ class LabeledStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get label() { @@ -4253,7 +4253,7 @@ class ThrowStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get argument() { @@ -4305,7 +4305,7 @@ class TryStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get block() { @@ -4369,7 +4369,7 @@ class CatchClause { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get param() { @@ -4459,7 +4459,7 @@ class DebuggerStatement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -4564,7 +4564,7 @@ class AssignmentPattern { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get left() { @@ -4622,7 +4622,7 @@ class ObjectPattern { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get properties() { @@ -4676,7 +4676,7 @@ class BindingProperty { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get key() { @@ -4746,7 +4746,7 @@ class ArrayPattern { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get elements() { @@ -4800,7 +4800,7 @@ class BindingRestElement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get argument() { @@ -4851,7 +4851,7 @@ class Function { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get type() { @@ -4965,7 +4965,7 @@ class FormalParameters { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get kind() { @@ -5080,7 +5080,7 @@ class FunctionBody { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get body() { @@ -5134,7 +5134,7 @@ class ArrowFunctionExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -5216,7 +5216,7 @@ class YieldExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get delegate() { @@ -5273,7 +5273,7 @@ class Class { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get type() { @@ -5393,7 +5393,7 @@ class ClassBody { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get body() { @@ -5463,7 +5463,7 @@ class MethodDefinition { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get type() { @@ -5580,7 +5580,7 @@ class PropertyDefinition { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get type() { @@ -5731,7 +5731,7 @@ class PrivateIdentifier { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get name() { @@ -5785,7 +5785,7 @@ class StaticBlock { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get body() { @@ -5868,7 +5868,7 @@ class AccessorProperty { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get type() { @@ -5975,7 +5975,7 @@ class ImportExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get source() { @@ -6039,7 +6039,7 @@ class ImportDeclaration { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get specifiers() { @@ -6141,7 +6141,7 @@ class ImportSpecifier { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get imported() { @@ -6205,7 +6205,7 @@ class ImportDefaultSpecifier { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get local() { @@ -6257,7 +6257,7 @@ class ImportNamespaceSpecifier { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get local() { @@ -6343,7 +6343,7 @@ class ImportAttribute { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get key() { @@ -6412,7 +6412,7 @@ class ExportNamedDeclaration { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get declaration() { @@ -6490,7 +6490,7 @@ class ExportDefaultDeclaration { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get declaration() { @@ -6542,7 +6542,7 @@ class ExportAllDeclaration { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get exported() { @@ -6612,7 +6612,7 @@ class ExportSpecifier { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get local() { @@ -6788,7 +6788,7 @@ class V8IntrinsicExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get name() { @@ -6848,7 +6848,7 @@ class BooleanLiteral { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get value() { @@ -6900,7 +6900,7 @@ class NullLiteral { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -6946,7 +6946,7 @@ class NumericLiteral { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get value() { @@ -7006,7 +7006,7 @@ class StringLiteral { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get value() { @@ -7068,7 +7068,7 @@ class BigIntLiteral { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get value() { @@ -7130,7 +7130,7 @@ class RegExpLiteral { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get regex() { @@ -7296,7 +7296,7 @@ class JSXElement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get openingElement() { @@ -7362,7 +7362,7 @@ class JSXOpeningElement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get name() { @@ -7428,7 +7428,7 @@ class JSXClosingElement { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get name() { @@ -7480,7 +7480,7 @@ class JSXFragment { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get openingFragment() { @@ -7546,7 +7546,7 @@ class JSXOpeningFragment { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -7592,7 +7592,7 @@ class JSXClosingFragment { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -7655,7 +7655,7 @@ class JSXNamespacedName { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get namespace() { @@ -7713,7 +7713,7 @@ class JSXMemberExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get object() { @@ -7784,7 +7784,7 @@ class JSXExpressionContainer { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -7931,7 +7931,7 @@ class JSXEmptyExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -7988,7 +7988,7 @@ class JSXAttribute { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get name() { @@ -8046,7 +8046,7 @@ class JSXSpreadAttribute { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get argument() { @@ -8124,7 +8124,7 @@ class JSXIdentifier { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get name() { @@ -8195,7 +8195,7 @@ class JSXSpreadChild { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -8247,7 +8247,7 @@ class JSXText { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get value() { @@ -8309,7 +8309,7 @@ class TSThisParameter { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get typeAnnotation() { @@ -8361,7 +8361,7 @@ class TSEnumDeclaration { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get id() { @@ -8431,7 +8431,7 @@ class TSEnumBody { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get members() { @@ -8485,7 +8485,7 @@ class TSEnumMember { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get id() { @@ -8558,7 +8558,7 @@ class TSTypeAnnotation { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get typeAnnotation() { @@ -8610,7 +8610,7 @@ class TSLiteralType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get literal() { @@ -8762,7 +8762,7 @@ class TSConditionalType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get checkType() { @@ -8832,7 +8832,7 @@ class TSUnionType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get types() { @@ -8886,7 +8886,7 @@ class TSIntersectionType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get types() { @@ -8940,7 +8940,7 @@ class TSParenthesizedType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get typeAnnotation() { @@ -8992,7 +8992,7 @@ class TSTypeOperator { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get operator() { @@ -9063,7 +9063,7 @@ class TSArrayType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get elementType() { @@ -9115,7 +9115,7 @@ class TSIndexedAccessType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get objectType() { @@ -9173,7 +9173,7 @@ class TSTupleType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get elementTypes() { @@ -9227,7 +9227,7 @@ class TSNamedTupleMember { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get label() { @@ -9291,7 +9291,7 @@ class TSOptionalType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get typeAnnotation() { @@ -9343,7 +9343,7 @@ class TSRestType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get typeAnnotation() { @@ -9480,7 +9480,7 @@ class TSAnyKeyword { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -9526,7 +9526,7 @@ class TSStringKeyword { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -9572,7 +9572,7 @@ class TSBooleanKeyword { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -9618,7 +9618,7 @@ class TSNumberKeyword { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -9664,7 +9664,7 @@ class TSNeverKeyword { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -9710,7 +9710,7 @@ class TSIntrinsicKeyword { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -9756,7 +9756,7 @@ class TSUnknownKeyword { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -9802,7 +9802,7 @@ class TSNullKeyword { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -9848,7 +9848,7 @@ class TSUndefinedKeyword { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -9894,7 +9894,7 @@ class TSVoidKeyword { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -9940,7 +9940,7 @@ class TSSymbolKeyword { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -9986,7 +9986,7 @@ class TSThisType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -10032,7 +10032,7 @@ class TSObjectKeyword { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -10078,7 +10078,7 @@ class TSBigIntKeyword { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -10124,7 +10124,7 @@ class TSTypeReference { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get typeName() { @@ -10193,7 +10193,7 @@ class TSQualifiedName { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get left() { @@ -10251,7 +10251,7 @@ class TSTypeParameterInstantiation { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get params() { @@ -10305,7 +10305,7 @@ class TSTypeParameter { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get name() { @@ -10387,7 +10387,7 @@ class TSTypeParameterDeclaration { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get params() { @@ -10441,7 +10441,7 @@ class TSTypeAliasDeclaration { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get id() { @@ -10524,7 +10524,7 @@ class TSClassImplements { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -10582,7 +10582,7 @@ class TSInterfaceDeclaration { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get id() { @@ -10660,7 +10660,7 @@ class TSInterfaceBody { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get body() { @@ -10714,7 +10714,7 @@ class TSPropertySignature { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get computed() { @@ -10807,7 +10807,7 @@ class TSIndexSignature { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get parameters() { @@ -10879,7 +10879,7 @@ class TSCallSignatureDeclaration { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get typeParameters() { @@ -10956,7 +10956,7 @@ class TSMethodSignature { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get key() { @@ -11044,7 +11044,7 @@ class TSConstructSignatureDeclaration { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get typeParameters() { @@ -11108,7 +11108,7 @@ class TSIndexSignatureName { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get name() { @@ -11168,7 +11168,7 @@ class TSInterfaceHeritage { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -11226,7 +11226,7 @@ class TSTypePredicate { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get parameterName() { @@ -11301,7 +11301,7 @@ class TSModuleDeclaration { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get id() { @@ -11406,7 +11406,7 @@ class TSModuleBlock { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get body() { @@ -11460,7 +11460,7 @@ class TSTypeLiteral { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get members() { @@ -11514,7 +11514,7 @@ class TSInferType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get typeParameter() { @@ -11566,7 +11566,7 @@ class TSTypeQuery { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get exprName() { @@ -11637,7 +11637,7 @@ class TSImportType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get argument() { @@ -11707,7 +11707,7 @@ class TSFunctionType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get typeParameters() { @@ -11771,7 +11771,7 @@ class TSConstructorType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get abstract() { @@ -11841,7 +11841,7 @@ class TSMappedType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get nameType() { @@ -11924,7 +11924,7 @@ class TSTemplateLiteralType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get quasis() { @@ -11986,7 +11986,7 @@ class TSAsExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -12044,7 +12044,7 @@ class TSSatisfiesExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -12102,7 +12102,7 @@ class TSTypeAssertion { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get typeAnnotation() { @@ -12160,7 +12160,7 @@ class TSImportEqualsDeclaration { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get id() { @@ -12237,7 +12237,7 @@ class TSExternalModuleReference { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -12289,7 +12289,7 @@ class TSNonNullExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -12341,7 +12341,7 @@ class Decorator { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -12393,7 +12393,7 @@ class TSExportAssignment { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -12445,7 +12445,7 @@ class TSNamespaceExportDeclaration { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get id() { @@ -12497,7 +12497,7 @@ class TSInstantiationExpression { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get expression() { @@ -12566,7 +12566,7 @@ class JSDocNullableType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get typeAnnotation() { @@ -12624,7 +12624,7 @@ class JSDocNonNullableType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get typeAnnotation() { @@ -12682,7 +12682,7 @@ class JSDocUnknownType { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -12738,7 +12738,7 @@ class Comment { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get type() { @@ -12795,7 +12795,7 @@ class NameSpan { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -12897,7 +12897,7 @@ class ExportEntry { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get moduleRequest() { @@ -13012,7 +13012,7 @@ class DynamicImport { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get moduleRequest() { @@ -13197,7 +13197,7 @@ class Span { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -13423,7 +13423,7 @@ class ErrorLabel { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } toJSON() { @@ -13539,7 +13539,7 @@ class StaticImport { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get moduleRequest() { @@ -13597,7 +13597,7 @@ class StaticExport { get range() { const internal = this.#internal; - return constructOptionArrayType(internal.pos + 8, internal.ast); + return constructOptionRangeArray(internal.pos + 8, internal.ast); } get entries() { @@ -14908,9 +14908,9 @@ function constructOptionNameSpan(pos, ast) { return new NameSpan(pos, ast); } -function constructOptionArrayType(pos, ast) { +function constructOptionRangeArray(pos, ast) { if (ast.buffer[pos] === 0) return null; - return constructArrayType(pos + 4, ast); + return constructRangeArray(pos + 4, ast); } function constructU64(pos, ast) { diff --git a/napi/parser/generated/deserialize/ts.js b/napi/parser/generated/deserialize/ts.js index 9413048992d77..ebf6571914c05 100644 --- a/napi/parser/generated/deserialize/ts.js +++ b/napi/parser/generated/deserialize/ts.js @@ -73,7 +73,7 @@ function deserializeIdentifierName(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], name: deserializeStr(pos + 24), optional: false, @@ -86,7 +86,7 @@ function deserializeIdentifierReference(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], name: deserializeStr(pos + 24), optional: false, @@ -99,7 +99,7 @@ function deserializeBindingIdentifier(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], name: deserializeStr(pos + 24), optional: false, @@ -112,7 +112,7 @@ function deserializeLabelIdentifier(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], name: deserializeStr(pos + 24), optional: false, @@ -125,7 +125,7 @@ function deserializeThisExpression(pos) { type: 'ThisExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -134,7 +134,7 @@ function deserializeArrayExpression(pos) { type: 'ArrayExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), elements: deserializeVecArrayExpressionElement(pos + 24), }; } @@ -148,7 +148,7 @@ function deserializeObjectExpression(pos) { type: 'ObjectExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), properties: deserializeVecObjectPropertyKind(pos + 24), }; } @@ -158,7 +158,7 @@ function deserializeObjectProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), kind: deserializePropertyKind(pos + 56), key: deserializePropertyKey(pos + 24), value: deserializeExpression(pos + 40), @@ -174,7 +174,7 @@ function deserializeTemplateLiteral(pos) { type: 'TemplateLiteral', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), quasis: deserializeVecTemplateElement(pos + 24), expressions: deserializeVecExpression(pos + 48), }; @@ -185,7 +185,7 @@ function deserializeTaggedTemplateExpression(pos) { type: 'TaggedTemplateExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), tag: deserializeExpression(pos + 24), typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), quasi: deserializeTemplateLiteral(pos + 48), @@ -216,7 +216,7 @@ function deserializeComputedMemberExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), object: deserializeExpression(pos + 24), property: deserializeExpression(pos + 40), optional: deserializeBool(pos + 56), @@ -229,7 +229,7 @@ function deserializeStaticMemberExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), object: deserializeExpression(pos + 24), property: deserializeIdentifierName(pos + 40), optional: deserializeBool(pos + 80), @@ -242,7 +242,7 @@ function deserializePrivateFieldExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), object: deserializeExpression(pos + 24), property: deserializePrivateIdentifier(pos + 40), optional: deserializeBool(pos + 80), @@ -255,7 +255,7 @@ function deserializeCallExpression(pos) { type: 'CallExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), callee: deserializeExpression(pos + 24), typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), arguments: deserializeVecArgument(pos + 48), @@ -268,7 +268,7 @@ function deserializeNewExpression(pos) { type: 'NewExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), callee: deserializeExpression(pos + 24), typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), arguments: deserializeVecArgument(pos + 48), @@ -280,7 +280,7 @@ function deserializeMetaProperty(pos) { type: 'MetaProperty', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), meta: deserializeIdentifierName(pos + 24), property: deserializeIdentifierName(pos + 64), }; @@ -291,7 +291,7 @@ function deserializeSpreadElement(pos) { type: 'SpreadElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), argument: deserializeExpression(pos + 24), }; } @@ -301,7 +301,7 @@ function deserializeUpdateExpression(pos) { type: 'UpdateExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), operator: deserializeUpdateOperator(pos + 40), prefix: deserializeBool(pos + 41), argument: deserializeSimpleAssignmentTarget(pos + 24), @@ -313,7 +313,7 @@ function deserializeUnaryExpression(pos) { type: 'UnaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), operator: deserializeUnaryOperator(pos + 40), argument: deserializeExpression(pos + 24), prefix: true, @@ -325,7 +325,7 @@ function deserializeBinaryExpression(pos) { type: 'BinaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), left: deserializeExpression(pos + 24), operator: deserializeBinaryOperator(pos + 56), right: deserializeExpression(pos + 40), @@ -337,7 +337,7 @@ function deserializePrivateInExpression(pos) { type: 'BinaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), left: deserializePrivateIdentifier(pos + 24), operator: 'in', right: deserializeExpression(pos + 64), @@ -349,7 +349,7 @@ function deserializeLogicalExpression(pos) { type: 'LogicalExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), left: deserializeExpression(pos + 24), operator: deserializeLogicalOperator(pos + 56), right: deserializeExpression(pos + 40), @@ -361,7 +361,7 @@ function deserializeConditionalExpression(pos) { type: 'ConditionalExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), test: deserializeExpression(pos + 24), consequent: deserializeExpression(pos + 40), alternate: deserializeExpression(pos + 56), @@ -373,7 +373,7 @@ function deserializeAssignmentExpression(pos) { type: 'AssignmentExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), operator: deserializeAssignmentOperator(pos + 56), left: deserializeAssignmentTarget(pos + 24), right: deserializeExpression(pos + 40), @@ -388,7 +388,7 @@ function deserializeArrayAssignmentTarget(pos) { type: 'ArrayPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], elements, optional: false, @@ -404,7 +404,7 @@ function deserializeObjectAssignmentTarget(pos) { type: 'ObjectPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], properties, optional: false, @@ -417,7 +417,7 @@ function deserializeAssignmentTargetRest(pos) { type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], argument: deserializeAssignmentTarget(pos + 24), optional: false, @@ -431,7 +431,7 @@ function deserializeAssignmentTargetWithDefault(pos) { type: 'AssignmentPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], left: deserializeAssignmentTarget(pos + 24), right: deserializeExpression(pos + 40), @@ -462,7 +462,7 @@ function deserializeAssignmentTargetPropertyIdentifier(pos) { type: 'Property', start, end, - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), kind: 'init', key, value, @@ -478,7 +478,7 @@ function deserializeAssignmentTargetPropertyProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), kind: 'init', key: deserializePropertyKey(pos + 24), value: deserializeAssignmentTargetMaybeDefault(pos + 40), @@ -494,7 +494,7 @@ function deserializeSequenceExpression(pos) { type: 'SequenceExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expressions: deserializeVecExpression(pos + 24), }; } @@ -504,7 +504,7 @@ function deserializeSuper(pos) { type: 'Super', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -513,7 +513,7 @@ function deserializeAwaitExpression(pos) { type: 'AwaitExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), argument: deserializeExpression(pos + 24), }; } @@ -523,7 +523,7 @@ function deserializeChainExpression(pos) { type: 'ChainExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeChainElement(pos + 24), }; } @@ -533,7 +533,7 @@ function deserializeParenthesizedExpression(pos) { type: 'ParenthesizedExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), }; } @@ -543,7 +543,7 @@ function deserializeDirective(pos) { type: 'ExpressionStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeStringLiteral(pos + 24), directive: deserializeStr(pos + 88), }; @@ -554,7 +554,7 @@ function deserializeHashbang(pos) { type: 'Hashbang', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value: deserializeStr(pos + 24), }; } @@ -564,7 +564,7 @@ function deserializeBlockStatement(pos) { type: 'BlockStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), body: deserializeVecStatement(pos + 24), }; } @@ -574,7 +574,7 @@ function deserializeVariableDeclaration(pos) { type: 'VariableDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), kind: deserializeVariableDeclarationKind(pos + 48), declarations: deserializeVecVariableDeclarator(pos + 24), declare: deserializeBool(pos + 49), @@ -586,7 +586,7 @@ function deserializeVariableDeclarator(pos) { type: 'VariableDeclarator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeBindingPattern(pos + 24), init: deserializeOptionExpression(pos + 56), definite: deserializeBool(pos + 73), @@ -598,7 +598,7 @@ function deserializeEmptyStatement(pos) { type: 'EmptyStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -607,7 +607,7 @@ function deserializeExpressionStatement(pos) { type: 'ExpressionStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), directive: null, }; @@ -618,7 +618,7 @@ function deserializeIfStatement(pos) { type: 'IfStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), test: deserializeExpression(pos + 24), consequent: deserializeStatement(pos + 40), alternate: deserializeOptionStatement(pos + 56), @@ -630,7 +630,7 @@ function deserializeDoWhileStatement(pos) { type: 'DoWhileStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), body: deserializeStatement(pos + 24), test: deserializeExpression(pos + 40), }; @@ -641,7 +641,7 @@ function deserializeWhileStatement(pos) { type: 'WhileStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), test: deserializeExpression(pos + 24), body: deserializeStatement(pos + 40), }; @@ -652,7 +652,7 @@ function deserializeForStatement(pos) { type: 'ForStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), init: deserializeOptionForStatementInit(pos + 24), test: deserializeOptionExpression(pos + 40), update: deserializeOptionExpression(pos + 56), @@ -665,7 +665,7 @@ function deserializeForInStatement(pos) { type: 'ForInStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), left: deserializeForStatementLeft(pos + 24), right: deserializeExpression(pos + 40), body: deserializeStatement(pos + 56), @@ -677,7 +677,7 @@ function deserializeForOfStatement(pos) { type: 'ForOfStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), await: deserializeBool(pos + 76), left: deserializeForStatementLeft(pos + 24), right: deserializeExpression(pos + 40), @@ -690,7 +690,7 @@ function deserializeContinueStatement(pos) { type: 'ContinueStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), label: deserializeOptionLabelIdentifier(pos + 24), }; } @@ -700,7 +700,7 @@ function deserializeBreakStatement(pos) { type: 'BreakStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), label: deserializeOptionLabelIdentifier(pos + 24), }; } @@ -710,7 +710,7 @@ function deserializeReturnStatement(pos) { type: 'ReturnStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), argument: deserializeOptionExpression(pos + 24), }; } @@ -720,7 +720,7 @@ function deserializeWithStatement(pos) { type: 'WithStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), object: deserializeExpression(pos + 24), body: deserializeStatement(pos + 40), }; @@ -731,7 +731,7 @@ function deserializeSwitchStatement(pos) { type: 'SwitchStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), discriminant: deserializeExpression(pos + 24), cases: deserializeVecSwitchCase(pos + 40), }; @@ -742,7 +742,7 @@ function deserializeSwitchCase(pos) { type: 'SwitchCase', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), test: deserializeOptionExpression(pos + 24), consequent: deserializeVecStatement(pos + 40), }; @@ -753,7 +753,7 @@ function deserializeLabeledStatement(pos) { type: 'LabeledStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), label: deserializeLabelIdentifier(pos + 24), body: deserializeStatement(pos + 64), }; @@ -764,7 +764,7 @@ function deserializeThrowStatement(pos) { type: 'ThrowStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), argument: deserializeExpression(pos + 24), }; } @@ -774,7 +774,7 @@ function deserializeTryStatement(pos) { type: 'TryStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), block: deserializeBoxBlockStatement(pos + 24), handler: deserializeOptionBoxCatchClause(pos + 32), finalizer: deserializeOptionBoxBlockStatement(pos + 40), @@ -786,7 +786,7 @@ function deserializeCatchClause(pos) { type: 'CatchClause', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), param: deserializeOptionCatchParameter(pos + 24), body: deserializeBoxBlockStatement(pos + 80), }; @@ -801,7 +801,7 @@ function deserializeDebuggerStatement(pos) { type: 'DebuggerStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -817,7 +817,7 @@ function deserializeAssignmentPattern(pos) { type: 'AssignmentPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], left: deserializeBindingPattern(pos + 24), right: deserializeExpression(pos + 56), @@ -834,7 +834,7 @@ function deserializeObjectPattern(pos) { type: 'ObjectPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], properties, optional: false, @@ -847,7 +847,7 @@ function deserializeBindingProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), kind: 'init', key: deserializePropertyKey(pos + 24), value: deserializeBindingPattern(pos + 40), @@ -866,7 +866,7 @@ function deserializeArrayPattern(pos) { type: 'ArrayPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], elements, optional: false, @@ -879,7 +879,7 @@ function deserializeBindingRestElement(pos) { type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], argument: deserializeBindingPattern(pos + 24), optional: false, @@ -896,7 +896,7 @@ function deserializeFunction(pos) { type: deserializeFunctionType(pos + 116), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeOptionBindingIdentifier(pos + 24), generator: deserializeBool(pos + 117), async: deserializeBool(pos + 118), @@ -962,7 +962,7 @@ function deserializeFunctionBody(pos) { type: 'BlockStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), body, }; } @@ -974,7 +974,7 @@ function deserializeArrowFunctionExpression(pos) { type: 'ArrowFunctionExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression, async: deserializeBool(pos + 61), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), @@ -991,7 +991,7 @@ function deserializeYieldExpression(pos) { type: 'YieldExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), delegate: deserializeBool(pos + 40), argument: deserializeOptionExpression(pos + 24), }; @@ -1002,7 +1002,7 @@ function deserializeClass(pos) { type: deserializeClassType(pos + 164), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: deserializeVecDecorator(pos + 24), id: deserializeOptionBindingIdentifier(pos + 48), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 96), @@ -1020,7 +1020,7 @@ function deserializeClassBody(pos) { type: 'ClassBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), body: deserializeVecClassElement(pos + 24), }; } @@ -1030,7 +1030,7 @@ function deserializeMethodDefinition(pos) { type: deserializeMethodDefinitionType(pos + 72), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: deserializeVecDecorator(pos + 24), key: deserializePropertyKey(pos + 48), value: deserializeBoxFunction(pos + 64), @@ -1048,7 +1048,7 @@ function deserializePropertyDefinition(pos) { type: deserializePropertyDefinitionType(pos + 88), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: deserializeVecDecorator(pos + 24), key: deserializePropertyKey(pos + 48), typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 64), @@ -1069,7 +1069,7 @@ function deserializePrivateIdentifier(pos) { type: 'PrivateIdentifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeStr(pos + 24), }; } @@ -1079,7 +1079,7 @@ function deserializeStaticBlock(pos) { type: 'StaticBlock', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), body: deserializeVecStatement(pos + 24), }; } @@ -1089,7 +1089,7 @@ function deserializeAccessorProperty(pos) { type: deserializeAccessorPropertyType(pos + 88), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: deserializeVecDecorator(pos + 24), key: deserializePropertyKey(pos + 48), typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 64), @@ -1110,7 +1110,7 @@ function deserializeImportExpression(pos) { type: 'ImportExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), source: deserializeExpression(pos + 24), options: deserializeOptionExpression(pos + 40), phase: deserializeOptionImportPhase(pos + 56), @@ -1125,7 +1125,7 @@ function deserializeImportDeclaration(pos) { type: 'ImportDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), specifiers, source: deserializeStringLiteral(pos + 48), phase: deserializeOptionImportPhase(pos + 120), @@ -1139,7 +1139,7 @@ function deserializeImportSpecifier(pos) { type: 'ImportSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), imported: deserializeModuleExportName(pos + 24), local: deserializeBindingIdentifier(pos + 96), importKind: deserializeImportOrExportKind(pos + 144), @@ -1151,7 +1151,7 @@ function deserializeImportDefaultSpecifier(pos) { type: 'ImportDefaultSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), local: deserializeBindingIdentifier(pos + 24), }; } @@ -1161,7 +1161,7 @@ function deserializeImportNamespaceSpecifier(pos) { type: 'ImportNamespaceSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), local: deserializeBindingIdentifier(pos + 24), }; } @@ -1177,7 +1177,7 @@ function deserializeImportAttribute(pos) { type: 'ImportAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), key: deserializeImportAttributeKey(pos + 24), value: deserializeStringLiteral(pos + 96), }; @@ -1189,7 +1189,7 @@ function deserializeExportNamedDeclaration(pos) { type: 'ExportNamedDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), declaration: deserializeOptionDeclaration(pos + 24), specifiers: deserializeVecExportSpecifier(pos + 40), source: deserializeOptionStringLiteral(pos + 64), @@ -1203,7 +1203,7 @@ function deserializeExportDefaultDeclaration(pos) { type: 'ExportDefaultDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), declaration: deserializeExportDefaultDeclarationKind(pos + 96), exportKind: 'value', }; @@ -1215,7 +1215,7 @@ function deserializeExportAllDeclaration(pos) { type: 'ExportAllDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), exported: deserializeOptionModuleExportName(pos + 24), source: deserializeStringLiteral(pos + 96), attributes: withClause === null ? [] : withClause.attributes, @@ -1228,7 +1228,7 @@ function deserializeExportSpecifier(pos) { type: 'ExportSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), local: deserializeModuleExportName(pos + 24), exported: deserializeModuleExportName(pos + 96), exportKind: deserializeImportOrExportKind(pos + 168), @@ -1240,7 +1240,7 @@ function deserializeV8IntrinsicExpression(pos) { type: 'V8IntrinsicExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeIdentifierName(pos + 24), arguments: deserializeVecArgument(pos + 64), }; @@ -1254,7 +1254,7 @@ function deserializeBooleanLiteral(pos) { type: 'Literal', start, end, - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value, raw: (start === 0 && end === 0) ? null : value + '', }; @@ -1267,7 +1267,7 @@ function deserializeNullLiteral(pos) { type: 'Literal', start, end, - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value: null, raw: (start === 0 && end === 0) ? null : 'null', }; @@ -1278,7 +1278,7 @@ function deserializeNumericLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value: deserializeF64(pos + 24), raw: deserializeOptionStr(pos + 32), }; @@ -1293,7 +1293,7 @@ function deserializeStringLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value, raw: deserializeOptionStr(pos + 40), }; @@ -1305,7 +1305,7 @@ function deserializeBigIntLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value: BigInt(bigint), raw: deserializeOptionStr(pos + 40), bigint, @@ -1322,7 +1322,7 @@ function deserializeRegExpLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value, raw: deserializeOptionStr(pos + 56), regex, @@ -1365,7 +1365,7 @@ function deserializeJSXElement(pos) { type: 'JSXElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), openingElement, children: deserializeVecJSXChild(pos + 32), closingElement, @@ -1377,7 +1377,7 @@ function deserializeJSXOpeningElement(pos) { type: 'JSXOpeningElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeJSXElementName(pos + 24), typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), attributes: deserializeVecJSXAttributeItem(pos + 48), @@ -1390,7 +1390,7 @@ function deserializeJSXClosingElement(pos) { type: 'JSXClosingElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeJSXElementName(pos + 24), }; } @@ -1400,7 +1400,7 @@ function deserializeJSXFragment(pos) { type: 'JSXFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), openingFragment: deserializeJSXOpeningFragment(pos + 24), children: deserializeVecJSXChild(pos + 48), closingFragment: deserializeJSXClosingFragment(pos + 72), @@ -1412,7 +1412,7 @@ function deserializeJSXOpeningFragment(pos) { type: 'JSXOpeningFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1421,7 +1421,7 @@ function deserializeJSXClosingFragment(pos) { type: 'JSXClosingFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1430,7 +1430,7 @@ function deserializeJSXNamespacedName(pos) { type: 'JSXNamespacedName', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), namespace: deserializeJSXIdentifier(pos + 24), name: deserializeJSXIdentifier(pos + 64), }; @@ -1441,7 +1441,7 @@ function deserializeJSXMemberExpression(pos) { type: 'JSXMemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), object: deserializeJSXMemberExpressionObject(pos + 24), property: deserializeJSXIdentifier(pos + 40), }; @@ -1452,7 +1452,7 @@ function deserializeJSXExpressionContainer(pos) { type: 'JSXExpressionContainer', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeJSXExpression(pos + 24), }; } @@ -1462,7 +1462,7 @@ function deserializeJSXEmptyExpression(pos) { type: 'JSXEmptyExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1471,7 +1471,7 @@ function deserializeJSXAttribute(pos) { type: 'JSXAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeJSXAttributeName(pos + 24), value: deserializeOptionJSXAttributeValue(pos + 40), }; @@ -1482,7 +1482,7 @@ function deserializeJSXSpreadAttribute(pos) { type: 'JSXSpreadAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), argument: deserializeExpression(pos + 24), }; } @@ -1492,7 +1492,7 @@ function deserializeJSXIdentifier(pos) { type: 'JSXIdentifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeStr(pos + 24), }; } @@ -1502,7 +1502,7 @@ function deserializeJSXSpreadChild(pos) { type: 'JSXSpreadChild', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), }; } @@ -1512,7 +1512,7 @@ function deserializeJSXText(pos) { type: 'JSXText', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), value: deserializeStr(pos + 24), raw: deserializeOptionStr(pos + 40), }; @@ -1523,7 +1523,7 @@ function deserializeTSThisParameter(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], name: 'this', optional: false, @@ -1536,7 +1536,7 @@ function deserializeTSEnumDeclaration(pos) { type: 'TSEnumDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeBindingIdentifier(pos + 24), body: deserializeTSEnumBody(pos + 72), const: deserializeBool(pos + 124), @@ -1549,7 +1549,7 @@ function deserializeTSEnumBody(pos) { type: 'TSEnumBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), members: deserializeVecTSEnumMember(pos + 24), }; } @@ -1559,7 +1559,7 @@ function deserializeTSEnumMember(pos) { type: 'TSEnumMember', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeTSEnumMemberName(pos + 24), initializer: deserializeOptionExpression(pos + 40), computed: deserializeU8(pos + 24) > 1, @@ -1571,7 +1571,7 @@ function deserializeTSTypeAnnotation(pos) { type: 'TSTypeAnnotation', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1581,7 +1581,7 @@ function deserializeTSLiteralType(pos) { type: 'TSLiteralType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), literal: deserializeTSLiteral(pos + 24), }; } @@ -1591,7 +1591,7 @@ function deserializeTSConditionalType(pos) { type: 'TSConditionalType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), checkType: deserializeTSType(pos + 24), extendsType: deserializeTSType(pos + 40), trueType: deserializeTSType(pos + 56), @@ -1604,7 +1604,7 @@ function deserializeTSUnionType(pos) { type: 'TSUnionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), types: deserializeVecTSType(pos + 24), }; } @@ -1614,7 +1614,7 @@ function deserializeTSIntersectionType(pos) { type: 'TSIntersectionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), types: deserializeVecTSType(pos + 24), }; } @@ -1624,7 +1624,7 @@ function deserializeTSParenthesizedType(pos) { type: 'TSParenthesizedType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1634,7 +1634,7 @@ function deserializeTSTypeOperator(pos) { type: 'TSTypeOperator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), operator: deserializeTSTypeOperatorOperator(pos + 40), typeAnnotation: deserializeTSType(pos + 24), }; @@ -1645,7 +1645,7 @@ function deserializeTSArrayType(pos) { type: 'TSArrayType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), elementType: deserializeTSType(pos + 24), }; } @@ -1655,7 +1655,7 @@ function deserializeTSIndexedAccessType(pos) { type: 'TSIndexedAccessType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), objectType: deserializeTSType(pos + 24), indexType: deserializeTSType(pos + 40), }; @@ -1666,7 +1666,7 @@ function deserializeTSTupleType(pos) { type: 'TSTupleType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), elementTypes: deserializeVecTSTupleElement(pos + 24), }; } @@ -1676,7 +1676,7 @@ function deserializeTSNamedTupleMember(pos) { type: 'TSNamedTupleMember', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), label: deserializeIdentifierName(pos + 24), elementType: deserializeTSTupleElement(pos + 64), optional: deserializeBool(pos + 80), @@ -1688,7 +1688,7 @@ function deserializeTSOptionalType(pos) { type: 'TSOptionalType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1698,7 +1698,7 @@ function deserializeTSRestType(pos) { type: 'TSRestType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeAnnotation: deserializeTSType(pos + 24), }; } @@ -1708,7 +1708,7 @@ function deserializeTSAnyKeyword(pos) { type: 'TSAnyKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1717,7 +1717,7 @@ function deserializeTSStringKeyword(pos) { type: 'TSStringKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1726,7 +1726,7 @@ function deserializeTSBooleanKeyword(pos) { type: 'TSBooleanKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1735,7 +1735,7 @@ function deserializeTSNumberKeyword(pos) { type: 'TSNumberKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1744,7 +1744,7 @@ function deserializeTSNeverKeyword(pos) { type: 'TSNeverKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1753,7 +1753,7 @@ function deserializeTSIntrinsicKeyword(pos) { type: 'TSIntrinsicKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1762,7 +1762,7 @@ function deserializeTSUnknownKeyword(pos) { type: 'TSUnknownKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1771,7 +1771,7 @@ function deserializeTSNullKeyword(pos) { type: 'TSNullKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1780,7 +1780,7 @@ function deserializeTSUndefinedKeyword(pos) { type: 'TSUndefinedKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1789,7 +1789,7 @@ function deserializeTSVoidKeyword(pos) { type: 'TSVoidKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1798,7 +1798,7 @@ function deserializeTSSymbolKeyword(pos) { type: 'TSSymbolKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1807,7 +1807,7 @@ function deserializeTSThisType(pos) { type: 'TSThisType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1816,7 +1816,7 @@ function deserializeTSObjectKeyword(pos) { type: 'TSObjectKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1825,7 +1825,7 @@ function deserializeTSBigIntKeyword(pos) { type: 'TSBigIntKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -1834,7 +1834,7 @@ function deserializeTSTypeReference(pos) { type: 'TSTypeReference', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeName: deserializeTSTypeName(pos + 24), typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; @@ -1845,7 +1845,7 @@ function deserializeTSQualifiedName(pos) { type: 'TSQualifiedName', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), left: deserializeTSTypeName(pos + 24), right: deserializeIdentifierName(pos + 40), }; @@ -1856,7 +1856,7 @@ function deserializeTSTypeParameterInstantiation(pos) { type: 'TSTypeParameterInstantiation', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), params: deserializeVecTSType(pos + 24), }; } @@ -1866,7 +1866,7 @@ function deserializeTSTypeParameter(pos) { type: 'TSTypeParameter', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), name: deserializeBindingIdentifier(pos + 24), constraint: deserializeOptionTSType(pos + 72), default: deserializeOptionTSType(pos + 88), @@ -1881,7 +1881,7 @@ function deserializeTSTypeParameterDeclaration(pos) { type: 'TSTypeParameterDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), params: deserializeVecTSTypeParameter(pos + 24), }; } @@ -1891,7 +1891,7 @@ function deserializeTSTypeAliasDeclaration(pos) { type: 'TSTypeAliasDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeBindingIdentifier(pos + 24), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), typeAnnotation: deserializeTSType(pos + 80), @@ -1929,7 +1929,7 @@ function deserializeTSClassImplements(pos) { type: 'TSClassImplements', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression, typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; @@ -1940,7 +1940,7 @@ function deserializeTSInterfaceDeclaration(pos) { type: 'TSInterfaceDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeBindingIdentifier(pos + 24), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), extends: deserializeVecTSInterfaceHeritage(pos + 80), @@ -1954,7 +1954,7 @@ function deserializeTSInterfaceBody(pos) { type: 'TSInterfaceBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), body: deserializeVecTSSignature(pos + 24), }; } @@ -1964,7 +1964,7 @@ function deserializeTSPropertySignature(pos) { type: 'TSPropertySignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), computed: deserializeBool(pos + 48), optional: deserializeBool(pos + 49), readonly: deserializeBool(pos + 50), @@ -1980,7 +1980,7 @@ function deserializeTSIndexSignature(pos) { type: 'TSIndexSignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), parameters: deserializeVecTSIndexSignatureName(pos + 24), typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 48), readonly: deserializeBool(pos + 56), @@ -1997,7 +1997,7 @@ function deserializeTSCallSignatureDeclaration(pos) { type: 'TSCallSignatureDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), params, returnType: deserializeOptionBoxTSTypeAnnotation(pos + 48), @@ -2012,7 +2012,7 @@ function deserializeTSMethodSignature(pos) { type: 'TSMethodSignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), key: deserializePropertyKey(pos + 24), computed: deserializeBool(pos + 76), optional: deserializeBool(pos + 77), @@ -2031,7 +2031,7 @@ function deserializeTSConstructSignatureDeclaration(pos) { type: 'TSConstructSignatureDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), params: deserializeBoxFormalParameters(pos + 32), returnType: deserializeOptionBoxTSTypeAnnotation(pos + 40), @@ -2043,7 +2043,7 @@ function deserializeTSIndexSignatureName(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), decorators: [], name: deserializeStr(pos + 24), optional: false, @@ -2056,7 +2056,7 @@ function deserializeTSInterfaceHeritage(pos) { type: 'TSInterfaceHeritage', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; @@ -2067,7 +2067,7 @@ function deserializeTSTypePredicate(pos) { type: 'TSTypePredicate', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), parameterName: deserializeTSTypePredicateName(pos + 24), asserts: deserializeBool(pos + 64), typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 56), @@ -2128,7 +2128,7 @@ function deserializeTSModuleBlock(pos) { type: 'TSModuleBlock', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), body, }; } @@ -2138,7 +2138,7 @@ function deserializeTSTypeLiteral(pos) { type: 'TSTypeLiteral', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), members: deserializeVecTSSignature(pos + 24), }; } @@ -2148,7 +2148,7 @@ function deserializeTSInferType(pos) { type: 'TSInferType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeParameter: deserializeBoxTSTypeParameter(pos + 24), }; } @@ -2158,7 +2158,7 @@ function deserializeTSTypeQuery(pos) { type: 'TSTypeQuery', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), exprName: deserializeTSTypeQueryExprName(pos + 24), typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), }; @@ -2169,7 +2169,7 @@ function deserializeTSImportType(pos) { type: 'TSImportType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), argument: deserializeTSType(pos + 24), options: deserializeOptionBoxObjectExpression(pos + 40), qualifier: deserializeOptionTSTypeName(pos + 48), @@ -2185,7 +2185,7 @@ function deserializeTSFunctionType(pos) { type: 'TSFunctionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), params, returnType: deserializeBoxTSTypeAnnotation(pos + 48), @@ -2197,7 +2197,7 @@ function deserializeTSConstructorType(pos) { type: 'TSConstructorType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), abstract: deserializeBool(pos + 48), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), params: deserializeBoxFormalParameters(pos + 32), @@ -2213,7 +2213,7 @@ function deserializeTSMappedType(pos) { type: 'TSMappedType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), key: typeParameter.name, constraint: typeParameter.constraint, nameType: deserializeOptionTSType(pos + 32), @@ -2228,7 +2228,7 @@ function deserializeTSTemplateLiteralType(pos) { type: 'TSTemplateLiteralType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), quasis: deserializeVecTemplateElement(pos + 24), types: deserializeVecTSType(pos + 48), }; @@ -2239,7 +2239,7 @@ function deserializeTSAsExpression(pos) { type: 'TSAsExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), typeAnnotation: deserializeTSType(pos + 40), }; @@ -2250,7 +2250,7 @@ function deserializeTSSatisfiesExpression(pos) { type: 'TSSatisfiesExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), typeAnnotation: deserializeTSType(pos + 40), }; @@ -2261,7 +2261,7 @@ function deserializeTSTypeAssertion(pos) { type: 'TSTypeAssertion', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeAnnotation: deserializeTSType(pos + 24), expression: deserializeExpression(pos + 40), }; @@ -2272,7 +2272,7 @@ function deserializeTSImportEqualsDeclaration(pos) { type: 'TSImportEqualsDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeBindingIdentifier(pos + 24), moduleReference: deserializeTSModuleReference(pos + 72), importKind: deserializeImportOrExportKind(pos + 88), @@ -2284,7 +2284,7 @@ function deserializeTSExternalModuleReference(pos) { type: 'TSExternalModuleReference', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeStringLiteral(pos + 24), }; } @@ -2294,7 +2294,7 @@ function deserializeTSNonNullExpression(pos) { type: 'TSNonNullExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), }; } @@ -2304,7 +2304,7 @@ function deserializeDecorator(pos) { type: 'Decorator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), }; } @@ -2314,7 +2314,7 @@ function deserializeTSExportAssignment(pos) { type: 'TSExportAssignment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), }; } @@ -2324,7 +2324,7 @@ function deserializeTSNamespaceExportDeclaration(pos) { type: 'TSNamespaceExportDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), id: deserializeIdentifierName(pos + 24), }; } @@ -2334,7 +2334,7 @@ function deserializeTSInstantiationExpression(pos) { type: 'TSInstantiationExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), expression: deserializeExpression(pos + 24), typeArguments: deserializeBoxTSTypeParameterInstantiation(pos + 40), }; @@ -2345,7 +2345,7 @@ function deserializeJSDocNullableType(pos) { type: 'TSJSDocNullableType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeAnnotation: deserializeTSType(pos + 24), postfix: deserializeBool(pos + 40), }; @@ -2356,7 +2356,7 @@ function deserializeJSDocNonNullableType(pos) { type: 'TSJSDocNonNullableType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), typeAnnotation: deserializeTSType(pos + 24), postfix: deserializeBool(pos + 40), }; @@ -2367,7 +2367,7 @@ function deserializeJSDocUnknownType(pos) { type: 'TSJSDocUnknownType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -2381,7 +2381,7 @@ function deserializeComment(pos) { value: sourceText.slice(start + 2, end - endCut), start, end, - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -2390,7 +2390,7 @@ function deserializeNameSpan(pos) { value: deserializeStr(pos + 24), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -2406,7 +2406,7 @@ function deserializeExportEntry(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), moduleRequest: deserializeOptionNameSpan(pos + 48), importName: deserializeExportImportName(pos + 88), exportName: deserializeExportExportName(pos + 136), @@ -2419,7 +2419,7 @@ function deserializeDynamicImport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), moduleRequest: deserializeSpan(pos + 24), }; } @@ -2428,7 +2428,7 @@ function deserializeSpan(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -2462,7 +2462,7 @@ function deserializeErrorLabel(pos) { message: deserializeOptionStr(pos + 24), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), }; } @@ -2480,7 +2480,7 @@ function deserializeStaticImport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), moduleRequest: deserializeNameSpan(pos + 24), entries: deserializeVecImportEntry(pos + 64), }; @@ -2490,7 +2490,7 @@ function deserializeStaticExport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionArrayType(pos + 8), + range: deserializeOptionRangeArray(pos + 8), entries: deserializeVecExportEntry(pos + 24), }; } @@ -5560,9 +5560,9 @@ function deserializeOptionNameSpan(pos) { return deserializeNameSpan(pos); } -function deserializeOptionArrayType(pos) { +function deserializeOptionRangeArray(pos) { if (uint8[pos] === 0) return null; - return deserializeArrayType(pos + 4); + return deserializeRangeArray(pos + 4); } function deserializeU64(pos) { diff --git a/tasks/ast_tools/src/generators/assert_layouts.rs b/tasks/ast_tools/src/generators/assert_layouts.rs index 9a16e7c130feb..4a8572d06fd8e 100644 --- a/tasks/ast_tools/src/generators/assert_layouts.rs +++ b/tasks/ast_tools/src/generators/assert_layouts.rs @@ -476,7 +476,7 @@ fn calculate_layout_for_primitive(primitive_def: &PrimitiveDef) -> Layout { layout_64: PlatformLayout::from_size_align(0, 8), layout_32: PlatformLayout::from_size_align(0, 4), }, - "ArrayType" => Layout { + "RangeArray" => Layout { layout_64: PlatformLayout::from_size_align(12, 4), // Option<[i32; 2]> is Option<12 bytes aligned at 4> layout_32: PlatformLayout::from_size_align(12, 4), }, diff --git a/tasks/ast_tools/src/generators/raw_transfer.rs b/tasks/ast_tools/src/generators/raw_transfer.rs index cdb07094545d6..a12d2c96320e1 100644 --- a/tasks/ast_tools/src/generators/raw_transfer.rs +++ b/tasks/ast_tools/src/generators/raw_transfer.rs @@ -471,13 +471,12 @@ fn generate_enum( /// Generate deserialize function for a primitive. fn generate_primitive(primitive_def: &PrimitiveDef, code: &mut String, schema: &Schema) { - #[expect(clippy::match_same_arms)] let ret = match primitive_def.name() { // Reuse deserializer for `&str` "Atom" => return, // Dummy type "PointerAlign" => return, - "ArrayType" => return, + "RangeArray" => return, "bool" => "return uint8[pos] === 1;", "u8" => "return uint8[pos];", // "u16" => "return uint16[pos >> 1];", diff --git a/tasks/ast_tools/src/generators/raw_transfer_lazy.rs b/tasks/ast_tools/src/generators/raw_transfer_lazy.rs index d6717bad78409..d344581bdb2bc 100644 --- a/tasks/ast_tools/src/generators/raw_transfer_lazy.rs +++ b/tasks/ast_tools/src/generators/raw_transfer_lazy.rs @@ -594,7 +594,7 @@ fn generate_primitive(primitive_def: &PrimitiveDef, code: &mut String, schema: & "Atom" => return, // Dummy type "PointerAlign" => return, - "ArrayType" => return, + "RangeArray" => return, "bool" => "return ast.buffer[pos] === 1;", "u8" => "return ast.buffer[pos];", // "u16" => "return uint16[pos >> 1];", diff --git a/tasks/ast_tools/src/generators/typescript.rs b/tasks/ast_tools/src/generators/typescript.rs index 2bb778b64d5ec..1b22f46affcb2 100644 --- a/tasks/ast_tools/src/generators/typescript.rs +++ b/tasks/ast_tools/src/generators/typescript.rs @@ -377,7 +377,7 @@ fn ts_type_name<'s>(type_def: &'s TypeDef, schema: &'s Schema) -> Cow<'s, str> { | "f32" | "f64" => "number", "bool" => "boolean", "&str" | "Atom" => "string", - "ArrayType" => "[number, number]", + "RangeArray" => "[number, number]", name => name, }), TypeDef::Option(option_def) => { diff --git a/tasks/ast_tools/src/parse/parse.rs b/tasks/ast_tools/src/parse/parse.rs index 3036b635799cf..f90f75771551f 100644 --- a/tasks/ast_tools/src/parse/parse.rs +++ b/tasks/ast_tools/src/parse/parse.rs @@ -226,7 +226,7 @@ impl<'c> Parser<'c> { // TODO: Remove the need for this by adding // `#[cfg_attr(target_pointer_width = "64", repr(align(8)))]` to all AST types "PointerAlign" => primitive("PointerAlign"), - "ArrayType" => primitive("ArrayType"), + "RangeArray" => primitive("RangeArray"), _ => panic!("Unknown type: {name}"), }; self.create_new_type(type_def) @@ -586,7 +586,7 @@ impl<'c> Parser<'c> { } fn parse_type_array(&mut self, _type_array: &TypeArray) -> TypeId { - self.type_id("ArrayType") + self.type_id("RangeArray") } /// Parse attributes on struct or enum with parsers provided by [`Derive`]s and [`Generator`]s. From 92a5a52b6280647cd1fc59ace96ab1c4a799f713 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Fri, 20 Jun 2025 16:47:42 +0200 Subject: [PATCH 20/42] chore: revert generated code --- .../oxc_ast/src/generated/assert_layouts.rs | 2548 ++++++++--------- crates/oxc_ast/src/generated/derive_dummy.rs | 262 +- crates/oxc_ast/src/generated/derive_estree.rs | 534 ---- .../src/generated/assert_layouts.rs | 220 +- .../oxc_span/src/generated/assert_layouts.rs | 6 +- .../oxc_span/src/generated/derive_estree.rs | 1 - .../src/generated/assert_layouts.rs | 80 +- .../oxc_syntax/src/generated/derive_estree.rs | 9 - napi/parser/generated/deserialize/js.js | 1020 +++---- napi/parser/generated/deserialize/lazy.js | 2019 +++---------- napi/parser/generated/deserialize/ts.js | 1112 +++---- napi/parser/src/generated/assert_layouts.rs | 44 +- napi/parser/src/generated/derive_estree.rs | 9 - 13 files changed, 2892 insertions(+), 4972 deletions(-) diff --git a/crates/oxc_ast/src/generated/assert_layouts.rs b/crates/oxc_ast/src/generated/assert_layouts.rs index 4f229a5281e36..2852f7cf02668 100644 --- a/crates/oxc_ast/src/generated/assert_layouts.rs +++ b/crates/oxc_ast/src/generated/assert_layouts.rs @@ -10,84 +10,84 @@ use crate::ast::*; #[cfg(target_pointer_width = "64")] const _: () = { // Padding: 1 bytes - assert!(size_of::() == 160); + assert!(size_of::() == 128); assert!(align_of::() == 8); assert!(offset_of!(Program, span) == 0); - assert!(offset_of!(Program, source_type) == 156); - assert!(offset_of!(Program, source_text) == 24); - assert!(offset_of!(Program, comments) == 40); - assert!(offset_of!(Program, hashbang) == 64); - assert!(offset_of!(Program, directives) == 104); - assert!(offset_of!(Program, body) == 128); - assert!(offset_of!(Program, scope_id) == 152); + assert!(offset_of!(Program, source_type) == 124); + assert!(offset_of!(Program, source_text) == 8); + assert!(offset_of!(Program, comments) == 24); + assert!(offset_of!(Program, hashbang) == 48); + assert!(offset_of!(Program, directives) == 72); + assert!(offset_of!(Program, body) == 96); + assert!(offset_of!(Program, scope_id) == 120); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(IdentifierName, span) == 0); - assert!(offset_of!(IdentifierName, name) == 24); + assert!(offset_of!(IdentifierName, name) == 8); // Padding: 4 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(IdentifierReference, span) == 0); - assert!(offset_of!(IdentifierReference, name) == 24); - assert!(offset_of!(IdentifierReference, reference_id) == 40); + assert!(offset_of!(IdentifierReference, name) == 8); + assert!(offset_of!(IdentifierReference, reference_id) == 24); // Padding: 4 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(BindingIdentifier, span) == 0); - assert!(offset_of!(BindingIdentifier, name) == 24); - assert!(offset_of!(BindingIdentifier, symbol_id) == 40); + assert!(offset_of!(BindingIdentifier, name) == 8); + assert!(offset_of!(BindingIdentifier, symbol_id) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(LabelIdentifier, span) == 0); - assert!(offset_of!(LabelIdentifier, name) == 24); + assert!(offset_of!(LabelIdentifier, name) == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(ThisExpression, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(ArrayExpression, span) == 0); - assert!(offset_of!(ArrayExpression, elements) == 24); + assert!(offset_of!(ArrayExpression, elements) == 8); - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(Elision, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(ObjectExpression, span) == 0); - assert!(offset_of!(ObjectExpression, properties) == 24); + assert!(offset_of!(ObjectExpression, properties) == 8); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 4 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(ObjectProperty, span) == 0); - assert!(offset_of!(ObjectProperty, kind) == 56); - assert!(offset_of!(ObjectProperty, key) == 24); - assert!(offset_of!(ObjectProperty, value) == 40); - assert!(offset_of!(ObjectProperty, method) == 57); - assert!(offset_of!(ObjectProperty, shorthand) == 58); - assert!(offset_of!(ObjectProperty, computed) == 59); + assert!(offset_of!(ObjectProperty, kind) == 40); + assert!(offset_of!(ObjectProperty, key) == 8); + assert!(offset_of!(ObjectProperty, value) == 24); + assert!(offset_of!(ObjectProperty, method) == 41); + assert!(offset_of!(ObjectProperty, shorthand) == 42); + assert!(offset_of!(ObjectProperty, computed) == 43); assert!(size_of::() == 16); assert!(align_of::() == 8); @@ -96,27 +96,27 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TemplateLiteral, span) == 0); - assert!(offset_of!(TemplateLiteral, quasis) == 24); - assert!(offset_of!(TemplateLiteral, expressions) == 48); + assert!(offset_of!(TemplateLiteral, quasis) == 8); + assert!(offset_of!(TemplateLiteral, expressions) == 32); // Padding: 0 bytes - assert!(size_of::() == 120); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(TaggedTemplateExpression, span) == 0); - assert!(offset_of!(TaggedTemplateExpression, tag) == 24); - assert!(offset_of!(TaggedTemplateExpression, type_arguments) == 40); - assert!(offset_of!(TaggedTemplateExpression, quasi) == 48); + assert!(offset_of!(TaggedTemplateExpression, tag) == 8); + assert!(offset_of!(TaggedTemplateExpression, type_arguments) == 24); + assert!(offset_of!(TaggedTemplateExpression, quasi) == 32); // Padding: 6 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TemplateElement, span) == 0); - assert!(offset_of!(TemplateElement, value) == 24); - assert!(offset_of!(TemplateElement, tail) == 56); - assert!(offset_of!(TemplateElement, lone_surrogates) == 57); + assert!(offset_of!(TemplateElement, value) == 8); + assert!(offset_of!(TemplateElement, tail) == 40); + assert!(offset_of!(TemplateElement, lone_surrogates) == 41); // Padding: 0 bytes assert!(size_of::() == 32); @@ -128,117 +128,117 @@ const _: () = { assert!(align_of::() == 8); // Padding: 7 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(ComputedMemberExpression, span) == 0); - assert!(offset_of!(ComputedMemberExpression, object) == 24); - assert!(offset_of!(ComputedMemberExpression, expression) == 40); - assert!(offset_of!(ComputedMemberExpression, optional) == 56); + assert!(offset_of!(ComputedMemberExpression, object) == 8); + assert!(offset_of!(ComputedMemberExpression, expression) == 24); + assert!(offset_of!(ComputedMemberExpression, optional) == 40); // Padding: 7 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(StaticMemberExpression, span) == 0); - assert!(offset_of!(StaticMemberExpression, object) == 24); - assert!(offset_of!(StaticMemberExpression, property) == 40); - assert!(offset_of!(StaticMemberExpression, optional) == 80); + assert!(offset_of!(StaticMemberExpression, object) == 8); + assert!(offset_of!(StaticMemberExpression, property) == 24); + assert!(offset_of!(StaticMemberExpression, optional) == 48); // Padding: 7 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(PrivateFieldExpression, span) == 0); - assert!(offset_of!(PrivateFieldExpression, object) == 24); - assert!(offset_of!(PrivateFieldExpression, field) == 40); - assert!(offset_of!(PrivateFieldExpression, optional) == 80); + assert!(offset_of!(PrivateFieldExpression, object) == 8); + assert!(offset_of!(PrivateFieldExpression, field) == 24); + assert!(offset_of!(PrivateFieldExpression, optional) == 48); // Padding: 6 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(CallExpression, span) == 0); - assert!(offset_of!(CallExpression, callee) == 24); - assert!(offset_of!(CallExpression, type_arguments) == 40); - assert!(offset_of!(CallExpression, arguments) == 48); - assert!(offset_of!(CallExpression, optional) == 72); - assert!(offset_of!(CallExpression, pure) == 73); + assert!(offset_of!(CallExpression, callee) == 8); + assert!(offset_of!(CallExpression, type_arguments) == 24); + assert!(offset_of!(CallExpression, arguments) == 32); + assert!(offset_of!(CallExpression, optional) == 56); + assert!(offset_of!(CallExpression, pure) == 57); // Padding: 7 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(NewExpression, span) == 0); - assert!(offset_of!(NewExpression, callee) == 24); - assert!(offset_of!(NewExpression, type_arguments) == 40); - assert!(offset_of!(NewExpression, arguments) == 48); - assert!(offset_of!(NewExpression, pure) == 72); + assert!(offset_of!(NewExpression, callee) == 8); + assert!(offset_of!(NewExpression, type_arguments) == 24); + assert!(offset_of!(NewExpression, arguments) == 32); + assert!(offset_of!(NewExpression, pure) == 56); // Padding: 0 bytes - assert!(size_of::() == 104); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(MetaProperty, span) == 0); - assert!(offset_of!(MetaProperty, meta) == 24); - assert!(offset_of!(MetaProperty, property) == 64); + assert!(offset_of!(MetaProperty, meta) == 8); + assert!(offset_of!(MetaProperty, property) == 32); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(SpreadElement, span) == 0); - assert!(offset_of!(SpreadElement, argument) == 24); + assert!(offset_of!(SpreadElement, argument) == 8); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 6 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(UpdateExpression, span) == 0); - assert!(offset_of!(UpdateExpression, operator) == 40); - assert!(offset_of!(UpdateExpression, prefix) == 41); - assert!(offset_of!(UpdateExpression, argument) == 24); + assert!(offset_of!(UpdateExpression, operator) == 24); + assert!(offset_of!(UpdateExpression, prefix) == 25); + assert!(offset_of!(UpdateExpression, argument) == 8); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(UnaryExpression, span) == 0); - assert!(offset_of!(UnaryExpression, operator) == 40); - assert!(offset_of!(UnaryExpression, argument) == 24); + assert!(offset_of!(UnaryExpression, operator) == 24); + assert!(offset_of!(UnaryExpression, argument) == 8); // Padding: 7 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(BinaryExpression, span) == 0); - assert!(offset_of!(BinaryExpression, left) == 24); - assert!(offset_of!(BinaryExpression, operator) == 56); - assert!(offset_of!(BinaryExpression, right) == 40); + assert!(offset_of!(BinaryExpression, left) == 8); + assert!(offset_of!(BinaryExpression, operator) == 40); + assert!(offset_of!(BinaryExpression, right) == 24); // Padding: 0 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(PrivateInExpression, span) == 0); - assert!(offset_of!(PrivateInExpression, left) == 24); - assert!(offset_of!(PrivateInExpression, right) == 64); + assert!(offset_of!(PrivateInExpression, left) == 8); + assert!(offset_of!(PrivateInExpression, right) == 32); // Padding: 7 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(LogicalExpression, span) == 0); - assert!(offset_of!(LogicalExpression, left) == 24); - assert!(offset_of!(LogicalExpression, operator) == 56); - assert!(offset_of!(LogicalExpression, right) == 40); + assert!(offset_of!(LogicalExpression, left) == 8); + assert!(offset_of!(LogicalExpression, operator) == 40); + assert!(offset_of!(LogicalExpression, right) == 24); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(ConditionalExpression, span) == 0); - assert!(offset_of!(ConditionalExpression, test) == 24); - assert!(offset_of!(ConditionalExpression, consequent) == 40); - assert!(offset_of!(ConditionalExpression, alternate) == 56); + assert!(offset_of!(ConditionalExpression, test) == 8); + assert!(offset_of!(ConditionalExpression, consequent) == 24); + assert!(offset_of!(ConditionalExpression, alternate) == 40); // Padding: 7 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(AssignmentExpression, span) == 0); - assert!(offset_of!(AssignmentExpression, operator) == 56); - assert!(offset_of!(AssignmentExpression, left) == 24); - assert!(offset_of!(AssignmentExpression, right) == 40); + assert!(offset_of!(AssignmentExpression, operator) == 40); + assert!(offset_of!(AssignmentExpression, left) == 8); + assert!(offset_of!(AssignmentExpression, right) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); @@ -250,276 +250,276 @@ const _: () = { assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(ArrayAssignmentTarget, span) == 0); - assert!(offset_of!(ArrayAssignmentTarget, elements) == 24); - assert!(offset_of!(ArrayAssignmentTarget, rest) == 48); + assert!(offset_of!(ArrayAssignmentTarget, elements) == 8); + assert!(offset_of!(ArrayAssignmentTarget, rest) == 32); // Padding: 0 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(ObjectAssignmentTarget, span) == 0); - assert!(offset_of!(ObjectAssignmentTarget, properties) == 24); - assert!(offset_of!(ObjectAssignmentTarget, rest) == 48); + assert!(offset_of!(ObjectAssignmentTarget, properties) == 8); + assert!(offset_of!(ObjectAssignmentTarget, rest) == 32); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(AssignmentTargetRest, span) == 0); - assert!(offset_of!(AssignmentTargetRest, target) == 24); + assert!(offset_of!(AssignmentTargetRest, target) == 8); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(AssignmentTargetWithDefault, span) == 0); - assert!(offset_of!(AssignmentTargetWithDefault, binding) == 24); - assert!(offset_of!(AssignmentTargetWithDefault, init) == 40); + assert!(offset_of!(AssignmentTargetWithDefault, binding) == 8); + assert!(offset_of!(AssignmentTargetWithDefault, init) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(AssignmentTargetPropertyIdentifier, span) == 0); - assert!(offset_of!(AssignmentTargetPropertyIdentifier, binding) == 24); - assert!(offset_of!(AssignmentTargetPropertyIdentifier, init) == 72); + assert!(offset_of!(AssignmentTargetPropertyIdentifier, binding) == 8); + assert!(offset_of!(AssignmentTargetPropertyIdentifier, init) == 40); // Padding: 7 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(AssignmentTargetPropertyProperty, span) == 0); - assert!(offset_of!(AssignmentTargetPropertyProperty, name) == 24); - assert!(offset_of!(AssignmentTargetPropertyProperty, binding) == 40); - assert!(offset_of!(AssignmentTargetPropertyProperty, computed) == 56); + assert!(offset_of!(AssignmentTargetPropertyProperty, name) == 8); + assert!(offset_of!(AssignmentTargetPropertyProperty, binding) == 24); + assert!(offset_of!(AssignmentTargetPropertyProperty, computed) == 40); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(SequenceExpression, span) == 0); - assert!(offset_of!(SequenceExpression, expressions) == 24); + assert!(offset_of!(SequenceExpression, expressions) == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(Super, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(AwaitExpression, span) == 0); - assert!(offset_of!(AwaitExpression, argument) == 24); + assert!(offset_of!(AwaitExpression, argument) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(ChainExpression, span) == 0); - assert!(offset_of!(ChainExpression, expression) == 24); + assert!(offset_of!(ChainExpression, expression) == 8); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(ParenthesizedExpression, span) == 0); - assert!(offset_of!(ParenthesizedExpression, expression) == 24); + assert!(offset_of!(ParenthesizedExpression, expression) == 8); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 104); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(Directive, span) == 0); - assert!(offset_of!(Directive, expression) == 24); - assert!(offset_of!(Directive, directive) == 88); + assert!(offset_of!(Directive, expression) == 8); + assert!(offset_of!(Directive, directive) == 56); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(Hashbang, span) == 0); - assert!(offset_of!(Hashbang, value) == 24); + assert!(offset_of!(Hashbang, value) == 8); // Padding: 4 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(BlockStatement, span) == 0); - assert!(offset_of!(BlockStatement, body) == 24); - assert!(offset_of!(BlockStatement, scope_id) == 48); + assert!(offset_of!(BlockStatement, body) == 8); + assert!(offset_of!(BlockStatement, scope_id) == 32); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 6 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(VariableDeclaration, span) == 0); - assert!(offset_of!(VariableDeclaration, kind) == 48); - assert!(offset_of!(VariableDeclaration, declarations) == 24); - assert!(offset_of!(VariableDeclaration, declare) == 49); + assert!(offset_of!(VariableDeclaration, kind) == 32); + assert!(offset_of!(VariableDeclaration, declarations) == 8); + assert!(offset_of!(VariableDeclaration, declare) == 33); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 6 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(VariableDeclarator, span) == 0); - assert!(offset_of!(VariableDeclarator, kind) == 72); - assert!(offset_of!(VariableDeclarator, id) == 24); - assert!(offset_of!(VariableDeclarator, init) == 56); - assert!(offset_of!(VariableDeclarator, definite) == 73); + assert!(offset_of!(VariableDeclarator, kind) == 56); + assert!(offset_of!(VariableDeclarator, id) == 8); + assert!(offset_of!(VariableDeclarator, init) == 40); + assert!(offset_of!(VariableDeclarator, definite) == 57); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(EmptyStatement, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(ExpressionStatement, span) == 0); - assert!(offset_of!(ExpressionStatement, expression) == 24); + assert!(offset_of!(ExpressionStatement, expression) == 8); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(IfStatement, span) == 0); - assert!(offset_of!(IfStatement, test) == 24); - assert!(offset_of!(IfStatement, consequent) == 40); - assert!(offset_of!(IfStatement, alternate) == 56); + assert!(offset_of!(IfStatement, test) == 8); + assert!(offset_of!(IfStatement, consequent) == 24); + assert!(offset_of!(IfStatement, alternate) == 40); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(DoWhileStatement, span) == 0); - assert!(offset_of!(DoWhileStatement, body) == 24); - assert!(offset_of!(DoWhileStatement, test) == 40); + assert!(offset_of!(DoWhileStatement, body) == 8); + assert!(offset_of!(DoWhileStatement, test) == 24); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(WhileStatement, span) == 0); - assert!(offset_of!(WhileStatement, test) == 24); - assert!(offset_of!(WhileStatement, body) == 40); + assert!(offset_of!(WhileStatement, test) == 8); + assert!(offset_of!(WhileStatement, body) == 24); // Padding: 4 bytes - assert!(size_of::() == 96); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(ForStatement, span) == 0); - assert!(offset_of!(ForStatement, init) == 24); - assert!(offset_of!(ForStatement, test) == 40); - assert!(offset_of!(ForStatement, update) == 56); - assert!(offset_of!(ForStatement, body) == 72); - assert!(offset_of!(ForStatement, scope_id) == 88); + assert!(offset_of!(ForStatement, init) == 8); + assert!(offset_of!(ForStatement, test) == 24); + assert!(offset_of!(ForStatement, update) == 40); + assert!(offset_of!(ForStatement, body) == 56); + assert!(offset_of!(ForStatement, scope_id) == 72); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 4 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(ForInStatement, span) == 0); - assert!(offset_of!(ForInStatement, left) == 24); - assert!(offset_of!(ForInStatement, right) == 40); - assert!(offset_of!(ForInStatement, body) == 56); - assert!(offset_of!(ForInStatement, scope_id) == 72); + assert!(offset_of!(ForInStatement, left) == 8); + assert!(offset_of!(ForInStatement, right) == 24); + assert!(offset_of!(ForInStatement, body) == 40); + assert!(offset_of!(ForInStatement, scope_id) == 56); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 3 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(ForOfStatement, span) == 0); - assert!(offset_of!(ForOfStatement, r#await) == 76); - assert!(offset_of!(ForOfStatement, left) == 24); - assert!(offset_of!(ForOfStatement, right) == 40); - assert!(offset_of!(ForOfStatement, body) == 56); - assert!(offset_of!(ForOfStatement, scope_id) == 72); + assert!(offset_of!(ForOfStatement, r#await) == 60); + assert!(offset_of!(ForOfStatement, left) == 8); + assert!(offset_of!(ForOfStatement, right) == 24); + assert!(offset_of!(ForOfStatement, body) == 40); + assert!(offset_of!(ForOfStatement, scope_id) == 56); // Padding: 0 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(ContinueStatement, span) == 0); - assert!(offset_of!(ContinueStatement, label) == 24); + assert!(offset_of!(ContinueStatement, label) == 8); // Padding: 0 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(BreakStatement, span) == 0); - assert!(offset_of!(BreakStatement, label) == 24); + assert!(offset_of!(BreakStatement, label) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(ReturnStatement, span) == 0); - assert!(offset_of!(ReturnStatement, argument) == 24); + assert!(offset_of!(ReturnStatement, argument) == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(WithStatement, span) == 0); - assert!(offset_of!(WithStatement, object) == 24); - assert!(offset_of!(WithStatement, body) == 40); + assert!(offset_of!(WithStatement, object) == 8); + assert!(offset_of!(WithStatement, body) == 24); // Padding: 4 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(SwitchStatement, span) == 0); - assert!(offset_of!(SwitchStatement, discriminant) == 24); - assert!(offset_of!(SwitchStatement, cases) == 40); - assert!(offset_of!(SwitchStatement, scope_id) == 64); + assert!(offset_of!(SwitchStatement, discriminant) == 8); + assert!(offset_of!(SwitchStatement, cases) == 24); + assert!(offset_of!(SwitchStatement, scope_id) == 48); // Padding: 0 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(SwitchCase, span) == 0); - assert!(offset_of!(SwitchCase, test) == 24); - assert!(offset_of!(SwitchCase, consequent) == 40); + assert!(offset_of!(SwitchCase, test) == 8); + assert!(offset_of!(SwitchCase, consequent) == 24); // Padding: 0 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(LabeledStatement, span) == 0); - assert!(offset_of!(LabeledStatement, label) == 24); - assert!(offset_of!(LabeledStatement, body) == 64); + assert!(offset_of!(LabeledStatement, label) == 8); + assert!(offset_of!(LabeledStatement, body) == 32); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(ThrowStatement, span) == 0); - assert!(offset_of!(ThrowStatement, argument) == 24); + assert!(offset_of!(ThrowStatement, argument) == 8); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TryStatement, span) == 0); - assert!(offset_of!(TryStatement, block) == 24); - assert!(offset_of!(TryStatement, handler) == 32); - assert!(offset_of!(TryStatement, finalizer) == 40); + assert!(offset_of!(TryStatement, block) == 8); + assert!(offset_of!(TryStatement, handler) == 16); + assert!(offset_of!(TryStatement, finalizer) == 24); // Padding: 4 bytes - assert!(size_of::() == 96); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(CatchClause, span) == 0); - assert!(offset_of!(CatchClause, param) == 24); - assert!(offset_of!(CatchClause, body) == 80); - assert!(offset_of!(CatchClause, scope_id) == 88); + assert!(offset_of!(CatchClause, param) == 8); + assert!(offset_of!(CatchClause, body) == 48); + assert!(offset_of!(CatchClause, scope_id) == 56); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(CatchParameter, span) == 0); - assert!(offset_of!(CatchParameter, pattern) == 24); + assert!(offset_of!(CatchParameter, pattern) == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(DebuggerStatement, span) == 0); @@ -534,172 +534,172 @@ const _: () = { assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(AssignmentPattern, span) == 0); - assert!(offset_of!(AssignmentPattern, left) == 24); - assert!(offset_of!(AssignmentPattern, right) == 56); + assert!(offset_of!(AssignmentPattern, left) == 8); + assert!(offset_of!(AssignmentPattern, right) == 40); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(ObjectPattern, span) == 0); - assert!(offset_of!(ObjectPattern, properties) == 24); - assert!(offset_of!(ObjectPattern, rest) == 48); + assert!(offset_of!(ObjectPattern, properties) == 8); + assert!(offset_of!(ObjectPattern, rest) == 32); // Padding: 6 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(BindingProperty, span) == 0); - assert!(offset_of!(BindingProperty, key) == 24); - assert!(offset_of!(BindingProperty, value) == 40); - assert!(offset_of!(BindingProperty, shorthand) == 72); - assert!(offset_of!(BindingProperty, computed) == 73); + assert!(offset_of!(BindingProperty, key) == 8); + assert!(offset_of!(BindingProperty, value) == 24); + assert!(offset_of!(BindingProperty, shorthand) == 56); + assert!(offset_of!(BindingProperty, computed) == 57); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(ArrayPattern, span) == 0); - assert!(offset_of!(ArrayPattern, elements) == 24); - assert!(offset_of!(ArrayPattern, rest) == 48); + assert!(offset_of!(ArrayPattern, elements) == 8); + assert!(offset_of!(ArrayPattern, rest) == 32); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(BindingRestElement, span) == 0); - assert!(offset_of!(BindingRestElement, argument) == 24); + assert!(offset_of!(BindingRestElement, argument) == 8); // Padding: 7 bytes - assert!(size_of::() == 128); + assert!(size_of::() == 96); assert!(align_of::() == 8); assert!(offset_of!(Function, span) == 0); - assert!(offset_of!(Function, r#type) == 116); - assert!(offset_of!(Function, id) == 24); - assert!(offset_of!(Function, generator) == 117); - assert!(offset_of!(Function, r#async) == 118); - assert!(offset_of!(Function, declare) == 119); - assert!(offset_of!(Function, type_parameters) == 72); - assert!(offset_of!(Function, this_param) == 80); - assert!(offset_of!(Function, params) == 88); - assert!(offset_of!(Function, return_type) == 96); - assert!(offset_of!(Function, body) == 104); - assert!(offset_of!(Function, scope_id) == 112); - assert!(offset_of!(Function, pure) == 120); + assert!(offset_of!(Function, r#type) == 84); + assert!(offset_of!(Function, id) == 8); + assert!(offset_of!(Function, generator) == 85); + assert!(offset_of!(Function, r#async) == 86); + assert!(offset_of!(Function, declare) == 87); + assert!(offset_of!(Function, type_parameters) == 40); + assert!(offset_of!(Function, this_param) == 48); + assert!(offset_of!(Function, params) == 56); + assert!(offset_of!(Function, return_type) == 64); + assert!(offset_of!(Function, body) == 72); + assert!(offset_of!(Function, scope_id) == 80); + assert!(offset_of!(Function, pure) == 88); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 7 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(FormalParameters, span) == 0); - assert!(offset_of!(FormalParameters, kind) == 56); - assert!(offset_of!(FormalParameters, items) == 24); - assert!(offset_of!(FormalParameters, rest) == 48); + assert!(offset_of!(FormalParameters, kind) == 40); + assert!(offset_of!(FormalParameters, items) == 8); + assert!(offset_of!(FormalParameters, rest) == 32); // Padding: 5 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(FormalParameter, span) == 0); - assert!(offset_of!(FormalParameter, decorators) == 24); - assert!(offset_of!(FormalParameter, pattern) == 48); - assert!(offset_of!(FormalParameter, accessibility) == 80); - assert!(offset_of!(FormalParameter, readonly) == 81); - assert!(offset_of!(FormalParameter, r#override) == 82); + assert!(offset_of!(FormalParameter, decorators) == 8); + assert!(offset_of!(FormalParameter, pattern) == 32); + assert!(offset_of!(FormalParameter, accessibility) == 64); + assert!(offset_of!(FormalParameter, readonly) == 65); + assert!(offset_of!(FormalParameter, r#override) == 66); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(FunctionBody, span) == 0); - assert!(offset_of!(FunctionBody, directives) == 24); - assert!(offset_of!(FunctionBody, statements) == 48); + assert!(offset_of!(FunctionBody, directives) == 8); + assert!(offset_of!(FunctionBody, statements) == 32); // Padding: 1 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(ArrowFunctionExpression, span) == 0); - assert!(offset_of!(ArrowFunctionExpression, expression) == 60); - assert!(offset_of!(ArrowFunctionExpression, r#async) == 61); - assert!(offset_of!(ArrowFunctionExpression, type_parameters) == 24); - assert!(offset_of!(ArrowFunctionExpression, params) == 32); - assert!(offset_of!(ArrowFunctionExpression, return_type) == 40); - assert!(offset_of!(ArrowFunctionExpression, body) == 48); - assert!(offset_of!(ArrowFunctionExpression, scope_id) == 56); - assert!(offset_of!(ArrowFunctionExpression, pure) == 62); + assert!(offset_of!(ArrowFunctionExpression, expression) == 44); + assert!(offset_of!(ArrowFunctionExpression, r#async) == 45); + assert!(offset_of!(ArrowFunctionExpression, type_parameters) == 8); + assert!(offset_of!(ArrowFunctionExpression, params) == 16); + assert!(offset_of!(ArrowFunctionExpression, return_type) == 24); + assert!(offset_of!(ArrowFunctionExpression, body) == 32); + assert!(offset_of!(ArrowFunctionExpression, scope_id) == 40); + assert!(offset_of!(ArrowFunctionExpression, pure) == 46); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(YieldExpression, span) == 0); - assert!(offset_of!(YieldExpression, delegate) == 40); - assert!(offset_of!(YieldExpression, argument) == 24); + assert!(offset_of!(YieldExpression, delegate) == 24); + assert!(offset_of!(YieldExpression, argument) == 8); // Padding: 1 bytes - assert!(size_of::() == 168); + assert!(size_of::() == 136); assert!(align_of::() == 8); assert!(offset_of!(Class, span) == 0); - assert!(offset_of!(Class, r#type) == 164); - assert!(offset_of!(Class, decorators) == 24); - assert!(offset_of!(Class, id) == 48); - assert!(offset_of!(Class, type_parameters) == 96); - assert!(offset_of!(Class, super_class) == 104); - assert!(offset_of!(Class, super_type_arguments) == 120); - assert!(offset_of!(Class, implements) == 128); - assert!(offset_of!(Class, body) == 152); - assert!(offset_of!(Class, r#abstract) == 165); - assert!(offset_of!(Class, declare) == 166); - assert!(offset_of!(Class, scope_id) == 160); + assert!(offset_of!(Class, r#type) == 132); + assert!(offset_of!(Class, decorators) == 8); + assert!(offset_of!(Class, id) == 32); + assert!(offset_of!(Class, type_parameters) == 64); + assert!(offset_of!(Class, super_class) == 72); + assert!(offset_of!(Class, super_type_arguments) == 88); + assert!(offset_of!(Class, implements) == 96); + assert!(offset_of!(Class, body) == 120); + assert!(offset_of!(Class, r#abstract) == 133); + assert!(offset_of!(Class, declare) == 134); + assert!(offset_of!(Class, scope_id) == 128); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(ClassBody, span) == 0); - assert!(offset_of!(ClassBody, body) == 24); + assert!(offset_of!(ClassBody, body) == 8); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 1 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(MethodDefinition, span) == 0); - assert!(offset_of!(MethodDefinition, r#type) == 72); - assert!(offset_of!(MethodDefinition, decorators) == 24); - assert!(offset_of!(MethodDefinition, key) == 48); - assert!(offset_of!(MethodDefinition, value) == 64); - assert!(offset_of!(MethodDefinition, kind) == 73); - assert!(offset_of!(MethodDefinition, computed) == 74); - assert!(offset_of!(MethodDefinition, r#static) == 75); - assert!(offset_of!(MethodDefinition, r#override) == 76); - assert!(offset_of!(MethodDefinition, optional) == 77); - assert!(offset_of!(MethodDefinition, accessibility) == 78); + assert!(offset_of!(MethodDefinition, r#type) == 56); + assert!(offset_of!(MethodDefinition, decorators) == 8); + assert!(offset_of!(MethodDefinition, key) == 32); + assert!(offset_of!(MethodDefinition, value) == 48); + assert!(offset_of!(MethodDefinition, kind) == 57); + assert!(offset_of!(MethodDefinition, computed) == 58); + assert!(offset_of!(MethodDefinition, r#static) == 59); + assert!(offset_of!(MethodDefinition, r#override) == 60); + assert!(offset_of!(MethodDefinition, optional) == 61); + assert!(offset_of!(MethodDefinition, accessibility) == 62); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 7 bytes - assert!(size_of::() == 104); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(PropertyDefinition, span) == 0); - assert!(offset_of!(PropertyDefinition, r#type) == 88); - assert!(offset_of!(PropertyDefinition, decorators) == 24); - assert!(offset_of!(PropertyDefinition, key) == 48); - assert!(offset_of!(PropertyDefinition, type_annotation) == 64); - assert!(offset_of!(PropertyDefinition, value) == 72); - assert!(offset_of!(PropertyDefinition, computed) == 89); - assert!(offset_of!(PropertyDefinition, r#static) == 90); - assert!(offset_of!(PropertyDefinition, declare) == 91); - assert!(offset_of!(PropertyDefinition, r#override) == 92); - assert!(offset_of!(PropertyDefinition, optional) == 93); - assert!(offset_of!(PropertyDefinition, definite) == 94); - assert!(offset_of!(PropertyDefinition, readonly) == 95); - assert!(offset_of!(PropertyDefinition, accessibility) == 96); + assert!(offset_of!(PropertyDefinition, r#type) == 72); + assert!(offset_of!(PropertyDefinition, decorators) == 8); + assert!(offset_of!(PropertyDefinition, key) == 32); + assert!(offset_of!(PropertyDefinition, type_annotation) == 48); + assert!(offset_of!(PropertyDefinition, value) == 56); + assert!(offset_of!(PropertyDefinition, computed) == 73); + assert!(offset_of!(PropertyDefinition, r#static) == 74); + assert!(offset_of!(PropertyDefinition, declare) == 75); + assert!(offset_of!(PropertyDefinition, r#override) == 76); + assert!(offset_of!(PropertyDefinition, optional) == 77); + assert!(offset_of!(PropertyDefinition, definite) == 78); + assert!(offset_of!(PropertyDefinition, readonly) == 79); + assert!(offset_of!(PropertyDefinition, accessibility) == 80); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -708,17 +708,17 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(PrivateIdentifier, span) == 0); - assert!(offset_of!(PrivateIdentifier, name) == 24); + assert!(offset_of!(PrivateIdentifier, name) == 8); // Padding: 4 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(StaticBlock, span) == 0); - assert!(offset_of!(StaticBlock, body) == 24); - assert!(offset_of!(StaticBlock, scope_id) == 48); + assert!(offset_of!(StaticBlock, body) == 8); + assert!(offset_of!(StaticBlock, scope_id) == 32); assert!(size_of::() == 16); assert!(align_of::() == 8); @@ -727,37 +727,37 @@ const _: () = { assert!(align_of::() == 1); // Padding: 2 bytes - assert!(size_of::() == 96); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(AccessorProperty, span) == 0); - assert!(offset_of!(AccessorProperty, r#type) == 88); - assert!(offset_of!(AccessorProperty, decorators) == 24); - assert!(offset_of!(AccessorProperty, key) == 48); - assert!(offset_of!(AccessorProperty, type_annotation) == 64); - assert!(offset_of!(AccessorProperty, value) == 72); - assert!(offset_of!(AccessorProperty, computed) == 89); - assert!(offset_of!(AccessorProperty, r#static) == 90); - assert!(offset_of!(AccessorProperty, r#override) == 91); - assert!(offset_of!(AccessorProperty, definite) == 92); - assert!(offset_of!(AccessorProperty, accessibility) == 93); + assert!(offset_of!(AccessorProperty, r#type) == 72); + assert!(offset_of!(AccessorProperty, decorators) == 8); + assert!(offset_of!(AccessorProperty, key) == 32); + assert!(offset_of!(AccessorProperty, type_annotation) == 48); + assert!(offset_of!(AccessorProperty, value) == 56); + assert!(offset_of!(AccessorProperty, computed) == 73); + assert!(offset_of!(AccessorProperty, r#static) == 74); + assert!(offset_of!(AccessorProperty, r#override) == 75); + assert!(offset_of!(AccessorProperty, definite) == 76); + assert!(offset_of!(AccessorProperty, accessibility) == 77); // Padding: 7 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(ImportExpression, span) == 0); - assert!(offset_of!(ImportExpression, source) == 24); - assert!(offset_of!(ImportExpression, options) == 40); - assert!(offset_of!(ImportExpression, phase) == 56); + assert!(offset_of!(ImportExpression, source) == 8); + assert!(offset_of!(ImportExpression, options) == 24); + assert!(offset_of!(ImportExpression, phase) == 40); // Padding: 6 bytes - assert!(size_of::() == 128); + assert!(size_of::() == 96); assert!(align_of::() == 8); assert!(offset_of!(ImportDeclaration, span) == 0); - assert!(offset_of!(ImportDeclaration, specifiers) == 24); - assert!(offset_of!(ImportDeclaration, source) == 48); - assert!(offset_of!(ImportDeclaration, phase) == 120); - assert!(offset_of!(ImportDeclaration, with_clause) == 112); - assert!(offset_of!(ImportDeclaration, import_kind) == 121); + assert!(offset_of!(ImportDeclaration, specifiers) == 8); + assert!(offset_of!(ImportDeclaration, source) == 32); + assert!(offset_of!(ImportDeclaration, phase) == 88); + assert!(offset_of!(ImportDeclaration, with_clause) == 80); + assert!(offset_of!(ImportDeclaration, import_kind) == 89); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -766,130 +766,130 @@ const _: () = { assert!(align_of::() == 8); // Padding: 7 bytes - assert!(size_of::() == 152); + assert!(size_of::() == 104); assert!(align_of::() == 8); assert!(offset_of!(ImportSpecifier, span) == 0); - assert!(offset_of!(ImportSpecifier, imported) == 24); - assert!(offset_of!(ImportSpecifier, local) == 96); - assert!(offset_of!(ImportSpecifier, import_kind) == 144); + assert!(offset_of!(ImportSpecifier, imported) == 8); + assert!(offset_of!(ImportSpecifier, local) == 64); + assert!(offset_of!(ImportSpecifier, import_kind) == 96); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(ImportDefaultSpecifier, span) == 0); - assert!(offset_of!(ImportDefaultSpecifier, local) == 24); + assert!(offset_of!(ImportDefaultSpecifier, local) == 8); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(ImportNamespaceSpecifier, span) == 0); - assert!(offset_of!(ImportNamespaceSpecifier, local) == 24); + assert!(offset_of!(ImportNamespaceSpecifier, local) == 8); // Padding: 0 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(WithClause, span) == 0); - assert!(offset_of!(WithClause, attributes_keyword) == 24); - assert!(offset_of!(WithClause, with_entries) == 64); + assert!(offset_of!(WithClause, attributes_keyword) == 8); + assert!(offset_of!(WithClause, with_entries) == 32); // Padding: 0 bytes - assert!(size_of::() == 160); + assert!(size_of::() == 112); assert!(align_of::() == 8); assert!(offset_of!(ImportAttribute, span) == 0); - assert!(offset_of!(ImportAttribute, key) == 24); - assert!(offset_of!(ImportAttribute, value) == 96); + assert!(offset_of!(ImportAttribute, key) == 8); + assert!(offset_of!(ImportAttribute, value) == 64); - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); // Padding: 7 bytes - assert!(size_of::() == 144); + assert!(size_of::() == 112); assert!(align_of::() == 8); assert!(offset_of!(ExportNamedDeclaration, span) == 0); - assert!(offset_of!(ExportNamedDeclaration, declaration) == 24); - assert!(offset_of!(ExportNamedDeclaration, specifiers) == 40); - assert!(offset_of!(ExportNamedDeclaration, source) == 64); - assert!(offset_of!(ExportNamedDeclaration, export_kind) == 136); - assert!(offset_of!(ExportNamedDeclaration, with_clause) == 128); + assert!(offset_of!(ExportNamedDeclaration, declaration) == 8); + assert!(offset_of!(ExportNamedDeclaration, specifiers) == 24); + assert!(offset_of!(ExportNamedDeclaration, source) == 48); + assert!(offset_of!(ExportNamedDeclaration, export_kind) == 104); + assert!(offset_of!(ExportNamedDeclaration, with_clause) == 96); // Padding: 0 bytes - assert!(size_of::() == 112); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(ExportDefaultDeclaration, span) == 0); - assert!(offset_of!(ExportDefaultDeclaration, exported) == 24); - assert!(offset_of!(ExportDefaultDeclaration, declaration) == 96); + assert!(offset_of!(ExportDefaultDeclaration, exported) == 8); + assert!(offset_of!(ExportDefaultDeclaration, declaration) == 64); // Padding: 7 bytes - assert!(size_of::() == 176); + assert!(size_of::() == 128); assert!(align_of::() == 8); assert!(offset_of!(ExportAllDeclaration, span) == 0); - assert!(offset_of!(ExportAllDeclaration, exported) == 24); - assert!(offset_of!(ExportAllDeclaration, source) == 96); - assert!(offset_of!(ExportAllDeclaration, with_clause) == 160); - assert!(offset_of!(ExportAllDeclaration, export_kind) == 168); + assert!(offset_of!(ExportAllDeclaration, exported) == 8); + assert!(offset_of!(ExportAllDeclaration, source) == 64); + assert!(offset_of!(ExportAllDeclaration, with_clause) == 112); + assert!(offset_of!(ExportAllDeclaration, export_kind) == 120); // Padding: 7 bytes - assert!(size_of::() == 176); + assert!(size_of::() == 128); assert!(align_of::() == 8); assert!(offset_of!(ExportSpecifier, span) == 0); - assert!(offset_of!(ExportSpecifier, local) == 24); - assert!(offset_of!(ExportSpecifier, exported) == 96); - assert!(offset_of!(ExportSpecifier, export_kind) == 168); + assert!(offset_of!(ExportSpecifier, local) == 8); + assert!(offset_of!(ExportSpecifier, exported) == 64); + assert!(offset_of!(ExportSpecifier, export_kind) == 120); assert!(size_of::() == 16); assert!(align_of::() == 8); - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(V8IntrinsicExpression, span) == 0); - assert!(offset_of!(V8IntrinsicExpression, name) == 24); - assert!(offset_of!(V8IntrinsicExpression, arguments) == 64); + assert!(offset_of!(V8IntrinsicExpression, name) == 8); + assert!(offset_of!(V8IntrinsicExpression, arguments) == 32); // Padding: 7 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 8); assert!(offset_of!(BooleanLiteral, span) == 0); - assert!(offset_of!(BooleanLiteral, value) == 24); + assert!(offset_of!(BooleanLiteral, value) == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(NullLiteral, span) == 0); // Padding: 7 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(NumericLiteral, span) == 0); - assert!(offset_of!(NumericLiteral, value) == 24); - assert!(offset_of!(NumericLiteral, raw) == 32); - assert!(offset_of!(NumericLiteral, base) == 48); + assert!(offset_of!(NumericLiteral, value) == 8); + assert!(offset_of!(NumericLiteral, raw) == 16); + assert!(offset_of!(NumericLiteral, base) == 32); // Padding: 7 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(StringLiteral, span) == 0); - assert!(offset_of!(StringLiteral, value) == 24); - assert!(offset_of!(StringLiteral, raw) == 40); - assert!(offset_of!(StringLiteral, lone_surrogates) == 56); + assert!(offset_of!(StringLiteral, value) == 8); + assert!(offset_of!(StringLiteral, raw) == 24); + assert!(offset_of!(StringLiteral, lone_surrogates) == 40); // Padding: 7 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(BigIntLiteral, span) == 0); - assert!(offset_of!(BigIntLiteral, value) == 24); - assert!(offset_of!(BigIntLiteral, raw) == 40); - assert!(offset_of!(BigIntLiteral, base) == 56); + assert!(offset_of!(BigIntLiteral, value) == 8); + assert!(offset_of!(BigIntLiteral, raw) == 24); + assert!(offset_of!(BigIntLiteral, base) == 40); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(RegExpLiteral, span) == 0); - assert!(offset_of!(RegExpLiteral, regex) == 24); - assert!(offset_of!(RegExpLiteral, raw) == 56); + assert!(offset_of!(RegExpLiteral, regex) == 8); + assert!(offset_of!(RegExpLiteral, raw) == 40); // Padding: 7 bytes assert!(size_of::() == 32); @@ -908,42 +908,42 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(JSXElement, span) == 0); - assert!(offset_of!(JSXElement, opening_element) == 24); - assert!(offset_of!(JSXElement, children) == 32); - assert!(offset_of!(JSXElement, closing_element) == 56); + assert!(offset_of!(JSXElement, opening_element) == 8); + assert!(offset_of!(JSXElement, children) == 16); + assert!(offset_of!(JSXElement, closing_element) == 40); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(JSXOpeningElement, span) == 0); - assert!(offset_of!(JSXOpeningElement, name) == 24); - assert!(offset_of!(JSXOpeningElement, type_arguments) == 40); - assert!(offset_of!(JSXOpeningElement, attributes) == 48); + assert!(offset_of!(JSXOpeningElement, name) == 8); + assert!(offset_of!(JSXOpeningElement, type_arguments) == 24); + assert!(offset_of!(JSXOpeningElement, attributes) == 32); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(JSXClosingElement, span) == 0); - assert!(offset_of!(JSXClosingElement, name) == 24); + assert!(offset_of!(JSXClosingElement, name) == 8); // Padding: 0 bytes - assert!(size_of::() == 96); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(JSXFragment, span) == 0); - assert!(offset_of!(JSXFragment, opening_fragment) == 24); - assert!(offset_of!(JSXFragment, children) == 48); - assert!(offset_of!(JSXFragment, closing_fragment) == 72); + assert!(offset_of!(JSXFragment, opening_fragment) == 8); + assert!(offset_of!(JSXFragment, children) == 16); + assert!(offset_of!(JSXFragment, closing_fragment) == 40); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(JSXOpeningFragment, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(JSXClosingFragment, span) == 0); @@ -951,33 +951,33 @@ const _: () = { assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 104); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(JSXNamespacedName, span) == 0); - assert!(offset_of!(JSXNamespacedName, namespace) == 24); - assert!(offset_of!(JSXNamespacedName, name) == 64); + assert!(offset_of!(JSXNamespacedName, namespace) == 8); + assert!(offset_of!(JSXNamespacedName, name) == 32); // Padding: 0 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(JSXMemberExpression, span) == 0); - assert!(offset_of!(JSXMemberExpression, object) == 24); - assert!(offset_of!(JSXMemberExpression, property) == 40); + assert!(offset_of!(JSXMemberExpression, object) == 8); + assert!(offset_of!(JSXMemberExpression, property) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(JSXExpressionContainer, span) == 0); - assert!(offset_of!(JSXExpressionContainer, expression) == 24); + assert!(offset_of!(JSXExpressionContainer, expression) == 8); - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(JSXEmptyExpression, span) == 0); @@ -985,17 +985,17 @@ const _: () = { assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(JSXAttribute, span) == 0); - assert!(offset_of!(JSXAttribute, name) == 24); - assert!(offset_of!(JSXAttribute, value) == 40); + assert!(offset_of!(JSXAttribute, name) == 8); + assert!(offset_of!(JSXAttribute, value) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(JSXSpreadAttribute, span) == 0); - assert!(offset_of!(JSXSpreadAttribute, argument) == 24); + assert!(offset_of!(JSXSpreadAttribute, argument) == 8); assert!(size_of::() == 16); assert!(align_of::() == 8); @@ -1004,71 +1004,71 @@ const _: () = { assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(JSXIdentifier, span) == 0); - assert!(offset_of!(JSXIdentifier, name) == 24); + assert!(offset_of!(JSXIdentifier, name) == 8); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(JSXSpreadChild, span) == 0); - assert!(offset_of!(JSXSpreadChild, expression) == 24); + assert!(offset_of!(JSXSpreadChild, expression) == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(JSXText, span) == 0); - assert!(offset_of!(JSXText, value) == 24); - assert!(offset_of!(JSXText, raw) == 40); + assert!(offset_of!(JSXText, value) == 8); + assert!(offset_of!(JSXText, raw) == 24); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSThisParameter, span) == 0); - assert!(offset_of!(TSThisParameter, this_span) == 24); - assert!(offset_of!(TSThisParameter, type_annotation) == 48); + assert!(offset_of!(TSThisParameter, this_span) == 8); + assert!(offset_of!(TSThisParameter, type_annotation) == 16); // Padding: 2 bytes - assert!(size_of::() == 128); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(TSEnumDeclaration, span) == 0); - assert!(offset_of!(TSEnumDeclaration, id) == 24); - assert!(offset_of!(TSEnumDeclaration, body) == 72); - assert!(offset_of!(TSEnumDeclaration, r#const) == 124); - assert!(offset_of!(TSEnumDeclaration, declare) == 125); - assert!(offset_of!(TSEnumDeclaration, scope_id) == 120); + assert!(offset_of!(TSEnumDeclaration, id) == 8); + assert!(offset_of!(TSEnumDeclaration, body) == 40); + assert!(offset_of!(TSEnumDeclaration, r#const) == 76); + assert!(offset_of!(TSEnumDeclaration, declare) == 77); + assert!(offset_of!(TSEnumDeclaration, scope_id) == 72); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSEnumBody, span) == 0); - assert!(offset_of!(TSEnumBody, members) == 24); + assert!(offset_of!(TSEnumBody, members) == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSEnumMember, span) == 0); - assert!(offset_of!(TSEnumMember, id) == 24); - assert!(offset_of!(TSEnumMember, initializer) == 40); + assert!(offset_of!(TSEnumMember, id) == 8); + assert!(offset_of!(TSEnumMember, initializer) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSTypeAnnotation, span) == 0); - assert!(offset_of!(TSTypeAnnotation, type_annotation) == 24); + assert!(offset_of!(TSTypeAnnotation, type_annotation) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSLiteralType, span) == 0); - assert!(offset_of!(TSLiteralType, literal) == 24); + assert!(offset_of!(TSLiteralType, literal) == 8); assert!(size_of::() == 16); assert!(align_of::() == 8); @@ -1077,499 +1077,499 @@ const _: () = { assert!(align_of::() == 8); // Padding: 4 bytes - assert!(size_of::() == 96); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(TSConditionalType, span) == 0); - assert!(offset_of!(TSConditionalType, check_type) == 24); - assert!(offset_of!(TSConditionalType, extends_type) == 40); - assert!(offset_of!(TSConditionalType, true_type) == 56); - assert!(offset_of!(TSConditionalType, false_type) == 72); - assert!(offset_of!(TSConditionalType, scope_id) == 88); + assert!(offset_of!(TSConditionalType, check_type) == 8); + assert!(offset_of!(TSConditionalType, extends_type) == 24); + assert!(offset_of!(TSConditionalType, true_type) == 40); + assert!(offset_of!(TSConditionalType, false_type) == 56); + assert!(offset_of!(TSConditionalType, scope_id) == 72); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSUnionType, span) == 0); - assert!(offset_of!(TSUnionType, types) == 24); + assert!(offset_of!(TSUnionType, types) == 8); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSIntersectionType, span) == 0); - assert!(offset_of!(TSIntersectionType, types) == 24); + assert!(offset_of!(TSIntersectionType, types) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSParenthesizedType, span) == 0); - assert!(offset_of!(TSParenthesizedType, type_annotation) == 24); + assert!(offset_of!(TSParenthesizedType, type_annotation) == 8); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSTypeOperator, span) == 0); - assert!(offset_of!(TSTypeOperator, operator) == 40); - assert!(offset_of!(TSTypeOperator, type_annotation) == 24); + assert!(offset_of!(TSTypeOperator, operator) == 24); + assert!(offset_of!(TSTypeOperator, type_annotation) == 8); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSArrayType, span) == 0); - assert!(offset_of!(TSArrayType, element_type) == 24); + assert!(offset_of!(TSArrayType, element_type) == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSIndexedAccessType, span) == 0); - assert!(offset_of!(TSIndexedAccessType, object_type) == 24); - assert!(offset_of!(TSIndexedAccessType, index_type) == 40); + assert!(offset_of!(TSIndexedAccessType, object_type) == 8); + assert!(offset_of!(TSIndexedAccessType, index_type) == 24); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSTupleType, span) == 0); - assert!(offset_of!(TSTupleType, element_types) == 24); + assert!(offset_of!(TSTupleType, element_types) == 8); // Padding: 7 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSNamedTupleMember, span) == 0); - assert!(offset_of!(TSNamedTupleMember, label) == 24); - assert!(offset_of!(TSNamedTupleMember, element_type) == 64); - assert!(offset_of!(TSNamedTupleMember, optional) == 80); + assert!(offset_of!(TSNamedTupleMember, label) == 8); + assert!(offset_of!(TSNamedTupleMember, element_type) == 32); + assert!(offset_of!(TSNamedTupleMember, optional) == 48); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSOptionalType, span) == 0); - assert!(offset_of!(TSOptionalType, type_annotation) == 24); + assert!(offset_of!(TSOptionalType, type_annotation) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSRestType, span) == 0); - assert!(offset_of!(TSRestType, type_annotation) == 24); + assert!(offset_of!(TSRestType, type_annotation) == 8); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(TSAnyKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(TSStringKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(TSBooleanKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(TSNumberKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(TSNeverKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(TSIntrinsicKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(TSUnknownKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(TSNullKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(TSUndefinedKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(TSVoidKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(TSSymbolKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(TSThisType, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(TSObjectKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(TSBigIntKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSTypeReference, span) == 0); - assert!(offset_of!(TSTypeReference, type_name) == 24); - assert!(offset_of!(TSTypeReference, type_arguments) == 40); + assert!(offset_of!(TSTypeReference, type_name) == 8); + assert!(offset_of!(TSTypeReference, type_arguments) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSQualifiedName, span) == 0); - assert!(offset_of!(TSQualifiedName, left) == 24); - assert!(offset_of!(TSQualifiedName, right) == 40); + assert!(offset_of!(TSQualifiedName, left) == 8); + assert!(offset_of!(TSQualifiedName, right) == 24); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSTypeParameterInstantiation, span) == 0); - assert!(offset_of!(TSTypeParameterInstantiation, params) == 24); + assert!(offset_of!(TSTypeParameterInstantiation, params) == 8); // Padding: 5 bytes - assert!(size_of::() == 112); + assert!(size_of::() == 80); assert!(align_of::() == 8); assert!(offset_of!(TSTypeParameter, span) == 0); - assert!(offset_of!(TSTypeParameter, name) == 24); - assert!(offset_of!(TSTypeParameter, constraint) == 72); - assert!(offset_of!(TSTypeParameter, default) == 88); - assert!(offset_of!(TSTypeParameter, r#in) == 104); - assert!(offset_of!(TSTypeParameter, out) == 105); - assert!(offset_of!(TSTypeParameter, r#const) == 106); + assert!(offset_of!(TSTypeParameter, name) == 8); + assert!(offset_of!(TSTypeParameter, constraint) == 40); + assert!(offset_of!(TSTypeParameter, default) == 56); + assert!(offset_of!(TSTypeParameter, r#in) == 72); + assert!(offset_of!(TSTypeParameter, out) == 73); + assert!(offset_of!(TSTypeParameter, r#const) == 74); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSTypeParameterDeclaration, span) == 0); - assert!(offset_of!(TSTypeParameterDeclaration, params) == 24); + assert!(offset_of!(TSTypeParameterDeclaration, params) == 8); // Padding: 3 bytes - assert!(size_of::() == 104); + assert!(size_of::() == 72); assert!(align_of::() == 8); assert!(offset_of!(TSTypeAliasDeclaration, span) == 0); - assert!(offset_of!(TSTypeAliasDeclaration, id) == 24); - assert!(offset_of!(TSTypeAliasDeclaration, type_parameters) == 72); - assert!(offset_of!(TSTypeAliasDeclaration, type_annotation) == 80); - assert!(offset_of!(TSTypeAliasDeclaration, declare) == 100); - assert!(offset_of!(TSTypeAliasDeclaration, scope_id) == 96); + assert!(offset_of!(TSTypeAliasDeclaration, id) == 8); + assert!(offset_of!(TSTypeAliasDeclaration, type_parameters) == 40); + assert!(offset_of!(TSTypeAliasDeclaration, type_annotation) == 48); + assert!(offset_of!(TSTypeAliasDeclaration, declare) == 68); + assert!(offset_of!(TSTypeAliasDeclaration, scope_id) == 64); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSClassImplements, span) == 0); - assert!(offset_of!(TSClassImplements, expression) == 24); - assert!(offset_of!(TSClassImplements, type_arguments) == 40); + assert!(offset_of!(TSClassImplements, expression) == 8); + assert!(offset_of!(TSClassImplements, type_arguments) == 24); // Padding: 3 bytes - assert!(size_of::() == 120); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(TSInterfaceDeclaration, span) == 0); - assert!(offset_of!(TSInterfaceDeclaration, id) == 24); - assert!(offset_of!(TSInterfaceDeclaration, type_parameters) == 72); - assert!(offset_of!(TSInterfaceDeclaration, extends) == 80); - assert!(offset_of!(TSInterfaceDeclaration, body) == 104); - assert!(offset_of!(TSInterfaceDeclaration, declare) == 116); - assert!(offset_of!(TSInterfaceDeclaration, scope_id) == 112); + assert!(offset_of!(TSInterfaceDeclaration, id) == 8); + assert!(offset_of!(TSInterfaceDeclaration, type_parameters) == 40); + assert!(offset_of!(TSInterfaceDeclaration, extends) == 48); + assert!(offset_of!(TSInterfaceDeclaration, body) == 72); + assert!(offset_of!(TSInterfaceDeclaration, declare) == 84); + assert!(offset_of!(TSInterfaceDeclaration, scope_id) == 80); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSInterfaceBody, span) == 0); - assert!(offset_of!(TSInterfaceBody, body) == 24); + assert!(offset_of!(TSInterfaceBody, body) == 8); // Padding: 5 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSPropertySignature, span) == 0); - assert!(offset_of!(TSPropertySignature, computed) == 48); - assert!(offset_of!(TSPropertySignature, optional) == 49); - assert!(offset_of!(TSPropertySignature, readonly) == 50); - assert!(offset_of!(TSPropertySignature, key) == 24); - assert!(offset_of!(TSPropertySignature, type_annotation) == 40); + assert!(offset_of!(TSPropertySignature, computed) == 32); + assert!(offset_of!(TSPropertySignature, optional) == 33); + assert!(offset_of!(TSPropertySignature, readonly) == 34); + assert!(offset_of!(TSPropertySignature, key) == 8); + assert!(offset_of!(TSPropertySignature, type_annotation) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 6 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSIndexSignature, span) == 0); - assert!(offset_of!(TSIndexSignature, parameters) == 24); - assert!(offset_of!(TSIndexSignature, type_annotation) == 48); - assert!(offset_of!(TSIndexSignature, readonly) == 56); - assert!(offset_of!(TSIndexSignature, r#static) == 57); + assert!(offset_of!(TSIndexSignature, parameters) == 8); + assert!(offset_of!(TSIndexSignature, type_annotation) == 32); + assert!(offset_of!(TSIndexSignature, readonly) == 40); + assert!(offset_of!(TSIndexSignature, r#static) == 41); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSCallSignatureDeclaration, span) == 0); - assert!(offset_of!(TSCallSignatureDeclaration, type_parameters) == 24); - assert!(offset_of!(TSCallSignatureDeclaration, this_param) == 32); - assert!(offset_of!(TSCallSignatureDeclaration, params) == 40); - assert!(offset_of!(TSCallSignatureDeclaration, return_type) == 48); + assert!(offset_of!(TSCallSignatureDeclaration, type_parameters) == 8); + assert!(offset_of!(TSCallSignatureDeclaration, this_param) == 16); + assert!(offset_of!(TSCallSignatureDeclaration, params) == 24); + assert!(offset_of!(TSCallSignatureDeclaration, return_type) == 32); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 1 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(TSMethodSignature, span) == 0); - assert!(offset_of!(TSMethodSignature, key) == 24); - assert!(offset_of!(TSMethodSignature, computed) == 76); - assert!(offset_of!(TSMethodSignature, optional) == 77); - assert!(offset_of!(TSMethodSignature, kind) == 78); - assert!(offset_of!(TSMethodSignature, type_parameters) == 40); - assert!(offset_of!(TSMethodSignature, this_param) == 48); - assert!(offset_of!(TSMethodSignature, params) == 56); - assert!(offset_of!(TSMethodSignature, return_type) == 64); - assert!(offset_of!(TSMethodSignature, scope_id) == 72); + assert!(offset_of!(TSMethodSignature, key) == 8); + assert!(offset_of!(TSMethodSignature, computed) == 60); + assert!(offset_of!(TSMethodSignature, optional) == 61); + assert!(offset_of!(TSMethodSignature, kind) == 62); + assert!(offset_of!(TSMethodSignature, type_parameters) == 24); + assert!(offset_of!(TSMethodSignature, this_param) == 32); + assert!(offset_of!(TSMethodSignature, params) == 40); + assert!(offset_of!(TSMethodSignature, return_type) == 48); + assert!(offset_of!(TSMethodSignature, scope_id) == 56); // Padding: 4 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSConstructSignatureDeclaration, span) == 0); - assert!(offset_of!(TSConstructSignatureDeclaration, type_parameters) == 24); - assert!(offset_of!(TSConstructSignatureDeclaration, params) == 32); - assert!(offset_of!(TSConstructSignatureDeclaration, return_type) == 40); - assert!(offset_of!(TSConstructSignatureDeclaration, scope_id) == 48); + assert!(offset_of!(TSConstructSignatureDeclaration, type_parameters) == 8); + assert!(offset_of!(TSConstructSignatureDeclaration, params) == 16); + assert!(offset_of!(TSConstructSignatureDeclaration, return_type) == 24); + assert!(offset_of!(TSConstructSignatureDeclaration, scope_id) == 32); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSIndexSignatureName, span) == 0); - assert!(offset_of!(TSIndexSignatureName, name) == 24); - assert!(offset_of!(TSIndexSignatureName, type_annotation) == 40); + assert!(offset_of!(TSIndexSignatureName, name) == 8); + assert!(offset_of!(TSIndexSignatureName, type_annotation) == 24); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSInterfaceHeritage, span) == 0); - assert!(offset_of!(TSInterfaceHeritage, expression) == 24); - assert!(offset_of!(TSInterfaceHeritage, type_arguments) == 40); + assert!(offset_of!(TSInterfaceHeritage, expression) == 8); + assert!(offset_of!(TSInterfaceHeritage, type_arguments) == 24); // Padding: 7 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSTypePredicate, span) == 0); - assert!(offset_of!(TSTypePredicate, parameter_name) == 24); - assert!(offset_of!(TSTypePredicate, asserts) == 64); - assert!(offset_of!(TSTypePredicate, type_annotation) == 56); + assert!(offset_of!(TSTypePredicate, parameter_name) == 8); + assert!(offset_of!(TSTypePredicate, asserts) == 32); + assert!(offset_of!(TSTypePredicate, type_annotation) == 24); - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 2 bytes - assert!(size_of::() == 120); + assert!(size_of::() == 88); assert!(align_of::() == 8); assert!(offset_of!(TSModuleDeclaration, span) == 0); - assert!(offset_of!(TSModuleDeclaration, id) == 24); - assert!(offset_of!(TSModuleDeclaration, body) == 96); - assert!(offset_of!(TSModuleDeclaration, kind) == 116); - assert!(offset_of!(TSModuleDeclaration, declare) == 117); - assert!(offset_of!(TSModuleDeclaration, scope_id) == 112); + assert!(offset_of!(TSModuleDeclaration, id) == 8); + assert!(offset_of!(TSModuleDeclaration, body) == 64); + assert!(offset_of!(TSModuleDeclaration, kind) == 84); + assert!(offset_of!(TSModuleDeclaration, declare) == 85); + assert!(offset_of!(TSModuleDeclaration, scope_id) == 80); assert!(size_of::() == 1); assert!(align_of::() == 1); - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSModuleBlock, span) == 0); - assert!(offset_of!(TSModuleBlock, directives) == 24); - assert!(offset_of!(TSModuleBlock, body) == 48); + assert!(offset_of!(TSModuleBlock, directives) == 8); + assert!(offset_of!(TSModuleBlock, body) == 32); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSTypeLiteral, span) == 0); - assert!(offset_of!(TSTypeLiteral, members) == 24); + assert!(offset_of!(TSTypeLiteral, members) == 8); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 8); assert!(offset_of!(TSInferType, span) == 0); - assert!(offset_of!(TSInferType, type_parameter) == 24); + assert!(offset_of!(TSInferType, type_parameter) == 8); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSTypeQuery, span) == 0); - assert!(offset_of!(TSTypeQuery, expr_name) == 24); - assert!(offset_of!(TSTypeQuery, type_arguments) == 40); + assert!(offset_of!(TSTypeQuery, expr_name) == 8); + assert!(offset_of!(TSTypeQuery, type_arguments) == 24); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSImportType, span) == 0); - assert!(offset_of!(TSImportType, argument) == 24); - assert!(offset_of!(TSImportType, options) == 40); - assert!(offset_of!(TSImportType, qualifier) == 48); - assert!(offset_of!(TSImportType, type_arguments) == 64); + assert!(offset_of!(TSImportType, argument) == 8); + assert!(offset_of!(TSImportType, options) == 24); + assert!(offset_of!(TSImportType, qualifier) == 32); + assert!(offset_of!(TSImportType, type_arguments) == 48); // Padding: 4 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(TSFunctionType, span) == 0); - assert!(offset_of!(TSFunctionType, type_parameters) == 24); - assert!(offset_of!(TSFunctionType, this_param) == 32); - assert!(offset_of!(TSFunctionType, params) == 40); - assert!(offset_of!(TSFunctionType, return_type) == 48); - assert!(offset_of!(TSFunctionType, scope_id) == 56); + assert!(offset_of!(TSFunctionType, type_parameters) == 8); + assert!(offset_of!(TSFunctionType, this_param) == 16); + assert!(offset_of!(TSFunctionType, params) == 24); + assert!(offset_of!(TSFunctionType, return_type) == 32); + assert!(offset_of!(TSFunctionType, scope_id) == 40); // Padding: 7 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSConstructorType, span) == 0); - assert!(offset_of!(TSConstructorType, r#abstract) == 48); - assert!(offset_of!(TSConstructorType, type_parameters) == 24); - assert!(offset_of!(TSConstructorType, params) == 32); - assert!(offset_of!(TSConstructorType, return_type) == 40); + assert!(offset_of!(TSConstructorType, r#abstract) == 32); + assert!(offset_of!(TSConstructorType, type_parameters) == 8); + assert!(offset_of!(TSConstructorType, params) == 16); + assert!(offset_of!(TSConstructorType, return_type) == 24); // Padding: 2 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSMappedType, span) == 0); - assert!(offset_of!(TSMappedType, type_parameter) == 24); - assert!(offset_of!(TSMappedType, name_type) == 32); - assert!(offset_of!(TSMappedType, type_annotation) == 48); - assert!(offset_of!(TSMappedType, optional) == 68); - assert!(offset_of!(TSMappedType, readonly) == 69); - assert!(offset_of!(TSMappedType, scope_id) == 64); + assert!(offset_of!(TSMappedType, type_parameter) == 8); + assert!(offset_of!(TSMappedType, name_type) == 16); + assert!(offset_of!(TSMappedType, type_annotation) == 32); + assert!(offset_of!(TSMappedType, optional) == 52); + assert!(offset_of!(TSMappedType, readonly) == 53); + assert!(offset_of!(TSMappedType, scope_id) == 48); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSTemplateLiteralType, span) == 0); - assert!(offset_of!(TSTemplateLiteralType, quasis) == 24); - assert!(offset_of!(TSTemplateLiteralType, types) == 48); + assert!(offset_of!(TSTemplateLiteralType, quasis) == 8); + assert!(offset_of!(TSTemplateLiteralType, types) == 32); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSAsExpression, span) == 0); - assert!(offset_of!(TSAsExpression, expression) == 24); - assert!(offset_of!(TSAsExpression, type_annotation) == 40); + assert!(offset_of!(TSAsExpression, expression) == 8); + assert!(offset_of!(TSAsExpression, type_annotation) == 24); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSSatisfiesExpression, span) == 0); - assert!(offset_of!(TSSatisfiesExpression, expression) == 24); - assert!(offset_of!(TSSatisfiesExpression, type_annotation) == 40); + assert!(offset_of!(TSSatisfiesExpression, expression) == 8); + assert!(offset_of!(TSSatisfiesExpression, type_annotation) == 24); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSTypeAssertion, span) == 0); - assert!(offset_of!(TSTypeAssertion, type_annotation) == 24); - assert!(offset_of!(TSTypeAssertion, expression) == 40); + assert!(offset_of!(TSTypeAssertion, type_annotation) == 8); + assert!(offset_of!(TSTypeAssertion, expression) == 24); // Padding: 7 bytes - assert!(size_of::() == 96); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(TSImportEqualsDeclaration, span) == 0); - assert!(offset_of!(TSImportEqualsDeclaration, id) == 24); - assert!(offset_of!(TSImportEqualsDeclaration, module_reference) == 72); - assert!(offset_of!(TSImportEqualsDeclaration, import_kind) == 88); + assert!(offset_of!(TSImportEqualsDeclaration, id) == 8); + assert!(offset_of!(TSImportEqualsDeclaration, module_reference) == 40); + assert!(offset_of!(TSImportEqualsDeclaration, import_kind) == 56); assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(TSExternalModuleReference, span) == 0); - assert!(offset_of!(TSExternalModuleReference, expression) == 24); + assert!(offset_of!(TSExternalModuleReference, expression) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSNonNullExpression, span) == 0); - assert!(offset_of!(TSNonNullExpression, expression) == 24); + assert!(offset_of!(TSNonNullExpression, expression) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(Decorator, span) == 0); - assert!(offset_of!(Decorator, expression) == 24); + assert!(offset_of!(Decorator, expression) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(TSExportAssignment, span) == 0); - assert!(offset_of!(TSExportAssignment, expression) == 24); + assert!(offset_of!(TSExportAssignment, expression) == 8); // Padding: 0 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSNamespaceExportDeclaration, span) == 0); - assert!(offset_of!(TSNamespaceExportDeclaration, id) == 24); + assert!(offset_of!(TSNamespaceExportDeclaration, id) == 8); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(TSInstantiationExpression, span) == 0); - assert!(offset_of!(TSInstantiationExpression, expression) == 24); - assert!(offset_of!(TSInstantiationExpression, type_arguments) == 40); + assert!(offset_of!(TSInstantiationExpression, expression) == 8); + assert!(offset_of!(TSInstantiationExpression, type_arguments) == 24); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(JSDocNullableType, span) == 0); - assert!(offset_of!(JSDocNullableType, type_annotation) == 24); - assert!(offset_of!(JSDocNullableType, postfix) == 40); + assert!(offset_of!(JSDocNullableType, type_annotation) == 8); + assert!(offset_of!(JSDocNullableType, postfix) == 24); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(JSDocNonNullableType, span) == 0); - assert!(offset_of!(JSDocNonNullableType, type_annotation) == 24); - assert!(offset_of!(JSDocNonNullableType, postfix) == 40); + assert!(offset_of!(JSDocNonNullableType, type_annotation) == 8); + assert!(offset_of!(JSDocNonNullableType, postfix) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(JSDocUnknownType, span) == 0); @@ -1587,97 +1587,97 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 8); assert!(offset_of!(Comment, span) == 0); - assert!(offset_of!(Comment, attached_to) == 24); - assert!(offset_of!(Comment, kind) == 28); - assert!(offset_of!(Comment, position) == 29); - assert!(offset_of!(Comment, newlines) == 30); - assert!(offset_of!(Comment, content) == 31); + assert!(offset_of!(Comment, attached_to) == 8); + assert!(offset_of!(Comment, kind) == 12); + assert!(offset_of!(Comment, position) == 13); + assert!(offset_of!(Comment, newlines) == 14); + assert!(offset_of!(Comment, content) == 15); }; #[cfg(target_pointer_width = "32")] const _: () = { // Padding: 1 bytes - assert!(size_of::() == 120); + assert!(size_of::() == 88); assert!(align_of::() == 4); assert!(offset_of!(Program, span) == 0); - assert!(offset_of!(Program, source_type) == 116); - assert!(offset_of!(Program, source_text) == 24); - assert!(offset_of!(Program, comments) == 32); - assert!(offset_of!(Program, hashbang) == 48); - assert!(offset_of!(Program, directives) == 80); - assert!(offset_of!(Program, body) == 96); - assert!(offset_of!(Program, scope_id) == 112); + assert!(offset_of!(Program, source_type) == 84); + assert!(offset_of!(Program, source_text) == 8); + assert!(offset_of!(Program, comments) == 16); + assert!(offset_of!(Program, hashbang) == 32); + assert!(offset_of!(Program, directives) == 48); + assert!(offset_of!(Program, body) == 64); + assert!(offset_of!(Program, scope_id) == 80); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(IdentifierName, span) == 0); - assert!(offset_of!(IdentifierName, name) == 24); + assert!(offset_of!(IdentifierName, name) == 8); // Padding: 0 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(IdentifierReference, span) == 0); - assert!(offset_of!(IdentifierReference, name) == 24); - assert!(offset_of!(IdentifierReference, reference_id) == 32); + assert!(offset_of!(IdentifierReference, name) == 8); + assert!(offset_of!(IdentifierReference, reference_id) == 16); // Padding: 0 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(BindingIdentifier, span) == 0); - assert!(offset_of!(BindingIdentifier, name) == 24); - assert!(offset_of!(BindingIdentifier, symbol_id) == 32); + assert!(offset_of!(BindingIdentifier, name) == 8); + assert!(offset_of!(BindingIdentifier, symbol_id) == 16); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(LabelIdentifier, span) == 0); - assert!(offset_of!(LabelIdentifier, name) == 24); + assert!(offset_of!(LabelIdentifier, name) == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(ThisExpression, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(ArrayExpression, span) == 0); - assert!(offset_of!(ArrayExpression, elements) == 24); + assert!(offset_of!(ArrayExpression, elements) == 8); - assert!(size_of::() == 28); + assert!(size_of::() == 12); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(Elision, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(ObjectExpression, span) == 0); - assert!(offset_of!(ObjectExpression, properties) == 24); + assert!(offset_of!(ObjectExpression, properties) == 8); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(ObjectProperty, span) == 0); - assert!(offset_of!(ObjectProperty, kind) == 40); - assert!(offset_of!(ObjectProperty, key) == 24); - assert!(offset_of!(ObjectProperty, value) == 32); - assert!(offset_of!(ObjectProperty, method) == 41); - assert!(offset_of!(ObjectProperty, shorthand) == 42); - assert!(offset_of!(ObjectProperty, computed) == 43); + assert!(offset_of!(ObjectProperty, kind) == 24); + assert!(offset_of!(ObjectProperty, key) == 8); + assert!(offset_of!(ObjectProperty, value) == 16); + assert!(offset_of!(ObjectProperty, method) == 25); + assert!(offset_of!(ObjectProperty, shorthand) == 26); + assert!(offset_of!(ObjectProperty, computed) == 27); assert!(size_of::() == 8); assert!(align_of::() == 4); @@ -1686,27 +1686,27 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TemplateLiteral, span) == 0); - assert!(offset_of!(TemplateLiteral, quasis) == 24); - assert!(offset_of!(TemplateLiteral, expressions) == 40); + assert!(offset_of!(TemplateLiteral, quasis) == 8); + assert!(offset_of!(TemplateLiteral, expressions) == 24); // Padding: 0 bytes - assert!(size_of::() == 92); + assert!(size_of::() == 60); assert!(align_of::() == 4); assert!(offset_of!(TaggedTemplateExpression, span) == 0); - assert!(offset_of!(TaggedTemplateExpression, tag) == 24); - assert!(offset_of!(TaggedTemplateExpression, type_arguments) == 32); - assert!(offset_of!(TaggedTemplateExpression, quasi) == 36); + assert!(offset_of!(TaggedTemplateExpression, tag) == 8); + assert!(offset_of!(TaggedTemplateExpression, type_arguments) == 16); + assert!(offset_of!(TaggedTemplateExpression, quasi) == 20); // Padding: 2 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(TemplateElement, span) == 0); - assert!(offset_of!(TemplateElement, value) == 24); - assert!(offset_of!(TemplateElement, tail) == 40); - assert!(offset_of!(TemplateElement, lone_surrogates) == 41); + assert!(offset_of!(TemplateElement, value) == 8); + assert!(offset_of!(TemplateElement, tail) == 24); + assert!(offset_of!(TemplateElement, lone_surrogates) == 25); // Padding: 0 bytes assert!(size_of::() == 16); @@ -1718,117 +1718,117 @@ const _: () = { assert!(align_of::() == 4); // Padding: 3 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(ComputedMemberExpression, span) == 0); - assert!(offset_of!(ComputedMemberExpression, object) == 24); - assert!(offset_of!(ComputedMemberExpression, expression) == 32); - assert!(offset_of!(ComputedMemberExpression, optional) == 40); + assert!(offset_of!(ComputedMemberExpression, object) == 8); + assert!(offset_of!(ComputedMemberExpression, expression) == 16); + assert!(offset_of!(ComputedMemberExpression, optional) == 24); // Padding: 3 bytes - assert!(size_of::() == 68); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(StaticMemberExpression, span) == 0); - assert!(offset_of!(StaticMemberExpression, object) == 24); - assert!(offset_of!(StaticMemberExpression, property) == 32); - assert!(offset_of!(StaticMemberExpression, optional) == 64); + assert!(offset_of!(StaticMemberExpression, object) == 8); + assert!(offset_of!(StaticMemberExpression, property) == 16); + assert!(offset_of!(StaticMemberExpression, optional) == 32); // Padding: 3 bytes - assert!(size_of::() == 68); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(PrivateFieldExpression, span) == 0); - assert!(offset_of!(PrivateFieldExpression, object) == 24); - assert!(offset_of!(PrivateFieldExpression, field) == 32); - assert!(offset_of!(PrivateFieldExpression, optional) == 64); + assert!(offset_of!(PrivateFieldExpression, object) == 8); + assert!(offset_of!(PrivateFieldExpression, field) == 16); + assert!(offset_of!(PrivateFieldExpression, optional) == 32); // Padding: 2 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(CallExpression, span) == 0); - assert!(offset_of!(CallExpression, callee) == 24); - assert!(offset_of!(CallExpression, type_arguments) == 32); - assert!(offset_of!(CallExpression, arguments) == 36); - assert!(offset_of!(CallExpression, optional) == 52); - assert!(offset_of!(CallExpression, pure) == 53); + assert!(offset_of!(CallExpression, callee) == 8); + assert!(offset_of!(CallExpression, type_arguments) == 16); + assert!(offset_of!(CallExpression, arguments) == 20); + assert!(offset_of!(CallExpression, optional) == 36); + assert!(offset_of!(CallExpression, pure) == 37); // Padding: 3 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(NewExpression, span) == 0); - assert!(offset_of!(NewExpression, callee) == 24); - assert!(offset_of!(NewExpression, type_arguments) == 32); - assert!(offset_of!(NewExpression, arguments) == 36); - assert!(offset_of!(NewExpression, pure) == 52); + assert!(offset_of!(NewExpression, callee) == 8); + assert!(offset_of!(NewExpression, type_arguments) == 16); + assert!(offset_of!(NewExpression, arguments) == 20); + assert!(offset_of!(NewExpression, pure) == 36); // Padding: 0 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(MetaProperty, span) == 0); - assert!(offset_of!(MetaProperty, meta) == 24); - assert!(offset_of!(MetaProperty, property) == 56); + assert!(offset_of!(MetaProperty, meta) == 8); + assert!(offset_of!(MetaProperty, property) == 24); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(SpreadElement, span) == 0); - assert!(offset_of!(SpreadElement, argument) == 24); + assert!(offset_of!(SpreadElement, argument) == 8); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 2 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(UpdateExpression, span) == 0); - assert!(offset_of!(UpdateExpression, operator) == 32); - assert!(offset_of!(UpdateExpression, prefix) == 33); - assert!(offset_of!(UpdateExpression, argument) == 24); + assert!(offset_of!(UpdateExpression, operator) == 16); + assert!(offset_of!(UpdateExpression, prefix) == 17); + assert!(offset_of!(UpdateExpression, argument) == 8); // Padding: 3 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(UnaryExpression, span) == 0); - assert!(offset_of!(UnaryExpression, operator) == 32); - assert!(offset_of!(UnaryExpression, argument) == 24); + assert!(offset_of!(UnaryExpression, operator) == 16); + assert!(offset_of!(UnaryExpression, argument) == 8); // Padding: 3 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(BinaryExpression, span) == 0); - assert!(offset_of!(BinaryExpression, left) == 24); - assert!(offset_of!(BinaryExpression, operator) == 40); - assert!(offset_of!(BinaryExpression, right) == 32); + assert!(offset_of!(BinaryExpression, left) == 8); + assert!(offset_of!(BinaryExpression, operator) == 24); + assert!(offset_of!(BinaryExpression, right) == 16); // Padding: 0 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(PrivateInExpression, span) == 0); - assert!(offset_of!(PrivateInExpression, left) == 24); - assert!(offset_of!(PrivateInExpression, right) == 56); + assert!(offset_of!(PrivateInExpression, left) == 8); + assert!(offset_of!(PrivateInExpression, right) == 24); // Padding: 3 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(LogicalExpression, span) == 0); - assert!(offset_of!(LogicalExpression, left) == 24); - assert!(offset_of!(LogicalExpression, operator) == 40); - assert!(offset_of!(LogicalExpression, right) == 32); + assert!(offset_of!(LogicalExpression, left) == 8); + assert!(offset_of!(LogicalExpression, operator) == 24); + assert!(offset_of!(LogicalExpression, right) == 16); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(ConditionalExpression, span) == 0); - assert!(offset_of!(ConditionalExpression, test) == 24); - assert!(offset_of!(ConditionalExpression, consequent) == 32); - assert!(offset_of!(ConditionalExpression, alternate) == 40); + assert!(offset_of!(ConditionalExpression, test) == 8); + assert!(offset_of!(ConditionalExpression, consequent) == 16); + assert!(offset_of!(ConditionalExpression, alternate) == 24); // Padding: 3 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(AssignmentExpression, span) == 0); - assert!(offset_of!(AssignmentExpression, operator) == 40); - assert!(offset_of!(AssignmentExpression, left) == 24); - assert!(offset_of!(AssignmentExpression, right) == 32); + assert!(offset_of!(AssignmentExpression, operator) == 24); + assert!(offset_of!(AssignmentExpression, left) == 8); + assert!(offset_of!(AssignmentExpression, right) == 16); assert!(size_of::() == 8); assert!(align_of::() == 4); @@ -1840,276 +1840,276 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(ArrayAssignmentTarget, span) == 0); - assert!(offset_of!(ArrayAssignmentTarget, elements) == 24); - assert!(offset_of!(ArrayAssignmentTarget, rest) == 40); + assert!(offset_of!(ArrayAssignmentTarget, elements) == 8); + assert!(offset_of!(ArrayAssignmentTarget, rest) == 24); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(ObjectAssignmentTarget, span) == 0); - assert!(offset_of!(ObjectAssignmentTarget, properties) == 24); - assert!(offset_of!(ObjectAssignmentTarget, rest) == 40); + assert!(offset_of!(ObjectAssignmentTarget, properties) == 8); + assert!(offset_of!(ObjectAssignmentTarget, rest) == 24); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(AssignmentTargetRest, span) == 0); - assert!(offset_of!(AssignmentTargetRest, target) == 24); + assert!(offset_of!(AssignmentTargetRest, target) == 8); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(AssignmentTargetWithDefault, span) == 0); - assert!(offset_of!(AssignmentTargetWithDefault, binding) == 24); - assert!(offset_of!(AssignmentTargetWithDefault, init) == 32); + assert!(offset_of!(AssignmentTargetWithDefault, binding) == 8); + assert!(offset_of!(AssignmentTargetWithDefault, init) == 16); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 68); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(AssignmentTargetPropertyIdentifier, span) == 0); - assert!(offset_of!(AssignmentTargetPropertyIdentifier, binding) == 24); - assert!(offset_of!(AssignmentTargetPropertyIdentifier, init) == 60); + assert!(offset_of!(AssignmentTargetPropertyIdentifier, binding) == 8); + assert!(offset_of!(AssignmentTargetPropertyIdentifier, init) == 28); // Padding: 3 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(AssignmentTargetPropertyProperty, span) == 0); - assert!(offset_of!(AssignmentTargetPropertyProperty, name) == 24); - assert!(offset_of!(AssignmentTargetPropertyProperty, binding) == 32); - assert!(offset_of!(AssignmentTargetPropertyProperty, computed) == 40); + assert!(offset_of!(AssignmentTargetPropertyProperty, name) == 8); + assert!(offset_of!(AssignmentTargetPropertyProperty, binding) == 16); + assert!(offset_of!(AssignmentTargetPropertyProperty, computed) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(SequenceExpression, span) == 0); - assert!(offset_of!(SequenceExpression, expressions) == 24); + assert!(offset_of!(SequenceExpression, expressions) == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(Super, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(AwaitExpression, span) == 0); - assert!(offset_of!(AwaitExpression, argument) == 24); + assert!(offset_of!(AwaitExpression, argument) == 8); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(ChainExpression, span) == 0); - assert!(offset_of!(ChainExpression, expression) == 24); + assert!(offset_of!(ChainExpression, expression) == 8); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(ParenthesizedExpression, span) == 0); - assert!(offset_of!(ParenthesizedExpression, expression) == 24); + assert!(offset_of!(ParenthesizedExpression, expression) == 8); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 76); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(Directive, span) == 0); - assert!(offset_of!(Directive, expression) == 24); - assert!(offset_of!(Directive, directive) == 68); + assert!(offset_of!(Directive, expression) == 8); + assert!(offset_of!(Directive, directive) == 36); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(Hashbang, span) == 0); - assert!(offset_of!(Hashbang, value) == 24); + assert!(offset_of!(Hashbang, value) == 8); // Padding: 0 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(BlockStatement, span) == 0); - assert!(offset_of!(BlockStatement, body) == 24); - assert!(offset_of!(BlockStatement, scope_id) == 40); + assert!(offset_of!(BlockStatement, body) == 8); + assert!(offset_of!(BlockStatement, scope_id) == 24); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 2 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(VariableDeclaration, span) == 0); - assert!(offset_of!(VariableDeclaration, kind) == 40); - assert!(offset_of!(VariableDeclaration, declarations) == 24); - assert!(offset_of!(VariableDeclaration, declare) == 41); + assert!(offset_of!(VariableDeclaration, kind) == 24); + assert!(offset_of!(VariableDeclaration, declarations) == 8); + assert!(offset_of!(VariableDeclaration, declare) == 25); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 2 bytes - assert!(size_of::() == 52); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(VariableDeclarator, span) == 0); - assert!(offset_of!(VariableDeclarator, kind) == 48); - assert!(offset_of!(VariableDeclarator, id) == 24); - assert!(offset_of!(VariableDeclarator, init) == 40); - assert!(offset_of!(VariableDeclarator, definite) == 49); + assert!(offset_of!(VariableDeclarator, kind) == 32); + assert!(offset_of!(VariableDeclarator, id) == 8); + assert!(offset_of!(VariableDeclarator, init) == 24); + assert!(offset_of!(VariableDeclarator, definite) == 33); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(EmptyStatement, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(ExpressionStatement, span) == 0); - assert!(offset_of!(ExpressionStatement, expression) == 24); + assert!(offset_of!(ExpressionStatement, expression) == 8); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(IfStatement, span) == 0); - assert!(offset_of!(IfStatement, test) == 24); - assert!(offset_of!(IfStatement, consequent) == 32); - assert!(offset_of!(IfStatement, alternate) == 40); + assert!(offset_of!(IfStatement, test) == 8); + assert!(offset_of!(IfStatement, consequent) == 16); + assert!(offset_of!(IfStatement, alternate) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(DoWhileStatement, span) == 0); - assert!(offset_of!(DoWhileStatement, body) == 24); - assert!(offset_of!(DoWhileStatement, test) == 32); + assert!(offset_of!(DoWhileStatement, body) == 8); + assert!(offset_of!(DoWhileStatement, test) == 16); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(WhileStatement, span) == 0); - assert!(offset_of!(WhileStatement, test) == 24); - assert!(offset_of!(WhileStatement, body) == 32); + assert!(offset_of!(WhileStatement, test) == 8); + assert!(offset_of!(WhileStatement, body) == 16); // Padding: 0 bytes - assert!(size_of::() == 60); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(ForStatement, span) == 0); - assert!(offset_of!(ForStatement, init) == 24); - assert!(offset_of!(ForStatement, test) == 32); - assert!(offset_of!(ForStatement, update) == 40); - assert!(offset_of!(ForStatement, body) == 48); - assert!(offset_of!(ForStatement, scope_id) == 56); + assert!(offset_of!(ForStatement, init) == 8); + assert!(offset_of!(ForStatement, test) == 16); + assert!(offset_of!(ForStatement, update) == 24); + assert!(offset_of!(ForStatement, body) == 32); + assert!(offset_of!(ForStatement, scope_id) == 40); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 52); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(ForInStatement, span) == 0); - assert!(offset_of!(ForInStatement, left) == 24); - assert!(offset_of!(ForInStatement, right) == 32); - assert!(offset_of!(ForInStatement, body) == 40); - assert!(offset_of!(ForInStatement, scope_id) == 48); + assert!(offset_of!(ForInStatement, left) == 8); + assert!(offset_of!(ForInStatement, right) == 16); + assert!(offset_of!(ForInStatement, body) == 24); + assert!(offset_of!(ForInStatement, scope_id) == 32); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 3 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(ForOfStatement, span) == 0); - assert!(offset_of!(ForOfStatement, r#await) == 52); - assert!(offset_of!(ForOfStatement, left) == 24); - assert!(offset_of!(ForOfStatement, right) == 32); - assert!(offset_of!(ForOfStatement, body) == 40); - assert!(offset_of!(ForOfStatement, scope_id) == 48); + assert!(offset_of!(ForOfStatement, r#await) == 36); + assert!(offset_of!(ForOfStatement, left) == 8); + assert!(offset_of!(ForOfStatement, right) == 16); + assert!(offset_of!(ForOfStatement, body) == 24); + assert!(offset_of!(ForOfStatement, scope_id) == 32); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(ContinueStatement, span) == 0); - assert!(offset_of!(ContinueStatement, label) == 24); + assert!(offset_of!(ContinueStatement, label) == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(BreakStatement, span) == 0); - assert!(offset_of!(BreakStatement, label) == 24); + assert!(offset_of!(BreakStatement, label) == 8); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(ReturnStatement, span) == 0); - assert!(offset_of!(ReturnStatement, argument) == 24); + assert!(offset_of!(ReturnStatement, argument) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(WithStatement, span) == 0); - assert!(offset_of!(WithStatement, object) == 24); - assert!(offset_of!(WithStatement, body) == 32); + assert!(offset_of!(WithStatement, object) == 8); + assert!(offset_of!(WithStatement, body) == 16); // Padding: 0 bytes - assert!(size_of::() == 52); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(SwitchStatement, span) == 0); - assert!(offset_of!(SwitchStatement, discriminant) == 24); - assert!(offset_of!(SwitchStatement, cases) == 32); - assert!(offset_of!(SwitchStatement, scope_id) == 48); + assert!(offset_of!(SwitchStatement, discriminant) == 8); + assert!(offset_of!(SwitchStatement, cases) == 16); + assert!(offset_of!(SwitchStatement, scope_id) == 32); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(SwitchCase, span) == 0); - assert!(offset_of!(SwitchCase, test) == 24); - assert!(offset_of!(SwitchCase, consequent) == 32); + assert!(offset_of!(SwitchCase, test) == 8); + assert!(offset_of!(SwitchCase, consequent) == 16); // Padding: 0 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(LabeledStatement, span) == 0); - assert!(offset_of!(LabeledStatement, label) == 24); - assert!(offset_of!(LabeledStatement, body) == 56); + assert!(offset_of!(LabeledStatement, label) == 8); + assert!(offset_of!(LabeledStatement, body) == 24); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(ThrowStatement, span) == 0); - assert!(offset_of!(ThrowStatement, argument) == 24); + assert!(offset_of!(ThrowStatement, argument) == 8); // Padding: 0 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(TryStatement, span) == 0); - assert!(offset_of!(TryStatement, block) == 24); - assert!(offset_of!(TryStatement, handler) == 28); - assert!(offset_of!(TryStatement, finalizer) == 32); + assert!(offset_of!(TryStatement, block) == 8); + assert!(offset_of!(TryStatement, handler) == 12); + assert!(offset_of!(TryStatement, finalizer) == 16); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(CatchClause, span) == 0); - assert!(offset_of!(CatchClause, param) == 24); - assert!(offset_of!(CatchClause, body) == 64); - assert!(offset_of!(CatchClause, scope_id) == 68); + assert!(offset_of!(CatchClause, param) == 8); + assert!(offset_of!(CatchClause, body) == 32); + assert!(offset_of!(CatchClause, scope_id) == 36); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(CatchParameter, span) == 0); - assert!(offset_of!(CatchParameter, pattern) == 24); + assert!(offset_of!(CatchParameter, pattern) == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(DebuggerStatement, span) == 0); @@ -2124,172 +2124,172 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(AssignmentPattern, span) == 0); - assert!(offset_of!(AssignmentPattern, left) == 24); - assert!(offset_of!(AssignmentPattern, right) == 40); + assert!(offset_of!(AssignmentPattern, left) == 8); + assert!(offset_of!(AssignmentPattern, right) == 24); // Padding: 0 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(ObjectPattern, span) == 0); - assert!(offset_of!(ObjectPattern, properties) == 24); - assert!(offset_of!(ObjectPattern, rest) == 40); + assert!(offset_of!(ObjectPattern, properties) == 8); + assert!(offset_of!(ObjectPattern, rest) == 24); // Padding: 2 bytes - assert!(size_of::() == 52); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(BindingProperty, span) == 0); - assert!(offset_of!(BindingProperty, key) == 24); - assert!(offset_of!(BindingProperty, value) == 32); - assert!(offset_of!(BindingProperty, shorthand) == 48); - assert!(offset_of!(BindingProperty, computed) == 49); + assert!(offset_of!(BindingProperty, key) == 8); + assert!(offset_of!(BindingProperty, value) == 16); + assert!(offset_of!(BindingProperty, shorthand) == 32); + assert!(offset_of!(BindingProperty, computed) == 33); // Padding: 0 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(ArrayPattern, span) == 0); - assert!(offset_of!(ArrayPattern, elements) == 24); - assert!(offset_of!(ArrayPattern, rest) == 40); + assert!(offset_of!(ArrayPattern, elements) == 8); + assert!(offset_of!(ArrayPattern, rest) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(BindingRestElement, span) == 0); - assert!(offset_of!(BindingRestElement, argument) == 24); + assert!(offset_of!(BindingRestElement, argument) == 8); // Padding: 3 bytes - assert!(size_of::() == 92); + assert!(size_of::() == 60); assert!(align_of::() == 4); assert!(offset_of!(Function, span) == 0); - assert!(offset_of!(Function, r#type) == 84); - assert!(offset_of!(Function, id) == 24); - assert!(offset_of!(Function, generator) == 85); - assert!(offset_of!(Function, r#async) == 86); - assert!(offset_of!(Function, declare) == 87); - assert!(offset_of!(Function, type_parameters) == 60); - assert!(offset_of!(Function, this_param) == 64); - assert!(offset_of!(Function, params) == 68); - assert!(offset_of!(Function, return_type) == 72); - assert!(offset_of!(Function, body) == 76); - assert!(offset_of!(Function, scope_id) == 80); - assert!(offset_of!(Function, pure) == 88); + assert!(offset_of!(Function, r#type) == 52); + assert!(offset_of!(Function, id) == 8); + assert!(offset_of!(Function, generator) == 53); + assert!(offset_of!(Function, r#async) == 54); + assert!(offset_of!(Function, declare) == 55); + assert!(offset_of!(Function, type_parameters) == 28); + assert!(offset_of!(Function, this_param) == 32); + assert!(offset_of!(Function, params) == 36); + assert!(offset_of!(Function, return_type) == 40); + assert!(offset_of!(Function, body) == 44); + assert!(offset_of!(Function, scope_id) == 48); + assert!(offset_of!(Function, pure) == 56); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 3 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(FormalParameters, span) == 0); - assert!(offset_of!(FormalParameters, kind) == 44); - assert!(offset_of!(FormalParameters, items) == 24); - assert!(offset_of!(FormalParameters, rest) == 40); + assert!(offset_of!(FormalParameters, kind) == 28); + assert!(offset_of!(FormalParameters, items) == 8); + assert!(offset_of!(FormalParameters, rest) == 24); // Padding: 1 bytes - assert!(size_of::() == 60); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(FormalParameter, span) == 0); - assert!(offset_of!(FormalParameter, decorators) == 24); - assert!(offset_of!(FormalParameter, pattern) == 40); - assert!(offset_of!(FormalParameter, accessibility) == 56); - assert!(offset_of!(FormalParameter, readonly) == 57); - assert!(offset_of!(FormalParameter, r#override) == 58); + assert!(offset_of!(FormalParameter, decorators) == 8); + assert!(offset_of!(FormalParameter, pattern) == 24); + assert!(offset_of!(FormalParameter, accessibility) == 40); + assert!(offset_of!(FormalParameter, readonly) == 41); + assert!(offset_of!(FormalParameter, r#override) == 42); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(FunctionBody, span) == 0); - assert!(offset_of!(FunctionBody, directives) == 24); - assert!(offset_of!(FunctionBody, statements) == 40); + assert!(offset_of!(FunctionBody, directives) == 8); + assert!(offset_of!(FunctionBody, statements) == 24); // Padding: 1 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(ArrowFunctionExpression, span) == 0); - assert!(offset_of!(ArrowFunctionExpression, expression) == 44); - assert!(offset_of!(ArrowFunctionExpression, r#async) == 45); - assert!(offset_of!(ArrowFunctionExpression, type_parameters) == 24); - assert!(offset_of!(ArrowFunctionExpression, params) == 28); - assert!(offset_of!(ArrowFunctionExpression, return_type) == 32); - assert!(offset_of!(ArrowFunctionExpression, body) == 36); - assert!(offset_of!(ArrowFunctionExpression, scope_id) == 40); - assert!(offset_of!(ArrowFunctionExpression, pure) == 46); + assert!(offset_of!(ArrowFunctionExpression, expression) == 28); + assert!(offset_of!(ArrowFunctionExpression, r#async) == 29); + assert!(offset_of!(ArrowFunctionExpression, type_parameters) == 8); + assert!(offset_of!(ArrowFunctionExpression, params) == 12); + assert!(offset_of!(ArrowFunctionExpression, return_type) == 16); + assert!(offset_of!(ArrowFunctionExpression, body) == 20); + assert!(offset_of!(ArrowFunctionExpression, scope_id) == 24); + assert!(offset_of!(ArrowFunctionExpression, pure) == 30); // Padding: 3 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(YieldExpression, span) == 0); - assert!(offset_of!(YieldExpression, delegate) == 32); - assert!(offset_of!(YieldExpression, argument) == 24); + assert!(offset_of!(YieldExpression, delegate) == 16); + assert!(offset_of!(YieldExpression, argument) == 8); // Padding: 1 bytes - assert!(size_of::() == 120); + assert!(size_of::() == 88); assert!(align_of::() == 4); assert!(offset_of!(Class, span) == 0); - assert!(offset_of!(Class, r#type) == 116); - assert!(offset_of!(Class, decorators) == 24); - assert!(offset_of!(Class, id) == 40); - assert!(offset_of!(Class, type_parameters) == 76); - assert!(offset_of!(Class, super_class) == 80); - assert!(offset_of!(Class, super_type_arguments) == 88); - assert!(offset_of!(Class, implements) == 92); - assert!(offset_of!(Class, body) == 108); - assert!(offset_of!(Class, r#abstract) == 117); - assert!(offset_of!(Class, declare) == 118); - assert!(offset_of!(Class, scope_id) == 112); + assert!(offset_of!(Class, r#type) == 84); + assert!(offset_of!(Class, decorators) == 8); + assert!(offset_of!(Class, id) == 24); + assert!(offset_of!(Class, type_parameters) == 44); + assert!(offset_of!(Class, super_class) == 48); + assert!(offset_of!(Class, super_type_arguments) == 56); + assert!(offset_of!(Class, implements) == 60); + assert!(offset_of!(Class, body) == 76); + assert!(offset_of!(Class, r#abstract) == 85); + assert!(offset_of!(Class, declare) == 86); + assert!(offset_of!(Class, scope_id) == 80); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(ClassBody, span) == 0); - assert!(offset_of!(ClassBody, body) == 24); + assert!(offset_of!(ClassBody, body) == 8); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 1 bytes - assert!(size_of::() == 60); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(MethodDefinition, span) == 0); - assert!(offset_of!(MethodDefinition, r#type) == 52); - assert!(offset_of!(MethodDefinition, decorators) == 24); - assert!(offset_of!(MethodDefinition, key) == 40); - assert!(offset_of!(MethodDefinition, value) == 48); - assert!(offset_of!(MethodDefinition, kind) == 53); - assert!(offset_of!(MethodDefinition, computed) == 54); - assert!(offset_of!(MethodDefinition, r#static) == 55); - assert!(offset_of!(MethodDefinition, r#override) == 56); - assert!(offset_of!(MethodDefinition, optional) == 57); - assert!(offset_of!(MethodDefinition, accessibility) == 58); + assert!(offset_of!(MethodDefinition, r#type) == 36); + assert!(offset_of!(MethodDefinition, decorators) == 8); + assert!(offset_of!(MethodDefinition, key) == 24); + assert!(offset_of!(MethodDefinition, value) == 32); + assert!(offset_of!(MethodDefinition, kind) == 37); + assert!(offset_of!(MethodDefinition, computed) == 38); + assert!(offset_of!(MethodDefinition, r#static) == 39); + assert!(offset_of!(MethodDefinition, r#override) == 40); + assert!(offset_of!(MethodDefinition, optional) == 41); + assert!(offset_of!(MethodDefinition, accessibility) == 42); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 3 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 56); assert!(align_of::() == 4); assert!(offset_of!(PropertyDefinition, span) == 0); - assert!(offset_of!(PropertyDefinition, r#type) == 60); - assert!(offset_of!(PropertyDefinition, decorators) == 24); - assert!(offset_of!(PropertyDefinition, key) == 40); - assert!(offset_of!(PropertyDefinition, type_annotation) == 48); - assert!(offset_of!(PropertyDefinition, value) == 52); - assert!(offset_of!(PropertyDefinition, computed) == 61); - assert!(offset_of!(PropertyDefinition, r#static) == 62); - assert!(offset_of!(PropertyDefinition, declare) == 63); - assert!(offset_of!(PropertyDefinition, r#override) == 64); - assert!(offset_of!(PropertyDefinition, optional) == 65); - assert!(offset_of!(PropertyDefinition, definite) == 66); - assert!(offset_of!(PropertyDefinition, readonly) == 67); - assert!(offset_of!(PropertyDefinition, accessibility) == 68); + assert!(offset_of!(PropertyDefinition, r#type) == 44); + assert!(offset_of!(PropertyDefinition, decorators) == 8); + assert!(offset_of!(PropertyDefinition, key) == 24); + assert!(offset_of!(PropertyDefinition, type_annotation) == 32); + assert!(offset_of!(PropertyDefinition, value) == 36); + assert!(offset_of!(PropertyDefinition, computed) == 45); + assert!(offset_of!(PropertyDefinition, r#static) == 46); + assert!(offset_of!(PropertyDefinition, declare) == 47); + assert!(offset_of!(PropertyDefinition, r#override) == 48); + assert!(offset_of!(PropertyDefinition, optional) == 49); + assert!(offset_of!(PropertyDefinition, definite) == 50); + assert!(offset_of!(PropertyDefinition, readonly) == 51); + assert!(offset_of!(PropertyDefinition, accessibility) == 52); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -2298,17 +2298,17 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(PrivateIdentifier, span) == 0); - assert!(offset_of!(PrivateIdentifier, name) == 24); + assert!(offset_of!(PrivateIdentifier, name) == 8); // Padding: 0 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(StaticBlock, span) == 0); - assert!(offset_of!(StaticBlock, body) == 24); - assert!(offset_of!(StaticBlock, scope_id) == 40); + assert!(offset_of!(StaticBlock, body) == 8); + assert!(offset_of!(StaticBlock, scope_id) == 24); assert!(size_of::() == 8); assert!(align_of::() == 4); @@ -2317,37 +2317,37 @@ const _: () = { assert!(align_of::() == 1); // Padding: 2 bytes - assert!(size_of::() == 68); + assert!(size_of::() == 52); assert!(align_of::() == 4); assert!(offset_of!(AccessorProperty, span) == 0); - assert!(offset_of!(AccessorProperty, r#type) == 60); - assert!(offset_of!(AccessorProperty, decorators) == 24); - assert!(offset_of!(AccessorProperty, key) == 40); - assert!(offset_of!(AccessorProperty, type_annotation) == 48); - assert!(offset_of!(AccessorProperty, value) == 52); - assert!(offset_of!(AccessorProperty, computed) == 61); - assert!(offset_of!(AccessorProperty, r#static) == 62); - assert!(offset_of!(AccessorProperty, r#override) == 63); - assert!(offset_of!(AccessorProperty, definite) == 64); - assert!(offset_of!(AccessorProperty, accessibility) == 65); + assert!(offset_of!(AccessorProperty, r#type) == 44); + assert!(offset_of!(AccessorProperty, decorators) == 8); + assert!(offset_of!(AccessorProperty, key) == 24); + assert!(offset_of!(AccessorProperty, type_annotation) == 32); + assert!(offset_of!(AccessorProperty, value) == 36); + assert!(offset_of!(AccessorProperty, computed) == 45); + assert!(offset_of!(AccessorProperty, r#static) == 46); + assert!(offset_of!(AccessorProperty, r#override) == 47); + assert!(offset_of!(AccessorProperty, definite) == 48); + assert!(offset_of!(AccessorProperty, accessibility) == 49); // Padding: 3 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(ImportExpression, span) == 0); - assert!(offset_of!(ImportExpression, source) == 24); - assert!(offset_of!(ImportExpression, options) == 32); - assert!(offset_of!(ImportExpression, phase) == 40); + assert!(offset_of!(ImportExpression, source) == 8); + assert!(offset_of!(ImportExpression, options) == 16); + assert!(offset_of!(ImportExpression, phase) == 24); // Padding: 2 bytes - assert!(size_of::() == 92); + assert!(size_of::() == 60); assert!(align_of::() == 4); assert!(offset_of!(ImportDeclaration, span) == 0); - assert!(offset_of!(ImportDeclaration, specifiers) == 24); - assert!(offset_of!(ImportDeclaration, source) == 40); - assert!(offset_of!(ImportDeclaration, phase) == 88); - assert!(offset_of!(ImportDeclaration, with_clause) == 84); - assert!(offset_of!(ImportDeclaration, import_kind) == 89); + assert!(offset_of!(ImportDeclaration, specifiers) == 8); + assert!(offset_of!(ImportDeclaration, source) == 24); + assert!(offset_of!(ImportDeclaration, phase) == 56); + assert!(offset_of!(ImportDeclaration, with_clause) == 52); + assert!(offset_of!(ImportDeclaration, import_kind) == 57); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -2356,130 +2356,130 @@ const _: () = { assert!(align_of::() == 4); // Padding: 3 bytes - assert!(size_of::() == 112); + assert!(size_of::() == 64); assert!(align_of::() == 4); assert!(offset_of!(ImportSpecifier, span) == 0); - assert!(offset_of!(ImportSpecifier, imported) == 24); - assert!(offset_of!(ImportSpecifier, local) == 72); - assert!(offset_of!(ImportSpecifier, import_kind) == 108); + assert!(offset_of!(ImportSpecifier, imported) == 8); + assert!(offset_of!(ImportSpecifier, local) == 40); + assert!(offset_of!(ImportSpecifier, import_kind) == 60); // Padding: 0 bytes - assert!(size_of::() == 60); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(ImportDefaultSpecifier, span) == 0); - assert!(offset_of!(ImportDefaultSpecifier, local) == 24); + assert!(offset_of!(ImportDefaultSpecifier, local) == 8); // Padding: 0 bytes - assert!(size_of::() == 60); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(ImportNamespaceSpecifier, span) == 0); - assert!(offset_of!(ImportNamespaceSpecifier, local) == 24); + assert!(offset_of!(ImportNamespaceSpecifier, local) == 8); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(WithClause, span) == 0); - assert!(offset_of!(WithClause, attributes_keyword) == 24); - assert!(offset_of!(WithClause, with_entries) == 56); + assert!(offset_of!(WithClause, attributes_keyword) == 8); + assert!(offset_of!(WithClause, with_entries) == 24); // Padding: 0 bytes - assert!(size_of::() == 116); + assert!(size_of::() == 68); assert!(align_of::() == 4); assert!(offset_of!(ImportAttribute, span) == 0); - assert!(offset_of!(ImportAttribute, key) == 24); - assert!(offset_of!(ImportAttribute, value) == 72); + assert!(offset_of!(ImportAttribute, key) == 8); + assert!(offset_of!(ImportAttribute, value) == 40); - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 4); // Padding: 3 bytes - assert!(size_of::() == 100); + assert!(size_of::() == 68); assert!(align_of::() == 4); assert!(offset_of!(ExportNamedDeclaration, span) == 0); - assert!(offset_of!(ExportNamedDeclaration, declaration) == 24); - assert!(offset_of!(ExportNamedDeclaration, specifiers) == 32); - assert!(offset_of!(ExportNamedDeclaration, source) == 48); - assert!(offset_of!(ExportNamedDeclaration, export_kind) == 96); - assert!(offset_of!(ExportNamedDeclaration, with_clause) == 92); + assert!(offset_of!(ExportNamedDeclaration, declaration) == 8); + assert!(offset_of!(ExportNamedDeclaration, specifiers) == 16); + assert!(offset_of!(ExportNamedDeclaration, source) == 32); + assert!(offset_of!(ExportNamedDeclaration, export_kind) == 64); + assert!(offset_of!(ExportNamedDeclaration, with_clause) == 60); // Padding: 0 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(ExportDefaultDeclaration, span) == 0); - assert!(offset_of!(ExportDefaultDeclaration, exported) == 24); - assert!(offset_of!(ExportDefaultDeclaration, declaration) == 72); + assert!(offset_of!(ExportDefaultDeclaration, exported) == 8); + assert!(offset_of!(ExportDefaultDeclaration, declaration) == 40); // Padding: 3 bytes - assert!(size_of::() == 124); + assert!(size_of::() == 76); assert!(align_of::() == 4); assert!(offset_of!(ExportAllDeclaration, span) == 0); - assert!(offset_of!(ExportAllDeclaration, exported) == 24); - assert!(offset_of!(ExportAllDeclaration, source) == 72); - assert!(offset_of!(ExportAllDeclaration, with_clause) == 116); - assert!(offset_of!(ExportAllDeclaration, export_kind) == 120); + assert!(offset_of!(ExportAllDeclaration, exported) == 8); + assert!(offset_of!(ExportAllDeclaration, source) == 40); + assert!(offset_of!(ExportAllDeclaration, with_clause) == 68); + assert!(offset_of!(ExportAllDeclaration, export_kind) == 72); // Padding: 3 bytes - assert!(size_of::() == 124); + assert!(size_of::() == 76); assert!(align_of::() == 4); assert!(offset_of!(ExportSpecifier, span) == 0); - assert!(offset_of!(ExportSpecifier, local) == 24); - assert!(offset_of!(ExportSpecifier, exported) == 72); - assert!(offset_of!(ExportSpecifier, export_kind) == 120); + assert!(offset_of!(ExportSpecifier, local) == 8); + assert!(offset_of!(ExportSpecifier, exported) == 40); + assert!(offset_of!(ExportSpecifier, export_kind) == 72); assert!(size_of::() == 8); assert!(align_of::() == 4); - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(V8IntrinsicExpression, span) == 0); - assert!(offset_of!(V8IntrinsicExpression, name) == 24); - assert!(offset_of!(V8IntrinsicExpression, arguments) == 56); + assert!(offset_of!(V8IntrinsicExpression, name) == 8); + assert!(offset_of!(V8IntrinsicExpression, arguments) == 24); // Padding: 3 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 12); assert!(align_of::() == 4); assert!(offset_of!(BooleanLiteral, span) == 0); - assert!(offset_of!(BooleanLiteral, value) == 24); + assert!(offset_of!(BooleanLiteral, value) == 8); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(NullLiteral, span) == 0); // Padding: 7 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(NumericLiteral, span) == 0); - assert!(offset_of!(NumericLiteral, value) == 24); - assert!(offset_of!(NumericLiteral, raw) == 32); - assert!(offset_of!(NumericLiteral, base) == 40); + assert!(offset_of!(NumericLiteral, value) == 8); + assert!(offset_of!(NumericLiteral, raw) == 16); + assert!(offset_of!(NumericLiteral, base) == 24); // Padding: 3 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(StringLiteral, span) == 0); - assert!(offset_of!(StringLiteral, value) == 24); - assert!(offset_of!(StringLiteral, raw) == 32); - assert!(offset_of!(StringLiteral, lone_surrogates) == 40); + assert!(offset_of!(StringLiteral, value) == 8); + assert!(offset_of!(StringLiteral, raw) == 16); + assert!(offset_of!(StringLiteral, lone_surrogates) == 24); // Padding: 3 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(BigIntLiteral, span) == 0); - assert!(offset_of!(BigIntLiteral, value) == 24); - assert!(offset_of!(BigIntLiteral, raw) == 32); - assert!(offset_of!(BigIntLiteral, base) == 40); + assert!(offset_of!(BigIntLiteral, value) == 8); + assert!(offset_of!(BigIntLiteral, raw) == 16); + assert!(offset_of!(BigIntLiteral, base) == 24); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(RegExpLiteral, span) == 0); - assert!(offset_of!(RegExpLiteral, regex) == 24); - assert!(offset_of!(RegExpLiteral, raw) == 40); + assert!(offset_of!(RegExpLiteral, regex) == 8); + assert!(offset_of!(RegExpLiteral, raw) == 24); // Padding: 3 bytes assert!(size_of::() == 16); @@ -2498,42 +2498,42 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(JSXElement, span) == 0); - assert!(offset_of!(JSXElement, opening_element) == 24); - assert!(offset_of!(JSXElement, children) == 28); - assert!(offset_of!(JSXElement, closing_element) == 44); + assert!(offset_of!(JSXElement, opening_element) == 8); + assert!(offset_of!(JSXElement, children) == 12); + assert!(offset_of!(JSXElement, closing_element) == 28); // Padding: 0 bytes - assert!(size_of::() == 52); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(JSXOpeningElement, span) == 0); - assert!(offset_of!(JSXOpeningElement, name) == 24); - assert!(offset_of!(JSXOpeningElement, type_arguments) == 32); - assert!(offset_of!(JSXOpeningElement, attributes) == 36); + assert!(offset_of!(JSXOpeningElement, name) == 8); + assert!(offset_of!(JSXOpeningElement, type_arguments) == 16); + assert!(offset_of!(JSXOpeningElement, attributes) == 20); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(JSXClosingElement, span) == 0); - assert!(offset_of!(JSXClosingElement, name) == 24); + assert!(offset_of!(JSXClosingElement, name) == 8); // Padding: 0 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(JSXFragment, span) == 0); - assert!(offset_of!(JSXFragment, opening_fragment) == 24); - assert!(offset_of!(JSXFragment, children) == 48); - assert!(offset_of!(JSXFragment, closing_fragment) == 64); + assert!(offset_of!(JSXFragment, opening_fragment) == 8); + assert!(offset_of!(JSXFragment, children) == 16); + assert!(offset_of!(JSXFragment, closing_fragment) == 32); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(JSXOpeningFragment, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(JSXClosingFragment, span) == 0); @@ -2541,33 +2541,33 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(JSXNamespacedName, span) == 0); - assert!(offset_of!(JSXNamespacedName, namespace) == 24); - assert!(offset_of!(JSXNamespacedName, name) == 56); + assert!(offset_of!(JSXNamespacedName, namespace) == 8); + assert!(offset_of!(JSXNamespacedName, name) == 24); // Padding: 0 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(JSXMemberExpression, span) == 0); - assert!(offset_of!(JSXMemberExpression, object) == 24); - assert!(offset_of!(JSXMemberExpression, property) == 32); + assert!(offset_of!(JSXMemberExpression, object) == 8); + assert!(offset_of!(JSXMemberExpression, property) == 16); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 52); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(JSXExpressionContainer, span) == 0); - assert!(offset_of!(JSXExpressionContainer, expression) == 24); + assert!(offset_of!(JSXExpressionContainer, expression) == 8); - assert!(size_of::() == 28); + assert!(size_of::() == 12); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(JSXEmptyExpression, span) == 0); @@ -2575,17 +2575,17 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(JSXAttribute, span) == 0); - assert!(offset_of!(JSXAttribute, name) == 24); - assert!(offset_of!(JSXAttribute, value) == 32); + assert!(offset_of!(JSXAttribute, name) == 8); + assert!(offset_of!(JSXAttribute, value) == 16); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(JSXSpreadAttribute, span) == 0); - assert!(offset_of!(JSXSpreadAttribute, argument) == 24); + assert!(offset_of!(JSXSpreadAttribute, argument) == 8); assert!(size_of::() == 8); assert!(align_of::() == 4); @@ -2594,71 +2594,71 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(JSXIdentifier, span) == 0); - assert!(offset_of!(JSXIdentifier, name) == 24); + assert!(offset_of!(JSXIdentifier, name) == 8); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(JSXSpreadChild, span) == 0); - assert!(offset_of!(JSXSpreadChild, expression) == 24); + assert!(offset_of!(JSXSpreadChild, expression) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(JSXText, span) == 0); - assert!(offset_of!(JSXText, value) == 24); - assert!(offset_of!(JSXText, raw) == 32); + assert!(offset_of!(JSXText, value) == 8); + assert!(offset_of!(JSXText, raw) == 16); // Padding: 0 bytes - assert!(size_of::() == 52); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(TSThisParameter, span) == 0); - assert!(offset_of!(TSThisParameter, this_span) == 24); - assert!(offset_of!(TSThisParameter, type_annotation) == 48); + assert!(offset_of!(TSThisParameter, this_span) == 8); + assert!(offset_of!(TSThisParameter, type_annotation) == 16); // Padding: 2 bytes - assert!(size_of::() == 108); + assert!(size_of::() == 60); assert!(align_of::() == 4); assert!(offset_of!(TSEnumDeclaration, span) == 0); - assert!(offset_of!(TSEnumDeclaration, id) == 24); - assert!(offset_of!(TSEnumDeclaration, body) == 60); - assert!(offset_of!(TSEnumDeclaration, r#const) == 104); - assert!(offset_of!(TSEnumDeclaration, declare) == 105); - assert!(offset_of!(TSEnumDeclaration, scope_id) == 100); + assert!(offset_of!(TSEnumDeclaration, id) == 8); + assert!(offset_of!(TSEnumDeclaration, body) == 28); + assert!(offset_of!(TSEnumDeclaration, r#const) == 56); + assert!(offset_of!(TSEnumDeclaration, declare) == 57); + assert!(offset_of!(TSEnumDeclaration, scope_id) == 52); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSEnumBody, span) == 0); - assert!(offset_of!(TSEnumBody, members) == 24); + assert!(offset_of!(TSEnumBody, members) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSEnumMember, span) == 0); - assert!(offset_of!(TSEnumMember, id) == 24); - assert!(offset_of!(TSEnumMember, initializer) == 32); + assert!(offset_of!(TSEnumMember, id) == 8); + assert!(offset_of!(TSEnumMember, initializer) == 16); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(TSTypeAnnotation, span) == 0); - assert!(offset_of!(TSTypeAnnotation, type_annotation) == 24); + assert!(offset_of!(TSTypeAnnotation, type_annotation) == 8); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(TSLiteralType, span) == 0); - assert!(offset_of!(TSLiteralType, literal) == 24); + assert!(offset_of!(TSLiteralType, literal) == 8); assert!(size_of::() == 8); assert!(align_of::() == 4); @@ -2667,499 +2667,499 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 60); + assert!(size_of::() == 44); assert!(align_of::() == 4); assert!(offset_of!(TSConditionalType, span) == 0); - assert!(offset_of!(TSConditionalType, check_type) == 24); - assert!(offset_of!(TSConditionalType, extends_type) == 32); - assert!(offset_of!(TSConditionalType, true_type) == 40); - assert!(offset_of!(TSConditionalType, false_type) == 48); - assert!(offset_of!(TSConditionalType, scope_id) == 56); + assert!(offset_of!(TSConditionalType, check_type) == 8); + assert!(offset_of!(TSConditionalType, extends_type) == 16); + assert!(offset_of!(TSConditionalType, true_type) == 24); + assert!(offset_of!(TSConditionalType, false_type) == 32); + assert!(offset_of!(TSConditionalType, scope_id) == 40); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSUnionType, span) == 0); - assert!(offset_of!(TSUnionType, types) == 24); + assert!(offset_of!(TSUnionType, types) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSIntersectionType, span) == 0); - assert!(offset_of!(TSIntersectionType, types) == 24); + assert!(offset_of!(TSIntersectionType, types) == 8); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(TSParenthesizedType, span) == 0); - assert!(offset_of!(TSParenthesizedType, type_annotation) == 24); + assert!(offset_of!(TSParenthesizedType, type_annotation) == 8); // Padding: 3 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(TSTypeOperator, span) == 0); - assert!(offset_of!(TSTypeOperator, operator) == 32); - assert!(offset_of!(TSTypeOperator, type_annotation) == 24); + assert!(offset_of!(TSTypeOperator, operator) == 16); + assert!(offset_of!(TSTypeOperator, type_annotation) == 8); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(TSArrayType, span) == 0); - assert!(offset_of!(TSArrayType, element_type) == 24); + assert!(offset_of!(TSArrayType, element_type) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSIndexedAccessType, span) == 0); - assert!(offset_of!(TSIndexedAccessType, object_type) == 24); - assert!(offset_of!(TSIndexedAccessType, index_type) == 32); + assert!(offset_of!(TSIndexedAccessType, object_type) == 8); + assert!(offset_of!(TSIndexedAccessType, index_type) == 16); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSTupleType, span) == 0); - assert!(offset_of!(TSTupleType, element_types) == 24); + assert!(offset_of!(TSTupleType, element_types) == 8); // Padding: 3 bytes - assert!(size_of::() == 68); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(TSNamedTupleMember, span) == 0); - assert!(offset_of!(TSNamedTupleMember, label) == 24); - assert!(offset_of!(TSNamedTupleMember, element_type) == 56); - assert!(offset_of!(TSNamedTupleMember, optional) == 64); + assert!(offset_of!(TSNamedTupleMember, label) == 8); + assert!(offset_of!(TSNamedTupleMember, element_type) == 24); + assert!(offset_of!(TSNamedTupleMember, optional) == 32); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(TSOptionalType, span) == 0); - assert!(offset_of!(TSOptionalType, type_annotation) == 24); + assert!(offset_of!(TSOptionalType, type_annotation) == 8); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(TSRestType, span) == 0); - assert!(offset_of!(TSRestType, type_annotation) == 24); + assert!(offset_of!(TSRestType, type_annotation) == 8); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(TSAnyKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(TSStringKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(TSBooleanKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(TSNumberKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(TSNeverKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(TSIntrinsicKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(TSUnknownKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(TSNullKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(TSUndefinedKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(TSVoidKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(TSSymbolKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(TSThisType, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(TSObjectKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(TSBigIntKeyword, span) == 0); // Padding: 0 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(TSTypeReference, span) == 0); - assert!(offset_of!(TSTypeReference, type_name) == 24); - assert!(offset_of!(TSTypeReference, type_arguments) == 32); + assert!(offset_of!(TSTypeReference, type_name) == 8); + assert!(offset_of!(TSTypeReference, type_arguments) == 16); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(TSQualifiedName, span) == 0); - assert!(offset_of!(TSQualifiedName, left) == 24); - assert!(offset_of!(TSQualifiedName, right) == 32); + assert!(offset_of!(TSQualifiedName, left) == 8); + assert!(offset_of!(TSQualifiedName, right) == 16); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSTypeParameterInstantiation, span) == 0); - assert!(offset_of!(TSTypeParameterInstantiation, params) == 24); + assert!(offset_of!(TSTypeParameterInstantiation, params) == 8); // Padding: 1 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(TSTypeParameter, span) == 0); - assert!(offset_of!(TSTypeParameter, name) == 24); - assert!(offset_of!(TSTypeParameter, constraint) == 60); - assert!(offset_of!(TSTypeParameter, default) == 68); - assert!(offset_of!(TSTypeParameter, r#in) == 76); - assert!(offset_of!(TSTypeParameter, out) == 77); - assert!(offset_of!(TSTypeParameter, r#const) == 78); + assert!(offset_of!(TSTypeParameter, name) == 8); + assert!(offset_of!(TSTypeParameter, constraint) == 28); + assert!(offset_of!(TSTypeParameter, default) == 36); + assert!(offset_of!(TSTypeParameter, r#in) == 44); + assert!(offset_of!(TSTypeParameter, out) == 45); + assert!(offset_of!(TSTypeParameter, r#const) == 46); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSTypeParameterDeclaration, span) == 0); - assert!(offset_of!(TSTypeParameterDeclaration, params) == 24); + assert!(offset_of!(TSTypeParameterDeclaration, params) == 8); // Padding: 3 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(TSTypeAliasDeclaration, span) == 0); - assert!(offset_of!(TSTypeAliasDeclaration, id) == 24); - assert!(offset_of!(TSTypeAliasDeclaration, type_parameters) == 60); - assert!(offset_of!(TSTypeAliasDeclaration, type_annotation) == 64); - assert!(offset_of!(TSTypeAliasDeclaration, declare) == 76); - assert!(offset_of!(TSTypeAliasDeclaration, scope_id) == 72); + assert!(offset_of!(TSTypeAliasDeclaration, id) == 8); + assert!(offset_of!(TSTypeAliasDeclaration, type_parameters) == 28); + assert!(offset_of!(TSTypeAliasDeclaration, type_annotation) == 32); + assert!(offset_of!(TSTypeAliasDeclaration, declare) == 44); + assert!(offset_of!(TSTypeAliasDeclaration, scope_id) == 40); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(TSClassImplements, span) == 0); - assert!(offset_of!(TSClassImplements, expression) == 24); - assert!(offset_of!(TSClassImplements, type_arguments) == 32); + assert!(offset_of!(TSClassImplements, expression) == 8); + assert!(offset_of!(TSClassImplements, type_arguments) == 16); // Padding: 3 bytes - assert!(size_of::() == 92); + assert!(size_of::() == 60); assert!(align_of::() == 4); assert!(offset_of!(TSInterfaceDeclaration, span) == 0); - assert!(offset_of!(TSInterfaceDeclaration, id) == 24); - assert!(offset_of!(TSInterfaceDeclaration, type_parameters) == 60); - assert!(offset_of!(TSInterfaceDeclaration, extends) == 64); - assert!(offset_of!(TSInterfaceDeclaration, body) == 80); - assert!(offset_of!(TSInterfaceDeclaration, declare) == 88); - assert!(offset_of!(TSInterfaceDeclaration, scope_id) == 84); + assert!(offset_of!(TSInterfaceDeclaration, id) == 8); + assert!(offset_of!(TSInterfaceDeclaration, type_parameters) == 28); + assert!(offset_of!(TSInterfaceDeclaration, extends) == 32); + assert!(offset_of!(TSInterfaceDeclaration, body) == 48); + assert!(offset_of!(TSInterfaceDeclaration, declare) == 56); + assert!(offset_of!(TSInterfaceDeclaration, scope_id) == 52); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSInterfaceBody, span) == 0); - assert!(offset_of!(TSInterfaceBody, body) == 24); + assert!(offset_of!(TSInterfaceBody, body) == 8); // Padding: 1 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSPropertySignature, span) == 0); - assert!(offset_of!(TSPropertySignature, computed) == 36); - assert!(offset_of!(TSPropertySignature, optional) == 37); - assert!(offset_of!(TSPropertySignature, readonly) == 38); - assert!(offset_of!(TSPropertySignature, key) == 24); - assert!(offset_of!(TSPropertySignature, type_annotation) == 32); + assert!(offset_of!(TSPropertySignature, computed) == 20); + assert!(offset_of!(TSPropertySignature, optional) == 21); + assert!(offset_of!(TSPropertySignature, readonly) == 22); + assert!(offset_of!(TSPropertySignature, key) == 8); + assert!(offset_of!(TSPropertySignature, type_annotation) == 16); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 2 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(TSIndexSignature, span) == 0); - assert!(offset_of!(TSIndexSignature, parameters) == 24); - assert!(offset_of!(TSIndexSignature, type_annotation) == 40); - assert!(offset_of!(TSIndexSignature, readonly) == 44); - assert!(offset_of!(TSIndexSignature, r#static) == 45); + assert!(offset_of!(TSIndexSignature, parameters) == 8); + assert!(offset_of!(TSIndexSignature, type_annotation) == 24); + assert!(offset_of!(TSIndexSignature, readonly) == 28); + assert!(offset_of!(TSIndexSignature, r#static) == 29); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSCallSignatureDeclaration, span) == 0); - assert!(offset_of!(TSCallSignatureDeclaration, type_parameters) == 24); - assert!(offset_of!(TSCallSignatureDeclaration, this_param) == 28); - assert!(offset_of!(TSCallSignatureDeclaration, params) == 32); - assert!(offset_of!(TSCallSignatureDeclaration, return_type) == 36); + assert!(offset_of!(TSCallSignatureDeclaration, type_parameters) == 8); + assert!(offset_of!(TSCallSignatureDeclaration, this_param) == 12); + assert!(offset_of!(TSCallSignatureDeclaration, params) == 16); + assert!(offset_of!(TSCallSignatureDeclaration, return_type) == 20); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 1 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSMethodSignature, span) == 0); - assert!(offset_of!(TSMethodSignature, key) == 24); - assert!(offset_of!(TSMethodSignature, computed) == 52); - assert!(offset_of!(TSMethodSignature, optional) == 53); - assert!(offset_of!(TSMethodSignature, kind) == 54); - assert!(offset_of!(TSMethodSignature, type_parameters) == 32); - assert!(offset_of!(TSMethodSignature, this_param) == 36); - assert!(offset_of!(TSMethodSignature, params) == 40); - assert!(offset_of!(TSMethodSignature, return_type) == 44); - assert!(offset_of!(TSMethodSignature, scope_id) == 48); - - // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(offset_of!(TSMethodSignature, key) == 8); + assert!(offset_of!(TSMethodSignature, computed) == 36); + assert!(offset_of!(TSMethodSignature, optional) == 37); + assert!(offset_of!(TSMethodSignature, kind) == 38); + assert!(offset_of!(TSMethodSignature, type_parameters) == 16); + assert!(offset_of!(TSMethodSignature, this_param) == 20); + assert!(offset_of!(TSMethodSignature, params) == 24); + assert!(offset_of!(TSMethodSignature, return_type) == 28); + assert!(offset_of!(TSMethodSignature, scope_id) == 32); + + // Padding: 0 bytes + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSConstructSignatureDeclaration, span) == 0); - assert!(offset_of!(TSConstructSignatureDeclaration, type_parameters) == 24); - assert!(offset_of!(TSConstructSignatureDeclaration, params) == 28); - assert!(offset_of!(TSConstructSignatureDeclaration, return_type) == 32); - assert!(offset_of!(TSConstructSignatureDeclaration, scope_id) == 36); + assert!(offset_of!(TSConstructSignatureDeclaration, type_parameters) == 8); + assert!(offset_of!(TSConstructSignatureDeclaration, params) == 12); + assert!(offset_of!(TSConstructSignatureDeclaration, return_type) == 16); + assert!(offset_of!(TSConstructSignatureDeclaration, scope_id) == 20); // Padding: 0 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(TSIndexSignatureName, span) == 0); - assert!(offset_of!(TSIndexSignatureName, name) == 24); - assert!(offset_of!(TSIndexSignatureName, type_annotation) == 32); + assert!(offset_of!(TSIndexSignatureName, name) == 8); + assert!(offset_of!(TSIndexSignatureName, type_annotation) == 16); // Padding: 0 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(TSInterfaceHeritage, span) == 0); - assert!(offset_of!(TSInterfaceHeritage, expression) == 24); - assert!(offset_of!(TSInterfaceHeritage, type_arguments) == 32); + assert!(offset_of!(TSInterfaceHeritage, expression) == 8); + assert!(offset_of!(TSInterfaceHeritage, type_arguments) == 16); // Padding: 3 bytes - assert!(size_of::() == 60); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(TSTypePredicate, span) == 0); - assert!(offset_of!(TSTypePredicate, parameter_name) == 24); - assert!(offset_of!(TSTypePredicate, asserts) == 56); - assert!(offset_of!(TSTypePredicate, type_annotation) == 52); + assert!(offset_of!(TSTypePredicate, parameter_name) == 8); + assert!(offset_of!(TSTypePredicate, asserts) == 24); + assert!(offset_of!(TSTypePredicate, type_annotation) == 20); - assert!(size_of::() == 28); + assert!(size_of::() == 12); assert!(align_of::() == 4); // Padding: 2 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 56); assert!(align_of::() == 4); assert!(offset_of!(TSModuleDeclaration, span) == 0); - assert!(offset_of!(TSModuleDeclaration, id) == 24); - assert!(offset_of!(TSModuleDeclaration, body) == 72); - assert!(offset_of!(TSModuleDeclaration, kind) == 84); - assert!(offset_of!(TSModuleDeclaration, declare) == 85); - assert!(offset_of!(TSModuleDeclaration, scope_id) == 80); + assert!(offset_of!(TSModuleDeclaration, id) == 8); + assert!(offset_of!(TSModuleDeclaration, body) == 40); + assert!(offset_of!(TSModuleDeclaration, kind) == 52); + assert!(offset_of!(TSModuleDeclaration, declare) == 53); + assert!(offset_of!(TSModuleDeclaration, scope_id) == 48); assert!(size_of::() == 1); assert!(align_of::() == 1); - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSModuleBlock, span) == 0); - assert!(offset_of!(TSModuleBlock, directives) == 24); - assert!(offset_of!(TSModuleBlock, body) == 40); + assert!(offset_of!(TSModuleBlock, directives) == 8); + assert!(offset_of!(TSModuleBlock, body) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSTypeLiteral, span) == 0); - assert!(offset_of!(TSTypeLiteral, members) == 24); + assert!(offset_of!(TSTypeLiteral, members) == 8); // Padding: 0 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 12); assert!(align_of::() == 4); assert!(offset_of!(TSInferType, span) == 0); - assert!(offset_of!(TSInferType, type_parameter) == 24); + assert!(offset_of!(TSInferType, type_parameter) == 8); // Padding: 0 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(TSTypeQuery, span) == 0); - assert!(offset_of!(TSTypeQuery, expr_name) == 24); - assert!(offset_of!(TSTypeQuery, type_arguments) == 32); + assert!(offset_of!(TSTypeQuery, expr_name) == 8); + assert!(offset_of!(TSTypeQuery, type_arguments) == 16); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(TSImportType, span) == 0); - assert!(offset_of!(TSImportType, argument) == 24); - assert!(offset_of!(TSImportType, options) == 32); - assert!(offset_of!(TSImportType, qualifier) == 36); - assert!(offset_of!(TSImportType, type_arguments) == 44); + assert!(offset_of!(TSImportType, argument) == 8); + assert!(offset_of!(TSImportType, options) == 16); + assert!(offset_of!(TSImportType, qualifier) == 20); + assert!(offset_of!(TSImportType, type_arguments) == 28); // Padding: 0 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(TSFunctionType, span) == 0); - assert!(offset_of!(TSFunctionType, type_parameters) == 24); - assert!(offset_of!(TSFunctionType, this_param) == 28); - assert!(offset_of!(TSFunctionType, params) == 32); - assert!(offset_of!(TSFunctionType, return_type) == 36); - assert!(offset_of!(TSFunctionType, scope_id) == 40); + assert!(offset_of!(TSFunctionType, type_parameters) == 8); + assert!(offset_of!(TSFunctionType, this_param) == 12); + assert!(offset_of!(TSFunctionType, params) == 16); + assert!(offset_of!(TSFunctionType, return_type) == 20); + assert!(offset_of!(TSFunctionType, scope_id) == 24); // Padding: 3 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSConstructorType, span) == 0); - assert!(offset_of!(TSConstructorType, r#abstract) == 36); - assert!(offset_of!(TSConstructorType, type_parameters) == 24); - assert!(offset_of!(TSConstructorType, params) == 28); - assert!(offset_of!(TSConstructorType, return_type) == 32); + assert!(offset_of!(TSConstructorType, r#abstract) == 20); + assert!(offset_of!(TSConstructorType, type_parameters) == 8); + assert!(offset_of!(TSConstructorType, params) == 12); + assert!(offset_of!(TSConstructorType, return_type) == 16); // Padding: 2 bytes - assert!(size_of::() == 52); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(TSMappedType, span) == 0); - assert!(offset_of!(TSMappedType, type_parameter) == 24); - assert!(offset_of!(TSMappedType, name_type) == 28); - assert!(offset_of!(TSMappedType, type_annotation) == 36); - assert!(offset_of!(TSMappedType, optional) == 48); - assert!(offset_of!(TSMappedType, readonly) == 49); - assert!(offset_of!(TSMappedType, scope_id) == 44); + assert!(offset_of!(TSMappedType, type_parameter) == 8); + assert!(offset_of!(TSMappedType, name_type) == 12); + assert!(offset_of!(TSMappedType, type_annotation) == 20); + assert!(offset_of!(TSMappedType, optional) == 32); + assert!(offset_of!(TSMappedType, readonly) == 33); + assert!(offset_of!(TSMappedType, scope_id) == 28); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSTemplateLiteralType, span) == 0); - assert!(offset_of!(TSTemplateLiteralType, quasis) == 24); - assert!(offset_of!(TSTemplateLiteralType, types) == 40); + assert!(offset_of!(TSTemplateLiteralType, quasis) == 8); + assert!(offset_of!(TSTemplateLiteralType, types) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSAsExpression, span) == 0); - assert!(offset_of!(TSAsExpression, expression) == 24); - assert!(offset_of!(TSAsExpression, type_annotation) == 32); + assert!(offset_of!(TSAsExpression, expression) == 8); + assert!(offset_of!(TSAsExpression, type_annotation) == 16); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSSatisfiesExpression, span) == 0); - assert!(offset_of!(TSSatisfiesExpression, expression) == 24); - assert!(offset_of!(TSSatisfiesExpression, type_annotation) == 32); + assert!(offset_of!(TSSatisfiesExpression, expression) == 8); + assert!(offset_of!(TSSatisfiesExpression, type_annotation) == 16); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSTypeAssertion, span) == 0); - assert!(offset_of!(TSTypeAssertion, type_annotation) == 24); - assert!(offset_of!(TSTypeAssertion, expression) == 32); + assert!(offset_of!(TSTypeAssertion, type_annotation) == 8); + assert!(offset_of!(TSTypeAssertion, expression) == 16); // Padding: 3 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(TSImportEqualsDeclaration, span) == 0); - assert!(offset_of!(TSImportEqualsDeclaration, id) == 24); - assert!(offset_of!(TSImportEqualsDeclaration, module_reference) == 60); - assert!(offset_of!(TSImportEqualsDeclaration, import_kind) == 68); + assert!(offset_of!(TSImportEqualsDeclaration, id) == 8); + assert!(offset_of!(TSImportEqualsDeclaration, module_reference) == 28); + assert!(offset_of!(TSImportEqualsDeclaration, import_kind) == 36); assert!(size_of::() == 8); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 68); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(TSExternalModuleReference, span) == 0); - assert!(offset_of!(TSExternalModuleReference, expression) == 24); + assert!(offset_of!(TSExternalModuleReference, expression) == 8); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(TSNonNullExpression, span) == 0); - assert!(offset_of!(TSNonNullExpression, expression) == 24); + assert!(offset_of!(TSNonNullExpression, expression) == 8); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(Decorator, span) == 0); - assert!(offset_of!(Decorator, expression) == 24); + assert!(offset_of!(Decorator, expression) == 8); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(TSExportAssignment, span) == 0); - assert!(offset_of!(TSExportAssignment, expression) == 24); + assert!(offset_of!(TSExportAssignment, expression) == 8); // Padding: 0 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSNamespaceExportDeclaration, span) == 0); - assert!(offset_of!(TSNamespaceExportDeclaration, id) == 24); + assert!(offset_of!(TSNamespaceExportDeclaration, id) == 8); // Padding: 0 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(TSInstantiationExpression, span) == 0); - assert!(offset_of!(TSInstantiationExpression, expression) == 24); - assert!(offset_of!(TSInstantiationExpression, type_arguments) == 32); + assert!(offset_of!(TSInstantiationExpression, expression) == 8); + assert!(offset_of!(TSInstantiationExpression, type_arguments) == 16); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 3 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(JSDocNullableType, span) == 0); - assert!(offset_of!(JSDocNullableType, type_annotation) == 24); - assert!(offset_of!(JSDocNullableType, postfix) == 32); + assert!(offset_of!(JSDocNullableType, type_annotation) == 8); + assert!(offset_of!(JSDocNullableType, postfix) == 16); // Padding: 3 bytes - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); assert!(offset_of!(JSDocNonNullableType, span) == 0); - assert!(offset_of!(JSDocNonNullableType, type_annotation) == 24); - assert!(offset_of!(JSDocNonNullableType, postfix) == 32); + assert!(offset_of!(JSDocNonNullableType, type_annotation) == 8); + assert!(offset_of!(JSDocNonNullableType, postfix) == 16); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(JSDocUnknownType, span) == 0); @@ -3177,14 +3177,14 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(Comment, span) == 0); - assert!(offset_of!(Comment, attached_to) == 24); - assert!(offset_of!(Comment, kind) == 28); - assert!(offset_of!(Comment, position) == 29); - assert!(offset_of!(Comment, newlines) == 30); - assert!(offset_of!(Comment, content) == 31); + assert!(offset_of!(Comment, attached_to) == 8); + assert!(offset_of!(Comment, kind) == 12); + assert!(offset_of!(Comment, position) == 13); + assert!(offset_of!(Comment, newlines) == 14); + assert!(offset_of!(Comment, content) == 15); }; #[cfg(not(any(target_pointer_width = "64", target_pointer_width = "32")))] diff --git a/crates/oxc_ast/src/generated/derive_dummy.rs b/crates/oxc_ast/src/generated/derive_dummy.rs index c94831ea8b9f3..12b4fd502d766 100644 --- a/crates/oxc_ast/src/generated/derive_dummy.rs +++ b/crates/oxc_ast/src/generated/derive_dummy.rs @@ -31,7 +31,7 @@ impl<'a> Dummy<'a> for Program<'a> { impl<'a> Dummy<'a> for Expression<'a> { /// Create a dummy [`Expression`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::NullLiteral(Dummy::dummy(allocator)) } @@ -129,7 +129,7 @@ impl<'a> Dummy<'a> for ObjectExpression<'a> { impl<'a> Dummy<'a> for ObjectPropertyKind<'a> { /// Create a dummy [`ObjectPropertyKind`]. /// - /// Has cost of making 2 allocations (64 bytes). + /// Has cost of making 2 allocations (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::SpreadProperty(Dummy::dummy(allocator)) } @@ -138,7 +138,7 @@ impl<'a> Dummy<'a> for ObjectPropertyKind<'a> { impl<'a> Dummy<'a> for ObjectProperty<'a> { /// Create a dummy [`ObjectProperty`]. /// - /// Has cost of making 2 allocations (48 bytes). + /// Has cost of making 2 allocations (16 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -155,7 +155,7 @@ impl<'a> Dummy<'a> for ObjectProperty<'a> { impl<'a> Dummy<'a> for PropertyKey<'a> { /// Create a dummy [`PropertyKey`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::NullLiteral(Dummy::dummy(allocator)) } @@ -187,7 +187,7 @@ impl<'a> Dummy<'a> for TemplateLiteral<'a> { impl<'a> Dummy<'a> for TaggedTemplateExpression<'a> { /// Create a dummy [`TaggedTemplateExpression`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -224,7 +224,7 @@ impl<'a> Dummy<'a> for TemplateElementValue<'a> { impl<'a> Dummy<'a> for MemberExpression<'a> { /// Create a dummy [`MemberExpression`]. /// - /// Has cost of making 2 allocations (112 bytes). + /// Has cost of making 2 allocations (64 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::StaticMemberExpression(Dummy::dummy(allocator)) } @@ -233,7 +233,7 @@ impl<'a> Dummy<'a> for MemberExpression<'a> { impl<'a> Dummy<'a> for ComputedMemberExpression<'a> { /// Create a dummy [`ComputedMemberExpression`]. /// - /// Has cost of making 2 allocations (48 bytes). + /// Has cost of making 2 allocations (16 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -247,7 +247,7 @@ impl<'a> Dummy<'a> for ComputedMemberExpression<'a> { impl<'a> Dummy<'a> for StaticMemberExpression<'a> { /// Create a dummy [`StaticMemberExpression`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -261,7 +261,7 @@ impl<'a> Dummy<'a> for StaticMemberExpression<'a> { impl<'a> Dummy<'a> for PrivateFieldExpression<'a> { /// Create a dummy [`PrivateFieldExpression`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -275,7 +275,7 @@ impl<'a> Dummy<'a> for PrivateFieldExpression<'a> { impl<'a> Dummy<'a> for CallExpression<'a> { /// Create a dummy [`CallExpression`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -291,7 +291,7 @@ impl<'a> Dummy<'a> for CallExpression<'a> { impl<'a> Dummy<'a> for NewExpression<'a> { /// Create a dummy [`NewExpression`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -319,7 +319,7 @@ impl<'a> Dummy<'a> for MetaProperty<'a> { impl<'a> Dummy<'a> for SpreadElement<'a> { /// Create a dummy [`SpreadElement`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), argument: Dummy::dummy(allocator) } } @@ -328,7 +328,7 @@ impl<'a> Dummy<'a> for SpreadElement<'a> { impl<'a> Dummy<'a> for Argument<'a> { /// Create a dummy [`Argument`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::NullLiteral(Dummy::dummy(allocator)) } @@ -337,7 +337,7 @@ impl<'a> Dummy<'a> for Argument<'a> { impl<'a> Dummy<'a> for UpdateExpression<'a> { /// Create a dummy [`UpdateExpression`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -351,7 +351,7 @@ impl<'a> Dummy<'a> for UpdateExpression<'a> { impl<'a> Dummy<'a> for UnaryExpression<'a> { /// Create a dummy [`UnaryExpression`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -364,7 +364,7 @@ impl<'a> Dummy<'a> for UnaryExpression<'a> { impl<'a> Dummy<'a> for BinaryExpression<'a> { /// Create a dummy [`BinaryExpression`]. /// - /// Has cost of making 2 allocations (48 bytes). + /// Has cost of making 2 allocations (16 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -378,7 +378,7 @@ impl<'a> Dummy<'a> for BinaryExpression<'a> { impl<'a> Dummy<'a> for PrivateInExpression<'a> { /// Create a dummy [`PrivateInExpression`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -391,7 +391,7 @@ impl<'a> Dummy<'a> for PrivateInExpression<'a> { impl<'a> Dummy<'a> for LogicalExpression<'a> { /// Create a dummy [`LogicalExpression`]. /// - /// Has cost of making 2 allocations (48 bytes). + /// Has cost of making 2 allocations (16 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -405,7 +405,7 @@ impl<'a> Dummy<'a> for LogicalExpression<'a> { impl<'a> Dummy<'a> for ConditionalExpression<'a> { /// Create a dummy [`ConditionalExpression`]. /// - /// Has cost of making 3 allocations (72 bytes). + /// Has cost of making 3 allocations (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -419,7 +419,7 @@ impl<'a> Dummy<'a> for ConditionalExpression<'a> { impl<'a> Dummy<'a> for AssignmentExpression<'a> { /// Create a dummy [`AssignmentExpression`]. /// - /// Has cost of making 2 allocations (72 bytes). + /// Has cost of making 2 allocations (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -433,7 +433,7 @@ impl<'a> Dummy<'a> for AssignmentExpression<'a> { impl<'a> Dummy<'a> for AssignmentTarget<'a> { /// Create a dummy [`AssignmentTarget`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::AssignmentTargetIdentifier(Dummy::dummy(allocator)) } @@ -442,7 +442,7 @@ impl<'a> Dummy<'a> for AssignmentTarget<'a> { impl<'a> Dummy<'a> for SimpleAssignmentTarget<'a> { /// Create a dummy [`SimpleAssignmentTarget`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::AssignmentTargetIdentifier(Dummy::dummy(allocator)) } @@ -451,7 +451,7 @@ impl<'a> Dummy<'a> for SimpleAssignmentTarget<'a> { impl<'a> Dummy<'a> for AssignmentTargetPattern<'a> { /// Create a dummy [`AssignmentTargetPattern`]. /// - /// Has cost of making 1 allocation (88 bytes). + /// Has cost of making 1 allocation (56 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::ArrayAssignmentTarget(Dummy::dummy(allocator)) } @@ -486,7 +486,7 @@ impl<'a> Dummy<'a> for ObjectAssignmentTarget<'a> { impl<'a> Dummy<'a> for AssignmentTargetRest<'a> { /// Create a dummy [`AssignmentTargetRest`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), target: Dummy::dummy(allocator) } } @@ -495,7 +495,7 @@ impl<'a> Dummy<'a> for AssignmentTargetRest<'a> { impl<'a> Dummy<'a> for AssignmentTargetMaybeDefault<'a> { /// Create a dummy [`AssignmentTargetMaybeDefault`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::AssignmentTargetIdentifier(Dummy::dummy(allocator)) } @@ -504,7 +504,7 @@ impl<'a> Dummy<'a> for AssignmentTargetMaybeDefault<'a> { impl<'a> Dummy<'a> for AssignmentTargetWithDefault<'a> { /// Create a dummy [`AssignmentTargetWithDefault`]. /// - /// Has cost of making 2 allocations (72 bytes). + /// Has cost of making 2 allocations (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -517,7 +517,7 @@ impl<'a> Dummy<'a> for AssignmentTargetWithDefault<'a> { impl<'a> Dummy<'a> for AssignmentTargetProperty<'a> { /// Create a dummy [`AssignmentTargetProperty`]. /// - /// Has cost of making 1 allocation (88 bytes). + /// Has cost of making 1 allocation (56 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::AssignmentTargetPropertyIdentifier(Dummy::dummy(allocator)) } @@ -539,7 +539,7 @@ impl<'a> Dummy<'a> for AssignmentTargetPropertyIdentifier<'a> { impl<'a> Dummy<'a> for AssignmentTargetPropertyProperty<'a> { /// Create a dummy [`AssignmentTargetPropertyProperty`]. /// - /// Has cost of making 2 allocations (72 bytes). + /// Has cost of making 2 allocations (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -571,7 +571,7 @@ impl<'a> Dummy<'a> for Super { impl<'a> Dummy<'a> for AwaitExpression<'a> { /// Create a dummy [`AwaitExpression`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), argument: Dummy::dummy(allocator) } } @@ -580,7 +580,7 @@ impl<'a> Dummy<'a> for AwaitExpression<'a> { impl<'a> Dummy<'a> for ChainExpression<'a> { /// Create a dummy [`ChainExpression`]. /// - /// Has cost of making 2 allocations (64 bytes). + /// Has cost of making 2 allocations (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), expression: Dummy::dummy(allocator) } } @@ -589,7 +589,7 @@ impl<'a> Dummy<'a> for ChainExpression<'a> { impl<'a> Dummy<'a> for ChainElement<'a> { /// Create a dummy [`ChainElement`]. /// - /// Has cost of making 2 allocations (64 bytes). + /// Has cost of making 2 allocations (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::TSNonNullExpression(Dummy::dummy(allocator)) } @@ -598,7 +598,7 @@ impl<'a> Dummy<'a> for ChainElement<'a> { impl<'a> Dummy<'a> for ParenthesizedExpression<'a> { /// Create a dummy [`ParenthesizedExpression`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), expression: Dummy::dummy(allocator) } } @@ -607,7 +607,7 @@ impl<'a> Dummy<'a> for ParenthesizedExpression<'a> { impl<'a> Dummy<'a> for Statement<'a> { /// Create a dummy [`Statement`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::DebuggerStatement(Dummy::dummy(allocator)) } @@ -651,7 +651,7 @@ impl<'a> Dummy<'a> for BlockStatement<'a> { impl<'a> Dummy<'a> for Declaration<'a> { /// Create a dummy [`Declaration`]. /// - /// Has cost of making 1 allocation (56 bytes). + /// Has cost of making 1 allocation (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::VariableDeclaration(Dummy::dummy(allocator)) } @@ -684,7 +684,7 @@ impl<'a> Dummy<'a> for VariableDeclarationKind { impl<'a> Dummy<'a> for VariableDeclarator<'a> { /// Create a dummy [`VariableDeclarator`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -708,7 +708,7 @@ impl<'a> Dummy<'a> for EmptyStatement { impl<'a> Dummy<'a> for ExpressionStatement<'a> { /// Create a dummy [`ExpressionStatement`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), expression: Dummy::dummy(allocator) } } @@ -717,7 +717,7 @@ impl<'a> Dummy<'a> for ExpressionStatement<'a> { impl<'a> Dummy<'a> for IfStatement<'a> { /// Create a dummy [`IfStatement`]. /// - /// Has cost of making 2 allocations (48 bytes). + /// Has cost of making 2 allocations (16 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -731,7 +731,7 @@ impl<'a> Dummy<'a> for IfStatement<'a> { impl<'a> Dummy<'a> for DoWhileStatement<'a> { /// Create a dummy [`DoWhileStatement`]. /// - /// Has cost of making 2 allocations (48 bytes). + /// Has cost of making 2 allocations (16 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -744,7 +744,7 @@ impl<'a> Dummy<'a> for DoWhileStatement<'a> { impl<'a> Dummy<'a> for WhileStatement<'a> { /// Create a dummy [`WhileStatement`]. /// - /// Has cost of making 2 allocations (48 bytes). + /// Has cost of making 2 allocations (16 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -757,7 +757,7 @@ impl<'a> Dummy<'a> for WhileStatement<'a> { impl<'a> Dummy<'a> for ForStatement<'a> { /// Create a dummy [`ForStatement`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -773,7 +773,7 @@ impl<'a> Dummy<'a> for ForStatement<'a> { impl<'a> Dummy<'a> for ForStatementInit<'a> { /// Create a dummy [`ForStatementInit`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::NullLiteral(Dummy::dummy(allocator)) } @@ -782,7 +782,7 @@ impl<'a> Dummy<'a> for ForStatementInit<'a> { impl<'a> Dummy<'a> for ForInStatement<'a> { /// Create a dummy [`ForInStatement`]. /// - /// Has cost of making 3 allocations (96 bytes). + /// Has cost of making 3 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -797,7 +797,7 @@ impl<'a> Dummy<'a> for ForInStatement<'a> { impl<'a> Dummy<'a> for ForStatementLeft<'a> { /// Create a dummy [`ForStatementLeft`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::AssignmentTargetIdentifier(Dummy::dummy(allocator)) } @@ -806,7 +806,7 @@ impl<'a> Dummy<'a> for ForStatementLeft<'a> { impl<'a> Dummy<'a> for ForOfStatement<'a> { /// Create a dummy [`ForOfStatement`]. /// - /// Has cost of making 3 allocations (96 bytes). + /// Has cost of making 3 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -849,7 +849,7 @@ impl<'a> Dummy<'a> for ReturnStatement<'a> { impl<'a> Dummy<'a> for WithStatement<'a> { /// Create a dummy [`WithStatement`]. /// - /// Has cost of making 2 allocations (48 bytes). + /// Has cost of making 2 allocations (16 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -862,7 +862,7 @@ impl<'a> Dummy<'a> for WithStatement<'a> { impl<'a> Dummy<'a> for SwitchStatement<'a> { /// Create a dummy [`SwitchStatement`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -889,7 +889,7 @@ impl<'a> Dummy<'a> for SwitchCase<'a> { impl<'a> Dummy<'a> for LabeledStatement<'a> { /// Create a dummy [`LabeledStatement`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -902,7 +902,7 @@ impl<'a> Dummy<'a> for LabeledStatement<'a> { impl<'a> Dummy<'a> for ThrowStatement<'a> { /// Create a dummy [`ThrowStatement`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), argument: Dummy::dummy(allocator) } } @@ -911,7 +911,7 @@ impl<'a> Dummy<'a> for ThrowStatement<'a> { impl<'a> Dummy<'a> for TryStatement<'a> { /// Create a dummy [`TryStatement`]. /// - /// Has cost of making 1 allocation (56 bytes). + /// Has cost of making 1 allocation (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -925,7 +925,7 @@ impl<'a> Dummy<'a> for TryStatement<'a> { impl<'a> Dummy<'a> for CatchClause<'a> { /// Create a dummy [`CatchClause`]. /// - /// Has cost of making 1 allocation (56 bytes). + /// Has cost of making 1 allocation (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -939,7 +939,7 @@ impl<'a> Dummy<'a> for CatchClause<'a> { impl<'a> Dummy<'a> for CatchParameter<'a> { /// Create a dummy [`CatchParameter`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), pattern: Dummy::dummy(allocator) } } @@ -957,7 +957,7 @@ impl<'a> Dummy<'a> for DebuggerStatement { impl<'a> Dummy<'a> for BindingPattern<'a> { /// Create a dummy [`BindingPattern`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { kind: Dummy::dummy(allocator), @@ -970,7 +970,7 @@ impl<'a> Dummy<'a> for BindingPattern<'a> { impl<'a> Dummy<'a> for BindingPatternKind<'a> { /// Create a dummy [`BindingPatternKind`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::BindingIdentifier(Dummy::dummy(allocator)) } @@ -979,7 +979,7 @@ impl<'a> Dummy<'a> for BindingPatternKind<'a> { impl<'a> Dummy<'a> for AssignmentPattern<'a> { /// Create a dummy [`AssignmentPattern`]. /// - /// Has cost of making 2 allocations (72 bytes). + /// Has cost of making 2 allocations (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1005,7 +1005,7 @@ impl<'a> Dummy<'a> for ObjectPattern<'a> { impl<'a> Dummy<'a> for BindingProperty<'a> { /// Create a dummy [`BindingProperty`]. /// - /// Has cost of making 2 allocations (72 bytes). + /// Has cost of making 2 allocations (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1033,7 +1033,7 @@ impl<'a> Dummy<'a> for ArrayPattern<'a> { impl<'a> Dummy<'a> for BindingRestElement<'a> { /// Create a dummy [`BindingRestElement`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), argument: Dummy::dummy(allocator) } } @@ -1042,7 +1042,7 @@ impl<'a> Dummy<'a> for BindingRestElement<'a> { impl<'a> Dummy<'a> for Function<'a> { /// Create a dummy [`Function`]. /// - /// Has cost of making 1 allocation (64 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1089,7 +1089,7 @@ impl<'a> Dummy<'a> for FormalParameters<'a> { impl<'a> Dummy<'a> for FormalParameter<'a> { /// Create a dummy [`FormalParameter`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1128,7 +1128,7 @@ impl<'a> Dummy<'a> for FunctionBody<'a> { impl<'a> Dummy<'a> for ArrowFunctionExpression<'a> { /// Create a dummy [`ArrowFunctionExpression`]. /// - /// Has cost of making 2 allocations (136 bytes). + /// Has cost of making 2 allocations (104 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1160,7 +1160,7 @@ impl<'a> Dummy<'a> for YieldExpression<'a> { impl<'a> Dummy<'a> for Class<'a> { /// Create a dummy [`Class`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1201,7 +1201,7 @@ impl<'a> Dummy<'a> for ClassBody<'a> { impl<'a> Dummy<'a> for ClassElement<'a> { /// Create a dummy [`ClassElement`]. /// - /// Has cost of making 1 allocation (56 bytes). + /// Has cost of making 1 allocation (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::StaticBlock(Dummy::dummy(allocator)) } @@ -1210,7 +1210,7 @@ impl<'a> Dummy<'a> for ClassElement<'a> { impl<'a> Dummy<'a> for MethodDefinition<'a> { /// Create a dummy [`MethodDefinition`]. /// - /// Has cost of making 3 allocations (216 bytes). + /// Has cost of making 3 allocations (152 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1241,7 +1241,7 @@ impl<'a> Dummy<'a> for MethodDefinitionType { impl<'a> Dummy<'a> for PropertyDefinition<'a> { /// Create a dummy [`PropertyDefinition`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1307,7 +1307,7 @@ impl<'a> Dummy<'a> for StaticBlock<'a> { impl<'a> Dummy<'a> for ModuleDeclaration<'a> { /// Create a dummy [`ModuleDeclaration`]. /// - /// Has cost of making 1 allocation (64 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::TSNamespaceExportDeclaration(Dummy::dummy(allocator)) } @@ -1326,7 +1326,7 @@ impl<'a> Dummy<'a> for AccessorPropertyType { impl<'a> Dummy<'a> for AccessorProperty<'a> { /// Create a dummy [`AccessorProperty`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1347,7 +1347,7 @@ impl<'a> Dummy<'a> for AccessorProperty<'a> { impl<'a> Dummy<'a> for ImportExpression<'a> { /// Create a dummy [`ImportExpression`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1387,7 +1387,7 @@ impl<'a> Dummy<'a> for ImportPhase { impl<'a> Dummy<'a> for ImportDeclarationSpecifier<'a> { /// Create a dummy [`ImportDeclarationSpecifier`]. /// - /// Has cost of making 1 allocation (72 bytes). + /// Has cost of making 1 allocation (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::ImportDefaultSpecifier(Dummy::dummy(allocator)) } @@ -1479,7 +1479,7 @@ impl<'a> Dummy<'a> for ExportNamedDeclaration<'a> { impl<'a> Dummy<'a> for ExportDefaultDeclaration<'a> { /// Create a dummy [`ExportDefaultDeclaration`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1521,7 +1521,7 @@ impl<'a> Dummy<'a> for ExportSpecifier<'a> { impl<'a> Dummy<'a> for ExportDefaultDeclarationKind<'a> { /// Create a dummy [`ExportDefaultDeclarationKind`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::NullLiteral(Dummy::dummy(allocator)) } @@ -1643,7 +1643,7 @@ impl<'a> Dummy<'a> for RegExpPattern<'a> { impl<'a> Dummy<'a> for JSXElement<'a> { /// Create a dummy [`JSXElement`]. /// - /// Has cost of making 2 allocations (96 bytes). + /// Has cost of making 2 allocations (64 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1657,7 +1657,7 @@ impl<'a> Dummy<'a> for JSXElement<'a> { impl<'a> Dummy<'a> for JSXOpeningElement<'a> { /// Create a dummy [`JSXOpeningElement`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1671,7 +1671,7 @@ impl<'a> Dummy<'a> for JSXOpeningElement<'a> { impl<'a> Dummy<'a> for JSXClosingElement<'a> { /// Create a dummy [`JSXClosingElement`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), name: Dummy::dummy(allocator) } } @@ -1712,7 +1712,7 @@ impl<'a> Dummy<'a> for JSXClosingFragment { impl<'a> Dummy<'a> for JSXElementName<'a> { /// Create a dummy [`JSXElementName`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::ThisExpression(Dummy::dummy(allocator)) } @@ -1734,7 +1734,7 @@ impl<'a> Dummy<'a> for JSXNamespacedName<'a> { impl<'a> Dummy<'a> for JSXMemberExpression<'a> { /// Create a dummy [`JSXMemberExpression`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1747,7 +1747,7 @@ impl<'a> Dummy<'a> for JSXMemberExpression<'a> { impl<'a> Dummy<'a> for JSXMemberExpressionObject<'a> { /// Create a dummy [`JSXMemberExpressionObject`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::ThisExpression(Dummy::dummy(allocator)) } @@ -1783,7 +1783,7 @@ impl<'a> Dummy<'a> for JSXEmptyExpression { impl<'a> Dummy<'a> for JSXAttributeItem<'a> { /// Create a dummy [`JSXAttributeItem`]. /// - /// Has cost of making 2 allocations (64 bytes). + /// Has cost of making 2 allocations (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::SpreadAttribute(Dummy::dummy(allocator)) } @@ -1792,7 +1792,7 @@ impl<'a> Dummy<'a> for JSXAttributeItem<'a> { impl<'a> Dummy<'a> for JSXAttribute<'a> { /// Create a dummy [`JSXAttribute`]. /// - /// Has cost of making 1 allocation (40 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1805,7 +1805,7 @@ impl<'a> Dummy<'a> for JSXAttribute<'a> { impl<'a> Dummy<'a> for JSXSpreadAttribute<'a> { /// Create a dummy [`JSXSpreadAttribute`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), argument: Dummy::dummy(allocator) } } @@ -1814,7 +1814,7 @@ impl<'a> Dummy<'a> for JSXSpreadAttribute<'a> { impl<'a> Dummy<'a> for JSXAttributeName<'a> { /// Create a dummy [`JSXAttributeName`]. /// - /// Has cost of making 1 allocation (40 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::Identifier(Dummy::dummy(allocator)) } @@ -1823,7 +1823,7 @@ impl<'a> Dummy<'a> for JSXAttributeName<'a> { impl<'a> Dummy<'a> for JSXAttributeValue<'a> { /// Create a dummy [`JSXAttributeValue`]. /// - /// Has cost of making 1 allocation (56 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::ExpressionContainer(Dummy::dummy(allocator)) } @@ -1841,16 +1841,16 @@ impl<'a> Dummy<'a> for JSXIdentifier<'a> { impl<'a> Dummy<'a> for JSXChild<'a> { /// Create a dummy [`JSXChild`]. /// - /// Has cost of making 1 allocation (56 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { - Self::Text(Dummy::dummy(allocator)) + Self::ExpressionContainer(Dummy::dummy(allocator)) } } impl<'a> Dummy<'a> for JSXSpreadChild<'a> { /// Create a dummy [`JSXSpreadChild`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), expression: Dummy::dummy(allocator) } } @@ -1910,7 +1910,7 @@ impl<'a> Dummy<'a> for TSEnumBody<'a> { impl<'a> Dummy<'a> for TSEnumMember<'a> { /// Create a dummy [`TSEnumMember`]. /// - /// Has cost of making 1 allocation (40 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -1923,7 +1923,7 @@ impl<'a> Dummy<'a> for TSEnumMember<'a> { impl<'a> Dummy<'a> for TSEnumMemberName<'a> { /// Create a dummy [`TSEnumMemberName`]. /// - /// Has cost of making 1 allocation (40 bytes). + /// Has cost of making 1 allocation (24 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::Identifier(Dummy::dummy(allocator)) } @@ -1932,7 +1932,7 @@ impl<'a> Dummy<'a> for TSEnumMemberName<'a> { impl<'a> Dummy<'a> for TSTypeAnnotation<'a> { /// Create a dummy [`TSTypeAnnotation`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), type_annotation: Dummy::dummy(allocator) } } @@ -1941,7 +1941,7 @@ impl<'a> Dummy<'a> for TSTypeAnnotation<'a> { impl<'a> Dummy<'a> for TSLiteralType<'a> { /// Create a dummy [`TSLiteralType`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (16 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), literal: Dummy::dummy(allocator) } } @@ -1950,7 +1950,7 @@ impl<'a> Dummy<'a> for TSLiteralType<'a> { impl<'a> Dummy<'a> for TSLiteral<'a> { /// Create a dummy [`TSLiteral`]. /// - /// Has cost of making 1 allocation (32 bytes). + /// Has cost of making 1 allocation (16 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::BooleanLiteral(Dummy::dummy(allocator)) } @@ -1959,7 +1959,7 @@ impl<'a> Dummy<'a> for TSLiteral<'a> { impl<'a> Dummy<'a> for TSType<'a> { /// Create a dummy [`TSType`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::TSAnyKeyword(Dummy::dummy(allocator)) } @@ -1968,7 +1968,7 @@ impl<'a> Dummy<'a> for TSType<'a> { impl<'a> Dummy<'a> for TSConditionalType<'a> { /// Create a dummy [`TSConditionalType`]. /// - /// Has cost of making 4 allocations (96 bytes). + /// Has cost of making 4 allocations (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2002,7 +2002,7 @@ impl<'a> Dummy<'a> for TSIntersectionType<'a> { impl<'a> Dummy<'a> for TSParenthesizedType<'a> { /// Create a dummy [`TSParenthesizedType`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), type_annotation: Dummy::dummy(allocator) } } @@ -2011,7 +2011,7 @@ impl<'a> Dummy<'a> for TSParenthesizedType<'a> { impl<'a> Dummy<'a> for TSTypeOperator<'a> { /// Create a dummy [`TSTypeOperator`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2034,7 +2034,7 @@ impl<'a> Dummy<'a> for TSTypeOperatorOperator { impl<'a> Dummy<'a> for TSArrayType<'a> { /// Create a dummy [`TSArrayType`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), element_type: Dummy::dummy(allocator) } } @@ -2043,7 +2043,7 @@ impl<'a> Dummy<'a> for TSArrayType<'a> { impl<'a> Dummy<'a> for TSIndexedAccessType<'a> { /// Create a dummy [`TSIndexedAccessType`]. /// - /// Has cost of making 2 allocations (48 bytes). + /// Has cost of making 2 allocations (16 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2065,7 +2065,7 @@ impl<'a> Dummy<'a> for TSTupleType<'a> { impl<'a> Dummy<'a> for TSNamedTupleMember<'a> { /// Create a dummy [`TSNamedTupleMember`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2079,7 +2079,7 @@ impl<'a> Dummy<'a> for TSNamedTupleMember<'a> { impl<'a> Dummy<'a> for TSOptionalType<'a> { /// Create a dummy [`TSOptionalType`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), type_annotation: Dummy::dummy(allocator) } } @@ -2088,7 +2088,7 @@ impl<'a> Dummy<'a> for TSOptionalType<'a> { impl<'a> Dummy<'a> for TSRestType<'a> { /// Create a dummy [`TSRestType`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), type_annotation: Dummy::dummy(allocator) } } @@ -2097,7 +2097,7 @@ impl<'a> Dummy<'a> for TSRestType<'a> { impl<'a> Dummy<'a> for TSTupleElement<'a> { /// Create a dummy [`TSTupleElement`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::TSAnyKeyword(Dummy::dummy(allocator)) } @@ -2232,7 +2232,7 @@ impl<'a> Dummy<'a> for TSBigIntKeyword { impl<'a> Dummy<'a> for TSTypeReference<'a> { /// Create a dummy [`TSTypeReference`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2245,7 +2245,7 @@ impl<'a> Dummy<'a> for TSTypeReference<'a> { impl<'a> Dummy<'a> for TSTypeName<'a> { /// Create a dummy [`TSTypeName`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::IdentifierReference(Dummy::dummy(allocator)) } @@ -2254,7 +2254,7 @@ impl<'a> Dummy<'a> for TSTypeName<'a> { impl<'a> Dummy<'a> for TSQualifiedName<'a> { /// Create a dummy [`TSQualifiedName`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2302,7 +2302,7 @@ impl<'a> Dummy<'a> for TSTypeParameterDeclaration<'a> { impl<'a> Dummy<'a> for TSTypeAliasDeclaration<'a> { /// Create a dummy [`TSTypeAliasDeclaration`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2328,7 +2328,7 @@ impl<'a> Dummy<'a> for TSAccessibility { impl<'a> Dummy<'a> for TSClassImplements<'a> { /// Create a dummy [`TSClassImplements`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2341,7 +2341,7 @@ impl<'a> Dummy<'a> for TSClassImplements<'a> { impl<'a> Dummy<'a> for TSInterfaceDeclaration<'a> { /// Create a dummy [`TSInterfaceDeclaration`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2367,7 +2367,7 @@ impl<'a> Dummy<'a> for TSInterfaceBody<'a> { impl<'a> Dummy<'a> for TSPropertySignature<'a> { /// Create a dummy [`TSPropertySignature`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2383,7 +2383,7 @@ impl<'a> Dummy<'a> for TSPropertySignature<'a> { impl<'a> Dummy<'a> for TSSignature<'a> { /// Create a dummy [`TSSignature`]. /// - /// Has cost of making 2 allocations (80 bytes). + /// Has cost of making 2 allocations (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::TSPropertySignature(Dummy::dummy(allocator)) } @@ -2392,7 +2392,7 @@ impl<'a> Dummy<'a> for TSSignature<'a> { impl<'a> Dummy<'a> for TSIndexSignature<'a> { /// Create a dummy [`TSIndexSignature`]. /// - /// Has cost of making 2 allocations (64 bytes). + /// Has cost of making 2 allocations (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2407,7 +2407,7 @@ impl<'a> Dummy<'a> for TSIndexSignature<'a> { impl<'a> Dummy<'a> for TSCallSignatureDeclaration<'a> { /// Create a dummy [`TSCallSignatureDeclaration`]. /// - /// Has cost of making 1 allocation (64 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2432,7 +2432,7 @@ impl<'a> Dummy<'a> for TSMethodSignatureKind { impl<'a> Dummy<'a> for TSMethodSignature<'a> { /// Create a dummy [`TSMethodSignature`]. /// - /// Has cost of making 2 allocations (88 bytes). + /// Has cost of making 2 allocations (56 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2452,7 +2452,7 @@ impl<'a> Dummy<'a> for TSMethodSignature<'a> { impl<'a> Dummy<'a> for TSConstructSignatureDeclaration<'a> { /// Create a dummy [`TSConstructSignatureDeclaration`]. /// - /// Has cost of making 1 allocation (64 bytes). + /// Has cost of making 1 allocation (48 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2467,7 +2467,7 @@ impl<'a> Dummy<'a> for TSConstructSignatureDeclaration<'a> { impl<'a> Dummy<'a> for TSIndexSignatureName<'a> { /// Create a dummy [`TSIndexSignatureName`]. /// - /// Has cost of making 2 allocations (64 bytes). + /// Has cost of making 2 allocations (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2480,7 +2480,7 @@ impl<'a> Dummy<'a> for TSIndexSignatureName<'a> { impl<'a> Dummy<'a> for TSInterfaceHeritage<'a> { /// Create a dummy [`TSInterfaceHeritage`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2551,7 +2551,7 @@ impl<'a> Dummy<'a> for TSModuleDeclarationName<'a> { impl<'a> Dummy<'a> for TSModuleDeclarationBody<'a> { /// Create a dummy [`TSModuleDeclarationBody`]. /// - /// Has cost of making 1 allocation (72 bytes). + /// Has cost of making 1 allocation (56 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::TSModuleBlock(Dummy::dummy(allocator)) } @@ -2582,7 +2582,7 @@ impl<'a> Dummy<'a> for TSTypeLiteral<'a> { impl<'a> Dummy<'a> for TSInferType<'a> { /// Create a dummy [`TSInferType`]. /// - /// Has cost of making 1 allocation (112 bytes). + /// Has cost of making 1 allocation (80 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), type_parameter: Dummy::dummy(allocator) } } @@ -2591,7 +2591,7 @@ impl<'a> Dummy<'a> for TSInferType<'a> { impl<'a> Dummy<'a> for TSTypeQuery<'a> { /// Create a dummy [`TSTypeQuery`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2604,7 +2604,7 @@ impl<'a> Dummy<'a> for TSTypeQuery<'a> { impl<'a> Dummy<'a> for TSTypeQueryExprName<'a> { /// Create a dummy [`TSTypeQueryExprName`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::IdentifierReference(Dummy::dummy(allocator)) } @@ -2613,7 +2613,7 @@ impl<'a> Dummy<'a> for TSTypeQueryExprName<'a> { impl<'a> Dummy<'a> for TSImportType<'a> { /// Create a dummy [`TSImportType`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2628,7 +2628,7 @@ impl<'a> Dummy<'a> for TSImportType<'a> { impl<'a> Dummy<'a> for TSFunctionType<'a> { /// Create a dummy [`TSFunctionType`]. /// - /// Has cost of making 3 allocations (128 bytes). + /// Has cost of making 3 allocations (80 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2644,7 +2644,7 @@ impl<'a> Dummy<'a> for TSFunctionType<'a> { impl<'a> Dummy<'a> for TSConstructorType<'a> { /// Create a dummy [`TSConstructorType`]. /// - /// Has cost of making 3 allocations (128 bytes). + /// Has cost of making 3 allocations (80 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2659,7 +2659,7 @@ impl<'a> Dummy<'a> for TSConstructorType<'a> { impl<'a> Dummy<'a> for TSMappedType<'a> { /// Create a dummy [`TSMappedType`]. /// - /// Has cost of making 1 allocation (112 bytes). + /// Has cost of making 1 allocation (80 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2699,7 +2699,7 @@ impl<'a> Dummy<'a> for TSTemplateLiteralType<'a> { impl<'a> Dummy<'a> for TSAsExpression<'a> { /// Create a dummy [`TSAsExpression`]. /// - /// Has cost of making 2 allocations (48 bytes). + /// Has cost of making 2 allocations (16 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2712,7 +2712,7 @@ impl<'a> Dummy<'a> for TSAsExpression<'a> { impl<'a> Dummy<'a> for TSSatisfiesExpression<'a> { /// Create a dummy [`TSSatisfiesExpression`]. /// - /// Has cost of making 2 allocations (48 bytes). + /// Has cost of making 2 allocations (16 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2725,7 +2725,7 @@ impl<'a> Dummy<'a> for TSSatisfiesExpression<'a> { impl<'a> Dummy<'a> for TSTypeAssertion<'a> { /// Create a dummy [`TSTypeAssertion`]. /// - /// Has cost of making 2 allocations (48 bytes). + /// Has cost of making 2 allocations (16 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2738,7 +2738,7 @@ impl<'a> Dummy<'a> for TSTypeAssertion<'a> { impl<'a> Dummy<'a> for TSImportEqualsDeclaration<'a> { /// Create a dummy [`TSImportEqualsDeclaration`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2752,7 +2752,7 @@ impl<'a> Dummy<'a> for TSImportEqualsDeclaration<'a> { impl<'a> Dummy<'a> for TSModuleReference<'a> { /// Create a dummy [`TSModuleReference`]. /// - /// Has cost of making 1 allocation (48 bytes). + /// Has cost of making 1 allocation (32 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self::IdentifierReference(Dummy::dummy(allocator)) } @@ -2770,7 +2770,7 @@ impl<'a> Dummy<'a> for TSExternalModuleReference<'a> { impl<'a> Dummy<'a> for TSNonNullExpression<'a> { /// Create a dummy [`TSNonNullExpression`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), expression: Dummy::dummy(allocator) } } @@ -2779,7 +2779,7 @@ impl<'a> Dummy<'a> for TSNonNullExpression<'a> { impl<'a> Dummy<'a> for Decorator<'a> { /// Create a dummy [`Decorator`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), expression: Dummy::dummy(allocator) } } @@ -2788,7 +2788,7 @@ impl<'a> Dummy<'a> for Decorator<'a> { impl<'a> Dummy<'a> for TSExportAssignment<'a> { /// Create a dummy [`TSExportAssignment`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), expression: Dummy::dummy(allocator) } } @@ -2806,7 +2806,7 @@ impl<'a> Dummy<'a> for TSNamespaceExportDeclaration<'a> { impl<'a> Dummy<'a> for TSInstantiationExpression<'a> { /// Create a dummy [`TSInstantiationExpression`]. /// - /// Has cost of making 2 allocations (72 bytes). + /// Has cost of making 2 allocations (40 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2829,7 +2829,7 @@ impl<'a> Dummy<'a> for ImportOrExportKind { impl<'a> Dummy<'a> for JSDocNullableType<'a> { /// Create a dummy [`JSDocNullableType`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), @@ -2842,7 +2842,7 @@ impl<'a> Dummy<'a> for JSDocNullableType<'a> { impl<'a> Dummy<'a> for JSDocNonNullableType<'a> { /// Create a dummy [`JSDocNonNullableType`]. /// - /// Has cost of making 1 allocation (24 bytes). + /// Has cost of making 1 allocation (8 bytes). fn dummy(allocator: &'a Allocator) -> Self { Self { span: Dummy::dummy(allocator), diff --git a/crates/oxc_ast/src/generated/derive_estree.rs b/crates/oxc_ast/src/generated/derive_estree.rs index abe4a7cb0a1d6..dd5c22b0a3e69 100644 --- a/crates/oxc_ast/src/generated/derive_estree.rs +++ b/crates/oxc_ast/src/generated/derive_estree.rs @@ -75,9 +75,6 @@ impl ESTree for IdentifierName<'_> { state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -92,9 +89,6 @@ impl ESTree for IdentifierReference<'_> { state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -109,9 +103,6 @@ impl ESTree for BindingIdentifier<'_> { state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -126,9 +117,6 @@ impl ESTree for LabelIdentifier<'_> { state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -143,9 +131,6 @@ impl ESTree for ThisExpression { state.serialize_field("type", &JsonSafeString("ThisExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -156,9 +141,6 @@ impl ESTree for ArrayExpression<'_> { state.serialize_field("type", &JsonSafeString("ArrayExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("elements", &self.elements); state.end(); } @@ -228,9 +210,6 @@ impl ESTree for ObjectExpression<'_> { state.serialize_field("type", &JsonSafeString("ObjectExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("properties", &self.properties); state.end(); } @@ -251,9 +230,6 @@ impl ESTree for ObjectProperty<'_> { state.serialize_field("type", &JsonSafeString("Property")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("kind", &self.kind); state.serialize_field("key", &self.key); state.serialize_field("value", &self.value); @@ -333,9 +309,6 @@ impl ESTree for TemplateLiteral<'_> { state.serialize_field("type", &JsonSafeString("TemplateLiteral")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("quasis", &self.quasis); state.serialize_field("expressions", &self.expressions); state.end(); @@ -348,9 +321,6 @@ impl ESTree for TaggedTemplateExpression<'_> { state.serialize_field("type", &JsonSafeString("TaggedTemplateExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("tag", &self.tag); state.serialize_ts_field("typeArguments", &self.type_arguments); state.serialize_field("quasi", &self.quasi); @@ -389,9 +359,6 @@ impl ESTree for ComputedMemberExpression<'_> { state.serialize_field("type", &JsonSafeString("MemberExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("object", &self.object); state.serialize_field("property", &self.expression); state.serialize_field("optional", &self.optional); @@ -406,9 +373,6 @@ impl ESTree for StaticMemberExpression<'_> { state.serialize_field("type", &JsonSafeString("MemberExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("object", &self.object); state.serialize_field("property", &self.property); state.serialize_field("optional", &self.optional); @@ -423,9 +387,6 @@ impl ESTree for PrivateFieldExpression<'_> { state.serialize_field("type", &JsonSafeString("MemberExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("object", &self.object); state.serialize_field("property", &self.field); state.serialize_field("optional", &self.optional); @@ -440,9 +401,6 @@ impl ESTree for CallExpression<'_> { state.serialize_field("type", &JsonSafeString("CallExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("callee", &self.callee); state.serialize_ts_field("typeArguments", &self.type_arguments); state.serialize_field("arguments", &self.arguments); @@ -457,9 +415,6 @@ impl ESTree for NewExpression<'_> { state.serialize_field("type", &JsonSafeString("NewExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("callee", &self.callee); state.serialize_ts_field("typeArguments", &self.type_arguments); state.serialize_field("arguments", &self.arguments); @@ -473,9 +428,6 @@ impl ESTree for MetaProperty<'_> { state.serialize_field("type", &JsonSafeString("MetaProperty")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("meta", &self.meta); state.serialize_field("property", &self.property); state.end(); @@ -488,9 +440,6 @@ impl ESTree for SpreadElement<'_> { state.serialize_field("type", &JsonSafeString("SpreadElement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("argument", &self.argument); state.end(); } @@ -553,9 +502,6 @@ impl ESTree for UpdateExpression<'_> { state.serialize_field("type", &JsonSafeString("UpdateExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("operator", &self.operator); state.serialize_field("prefix", &self.prefix); state.serialize_field("argument", &self.argument); @@ -569,9 +515,6 @@ impl ESTree for UnaryExpression<'_> { state.serialize_field("type", &JsonSafeString("UnaryExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("operator", &self.operator); state.serialize_field("argument", &self.argument); state.serialize_field("prefix", &crate::serialize::basic::True(self)); @@ -585,9 +528,6 @@ impl ESTree for BinaryExpression<'_> { state.serialize_field("type", &JsonSafeString("BinaryExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("left", &self.left); state.serialize_field("operator", &self.operator); state.serialize_field("right", &self.right); @@ -601,9 +541,6 @@ impl ESTree for PrivateInExpression<'_> { state.serialize_field("type", &JsonSafeString("BinaryExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("left", &self.left); state.serialize_field("operator", &crate::serialize::basic::In(self)); state.serialize_field("right", &self.right); @@ -617,9 +554,6 @@ impl ESTree for LogicalExpression<'_> { state.serialize_field("type", &JsonSafeString("LogicalExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("left", &self.left); state.serialize_field("operator", &self.operator); state.serialize_field("right", &self.right); @@ -633,9 +567,6 @@ impl ESTree for ConditionalExpression<'_> { state.serialize_field("type", &JsonSafeString("ConditionalExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("test", &self.test); state.serialize_field("consequent", &self.consequent); state.serialize_field("alternate", &self.alternate); @@ -649,9 +580,6 @@ impl ESTree for AssignmentExpression<'_> { state.serialize_field("type", &JsonSafeString("AssignmentExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("operator", &self.operator); state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); @@ -706,9 +634,6 @@ impl ESTree for ArrayAssignmentTarget<'_> { state.serialize_field("type", &JsonSafeString("ArrayPattern")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("elements", &Concat2(&self.elements, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -723,9 +648,6 @@ impl ESTree for ObjectAssignmentTarget<'_> { state.serialize_field("type", &JsonSafeString("ObjectPattern")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("properties", &Concat2(&self.properties, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -740,9 +662,6 @@ impl ESTree for AssignmentTargetRest<'_> { state.serialize_field("type", &JsonSafeString("RestElement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("argument", &self.target); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -776,9 +695,6 @@ impl ESTree for AssignmentTargetWithDefault<'_> { state.serialize_field("type", &JsonSafeString("AssignmentPattern")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("left", &self.binding); state.serialize_field("right", &self.init); @@ -803,9 +719,6 @@ impl ESTree for AssignmentTargetPropertyIdentifier<'_> { state.serialize_field("type", &JsonSafeString("Property")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("kind", &crate::serialize::basic::Init(self)); state.serialize_field("key", &self.binding); state.serialize_field( @@ -826,9 +739,6 @@ impl ESTree for AssignmentTargetPropertyProperty<'_> { state.serialize_field("type", &JsonSafeString("Property")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("kind", &crate::serialize::basic::Init(self)); state.serialize_field("key", &self.name); state.serialize_field("value", &self.binding); @@ -846,9 +756,6 @@ impl ESTree for SequenceExpression<'_> { state.serialize_field("type", &JsonSafeString("SequenceExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expressions", &self.expressions); state.end(); } @@ -860,9 +767,6 @@ impl ESTree for Super { state.serialize_field("type", &JsonSafeString("Super")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -873,9 +777,6 @@ impl ESTree for AwaitExpression<'_> { state.serialize_field("type", &JsonSafeString("AwaitExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("argument", &self.argument); state.end(); } @@ -887,9 +788,6 @@ impl ESTree for ChainExpression<'_> { state.serialize_field("type", &JsonSafeString("ChainExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.end(); } @@ -913,9 +811,6 @@ impl ESTree for ParenthesizedExpression<'_> { state.serialize_field("type", &JsonSafeString("ParenthesizedExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.end(); } @@ -966,9 +861,6 @@ impl ESTree for Directive<'_> { state.serialize_field("type", &JsonSafeString("ExpressionStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.serialize_field("directive", &self.directive); state.end(); @@ -981,9 +873,6 @@ impl ESTree for Hashbang<'_> { state.serialize_field("type", &JsonSafeString("Hashbang")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("value", &self.value); state.end(); } @@ -995,9 +884,6 @@ impl ESTree for BlockStatement<'_> { state.serialize_field("type", &JsonSafeString("BlockStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("body", &self.body); state.end(); } @@ -1024,9 +910,6 @@ impl ESTree for VariableDeclaration<'_> { state.serialize_field("type", &JsonSafeString("VariableDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("kind", &self.kind); state.serialize_field("declarations", &self.declarations); state.serialize_ts_field("declare", &self.declare); @@ -1052,9 +935,6 @@ impl ESTree for VariableDeclarator<'_> { state.serialize_field("type", &JsonSafeString("VariableDeclarator")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("id", &self.id); state.serialize_field("init", &self.init); state.serialize_ts_field("definite", &self.definite); @@ -1068,9 +948,6 @@ impl ESTree for EmptyStatement { state.serialize_field("type", &JsonSafeString("EmptyStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -1081,9 +958,6 @@ impl ESTree for ExpressionStatement<'_> { state.serialize_field("type", &JsonSafeString("ExpressionStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.serialize_ts_field( "directive", @@ -1099,9 +973,6 @@ impl ESTree for IfStatement<'_> { state.serialize_field("type", &JsonSafeString("IfStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("test", &self.test); state.serialize_field("consequent", &self.consequent); state.serialize_field("alternate", &self.alternate); @@ -1115,9 +986,6 @@ impl ESTree for DoWhileStatement<'_> { state.serialize_field("type", &JsonSafeString("DoWhileStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("body", &self.body); state.serialize_field("test", &self.test); state.end(); @@ -1130,9 +998,6 @@ impl ESTree for WhileStatement<'_> { state.serialize_field("type", &JsonSafeString("WhileStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("test", &self.test); state.serialize_field("body", &self.body); state.end(); @@ -1145,9 +1010,6 @@ impl ESTree for ForStatement<'_> { state.serialize_field("type", &JsonSafeString("ForStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("init", &self.init); state.serialize_field("test", &self.test); state.serialize_field("update", &self.update); @@ -1213,9 +1075,6 @@ impl ESTree for ForInStatement<'_> { state.serialize_field("type", &JsonSafeString("ForInStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); state.serialize_field("body", &self.body); @@ -1247,9 +1106,6 @@ impl ESTree for ForOfStatement<'_> { state.serialize_field("type", &JsonSafeString("ForOfStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("await", &self.r#await); state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); @@ -1264,9 +1120,6 @@ impl ESTree for ContinueStatement<'_> { state.serialize_field("type", &JsonSafeString("ContinueStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("label", &self.label); state.end(); } @@ -1278,9 +1131,6 @@ impl ESTree for BreakStatement<'_> { state.serialize_field("type", &JsonSafeString("BreakStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("label", &self.label); state.end(); } @@ -1292,9 +1142,6 @@ impl ESTree for ReturnStatement<'_> { state.serialize_field("type", &JsonSafeString("ReturnStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("argument", &self.argument); state.end(); } @@ -1306,9 +1153,6 @@ impl ESTree for WithStatement<'_> { state.serialize_field("type", &JsonSafeString("WithStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("object", &self.object); state.serialize_field("body", &self.body); state.end(); @@ -1321,9 +1165,6 @@ impl ESTree for SwitchStatement<'_> { state.serialize_field("type", &JsonSafeString("SwitchStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("discriminant", &self.discriminant); state.serialize_field("cases", &self.cases); state.end(); @@ -1336,9 +1177,6 @@ impl ESTree for SwitchCase<'_> { state.serialize_field("type", &JsonSafeString("SwitchCase")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("test", &self.test); state.serialize_field("consequent", &self.consequent); state.end(); @@ -1351,9 +1189,6 @@ impl ESTree for LabeledStatement<'_> { state.serialize_field("type", &JsonSafeString("LabeledStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("label", &self.label); state.serialize_field("body", &self.body); state.end(); @@ -1366,9 +1201,6 @@ impl ESTree for ThrowStatement<'_> { state.serialize_field("type", &JsonSafeString("ThrowStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("argument", &self.argument); state.end(); } @@ -1380,9 +1212,6 @@ impl ESTree for TryStatement<'_> { state.serialize_field("type", &JsonSafeString("TryStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("block", &self.block); state.serialize_field("handler", &self.handler); state.serialize_field("finalizer", &self.finalizer); @@ -1396,9 +1225,6 @@ impl ESTree for CatchClause<'_> { state.serialize_field("type", &JsonSafeString("CatchClause")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("param", &self.param); state.serialize_field("body", &self.body); state.end(); @@ -1417,9 +1243,6 @@ impl ESTree for DebuggerStatement { state.serialize_field("type", &JsonSafeString("DebuggerStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -1447,9 +1270,6 @@ impl ESTree for AssignmentPattern<'_> { state.serialize_field("type", &JsonSafeString("AssignmentPattern")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); @@ -1465,9 +1285,6 @@ impl ESTree for ObjectPattern<'_> { state.serialize_field("type", &JsonSafeString("ObjectPattern")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("properties", &Concat2(&self.properties, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -1482,9 +1299,6 @@ impl ESTree for BindingProperty<'_> { state.serialize_field("type", &JsonSafeString("Property")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("kind", &crate::serialize::basic::Init(self)); state.serialize_field("key", &self.key); state.serialize_field("value", &self.value); @@ -1502,9 +1316,6 @@ impl ESTree for ArrayPattern<'_> { state.serialize_field("type", &JsonSafeString("ArrayPattern")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("elements", &Concat2(&self.elements, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -1519,9 +1330,6 @@ impl ESTree for BindingRestElement<'_> { state.serialize_field("type", &JsonSafeString("RestElement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_ts_field("decorators", &crate::serialize::basic::TsEmptyArray(self)); state.serialize_field("argument", &self.argument); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); @@ -1537,9 +1345,6 @@ impl ESTree for Function<'_> { state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("id", &self.id); state.serialize_field("generator", &self.generator); state.serialize_field("async", &self.r#async); @@ -1601,9 +1406,6 @@ impl ESTree for FunctionBody<'_> { state.serialize_field("type", &JsonSafeString("BlockStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("body", &Concat2(&self.directives, &self.statements)); state.end(); } @@ -1615,9 +1417,6 @@ impl ESTree for ArrowFunctionExpression<'_> { state.serialize_field("type", &JsonSafeString("ArrowFunctionExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.serialize_field("async", &self.r#async); state.serialize_ts_field("typeParameters", &self.type_parameters); @@ -1636,9 +1435,6 @@ impl ESTree for YieldExpression<'_> { state.serialize_field("type", &JsonSafeString("YieldExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("delegate", &self.delegate); state.serialize_field("argument", &self.argument); state.end(); @@ -1651,9 +1447,6 @@ impl ESTree for Class<'_> { state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("decorators", &self.decorators); state.serialize_field("id", &self.id); state.serialize_ts_field("typeParameters", &self.type_parameters); @@ -1682,9 +1475,6 @@ impl ESTree for ClassBody<'_> { state.serialize_field("type", &JsonSafeString("ClassBody")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("body", &self.body); state.end(); } @@ -1708,9 +1498,6 @@ impl ESTree for MethodDefinition<'_> { state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("decorators", &self.decorators); state.serialize_field("key", &self.key); state.serialize_field("value", &self.value); @@ -1741,9 +1528,6 @@ impl ESTree for PropertyDefinition<'_> { state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("decorators", &self.decorators); state.serialize_field("key", &self.key); state.serialize_ts_field("typeAnnotation", &self.type_annotation); @@ -1788,9 +1572,6 @@ impl ESTree for PrivateIdentifier<'_> { state.serialize_field("type", &JsonSafeString("PrivateIdentifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("name", &self.name); state.end(); } @@ -1802,9 +1583,6 @@ impl ESTree for StaticBlock<'_> { state.serialize_field("type", &JsonSafeString("StaticBlock")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("body", &self.body); state.end(); } @@ -1840,9 +1618,6 @@ impl ESTree for AccessorProperty<'_> { state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("decorators", &self.decorators); state.serialize_field("key", &self.key); state.serialize_ts_field("typeAnnotation", &self.type_annotation); @@ -1865,9 +1640,6 @@ impl ESTree for ImportExpression<'_> { state.serialize_field("type", &JsonSafeString("ImportExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("source", &self.source); state.serialize_field("options", &self.options); state.serialize_field("phase", &self.phase); @@ -1881,9 +1653,6 @@ impl ESTree for ImportDeclaration<'_> { state.serialize_field("type", &JsonSafeString("ImportDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field( "specifiers", &crate::serialize::js::ImportDeclarationSpecifiers(self), @@ -1924,9 +1693,6 @@ impl ESTree for ImportSpecifier<'_> { state.serialize_field("type", &JsonSafeString("ImportSpecifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("imported", &self.imported); state.serialize_field("local", &self.local); state.serialize_ts_field("importKind", &self.import_kind); @@ -1940,9 +1706,6 @@ impl ESTree for ImportDefaultSpecifier<'_> { state.serialize_field("type", &JsonSafeString("ImportDefaultSpecifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("local", &self.local); state.end(); } @@ -1954,9 +1717,6 @@ impl ESTree for ImportNamespaceSpecifier<'_> { state.serialize_field("type", &JsonSafeString("ImportNamespaceSpecifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("local", &self.local); state.end(); } @@ -1976,9 +1736,6 @@ impl ESTree for ImportAttribute<'_> { state.serialize_field("type", &JsonSafeString("ImportAttribute")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("key", &self.key); state.serialize_field("value", &self.value); state.end(); @@ -2000,9 +1757,6 @@ impl ESTree for ExportNamedDeclaration<'_> { state.serialize_field("type", &JsonSafeString("ExportNamedDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("declaration", &self.declaration); state.serialize_field("specifiers", &self.specifiers); state.serialize_field("source", &self.source); @@ -2021,9 +1775,6 @@ impl ESTree for ExportDefaultDeclaration<'_> { state.serialize_field("type", &JsonSafeString("ExportDefaultDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("declaration", &self.declaration); state.serialize_ts_field("exportKind", &crate::serialize::basic::TsValue(self)); state.end(); @@ -2036,9 +1787,6 @@ impl ESTree for ExportAllDeclaration<'_> { state.serialize_field("type", &JsonSafeString("ExportAllDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("exported", &self.exported); state.serialize_field("source", &self.source); state.serialize_field( @@ -2056,9 +1804,6 @@ impl ESTree for ExportSpecifier<'_> { state.serialize_field("type", &JsonSafeString("ExportSpecifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("local", &self.local); state.serialize_field("exported", &self.exported); state.serialize_ts_field("exportKind", &self.export_kind); @@ -2135,9 +1880,6 @@ impl ESTree for V8IntrinsicExpression<'_> { state.serialize_field("type", &JsonSafeString("V8IntrinsicExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("name", &self.name); state.serialize_field("arguments", &self.arguments); state.end(); @@ -2150,9 +1892,6 @@ impl ESTree for BooleanLiteral { state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("value", &self.value); state.serialize_field("raw", &crate::serialize::literal::BooleanLiteralRaw(self)); state.end(); @@ -2165,9 +1904,6 @@ impl ESTree for NullLiteral { state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("value", &crate::serialize::basic::Null(self)); state.serialize_field("raw", &crate::serialize::literal::NullLiteralRaw(self)); state.end(); @@ -2180,9 +1916,6 @@ impl ESTree for NumericLiteral<'_> { state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("value", &self.value); state.serialize_field("raw", &self.raw.map(|s| JsonSafeString(s.as_str()))); state.end(); @@ -2195,9 +1928,6 @@ impl ESTree for StringLiteral<'_> { state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("value", &crate::serialize::literal::StringLiteralValue(self)); state.serialize_field("raw", &self.raw); state.end(); @@ -2210,9 +1940,6 @@ impl ESTree for BigIntLiteral<'_> { state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("value", &crate::serialize::literal::BigIntLiteralValue(self)); state.serialize_field("raw", &self.raw.map(|s| JsonSafeString(s.as_str()))); state.serialize_field("bigint", &crate::serialize::literal::BigIntLiteralBigint(self)); @@ -2226,9 +1953,6 @@ impl ESTree for RegExpLiteral<'_> { state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("value", &crate::serialize::literal::RegExpLiteralValue(self)); state.serialize_field("raw", &self.raw); state.serialize_field("regex", &self.regex); @@ -2265,9 +1989,6 @@ impl ESTree for JSXElement<'_> { state.serialize_field("type", &JsonSafeString("JSXElement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field( "openingElement", &crate::serialize::jsx::JSXElementOpeningElement(self), @@ -2284,9 +2005,6 @@ impl ESTree for JSXOpeningElement<'_> { state.serialize_field("type", &JsonSafeString("JSXOpeningElement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("name", &self.name); state.serialize_ts_field("typeArguments", &self.type_arguments); state.serialize_field("attributes", &self.attributes); @@ -2304,9 +2022,6 @@ impl ESTree for JSXClosingElement<'_> { state.serialize_field("type", &JsonSafeString("JSXClosingElement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("name", &self.name); state.end(); } @@ -2318,9 +2033,6 @@ impl ESTree for JSXFragment<'_> { state.serialize_field("type", &JsonSafeString("JSXFragment")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("openingFragment", &self.opening_fragment); state.serialize_field("children", &self.children); state.serialize_field("closingFragment", &self.closing_fragment); @@ -2334,9 +2046,6 @@ impl ESTree for JSXOpeningFragment { state.serialize_field("type", &JsonSafeString("JSXOpeningFragment")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_js_field("attributes", &crate::serialize::basic::JsEmptyArray(self)); state.serialize_js_field("selfClosing", &crate::serialize::basic::JsFalse(self)); state.end(); @@ -2349,9 +2058,6 @@ impl ESTree for JSXClosingFragment { state.serialize_field("type", &JsonSafeString("JSXClosingFragment")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -2378,9 +2084,6 @@ impl ESTree for JSXNamespacedName<'_> { state.serialize_field("type", &JsonSafeString("JSXNamespacedName")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("namespace", &self.namespace); state.serialize_field("name", &self.name); state.end(); @@ -2393,9 +2096,6 @@ impl ESTree for JSXMemberExpression<'_> { state.serialize_field("type", &JsonSafeString("JSXMemberExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("object", &self.object); state.serialize_field("property", &self.property); state.end(); @@ -2422,9 +2122,6 @@ impl ESTree for JSXExpressionContainer<'_> { state.serialize_field("type", &JsonSafeString("JSXExpressionContainer")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.end(); } @@ -2487,9 +2184,6 @@ impl ESTree for JSXEmptyExpression { state.serialize_field("type", &JsonSafeString("JSXEmptyExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -2509,9 +2203,6 @@ impl ESTree for JSXAttribute<'_> { state.serialize_field("type", &JsonSafeString("JSXAttribute")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("name", &self.name); state.serialize_field("value", &self.value); state.end(); @@ -2524,9 +2215,6 @@ impl ESTree for JSXSpreadAttribute<'_> { state.serialize_field("type", &JsonSafeString("JSXSpreadAttribute")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("argument", &self.argument); state.end(); } @@ -2558,9 +2246,6 @@ impl ESTree for JSXIdentifier<'_> { state.serialize_field("type", &JsonSafeString("JSXIdentifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.end(); } @@ -2584,9 +2269,6 @@ impl ESTree for JSXSpreadChild<'_> { state.serialize_field("type", &JsonSafeString("JSXSpreadChild")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.end(); } @@ -2598,9 +2280,6 @@ impl ESTree for JSXText<'_> { state.serialize_field("type", &JsonSafeString("JSXText")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("value", &self.value); state.serialize_field("raw", &self.raw); state.end(); @@ -2613,9 +2292,6 @@ impl ESTree for TSThisParameter<'_> { state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("decorators", &crate::serialize::basic::EmptyArray(self)); state.serialize_field("name", &crate::serialize::basic::This(self)); state.serialize_field("optional", &crate::serialize::basic::False(self)); @@ -2630,9 +2306,6 @@ impl ESTree for TSEnumDeclaration<'_> { state.serialize_field("type", &JsonSafeString("TSEnumDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("id", &self.id); state.serialize_field("body", &self.body); state.serialize_field("const", &self.r#const); @@ -2647,9 +2320,6 @@ impl ESTree for TSEnumBody<'_> { state.serialize_field("type", &JsonSafeString("TSEnumBody")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("members", &self.members); state.end(); } @@ -2661,9 +2331,6 @@ impl ESTree for TSEnumMember<'_> { state.serialize_field("type", &JsonSafeString("TSEnumMember")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("id", &self.id); state.serialize_field("initializer", &self.initializer); state.serialize_field("computed", &crate::serialize::ts::TSEnumMemberComputed(self)); @@ -2688,9 +2355,6 @@ impl ESTree for TSTypeAnnotation<'_> { state.serialize_field("type", &JsonSafeString("TSTypeAnnotation")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("typeAnnotation", &self.type_annotation); state.end(); } @@ -2702,9 +2366,6 @@ impl ESTree for TSLiteralType<'_> { state.serialize_field("type", &JsonSafeString("TSLiteralType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("literal", &self.literal); state.end(); } @@ -2773,9 +2434,6 @@ impl ESTree for TSConditionalType<'_> { state.serialize_field("type", &JsonSafeString("TSConditionalType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("checkType", &self.check_type); state.serialize_field("extendsType", &self.extends_type); state.serialize_field("trueType", &self.true_type); @@ -2790,9 +2448,6 @@ impl ESTree for TSUnionType<'_> { state.serialize_field("type", &JsonSafeString("TSUnionType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("types", &self.types); state.end(); } @@ -2804,9 +2459,6 @@ impl ESTree for TSIntersectionType<'_> { state.serialize_field("type", &JsonSafeString("TSIntersectionType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("types", &self.types); state.end(); } @@ -2818,9 +2470,6 @@ impl ESTree for TSParenthesizedType<'_> { state.serialize_field("type", &JsonSafeString("TSParenthesizedType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("typeAnnotation", &self.type_annotation); state.end(); } @@ -2832,9 +2481,6 @@ impl ESTree for TSTypeOperator<'_> { state.serialize_field("type", &JsonSafeString("TSTypeOperator")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("operator", &self.operator); state.serialize_field("typeAnnotation", &self.type_annotation); state.end(); @@ -2857,9 +2503,6 @@ impl ESTree for TSArrayType<'_> { state.serialize_field("type", &JsonSafeString("TSArrayType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("elementType", &self.element_type); state.end(); } @@ -2871,9 +2514,6 @@ impl ESTree for TSIndexedAccessType<'_> { state.serialize_field("type", &JsonSafeString("TSIndexedAccessType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("objectType", &self.object_type); state.serialize_field("indexType", &self.index_type); state.end(); @@ -2886,9 +2526,6 @@ impl ESTree for TSTupleType<'_> { state.serialize_field("type", &JsonSafeString("TSTupleType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("elementTypes", &self.element_types); state.end(); } @@ -2900,9 +2537,6 @@ impl ESTree for TSNamedTupleMember<'_> { state.serialize_field("type", &JsonSafeString("TSNamedTupleMember")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("label", &self.label); state.serialize_field("elementType", &self.element_type); state.serialize_field("optional", &self.optional); @@ -2916,9 +2550,6 @@ impl ESTree for TSOptionalType<'_> { state.serialize_field("type", &JsonSafeString("TSOptionalType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("typeAnnotation", &self.type_annotation); state.end(); } @@ -2930,9 +2561,6 @@ impl ESTree for TSRestType<'_> { state.serialize_field("type", &JsonSafeString("TSRestType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("typeAnnotation", &self.type_annotation); state.end(); } @@ -2990,9 +2618,6 @@ impl ESTree for TSAnyKeyword { state.serialize_field("type", &JsonSafeString("TSAnyKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3003,9 +2628,6 @@ impl ESTree for TSStringKeyword { state.serialize_field("type", &JsonSafeString("TSStringKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3016,9 +2638,6 @@ impl ESTree for TSBooleanKeyword { state.serialize_field("type", &JsonSafeString("TSBooleanKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3029,9 +2648,6 @@ impl ESTree for TSNumberKeyword { state.serialize_field("type", &JsonSafeString("TSNumberKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3042,9 +2658,6 @@ impl ESTree for TSNeverKeyword { state.serialize_field("type", &JsonSafeString("TSNeverKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3055,9 +2668,6 @@ impl ESTree for TSIntrinsicKeyword { state.serialize_field("type", &JsonSafeString("TSIntrinsicKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3068,9 +2678,6 @@ impl ESTree for TSUnknownKeyword { state.serialize_field("type", &JsonSafeString("TSUnknownKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3081,9 +2688,6 @@ impl ESTree for TSNullKeyword { state.serialize_field("type", &JsonSafeString("TSNullKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3094,9 +2698,6 @@ impl ESTree for TSUndefinedKeyword { state.serialize_field("type", &JsonSafeString("TSUndefinedKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3107,9 +2708,6 @@ impl ESTree for TSVoidKeyword { state.serialize_field("type", &JsonSafeString("TSVoidKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3120,9 +2718,6 @@ impl ESTree for TSSymbolKeyword { state.serialize_field("type", &JsonSafeString("TSSymbolKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3133,9 +2728,6 @@ impl ESTree for TSThisType { state.serialize_field("type", &JsonSafeString("TSThisType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3146,9 +2738,6 @@ impl ESTree for TSObjectKeyword { state.serialize_field("type", &JsonSafeString("TSObjectKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3159,9 +2748,6 @@ impl ESTree for TSBigIntKeyword { state.serialize_field("type", &JsonSafeString("TSBigIntKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3172,9 +2758,6 @@ impl ESTree for TSTypeReference<'_> { state.serialize_field("type", &JsonSafeString("TSTypeReference")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("typeName", &self.type_name); state.serialize_field("typeArguments", &self.type_arguments); state.end(); @@ -3198,9 +2781,6 @@ impl ESTree for TSQualifiedName<'_> { state.serialize_field("type", &JsonSafeString("TSQualifiedName")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); state.end(); @@ -3213,9 +2793,6 @@ impl ESTree for TSTypeParameterInstantiation<'_> { state.serialize_field("type", &JsonSafeString("TSTypeParameterInstantiation")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("params", &self.params); state.end(); } @@ -3227,9 +2804,6 @@ impl ESTree for TSTypeParameter<'_> { state.serialize_field("type", &JsonSafeString("TSTypeParameter")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("name", &self.name); state.serialize_field("constraint", &self.constraint); state.serialize_field("default", &self.default); @@ -3246,9 +2820,6 @@ impl ESTree for TSTypeParameterDeclaration<'_> { state.serialize_field("type", &JsonSafeString("TSTypeParameterDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("params", &self.params); state.end(); } @@ -3260,9 +2831,6 @@ impl ESTree for TSTypeAliasDeclaration<'_> { state.serialize_field("type", &JsonSafeString("TSTypeAliasDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("id", &self.id); state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -3287,9 +2855,6 @@ impl ESTree for TSClassImplements<'_> { state.serialize_field("type", &JsonSafeString("TSClassImplements")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field( "expression", &crate::serialize::ts::TSClassImplementsExpression(self), @@ -3305,9 +2870,6 @@ impl ESTree for TSInterfaceDeclaration<'_> { state.serialize_field("type", &JsonSafeString("TSInterfaceDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("id", &self.id); state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("extends", &self.extends); @@ -3323,9 +2885,6 @@ impl ESTree for TSInterfaceBody<'_> { state.serialize_field("type", &JsonSafeString("TSInterfaceBody")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("body", &self.body); state.end(); } @@ -3337,9 +2896,6 @@ impl ESTree for TSPropertySignature<'_> { state.serialize_field("type", &JsonSafeString("TSPropertySignature")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("computed", &self.computed); state.serialize_field("optional", &self.optional); state.serialize_field("readonly", &self.readonly); @@ -3369,9 +2925,6 @@ impl ESTree for TSIndexSignature<'_> { state.serialize_field("type", &JsonSafeString("TSIndexSignature")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("parameters", &self.parameters); state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("readonly", &self.readonly); @@ -3387,9 +2940,6 @@ impl ESTree for TSCallSignatureDeclaration<'_> { state.serialize_field("type", &JsonSafeString("TSCallSignatureDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field( "params", @@ -3416,9 +2966,6 @@ impl ESTree for TSMethodSignature<'_> { state.serialize_field("type", &JsonSafeString("TSMethodSignature")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("key", &self.key); state.serialize_field("computed", &self.computed); state.serialize_field("optional", &self.optional); @@ -3439,9 +2986,6 @@ impl ESTree for TSConstructSignatureDeclaration<'_> { state.serialize_field("type", &JsonSafeString("TSConstructSignatureDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("params", &self.params); state.serialize_field("returnType", &self.return_type); @@ -3455,9 +2999,6 @@ impl ESTree for TSIndexSignatureName<'_> { state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("decorators", &crate::serialize::basic::EmptyArray(self)); state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_field("optional", &crate::serialize::basic::False(self)); @@ -3472,9 +3013,6 @@ impl ESTree for TSInterfaceHeritage<'_> { state.serialize_field("type", &JsonSafeString("TSInterfaceHeritage")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.serialize_field("typeArguments", &self.type_arguments); state.end(); @@ -3487,9 +3025,6 @@ impl ESTree for TSTypePredicate<'_> { state.serialize_field("type", &JsonSafeString("TSTypePredicate")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("parameterName", &self.parameter_name); state.serialize_field("asserts", &self.asserts); state.serialize_field("typeAnnotation", &self.type_annotation); @@ -3546,9 +3081,6 @@ impl ESTree for TSModuleBlock<'_> { state.serialize_field("type", &JsonSafeString("TSModuleBlock")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("body", &Concat2(&self.directives, &self.body)); state.end(); } @@ -3560,9 +3092,6 @@ impl ESTree for TSTypeLiteral<'_> { state.serialize_field("type", &JsonSafeString("TSTypeLiteral")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("members", &self.members); state.end(); } @@ -3574,9 +3103,6 @@ impl ESTree for TSInferType<'_> { state.serialize_field("type", &JsonSafeString("TSInferType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("typeParameter", &self.type_parameter); state.end(); } @@ -3588,9 +3114,6 @@ impl ESTree for TSTypeQuery<'_> { state.serialize_field("type", &JsonSafeString("TSTypeQuery")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("exprName", &self.expr_name); state.serialize_field("typeArguments", &self.type_arguments); state.end(); @@ -3615,9 +3138,6 @@ impl ESTree for TSImportType<'_> { state.serialize_field("type", &JsonSafeString("TSImportType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("argument", &self.argument); state.serialize_field("options", &self.options); state.serialize_field("qualifier", &self.qualifier); @@ -3632,9 +3152,6 @@ impl ESTree for TSFunctionType<'_> { state.serialize_field("type", &JsonSafeString("TSFunctionType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("params", &crate::serialize::ts::TSFunctionTypeParams(self)); state.serialize_field("returnType", &self.return_type); @@ -3648,9 +3165,6 @@ impl ESTree for TSConstructorType<'_> { state.serialize_field("type", &JsonSafeString("TSConstructorType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("abstract", &self.r#abstract); state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("params", &self.params); @@ -3665,9 +3179,6 @@ impl ESTree for TSMappedType<'_> { state.serialize_field("type", &JsonSafeString("TSMappedType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("key", &crate::serialize::ts::TSMappedTypeKey(self)); state.serialize_field("constraint", &crate::serialize::ts::TSMappedTypeConstraint(self)); state.serialize_field("nameType", &self.name_type); @@ -3694,9 +3205,6 @@ impl ESTree for TSTemplateLiteralType<'_> { state.serialize_field("type", &JsonSafeString("TSTemplateLiteralType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("quasis", &self.quasis); state.serialize_field("types", &self.types); state.end(); @@ -3709,9 +3217,6 @@ impl ESTree for TSAsExpression<'_> { state.serialize_field("type", &JsonSafeString("TSAsExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.serialize_field("typeAnnotation", &self.type_annotation); state.end(); @@ -3724,9 +3229,6 @@ impl ESTree for TSSatisfiesExpression<'_> { state.serialize_field("type", &JsonSafeString("TSSatisfiesExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.serialize_field("typeAnnotation", &self.type_annotation); state.end(); @@ -3739,9 +3241,6 @@ impl ESTree for TSTypeAssertion<'_> { state.serialize_field("type", &JsonSafeString("TSTypeAssertion")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("expression", &self.expression); state.end(); @@ -3754,9 +3253,6 @@ impl ESTree for TSImportEqualsDeclaration<'_> { state.serialize_field("type", &JsonSafeString("TSImportEqualsDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("id", &self.id); state.serialize_field("moduleReference", &self.module_reference); state.serialize_field("importKind", &self.import_kind); @@ -3782,9 +3278,6 @@ impl ESTree for TSExternalModuleReference<'_> { state.serialize_field("type", &JsonSafeString("TSExternalModuleReference")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.end(); } @@ -3796,9 +3289,6 @@ impl ESTree for TSNonNullExpression<'_> { state.serialize_field("type", &JsonSafeString("TSNonNullExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.end(); } @@ -3810,9 +3300,6 @@ impl ESTree for Decorator<'_> { state.serialize_field("type", &JsonSafeString("Decorator")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.end(); } @@ -3824,9 +3311,6 @@ impl ESTree for TSExportAssignment<'_> { state.serialize_field("type", &JsonSafeString("TSExportAssignment")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.end(); } @@ -3838,9 +3322,6 @@ impl ESTree for TSNamespaceExportDeclaration<'_> { state.serialize_field("type", &JsonSafeString("TSNamespaceExportDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("id", &self.id); state.end(); } @@ -3852,9 +3333,6 @@ impl ESTree for TSInstantiationExpression<'_> { state.serialize_field("type", &JsonSafeString("TSInstantiationExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("expression", &self.expression); state.serialize_field("typeArguments", &self.type_arguments); state.end(); @@ -3876,9 +3354,6 @@ impl ESTree for JSDocNullableType<'_> { state.serialize_field("type", &JsonSafeString("TSJSDocNullableType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("postfix", &self.postfix); state.end(); @@ -3891,9 +3366,6 @@ impl ESTree for JSDocNonNullableType<'_> { state.serialize_field("type", &JsonSafeString("TSJSDocNonNullableType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("postfix", &self.postfix); state.end(); @@ -3906,9 +3378,6 @@ impl ESTree for JSDocUnknownType { state.serialize_field("type", &JsonSafeString("TSJSDocUnknownType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -3929,9 +3398,6 @@ impl ESTree for Comment { state.serialize_field("value", &crate::serialize::CommentValue(self)); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } diff --git a/crates/oxc_regular_expression/src/generated/assert_layouts.rs b/crates/oxc_regular_expression/src/generated/assert_layouts.rs index fb78ea92db887..e94f786f73416 100644 --- a/crates/oxc_regular_expression/src/generated/assert_layouts.rs +++ b/crates/oxc_regular_expression/src/generated/assert_layouts.rs @@ -10,95 +10,95 @@ use crate::ast::*; #[cfg(target_pointer_width = "64")] const _: () = { // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(Pattern, span) == 0); - assert!(offset_of!(Pattern, body) == 24); + assert!(offset_of!(Pattern, body) == 8); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(Disjunction, span) == 0); - assert!(offset_of!(Disjunction, body) == 24); + assert!(offset_of!(Disjunction, body) == 8); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(Alternative, span) == 0); - assert!(offset_of!(Alternative, body) == 24); + assert!(offset_of!(Alternative, body) == 8); - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 8); // Padding: 7 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 8); assert!(offset_of!(BoundaryAssertion, span) == 0); - assert!(offset_of!(BoundaryAssertion, kind) == 24); + assert!(offset_of!(BoundaryAssertion, kind) == 8); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 7 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(LookAroundAssertion, span) == 0); - assert!(offset_of!(LookAroundAssertion, kind) == 72); - assert!(offset_of!(LookAroundAssertion, body) == 24); + assert!(offset_of!(LookAroundAssertion, kind) == 40); + assert!(offset_of!(LookAroundAssertion, body) == 8); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 7 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(Quantifier, span) == 0); - assert!(offset_of!(Quantifier, min) == 24); - assert!(offset_of!(Quantifier, max) == 32); - assert!(offset_of!(Quantifier, greedy) == 80); - assert!(offset_of!(Quantifier, body) == 48); + assert!(offset_of!(Quantifier, min) == 8); + assert!(offset_of!(Quantifier, max) == 16); + assert!(offset_of!(Quantifier, greedy) == 48); + assert!(offset_of!(Quantifier, body) == 32); // Padding: 3 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 8); assert!(offset_of!(Character, span) == 0); - assert!(offset_of!(Character, kind) == 28); - assert!(offset_of!(Character, value) == 24); + assert!(offset_of!(Character, kind) == 12); + assert!(offset_of!(Character, value) == 8); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 7 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 8); assert!(offset_of!(CharacterClassEscape, span) == 0); - assert!(offset_of!(CharacterClassEscape, kind) == 24); + assert!(offset_of!(CharacterClassEscape, kind) == 8); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 6 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(UnicodePropertyEscape, span) == 0); - assert!(offset_of!(UnicodePropertyEscape, negative) == 56); - assert!(offset_of!(UnicodePropertyEscape, strings) == 57); - assert!(offset_of!(UnicodePropertyEscape, name) == 24); - assert!(offset_of!(UnicodePropertyEscape, value) == 40); + assert!(offset_of!(UnicodePropertyEscape, negative) == 40); + assert!(offset_of!(UnicodePropertyEscape, strings) == 41); + assert!(offset_of!(UnicodePropertyEscape, name) == 8); + assert!(offset_of!(UnicodePropertyEscape, value) == 24); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(Dot, span) == 0); // Padding: 5 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(CharacterClass, span) == 0); - assert!(offset_of!(CharacterClass, negative) == 48); - assert!(offset_of!(CharacterClass, strings) == 49); - assert!(offset_of!(CharacterClass, kind) == 50); - assert!(offset_of!(CharacterClass, body) == 24); + assert!(offset_of!(CharacterClass, negative) == 32); + assert!(offset_of!(CharacterClass, strings) == 33); + assert!(offset_of!(CharacterClass, kind) == 34); + assert!(offset_of!(CharacterClass, body) == 8); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -107,156 +107,156 @@ const _: () = { assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(CharacterClassRange, span) == 0); - assert!(offset_of!(CharacterClassRange, min) == 24); - assert!(offset_of!(CharacterClassRange, max) == 56); + assert!(offset_of!(CharacterClassRange, min) == 8); + assert!(offset_of!(CharacterClassRange, max) == 24); // Padding: 7 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(ClassStringDisjunction, span) == 0); - assert!(offset_of!(ClassStringDisjunction, strings) == 48); - assert!(offset_of!(ClassStringDisjunction, body) == 24); + assert!(offset_of!(ClassStringDisjunction, strings) == 32); + assert!(offset_of!(ClassStringDisjunction, body) == 8); // Padding: 7 bytes - assert!(size_of::() == 56); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(ClassString, span) == 0); - assert!(offset_of!(ClassString, strings) == 48); - assert!(offset_of!(ClassString, body) == 24); + assert!(offset_of!(ClassString, strings) == 32); + assert!(offset_of!(ClassString, body) == 8); // Padding: 0 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(CapturingGroup, span) == 0); - assert!(offset_of!(CapturingGroup, name) == 24); - assert!(offset_of!(CapturingGroup, body) == 40); + assert!(offset_of!(CapturingGroup, name) == 8); + assert!(offset_of!(CapturingGroup, body) == 24); // Padding: 0 bytes - assert!(size_of::() == 104); + assert!(size_of::() == 64); assert!(align_of::() == 8); assert!(offset_of!(IgnoreGroup, span) == 0); - assert!(offset_of!(IgnoreGroup, modifiers) == 24); - assert!(offset_of!(IgnoreGroup, body) == 56); + assert!(offset_of!(IgnoreGroup, modifiers) == 8); + assert!(offset_of!(IgnoreGroup, body) == 32); // Padding: 6 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 8); assert!(offset_of!(Modifiers, span) == 0); - assert!(offset_of!(Modifiers, enabling) == 24); - assert!(offset_of!(Modifiers, disabling) == 25); + assert!(offset_of!(Modifiers, enabling) == 8); + assert!(offset_of!(Modifiers, disabling) == 9); // Padding: 0 bytes assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 4 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 8); assert!(offset_of!(IndexedReference, span) == 0); - assert!(offset_of!(IndexedReference, index) == 24); + assert!(offset_of!(IndexedReference, index) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); assert!(offset_of!(NamedReference, span) == 0); - assert!(offset_of!(NamedReference, name) == 24); + assert!(offset_of!(NamedReference, name) == 8); }; #[cfg(target_pointer_width = "32")] const _: () = { // Padding: 0 bytes - assert!(size_of::() == 64); + assert!(size_of::() == 32); assert!(align_of::() == 4); assert!(offset_of!(Pattern, span) == 0); - assert!(offset_of!(Pattern, body) == 24); + assert!(offset_of!(Pattern, body) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(Disjunction, span) == 0); - assert!(offset_of!(Disjunction, body) == 24); + assert!(offset_of!(Disjunction, body) == 8); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(Alternative, span) == 0); - assert!(offset_of!(Alternative, body) == 24); + assert!(offset_of!(Alternative, body) == 8); - assert!(size_of::() == 28); + assert!(size_of::() == 12); assert!(align_of::() == 4); // Padding: 3 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 12); assert!(align_of::() == 4); assert!(offset_of!(BoundaryAssertion, span) == 0); - assert!(offset_of!(BoundaryAssertion, kind) == 24); + assert!(offset_of!(BoundaryAssertion, kind) == 8); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 3 bytes - assert!(size_of::() == 68); + assert!(size_of::() == 36); assert!(align_of::() == 4); assert!(offset_of!(LookAroundAssertion, span) == 0); - assert!(offset_of!(LookAroundAssertion, kind) == 64); - assert!(offset_of!(LookAroundAssertion, body) == 24); + assert!(offset_of!(LookAroundAssertion, kind) == 32); + assert!(offset_of!(LookAroundAssertion, body) == 8); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 3 bytes - assert!(size_of::() == 80); + assert!(size_of::() == 48); assert!(align_of::() == 8); assert!(offset_of!(Quantifier, span) == 0); - assert!(offset_of!(Quantifier, min) == 24); - assert!(offset_of!(Quantifier, max) == 32); - assert!(offset_of!(Quantifier, greedy) == 76); - assert!(offset_of!(Quantifier, body) == 48); + assert!(offset_of!(Quantifier, min) == 8); + assert!(offset_of!(Quantifier, max) == 16); + assert!(offset_of!(Quantifier, greedy) == 44); + assert!(offset_of!(Quantifier, body) == 32); // Padding: 3 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(Character, span) == 0); - assert!(offset_of!(Character, kind) == 28); - assert!(offset_of!(Character, value) == 24); + assert!(offset_of!(Character, kind) == 12); + assert!(offset_of!(Character, value) == 8); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 3 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 12); assert!(align_of::() == 4); assert!(offset_of!(CharacterClassEscape, span) == 0); - assert!(offset_of!(CharacterClassEscape, kind) == 24); + assert!(offset_of!(CharacterClassEscape, kind) == 8); assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 2 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(UnicodePropertyEscape, span) == 0); - assert!(offset_of!(UnicodePropertyEscape, negative) == 40); - assert!(offset_of!(UnicodePropertyEscape, strings) == 41); - assert!(offset_of!(UnicodePropertyEscape, name) == 24); - assert!(offset_of!(UnicodePropertyEscape, value) == 32); + assert!(offset_of!(UnicodePropertyEscape, negative) == 24); + assert!(offset_of!(UnicodePropertyEscape, strings) == 25); + assert!(offset_of!(UnicodePropertyEscape, name) == 8); + assert!(offset_of!(UnicodePropertyEscape, value) == 16); // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(Dot, span) == 0); // Padding: 1 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(CharacterClass, span) == 0); - assert!(offset_of!(CharacterClass, negative) == 40); - assert!(offset_of!(CharacterClass, strings) == 41); - assert!(offset_of!(CharacterClass, kind) == 42); - assert!(offset_of!(CharacterClass, body) == 24); + assert!(offset_of!(CharacterClass, negative) == 24); + assert!(offset_of!(CharacterClass, strings) == 25); + assert!(offset_of!(CharacterClass, kind) == 26); + assert!(offset_of!(CharacterClass, body) == 8); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -265,62 +265,62 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(CharacterClassRange, span) == 0); - assert!(offset_of!(CharacterClassRange, min) == 24); - assert!(offset_of!(CharacterClassRange, max) == 56); + assert!(offset_of!(CharacterClassRange, min) == 8); + assert!(offset_of!(CharacterClassRange, max) == 24); // Padding: 3 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(ClassStringDisjunction, span) == 0); - assert!(offset_of!(ClassStringDisjunction, strings) == 40); - assert!(offset_of!(ClassStringDisjunction, body) == 24); + assert!(offset_of!(ClassStringDisjunction, strings) == 24); + assert!(offset_of!(ClassStringDisjunction, body) == 8); // Padding: 3 bytes - assert!(size_of::() == 44); + assert!(size_of::() == 28); assert!(align_of::() == 4); assert!(offset_of!(ClassString, span) == 0); - assert!(offset_of!(ClassString, strings) == 40); - assert!(offset_of!(ClassString, body) == 24); + assert!(offset_of!(ClassString, strings) == 24); + assert!(offset_of!(ClassString, body) == 8); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(CapturingGroup, span) == 0); - assert!(offset_of!(CapturingGroup, name) == 24); - assert!(offset_of!(CapturingGroup, body) == 32); + assert!(offset_of!(CapturingGroup, name) == 8); + assert!(offset_of!(CapturingGroup, body) == 16); // Padding: 0 bytes - assert!(size_of::() == 92); + assert!(size_of::() == 48); assert!(align_of::() == 4); assert!(offset_of!(IgnoreGroup, span) == 0); - assert!(offset_of!(IgnoreGroup, modifiers) == 24); - assert!(offset_of!(IgnoreGroup, body) == 52); + assert!(offset_of!(IgnoreGroup, modifiers) == 8); + assert!(offset_of!(IgnoreGroup, body) == 24); // Padding: 2 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 12); assert!(align_of::() == 4); assert!(offset_of!(Modifiers, span) == 0); - assert!(offset_of!(Modifiers, enabling) == 24); - assert!(offset_of!(Modifiers, disabling) == 25); + assert!(offset_of!(Modifiers, enabling) == 8); + assert!(offset_of!(Modifiers, disabling) == 9); // Padding: 0 bytes assert!(size_of::() == 1); assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 28); + assert!(size_of::() == 12); assert!(align_of::() == 4); assert!(offset_of!(IndexedReference, span) == 0); - assert!(offset_of!(IndexedReference, index) == 24); + assert!(offset_of!(IndexedReference, index) == 8); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(NamedReference, span) == 0); - assert!(offset_of!(NamedReference, name) == 24); + assert!(offset_of!(NamedReference, name) == 8); }; #[cfg(not(any(target_pointer_width = "64", target_pointer_width = "32")))] diff --git a/crates/oxc_span/src/generated/assert_layouts.rs b/crates/oxc_span/src/generated/assert_layouts.rs index d8cc05b64e056..2e83549e0e9ec 100644 --- a/crates/oxc_span/src/generated/assert_layouts.rs +++ b/crates/oxc_span/src/generated/assert_layouts.rs @@ -10,11 +10,10 @@ use crate::*; #[cfg(target_pointer_width = "64")] const _: () = { // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 8); assert!(offset_of!(Span, start) == 0); assert!(offset_of!(Span, end) == 4); - assert!(offset_of!(Span, range) == 8); // Padding: 0 bytes assert!(size_of::() == 3); @@ -36,11 +35,10 @@ const _: () = { #[cfg(target_pointer_width = "32")] const _: () = { // Padding: 0 bytes - assert!(size_of::() == 24); + assert!(size_of::() == 8); assert!(align_of::() == 4); assert!(offset_of!(Span, start) == 0); assert!(offset_of!(Span, end) == 4); - assert!(offset_of!(Span, range) == 8); // Padding: 0 bytes assert!(size_of::() == 3); diff --git a/crates/oxc_span/src/generated/derive_estree.rs b/crates/oxc_span/src/generated/derive_estree.rs index 1cea3ba639d28..f82c5f70cc9ec 100644 --- a/crates/oxc_span/src/generated/derive_estree.rs +++ b/crates/oxc_span/src/generated/derive_estree.rs @@ -15,7 +15,6 @@ impl ESTree for Span { let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.start); state.serialize_field("end", &self.end); - state.serialize_field("range", &self.range); state.end(); } } diff --git a/crates/oxc_syntax/src/generated/assert_layouts.rs b/crates/oxc_syntax/src/generated/assert_layouts.rs index a391fba1d6335..0f0d589ebca44 100644 --- a/crates/oxc_syntax/src/generated/assert_layouts.rs +++ b/crates/oxc_syntax/src/generated/assert_layouts.rs @@ -22,48 +22,48 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); - assert!(offset_of!(NameSpan, name) == 24); + assert!(offset_of!(NameSpan, name) == 8); assert!(offset_of!(NameSpan, span) == 0); // Padding: 7 bytes - assert!(size_of::() == 160); + assert!(size_of::() == 96); assert!(align_of::() == 8); assert!(offset_of!(ImportEntry, statement_span) == 0); - assert!(offset_of!(ImportEntry, module_request) == 24); - assert!(offset_of!(ImportEntry, import_name) == 64); - assert!(offset_of!(ImportEntry, local_name) == 112); - assert!(offset_of!(ImportEntry, is_type) == 152); + assert!(offset_of!(ImportEntry, module_request) == 8); + assert!(offset_of!(ImportEntry, import_name) == 32); + assert!(offset_of!(ImportEntry, local_name) == 64); + assert!(offset_of!(ImportEntry, is_type) == 88); - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); // Padding: 7 bytes - assert!(size_of::() == 240); + assert!(size_of::() == 144); assert!(align_of::() == 8); - assert!(offset_of!(ExportEntry, statement_span) == 24); + assert!(offset_of!(ExportEntry, statement_span) == 8); assert!(offset_of!(ExportEntry, span) == 0); - assert!(offset_of!(ExportEntry, module_request) == 48); - assert!(offset_of!(ExportEntry, import_name) == 88); - assert!(offset_of!(ExportEntry, export_name) == 136); - assert!(offset_of!(ExportEntry, local_name) == 184); - assert!(offset_of!(ExportEntry, is_type) == 232); + assert!(offset_of!(ExportEntry, module_request) == 16); + assert!(offset_of!(ExportEntry, import_name) == 40); + assert!(offset_of!(ExportEntry, export_name) == 72); + assert!(offset_of!(ExportEntry, local_name) == 104); + assert!(offset_of!(ExportEntry, is_type) == 136); - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 16); assert!(align_of::() == 8); assert!(offset_of!(DynamicImport, span) == 0); - assert!(offset_of!(DynamicImport, module_request) == 24); + assert!(offset_of!(DynamicImport, module_request) == 8); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -110,48 +110,48 @@ const _: () = { assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); - assert!(offset_of!(NameSpan, name) == 24); + assert!(offset_of!(NameSpan, name) == 8); assert!(offset_of!(NameSpan, span) == 0); // Padding: 3 bytes - assert!(size_of::() == 128); + assert!(size_of::() == 64); assert!(align_of::() == 4); assert!(offset_of!(ImportEntry, statement_span) == 0); - assert!(offset_of!(ImportEntry, module_request) == 24); - assert!(offset_of!(ImportEntry, import_name) == 56); - assert!(offset_of!(ImportEntry, local_name) == 92); - assert!(offset_of!(ImportEntry, is_type) == 124); + assert!(offset_of!(ImportEntry, module_request) == 8); + assert!(offset_of!(ImportEntry, import_name) == 24); + assert!(offset_of!(ImportEntry, local_name) == 44); + assert!(offset_of!(ImportEntry, is_type) == 60); - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); // Padding: 3 bytes - assert!(size_of::() == 192); + assert!(size_of::() == 96); assert!(align_of::() == 4); - assert!(offset_of!(ExportEntry, statement_span) == 24); + assert!(offset_of!(ExportEntry, statement_span) == 8); assert!(offset_of!(ExportEntry, span) == 0); - assert!(offset_of!(ExportEntry, module_request) == 48); - assert!(offset_of!(ExportEntry, import_name) == 80); - assert!(offset_of!(ExportEntry, export_name) == 116); - assert!(offset_of!(ExportEntry, local_name) == 152); - assert!(offset_of!(ExportEntry, is_type) == 188); + assert!(offset_of!(ExportEntry, module_request) == 16); + assert!(offset_of!(ExportEntry, import_name) == 32); + assert!(offset_of!(ExportEntry, export_name) == 52); + assert!(offset_of!(ExportEntry, local_name) == 72); + assert!(offset_of!(ExportEntry, is_type) == 92); - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); - assert!(size_of::() == 36); + assert!(size_of::() == 20); assert!(align_of::() == 4); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 16); assert!(align_of::() == 4); assert!(offset_of!(DynamicImport, span) == 0); - assert!(offset_of!(DynamicImport, module_request) == 24); + assert!(offset_of!(DynamicImport, module_request) == 8); assert!(size_of::() == 1); assert!(align_of::() == 1); diff --git a/crates/oxc_syntax/src/generated/derive_estree.rs b/crates/oxc_syntax/src/generated/derive_estree.rs index 7e943af086ac6..40139563a60e0 100644 --- a/crates/oxc_syntax/src/generated/derive_estree.rs +++ b/crates/oxc_syntax/src/generated/derive_estree.rs @@ -16,9 +16,6 @@ impl ESTree for NameSpan<'_> { state.serialize_field("value", &self.name); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -52,9 +49,6 @@ impl ESTree for ExportEntry<'_> { let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("moduleRequest", &self.module_request); state.serialize_field("importName", &self.import_name); state.serialize_field("exportName", &self.export_name); @@ -104,9 +98,6 @@ impl ESTree for DynamicImport { let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("moduleRequest", &self.module_request); state.end(); } diff --git a/napi/parser/generated/deserialize/js.js b/napi/parser/generated/deserialize/js.js index 3fe97e8bc815c..9522a701a0600 100644 --- a/napi/parser/generated/deserialize/js.js +++ b/napi/parser/generated/deserialize/js.js @@ -35,8 +35,8 @@ function deserialize(buffer, sourceTextInput, sourceLenInput) { } function deserializeProgram(pos) { - const body = deserializeVecDirective(pos + 104); - body.push(...deserializeVecStatement(pos + 128)); + const body = deserializeVecDirective(pos + 72); + body.push(...deserializeVecStatement(pos + 96)); const start = deserializeU32(pos); const end = deserializeU32(pos + 4); @@ -46,8 +46,8 @@ function deserializeProgram(pos) { start, end, body, - sourceType: deserializeModuleKind(pos + 157), - hashbang: deserializeOptionHashbang(pos + 64), + sourceType: deserializeModuleKind(pos + 125), + hashbang: deserializeOptionHashbang(pos + 48), }; return program; } @@ -57,8 +57,7 @@ function deserializeIdentifierName(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeStr(pos + 24), + name: deserializeStr(pos + 8), }; } @@ -67,8 +66,7 @@ function deserializeIdentifierReference(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeStr(pos + 24), + name: deserializeStr(pos + 8), }; } @@ -77,8 +75,7 @@ function deserializeBindingIdentifier(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeStr(pos + 24), + name: deserializeStr(pos + 8), }; } @@ -87,8 +84,7 @@ function deserializeLabelIdentifier(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeStr(pos + 24), + name: deserializeStr(pos + 8), }; } @@ -97,7 +93,6 @@ function deserializeThisExpression(pos) { type: 'ThisExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -106,8 +101,7 @@ function deserializeArrayExpression(pos) { type: 'ArrayExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - elements: deserializeVecArrayExpressionElement(pos + 24), + elements: deserializeVecArrayExpressionElement(pos + 8), }; } @@ -120,8 +114,7 @@ function deserializeObjectExpression(pos) { type: 'ObjectExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - properties: deserializeVecObjectPropertyKind(pos + 24), + properties: deserializeVecObjectPropertyKind(pos + 8), }; } @@ -130,13 +123,12 @@ function deserializeObjectProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - kind: deserializePropertyKind(pos + 56), - key: deserializePropertyKey(pos + 24), - value: deserializeExpression(pos + 40), - method: deserializeBool(pos + 57), - shorthand: deserializeBool(pos + 58), - computed: deserializeBool(pos + 59), + kind: deserializePropertyKind(pos + 40), + key: deserializePropertyKey(pos + 8), + value: deserializeExpression(pos + 24), + method: deserializeBool(pos + 41), + shorthand: deserializeBool(pos + 42), + computed: deserializeBool(pos + 43), }; } @@ -145,9 +137,8 @@ function deserializeTemplateLiteral(pos) { type: 'TemplateLiteral', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - quasis: deserializeVecTemplateElement(pos + 24), - expressions: deserializeVecExpression(pos + 48), + quasis: deserializeVecTemplateElement(pos + 8), + expressions: deserializeVecExpression(pos + 32), }; } @@ -156,18 +147,17 @@ function deserializeTaggedTemplateExpression(pos) { type: 'TaggedTemplateExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - tag: deserializeExpression(pos + 24), - quasi: deserializeTemplateLiteral(pos + 48), + tag: deserializeExpression(pos + 8), + quasi: deserializeTemplateLiteral(pos + 32), }; } function deserializeTemplateElement(pos) { - const tail = deserializeBool(pos + 56), + const tail = deserializeBool(pos + 40), start = deserializeU32(pos), end = deserializeU32(pos + 4), - value = deserializeTemplateElementValue(pos + 24); - if (value.cooked !== null && deserializeBool(pos + 57)) { + value = deserializeTemplateElementValue(pos + 8); + if (value.cooked !== null && deserializeBool(pos + 41)) { value.cooked = value.cooked .replace(/\uFFFD(.{4})/g, (_, hex) => String.fromCodePoint(parseInt(hex, 16))); } @@ -186,10 +176,9 @@ function deserializeComputedMemberExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - object: deserializeExpression(pos + 24), - property: deserializeExpression(pos + 40), - optional: deserializeBool(pos + 56), + object: deserializeExpression(pos + 8), + property: deserializeExpression(pos + 24), + optional: deserializeBool(pos + 40), computed: true, }; } @@ -199,10 +188,9 @@ function deserializeStaticMemberExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - object: deserializeExpression(pos + 24), - property: deserializeIdentifierName(pos + 40), - optional: deserializeBool(pos + 80), + object: deserializeExpression(pos + 8), + property: deserializeIdentifierName(pos + 24), + optional: deserializeBool(pos + 48), computed: false, }; } @@ -212,10 +200,9 @@ function deserializePrivateFieldExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - object: deserializeExpression(pos + 24), - property: deserializePrivateIdentifier(pos + 40), - optional: deserializeBool(pos + 80), + object: deserializeExpression(pos + 8), + property: deserializePrivateIdentifier(pos + 24), + optional: deserializeBool(pos + 48), computed: false, }; } @@ -225,10 +212,9 @@ function deserializeCallExpression(pos) { type: 'CallExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - callee: deserializeExpression(pos + 24), - arguments: deserializeVecArgument(pos + 48), - optional: deserializeBool(pos + 72), + callee: deserializeExpression(pos + 8), + arguments: deserializeVecArgument(pos + 32), + optional: deserializeBool(pos + 56), }; } @@ -237,9 +223,8 @@ function deserializeNewExpression(pos) { type: 'NewExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - callee: deserializeExpression(pos + 24), - arguments: deserializeVecArgument(pos + 48), + callee: deserializeExpression(pos + 8), + arguments: deserializeVecArgument(pos + 32), }; } @@ -248,9 +233,8 @@ function deserializeMetaProperty(pos) { type: 'MetaProperty', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - meta: deserializeIdentifierName(pos + 24), - property: deserializeIdentifierName(pos + 64), + meta: deserializeIdentifierName(pos + 8), + property: deserializeIdentifierName(pos + 32), }; } @@ -259,8 +243,7 @@ function deserializeSpreadElement(pos) { type: 'SpreadElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - argument: deserializeExpression(pos + 24), + argument: deserializeExpression(pos + 8), }; } @@ -269,10 +252,9 @@ function deserializeUpdateExpression(pos) { type: 'UpdateExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - operator: deserializeUpdateOperator(pos + 40), - prefix: deserializeBool(pos + 41), - argument: deserializeSimpleAssignmentTarget(pos + 24), + operator: deserializeUpdateOperator(pos + 24), + prefix: deserializeBool(pos + 25), + argument: deserializeSimpleAssignmentTarget(pos + 8), }; } @@ -281,9 +263,8 @@ function deserializeUnaryExpression(pos) { type: 'UnaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - operator: deserializeUnaryOperator(pos + 40), - argument: deserializeExpression(pos + 24), + operator: deserializeUnaryOperator(pos + 24), + argument: deserializeExpression(pos + 8), prefix: true, }; } @@ -293,10 +274,9 @@ function deserializeBinaryExpression(pos) { type: 'BinaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - left: deserializeExpression(pos + 24), - operator: deserializeBinaryOperator(pos + 56), - right: deserializeExpression(pos + 40), + left: deserializeExpression(pos + 8), + operator: deserializeBinaryOperator(pos + 40), + right: deserializeExpression(pos + 24), }; } @@ -305,10 +285,9 @@ function deserializePrivateInExpression(pos) { type: 'BinaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - left: deserializePrivateIdentifier(pos + 24), + left: deserializePrivateIdentifier(pos + 8), operator: 'in', - right: deserializeExpression(pos + 64), + right: deserializeExpression(pos + 32), }; } @@ -317,10 +296,9 @@ function deserializeLogicalExpression(pos) { type: 'LogicalExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - left: deserializeExpression(pos + 24), - operator: deserializeLogicalOperator(pos + 56), - right: deserializeExpression(pos + 40), + left: deserializeExpression(pos + 8), + operator: deserializeLogicalOperator(pos + 40), + right: deserializeExpression(pos + 24), }; } @@ -329,10 +307,9 @@ function deserializeConditionalExpression(pos) { type: 'ConditionalExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - test: deserializeExpression(pos + 24), - consequent: deserializeExpression(pos + 40), - alternate: deserializeExpression(pos + 56), + test: deserializeExpression(pos + 8), + consequent: deserializeExpression(pos + 24), + alternate: deserializeExpression(pos + 40), }; } @@ -341,35 +318,32 @@ function deserializeAssignmentExpression(pos) { type: 'AssignmentExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - operator: deserializeAssignmentOperator(pos + 56), - left: deserializeAssignmentTarget(pos + 24), - right: deserializeExpression(pos + 40), + operator: deserializeAssignmentOperator(pos + 40), + left: deserializeAssignmentTarget(pos + 8), + right: deserializeExpression(pos + 24), }; } function deserializeArrayAssignmentTarget(pos) { - const elements = deserializeVecOptionAssignmentTargetMaybeDefault(pos + 24); - const rest = deserializeOptionAssignmentTargetRest(pos + 48); + const elements = deserializeVecOptionAssignmentTargetMaybeDefault(pos + 8); + const rest = deserializeOptionAssignmentTargetRest(pos + 32); if (rest !== null) elements.push(rest); return { type: 'ArrayPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), elements, }; } function deserializeObjectAssignmentTarget(pos) { - const properties = deserializeVecAssignmentTargetProperty(pos + 24); - const rest = deserializeOptionAssignmentTargetRest(pos + 48); + const properties = deserializeVecAssignmentTargetProperty(pos + 8); + const rest = deserializeOptionAssignmentTargetRest(pos + 32); if (rest !== null) properties.push(rest); return { type: 'ObjectPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), properties, }; } @@ -379,8 +353,7 @@ function deserializeAssignmentTargetRest(pos) { type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - argument: deserializeAssignmentTarget(pos + 24), + argument: deserializeAssignmentTarget(pos + 8), }; } @@ -389,17 +362,16 @@ function deserializeAssignmentTargetWithDefault(pos) { type: 'AssignmentPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - left: deserializeAssignmentTarget(pos + 24), - right: deserializeExpression(pos + 40), + left: deserializeAssignmentTarget(pos + 8), + right: deserializeExpression(pos + 24), }; } function deserializeAssignmentTargetPropertyIdentifier(pos) { const start = deserializeU32(pos), end = deserializeU32(pos + 4), - key = deserializeIdentifierReference(pos + 24); - const init = deserializeOptionExpression(pos + 72), + key = deserializeIdentifierReference(pos + 8); + const init = deserializeOptionExpression(pos + 40), keyCopy = { ...key }, value = init === null ? keyCopy @@ -414,7 +386,6 @@ function deserializeAssignmentTargetPropertyIdentifier(pos) { type: 'Property', start, end, - range: deserializeOptionRangeArray(pos + 8), kind: 'init', key, value, @@ -429,13 +400,12 @@ function deserializeAssignmentTargetPropertyProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), kind: 'init', - key: deserializePropertyKey(pos + 24), - value: deserializeAssignmentTargetMaybeDefault(pos + 40), + key: deserializePropertyKey(pos + 8), + value: deserializeAssignmentTargetMaybeDefault(pos + 24), method: false, shorthand: false, - computed: deserializeBool(pos + 56), + computed: deserializeBool(pos + 40), }; } @@ -444,8 +414,7 @@ function deserializeSequenceExpression(pos) { type: 'SequenceExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expressions: deserializeVecExpression(pos + 24), + expressions: deserializeVecExpression(pos + 8), }; } @@ -454,7 +423,6 @@ function deserializeSuper(pos) { type: 'Super', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -463,8 +431,7 @@ function deserializeAwaitExpression(pos) { type: 'AwaitExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - argument: deserializeExpression(pos + 24), + argument: deserializeExpression(pos + 8), }; } @@ -473,8 +440,7 @@ function deserializeChainExpression(pos) { type: 'ChainExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeChainElement(pos + 24), + expression: deserializeChainElement(pos + 8), }; } @@ -483,8 +449,7 @@ function deserializeParenthesizedExpression(pos) { type: 'ParenthesizedExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), + expression: deserializeExpression(pos + 8), }; } @@ -493,9 +458,8 @@ function deserializeDirective(pos) { type: 'ExpressionStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeStringLiteral(pos + 24), - directive: deserializeStr(pos + 88), + expression: deserializeStringLiteral(pos + 8), + directive: deserializeStr(pos + 56), }; } @@ -504,8 +468,7 @@ function deserializeHashbang(pos) { type: 'Hashbang', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - value: deserializeStr(pos + 24), + value: deserializeStr(pos + 8), }; } @@ -514,8 +477,7 @@ function deserializeBlockStatement(pos) { type: 'BlockStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - body: deserializeVecStatement(pos + 24), + body: deserializeVecStatement(pos + 8), }; } @@ -524,9 +486,8 @@ function deserializeVariableDeclaration(pos) { type: 'VariableDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - kind: deserializeVariableDeclarationKind(pos + 48), - declarations: deserializeVecVariableDeclarator(pos + 24), + kind: deserializeVariableDeclarationKind(pos + 32), + declarations: deserializeVecVariableDeclarator(pos + 8), }; } @@ -535,9 +496,8 @@ function deserializeVariableDeclarator(pos) { type: 'VariableDeclarator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeBindingPattern(pos + 24), - init: deserializeOptionExpression(pos + 56), + id: deserializeBindingPattern(pos + 8), + init: deserializeOptionExpression(pos + 40), }; } @@ -546,7 +506,6 @@ function deserializeEmptyStatement(pos) { type: 'EmptyStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -555,8 +514,7 @@ function deserializeExpressionStatement(pos) { type: 'ExpressionStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), + expression: deserializeExpression(pos + 8), }; } @@ -565,10 +523,9 @@ function deserializeIfStatement(pos) { type: 'IfStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - test: deserializeExpression(pos + 24), - consequent: deserializeStatement(pos + 40), - alternate: deserializeOptionStatement(pos + 56), + test: deserializeExpression(pos + 8), + consequent: deserializeStatement(pos + 24), + alternate: deserializeOptionStatement(pos + 40), }; } @@ -577,9 +534,8 @@ function deserializeDoWhileStatement(pos) { type: 'DoWhileStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - body: deserializeStatement(pos + 24), - test: deserializeExpression(pos + 40), + body: deserializeStatement(pos + 8), + test: deserializeExpression(pos + 24), }; } @@ -588,9 +544,8 @@ function deserializeWhileStatement(pos) { type: 'WhileStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - test: deserializeExpression(pos + 24), - body: deserializeStatement(pos + 40), + test: deserializeExpression(pos + 8), + body: deserializeStatement(pos + 24), }; } @@ -599,11 +554,10 @@ function deserializeForStatement(pos) { type: 'ForStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - init: deserializeOptionForStatementInit(pos + 24), - test: deserializeOptionExpression(pos + 40), - update: deserializeOptionExpression(pos + 56), - body: deserializeStatement(pos + 72), + init: deserializeOptionForStatementInit(pos + 8), + test: deserializeOptionExpression(pos + 24), + update: deserializeOptionExpression(pos + 40), + body: deserializeStatement(pos + 56), }; } @@ -612,10 +566,9 @@ function deserializeForInStatement(pos) { type: 'ForInStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - left: deserializeForStatementLeft(pos + 24), - right: deserializeExpression(pos + 40), - body: deserializeStatement(pos + 56), + left: deserializeForStatementLeft(pos + 8), + right: deserializeExpression(pos + 24), + body: deserializeStatement(pos + 40), }; } @@ -624,11 +577,10 @@ function deserializeForOfStatement(pos) { type: 'ForOfStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - await: deserializeBool(pos + 76), - left: deserializeForStatementLeft(pos + 24), - right: deserializeExpression(pos + 40), - body: deserializeStatement(pos + 56), + await: deserializeBool(pos + 60), + left: deserializeForStatementLeft(pos + 8), + right: deserializeExpression(pos + 24), + body: deserializeStatement(pos + 40), }; } @@ -637,8 +589,7 @@ function deserializeContinueStatement(pos) { type: 'ContinueStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - label: deserializeOptionLabelIdentifier(pos + 24), + label: deserializeOptionLabelIdentifier(pos + 8), }; } @@ -647,8 +598,7 @@ function deserializeBreakStatement(pos) { type: 'BreakStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - label: deserializeOptionLabelIdentifier(pos + 24), + label: deserializeOptionLabelIdentifier(pos + 8), }; } @@ -657,8 +607,7 @@ function deserializeReturnStatement(pos) { type: 'ReturnStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - argument: deserializeOptionExpression(pos + 24), + argument: deserializeOptionExpression(pos + 8), }; } @@ -667,9 +616,8 @@ function deserializeWithStatement(pos) { type: 'WithStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - object: deserializeExpression(pos + 24), - body: deserializeStatement(pos + 40), + object: deserializeExpression(pos + 8), + body: deserializeStatement(pos + 24), }; } @@ -678,9 +626,8 @@ function deserializeSwitchStatement(pos) { type: 'SwitchStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - discriminant: deserializeExpression(pos + 24), - cases: deserializeVecSwitchCase(pos + 40), + discriminant: deserializeExpression(pos + 8), + cases: deserializeVecSwitchCase(pos + 24), }; } @@ -689,9 +636,8 @@ function deserializeSwitchCase(pos) { type: 'SwitchCase', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - test: deserializeOptionExpression(pos + 24), - consequent: deserializeVecStatement(pos + 40), + test: deserializeOptionExpression(pos + 8), + consequent: deserializeVecStatement(pos + 24), }; } @@ -700,9 +646,8 @@ function deserializeLabeledStatement(pos) { type: 'LabeledStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - label: deserializeLabelIdentifier(pos + 24), - body: deserializeStatement(pos + 64), + label: deserializeLabelIdentifier(pos + 8), + body: deserializeStatement(pos + 32), }; } @@ -711,8 +656,7 @@ function deserializeThrowStatement(pos) { type: 'ThrowStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - argument: deserializeExpression(pos + 24), + argument: deserializeExpression(pos + 8), }; } @@ -721,10 +665,9 @@ function deserializeTryStatement(pos) { type: 'TryStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - block: deserializeBoxBlockStatement(pos + 24), - handler: deserializeOptionBoxCatchClause(pos + 32), - finalizer: deserializeOptionBoxBlockStatement(pos + 40), + block: deserializeBoxBlockStatement(pos + 8), + handler: deserializeOptionBoxCatchClause(pos + 16), + finalizer: deserializeOptionBoxBlockStatement(pos + 24), }; } @@ -733,14 +676,13 @@ function deserializeCatchClause(pos) { type: 'CatchClause', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - param: deserializeOptionCatchParameter(pos + 24), - body: deserializeBoxBlockStatement(pos + 80), + param: deserializeOptionCatchParameter(pos + 8), + body: deserializeBoxBlockStatement(pos + 48), }; } function deserializeCatchParameter(pos) { - return deserializeBindingPattern(pos + 24); + return deserializeBindingPattern(pos + 8); } function deserializeDebuggerStatement(pos) { @@ -748,7 +690,6 @@ function deserializeDebuggerStatement(pos) { type: 'DebuggerStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -762,21 +703,19 @@ function deserializeAssignmentPattern(pos) { type: 'AssignmentPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - left: deserializeBindingPattern(pos + 24), - right: deserializeExpression(pos + 56), + left: deserializeBindingPattern(pos + 8), + right: deserializeExpression(pos + 40), }; } function deserializeObjectPattern(pos) { - const properties = deserializeVecBindingProperty(pos + 24); - const rest = deserializeOptionBoxBindingRestElement(pos + 48); + const properties = deserializeVecBindingProperty(pos + 8); + const rest = deserializeOptionBoxBindingRestElement(pos + 32); if (rest !== null) properties.push(rest); return { type: 'ObjectPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), properties, }; } @@ -786,25 +725,23 @@ function deserializeBindingProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), kind: 'init', - key: deserializePropertyKey(pos + 24), - value: deserializeBindingPattern(pos + 40), + key: deserializePropertyKey(pos + 8), + value: deserializeBindingPattern(pos + 24), method: false, - shorthand: deserializeBool(pos + 72), - computed: deserializeBool(pos + 73), + shorthand: deserializeBool(pos + 56), + computed: deserializeBool(pos + 57), }; } function deserializeArrayPattern(pos) { - const elements = deserializeVecOptionBindingPattern(pos + 24); - const rest = deserializeOptionBoxBindingRestElement(pos + 48); + const elements = deserializeVecOptionBindingPattern(pos + 8); + const rest = deserializeOptionBoxBindingRestElement(pos + 32); if (rest !== null) elements.push(rest); return { type: 'ArrayPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), elements, }; } @@ -814,68 +751,64 @@ function deserializeBindingRestElement(pos) { type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - argument: deserializeBindingPattern(pos + 24), + argument: deserializeBindingPattern(pos + 8), }; } function deserializeFunction(pos) { - const params = deserializeBoxFormalParameters(pos + 88); + const params = deserializeBoxFormalParameters(pos + 56); return { - type: deserializeFunctionType(pos + 116), + type: deserializeFunctionType(pos + 84), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeOptionBindingIdentifier(pos + 24), - generator: deserializeBool(pos + 117), - async: deserializeBool(pos + 118), + id: deserializeOptionBindingIdentifier(pos + 8), + generator: deserializeBool(pos + 85), + async: deserializeBool(pos + 86), params, - body: deserializeOptionBoxFunctionBody(pos + 104), + body: deserializeOptionBoxFunctionBody(pos + 72), expression: false, }; } function deserializeFormalParameters(pos) { - const params = deserializeVecFormalParameter(pos + 24); - if (uint32[(pos + 48) >> 2] !== 0 && uint32[(pos + 52) >> 2] !== 0) { - pos = uint32[(pos + 48) >> 2]; + const params = deserializeVecFormalParameter(pos + 8); + if (uint32[(pos + 32) >> 2] !== 0 && uint32[(pos + 36) >> 2] !== 0) { + pos = uint32[(pos + 32) >> 2]; params.push({ type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - argument: deserializeBindingPatternKind(pos + 24), + argument: deserializeBindingPatternKind(pos + 8), }); } return params; } function deserializeFormalParameter(pos) { - return deserializeBindingPatternKind(pos + 48); + return deserializeBindingPatternKind(pos + 32); } function deserializeFunctionBody(pos) { - const body = deserializeVecDirective(pos + 24); - body.push(...deserializeVecStatement(pos + 48)); + const body = deserializeVecDirective(pos + 8); + body.push(...deserializeVecStatement(pos + 32)); return { type: 'BlockStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), body, }; } function deserializeArrowFunctionExpression(pos) { - const expression = deserializeBool(pos + 60); - let body = deserializeBoxFunctionBody(pos + 48); + const expression = deserializeBool(pos + 44); + let body = deserializeBoxFunctionBody(pos + 32); return { type: 'ArrowFunctionExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), expression, - async: deserializeBool(pos + 61), - params: deserializeBoxFormalParameters(pos + 32), + async: deserializeBool(pos + 45), + params: deserializeBoxFormalParameters(pos + 16), body: expression ? body.body[0].expression : body, id: null, generator: false, @@ -887,22 +820,20 @@ function deserializeYieldExpression(pos) { type: 'YieldExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - delegate: deserializeBool(pos + 40), - argument: deserializeOptionExpression(pos + 24), + delegate: deserializeBool(pos + 24), + argument: deserializeOptionExpression(pos + 8), }; } function deserializeClass(pos) { return { - type: deserializeClassType(pos + 164), + type: deserializeClassType(pos + 132), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - decorators: deserializeVecDecorator(pos + 24), - id: deserializeOptionBindingIdentifier(pos + 48), - superClass: deserializeOptionExpression(pos + 104), - body: deserializeBoxClassBody(pos + 152), + decorators: deserializeVecDecorator(pos + 8), + id: deserializeOptionBindingIdentifier(pos + 32), + superClass: deserializeOptionExpression(pos + 72), + body: deserializeBoxClassBody(pos + 120), }; } @@ -911,37 +842,34 @@ function deserializeClassBody(pos) { type: 'ClassBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - body: deserializeVecClassElement(pos + 24), + body: deserializeVecClassElement(pos + 8), }; } function deserializeMethodDefinition(pos) { return { - type: deserializeMethodDefinitionType(pos + 72), + type: deserializeMethodDefinitionType(pos + 56), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - decorators: deserializeVecDecorator(pos + 24), - key: deserializePropertyKey(pos + 48), - value: deserializeBoxFunction(pos + 64), - kind: deserializeMethodDefinitionKind(pos + 73), - computed: deserializeBool(pos + 74), - static: deserializeBool(pos + 75), + decorators: deserializeVecDecorator(pos + 8), + key: deserializePropertyKey(pos + 32), + value: deserializeBoxFunction(pos + 48), + kind: deserializeMethodDefinitionKind(pos + 57), + computed: deserializeBool(pos + 58), + static: deserializeBool(pos + 59), }; } function deserializePropertyDefinition(pos) { return { - type: deserializePropertyDefinitionType(pos + 88), + type: deserializePropertyDefinitionType(pos + 72), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - decorators: deserializeVecDecorator(pos + 24), - key: deserializePropertyKey(pos + 48), - value: deserializeOptionExpression(pos + 72), - computed: deserializeBool(pos + 89), - static: deserializeBool(pos + 90), + decorators: deserializeVecDecorator(pos + 8), + key: deserializePropertyKey(pos + 32), + value: deserializeOptionExpression(pos + 56), + computed: deserializeBool(pos + 73), + static: deserializeBool(pos + 74), }; } @@ -950,8 +878,7 @@ function deserializePrivateIdentifier(pos) { type: 'PrivateIdentifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeStr(pos + 24), + name: deserializeStr(pos + 8), }; } @@ -960,22 +887,20 @@ function deserializeStaticBlock(pos) { type: 'StaticBlock', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - body: deserializeVecStatement(pos + 24), + body: deserializeVecStatement(pos + 8), }; } function deserializeAccessorProperty(pos) { return { - type: deserializeAccessorPropertyType(pos + 88), + type: deserializeAccessorPropertyType(pos + 72), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - decorators: deserializeVecDecorator(pos + 24), - key: deserializePropertyKey(pos + 48), - value: deserializeOptionExpression(pos + 72), - computed: deserializeBool(pos + 89), - static: deserializeBool(pos + 90), + decorators: deserializeVecDecorator(pos + 8), + key: deserializePropertyKey(pos + 32), + value: deserializeOptionExpression(pos + 56), + computed: deserializeBool(pos + 73), + static: deserializeBool(pos + 74), }; } @@ -984,25 +909,23 @@ function deserializeImportExpression(pos) { type: 'ImportExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - source: deserializeExpression(pos + 24), - options: deserializeOptionExpression(pos + 40), - phase: deserializeOptionImportPhase(pos + 56), + source: deserializeExpression(pos + 8), + options: deserializeOptionExpression(pos + 24), + phase: deserializeOptionImportPhase(pos + 40), }; } function deserializeImportDeclaration(pos) { - let specifiers = deserializeOptionVecImportDeclarationSpecifier(pos + 24); + let specifiers = deserializeOptionVecImportDeclarationSpecifier(pos + 8); if (specifiers === null) specifiers = []; - const withClause = deserializeOptionBoxWithClause(pos + 112); + const withClause = deserializeOptionBoxWithClause(pos + 80); return { type: 'ImportDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), specifiers, - source: deserializeStringLiteral(pos + 48), - phase: deserializeOptionImportPhase(pos + 120), + source: deserializeStringLiteral(pos + 32), + phase: deserializeOptionImportPhase(pos + 88), attributes: withClause === null ? [] : withClause.attributes, }; } @@ -1012,9 +935,8 @@ function deserializeImportSpecifier(pos) { type: 'ImportSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - imported: deserializeModuleExportName(pos + 24), - local: deserializeBindingIdentifier(pos + 96), + imported: deserializeModuleExportName(pos + 8), + local: deserializeBindingIdentifier(pos + 64), }; } @@ -1023,8 +945,7 @@ function deserializeImportDefaultSpecifier(pos) { type: 'ImportDefaultSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - local: deserializeBindingIdentifier(pos + 24), + local: deserializeBindingIdentifier(pos + 8), }; } @@ -1033,14 +954,13 @@ function deserializeImportNamespaceSpecifier(pos) { type: 'ImportNamespaceSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - local: deserializeBindingIdentifier(pos + 24), + local: deserializeBindingIdentifier(pos + 8), }; } function deserializeWithClause(pos) { return { - attributes: deserializeVecImportAttribute(pos + 64), + attributes: deserializeVecImportAttribute(pos + 32), }; } @@ -1049,22 +969,20 @@ function deserializeImportAttribute(pos) { type: 'ImportAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - key: deserializeImportAttributeKey(pos + 24), - value: deserializeStringLiteral(pos + 96), + key: deserializeImportAttributeKey(pos + 8), + value: deserializeStringLiteral(pos + 64), }; } function deserializeExportNamedDeclaration(pos) { - const withClause = deserializeOptionBoxWithClause(pos + 128); + const withClause = deserializeOptionBoxWithClause(pos + 96); return { type: 'ExportNamedDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - declaration: deserializeOptionDeclaration(pos + 24), - specifiers: deserializeVecExportSpecifier(pos + 40), - source: deserializeOptionStringLiteral(pos + 64), + declaration: deserializeOptionDeclaration(pos + 8), + specifiers: deserializeVecExportSpecifier(pos + 24), + source: deserializeOptionStringLiteral(pos + 48), attributes: withClause === null ? [] : withClause.attributes, }; } @@ -1074,20 +992,18 @@ function deserializeExportDefaultDeclaration(pos) { type: 'ExportDefaultDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - declaration: deserializeExportDefaultDeclarationKind(pos + 96), + declaration: deserializeExportDefaultDeclarationKind(pos + 64), }; } function deserializeExportAllDeclaration(pos) { - const withClause = deserializeOptionBoxWithClause(pos + 160); + const withClause = deserializeOptionBoxWithClause(pos + 112); return { type: 'ExportAllDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - exported: deserializeOptionModuleExportName(pos + 24), - source: deserializeStringLiteral(pos + 96), + exported: deserializeOptionModuleExportName(pos + 8), + source: deserializeStringLiteral(pos + 64), attributes: withClause === null ? [] : withClause.attributes, }; } @@ -1097,9 +1013,8 @@ function deserializeExportSpecifier(pos) { type: 'ExportSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - local: deserializeModuleExportName(pos + 24), - exported: deserializeModuleExportName(pos + 96), + local: deserializeModuleExportName(pos + 8), + exported: deserializeModuleExportName(pos + 64), }; } @@ -1108,21 +1023,19 @@ function deserializeV8IntrinsicExpression(pos) { type: 'V8IntrinsicExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeIdentifierName(pos + 24), - arguments: deserializeVecArgument(pos + 64), + name: deserializeIdentifierName(pos + 8), + arguments: deserializeVecArgument(pos + 32), }; } function deserializeBooleanLiteral(pos) { const start = deserializeU32(pos), end = deserializeU32(pos + 4), - value = deserializeBool(pos + 24); + value = deserializeBool(pos + 8); return { type: 'Literal', start, end, - range: deserializeOptionRangeArray(pos + 8), value, raw: (start === 0 && end === 0) ? null : value + '', }; @@ -1135,7 +1048,6 @@ function deserializeNullLiteral(pos) { type: 'Literal', start, end, - range: deserializeOptionRangeArray(pos + 8), value: null, raw: (start === 0 && end === 0) ? null : 'null', }; @@ -1146,42 +1058,39 @@ function deserializeNumericLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - value: deserializeF64(pos + 24), - raw: deserializeOptionStr(pos + 32), + value: deserializeF64(pos + 8), + raw: deserializeOptionStr(pos + 16), }; } function deserializeStringLiteral(pos) { - let value = deserializeStr(pos + 24); - if (deserializeBool(pos + 56)) { + let value = deserializeStr(pos + 8); + if (deserializeBool(pos + 40)) { value = value.replace(/\uFFFD(.{4})/g, (_, hex) => String.fromCodePoint(parseInt(hex, 16))); } return { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), value, - raw: deserializeOptionStr(pos + 40), + raw: deserializeOptionStr(pos + 24), }; } function deserializeBigIntLiteral(pos) { - const bigint = deserializeStr(pos + 24); + const bigint = deserializeStr(pos + 8); return { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), value: BigInt(bigint), - raw: deserializeOptionStr(pos + 40), + raw: deserializeOptionStr(pos + 24), bigint, }; } function deserializeRegExpLiteral(pos) { - const regex = deserializeRegExp(pos + 24); + const regex = deserializeRegExp(pos + 8); let value = null; try { value = new RegExp(regex.pattern, regex.flags); @@ -1190,9 +1099,8 @@ function deserializeRegExpLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), value, - raw: deserializeOptionStr(pos + 56), + raw: deserializeOptionStr(pos + 40), regex, }; } @@ -1226,16 +1134,15 @@ function deserializeRegExpFlags(pos) { } function deserializeJSXElement(pos) { - const closingElement = deserializeOptionBoxJSXClosingElement(pos + 56); - const openingElement = deserializeBoxJSXOpeningElement(pos + 24); + const closingElement = deserializeOptionBoxJSXClosingElement(pos + 40); + const openingElement = deserializeBoxJSXOpeningElement(pos + 8); if (closingElement === null) openingElement.selfClosing = true; return { type: 'JSXElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), openingElement, - children: deserializeVecJSXChild(pos + 32), + children: deserializeVecJSXChild(pos + 16), closingElement, }; } @@ -1245,9 +1152,8 @@ function deserializeJSXOpeningElement(pos) { type: 'JSXOpeningElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeJSXElementName(pos + 24), - attributes: deserializeVecJSXAttributeItem(pos + 48), + name: deserializeJSXElementName(pos + 8), + attributes: deserializeVecJSXAttributeItem(pos + 32), selfClosing: false, }; } @@ -1257,8 +1163,7 @@ function deserializeJSXClosingElement(pos) { type: 'JSXClosingElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeJSXElementName(pos + 24), + name: deserializeJSXElementName(pos + 8), }; } @@ -1267,10 +1172,9 @@ function deserializeJSXFragment(pos) { type: 'JSXFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - openingFragment: deserializeJSXOpeningFragment(pos + 24), - children: deserializeVecJSXChild(pos + 48), - closingFragment: deserializeJSXClosingFragment(pos + 72), + openingFragment: deserializeJSXOpeningFragment(pos + 8), + children: deserializeVecJSXChild(pos + 16), + closingFragment: deserializeJSXClosingFragment(pos + 40), }; } @@ -1279,7 +1183,6 @@ function deserializeJSXOpeningFragment(pos) { type: 'JSXOpeningFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), attributes: [], selfClosing: false, }; @@ -1290,7 +1193,6 @@ function deserializeJSXClosingFragment(pos) { type: 'JSXClosingFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1299,9 +1201,8 @@ function deserializeJSXNamespacedName(pos) { type: 'JSXNamespacedName', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - namespace: deserializeJSXIdentifier(pos + 24), - name: deserializeJSXIdentifier(pos + 64), + namespace: deserializeJSXIdentifier(pos + 8), + name: deserializeJSXIdentifier(pos + 32), }; } @@ -1310,9 +1211,8 @@ function deserializeJSXMemberExpression(pos) { type: 'JSXMemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - object: deserializeJSXMemberExpressionObject(pos + 24), - property: deserializeJSXIdentifier(pos + 40), + object: deserializeJSXMemberExpressionObject(pos + 8), + property: deserializeJSXIdentifier(pos + 24), }; } @@ -1321,8 +1221,7 @@ function deserializeJSXExpressionContainer(pos) { type: 'JSXExpressionContainer', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeJSXExpression(pos + 24), + expression: deserializeJSXExpression(pos + 8), }; } @@ -1331,7 +1230,6 @@ function deserializeJSXEmptyExpression(pos) { type: 'JSXEmptyExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1340,9 +1238,8 @@ function deserializeJSXAttribute(pos) { type: 'JSXAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeJSXAttributeName(pos + 24), - value: deserializeOptionJSXAttributeValue(pos + 40), + name: deserializeJSXAttributeName(pos + 8), + value: deserializeOptionJSXAttributeValue(pos + 24), }; } @@ -1351,8 +1248,7 @@ function deserializeJSXSpreadAttribute(pos) { type: 'JSXSpreadAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - argument: deserializeExpression(pos + 24), + argument: deserializeExpression(pos + 8), }; } @@ -1361,8 +1257,7 @@ function deserializeJSXIdentifier(pos) { type: 'JSXIdentifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeStr(pos + 24), + name: deserializeStr(pos + 8), }; } @@ -1371,8 +1266,7 @@ function deserializeJSXSpreadChild(pos) { type: 'JSXSpreadChild', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), + expression: deserializeExpression(pos + 8), }; } @@ -1381,9 +1275,8 @@ function deserializeJSXText(pos) { type: 'JSXText', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - value: deserializeStr(pos + 24), - raw: deserializeOptionStr(pos + 40), + value: deserializeStr(pos + 8), + raw: deserializeOptionStr(pos + 24), }; } @@ -1392,11 +1285,10 @@ function deserializeTSThisParameter(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], name: 'this', optional: false, - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 48), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 16), }; } @@ -1405,11 +1297,10 @@ function deserializeTSEnumDeclaration(pos) { type: 'TSEnumDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeBindingIdentifier(pos + 24), - body: deserializeTSEnumBody(pos + 72), - const: deserializeBool(pos + 124), - declare: deserializeBool(pos + 125), + id: deserializeBindingIdentifier(pos + 8), + body: deserializeTSEnumBody(pos + 40), + const: deserializeBool(pos + 76), + declare: deserializeBool(pos + 77), }; } @@ -1418,8 +1309,7 @@ function deserializeTSEnumBody(pos) { type: 'TSEnumBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - members: deserializeVecTSEnumMember(pos + 24), + members: deserializeVecTSEnumMember(pos + 8), }; } @@ -1428,10 +1318,9 @@ function deserializeTSEnumMember(pos) { type: 'TSEnumMember', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeTSEnumMemberName(pos + 24), - initializer: deserializeOptionExpression(pos + 40), - computed: deserializeU8(pos + 24) > 1, + id: deserializeTSEnumMemberName(pos + 8), + initializer: deserializeOptionExpression(pos + 24), + computed: deserializeU8(pos + 8) > 1, }; } @@ -1440,8 +1329,7 @@ function deserializeTSTypeAnnotation(pos) { type: 'TSTypeAnnotation', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), + typeAnnotation: deserializeTSType(pos + 8), }; } @@ -1450,8 +1338,7 @@ function deserializeTSLiteralType(pos) { type: 'TSLiteralType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - literal: deserializeTSLiteral(pos + 24), + literal: deserializeTSLiteral(pos + 8), }; } @@ -1460,11 +1347,10 @@ function deserializeTSConditionalType(pos) { type: 'TSConditionalType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - checkType: deserializeTSType(pos + 24), - extendsType: deserializeTSType(pos + 40), - trueType: deserializeTSType(pos + 56), - falseType: deserializeTSType(pos + 72), + checkType: deserializeTSType(pos + 8), + extendsType: deserializeTSType(pos + 24), + trueType: deserializeTSType(pos + 40), + falseType: deserializeTSType(pos + 56), }; } @@ -1473,8 +1359,7 @@ function deserializeTSUnionType(pos) { type: 'TSUnionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - types: deserializeVecTSType(pos + 24), + types: deserializeVecTSType(pos + 8), }; } @@ -1483,8 +1368,7 @@ function deserializeTSIntersectionType(pos) { type: 'TSIntersectionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - types: deserializeVecTSType(pos + 24), + types: deserializeVecTSType(pos + 8), }; } @@ -1493,8 +1377,7 @@ function deserializeTSParenthesizedType(pos) { type: 'TSParenthesizedType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), + typeAnnotation: deserializeTSType(pos + 8), }; } @@ -1503,9 +1386,8 @@ function deserializeTSTypeOperator(pos) { type: 'TSTypeOperator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - operator: deserializeTSTypeOperatorOperator(pos + 40), - typeAnnotation: deserializeTSType(pos + 24), + operator: deserializeTSTypeOperatorOperator(pos + 24), + typeAnnotation: deserializeTSType(pos + 8), }; } @@ -1514,8 +1396,7 @@ function deserializeTSArrayType(pos) { type: 'TSArrayType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - elementType: deserializeTSType(pos + 24), + elementType: deserializeTSType(pos + 8), }; } @@ -1524,9 +1405,8 @@ function deserializeTSIndexedAccessType(pos) { type: 'TSIndexedAccessType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - objectType: deserializeTSType(pos + 24), - indexType: deserializeTSType(pos + 40), + objectType: deserializeTSType(pos + 8), + indexType: deserializeTSType(pos + 24), }; } @@ -1535,8 +1415,7 @@ function deserializeTSTupleType(pos) { type: 'TSTupleType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - elementTypes: deserializeVecTSTupleElement(pos + 24), + elementTypes: deserializeVecTSTupleElement(pos + 8), }; } @@ -1545,10 +1424,9 @@ function deserializeTSNamedTupleMember(pos) { type: 'TSNamedTupleMember', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - label: deserializeIdentifierName(pos + 24), - elementType: deserializeTSTupleElement(pos + 64), - optional: deserializeBool(pos + 80), + label: deserializeIdentifierName(pos + 8), + elementType: deserializeTSTupleElement(pos + 32), + optional: deserializeBool(pos + 48), }; } @@ -1557,8 +1435,7 @@ function deserializeTSOptionalType(pos) { type: 'TSOptionalType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), + typeAnnotation: deserializeTSType(pos + 8), }; } @@ -1567,8 +1444,7 @@ function deserializeTSRestType(pos) { type: 'TSRestType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), + typeAnnotation: deserializeTSType(pos + 8), }; } @@ -1577,7 +1453,6 @@ function deserializeTSAnyKeyword(pos) { type: 'TSAnyKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1586,7 +1461,6 @@ function deserializeTSStringKeyword(pos) { type: 'TSStringKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1595,7 +1469,6 @@ function deserializeTSBooleanKeyword(pos) { type: 'TSBooleanKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1604,7 +1477,6 @@ function deserializeTSNumberKeyword(pos) { type: 'TSNumberKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1613,7 +1485,6 @@ function deserializeTSNeverKeyword(pos) { type: 'TSNeverKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1622,7 +1493,6 @@ function deserializeTSIntrinsicKeyword(pos) { type: 'TSIntrinsicKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1631,7 +1501,6 @@ function deserializeTSUnknownKeyword(pos) { type: 'TSUnknownKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1640,7 +1509,6 @@ function deserializeTSNullKeyword(pos) { type: 'TSNullKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1649,7 +1517,6 @@ function deserializeTSUndefinedKeyword(pos) { type: 'TSUndefinedKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1658,7 +1525,6 @@ function deserializeTSVoidKeyword(pos) { type: 'TSVoidKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1667,7 +1533,6 @@ function deserializeTSSymbolKeyword(pos) { type: 'TSSymbolKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1676,7 +1541,6 @@ function deserializeTSThisType(pos) { type: 'TSThisType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1685,7 +1549,6 @@ function deserializeTSObjectKeyword(pos) { type: 'TSObjectKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1694,7 +1557,6 @@ function deserializeTSBigIntKeyword(pos) { type: 'TSBigIntKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1703,9 +1565,8 @@ function deserializeTSTypeReference(pos) { type: 'TSTypeReference', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeName: deserializeTSTypeName(pos + 24), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), + typeName: deserializeTSTypeName(pos + 8), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), }; } @@ -1714,9 +1575,8 @@ function deserializeTSQualifiedName(pos) { type: 'TSQualifiedName', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - left: deserializeTSTypeName(pos + 24), - right: deserializeIdentifierName(pos + 40), + left: deserializeTSTypeName(pos + 8), + right: deserializeIdentifierName(pos + 24), }; } @@ -1725,8 +1585,7 @@ function deserializeTSTypeParameterInstantiation(pos) { type: 'TSTypeParameterInstantiation', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - params: deserializeVecTSType(pos + 24), + params: deserializeVecTSType(pos + 8), }; } @@ -1735,13 +1594,12 @@ function deserializeTSTypeParameter(pos) { type: 'TSTypeParameter', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeBindingIdentifier(pos + 24), - constraint: deserializeOptionTSType(pos + 72), - default: deserializeOptionTSType(pos + 88), - in: deserializeBool(pos + 104), - out: deserializeBool(pos + 105), - const: deserializeBool(pos + 106), + name: deserializeBindingIdentifier(pos + 8), + constraint: deserializeOptionTSType(pos + 40), + default: deserializeOptionTSType(pos + 56), + in: deserializeBool(pos + 72), + out: deserializeBool(pos + 73), + const: deserializeBool(pos + 74), }; } @@ -1750,8 +1608,7 @@ function deserializeTSTypeParameterDeclaration(pos) { type: 'TSTypeParameterDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - params: deserializeVecTSTypeParameter(pos + 24), + params: deserializeVecTSTypeParameter(pos + 8), }; } @@ -1760,16 +1617,15 @@ function deserializeTSTypeAliasDeclaration(pos) { type: 'TSTypeAliasDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeBindingIdentifier(pos + 24), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), - typeAnnotation: deserializeTSType(pos + 80), - declare: deserializeBool(pos + 100), + id: deserializeBindingIdentifier(pos + 8), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40), + typeAnnotation: deserializeTSType(pos + 48), + declare: deserializeBool(pos + 68), }; } function deserializeTSClassImplements(pos) { - let expression = deserializeTSTypeName(pos + 24); + let expression = deserializeTSTypeName(pos + 8); if (expression.type === 'TSQualifiedName') { let parent = expression = { type: 'MemberExpression', @@ -1798,9 +1654,8 @@ function deserializeTSClassImplements(pos) { type: 'TSClassImplements', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), expression, - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), }; } @@ -1809,12 +1664,11 @@ function deserializeTSInterfaceDeclaration(pos) { type: 'TSInterfaceDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeBindingIdentifier(pos + 24), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), - extends: deserializeVecTSInterfaceHeritage(pos + 80), - body: deserializeBoxTSInterfaceBody(pos + 104), - declare: deserializeBool(pos + 116), + id: deserializeBindingIdentifier(pos + 8), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40), + extends: deserializeVecTSInterfaceHeritage(pos + 48), + body: deserializeBoxTSInterfaceBody(pos + 72), + declare: deserializeBool(pos + 84), }; } @@ -1823,8 +1677,7 @@ function deserializeTSInterfaceBody(pos) { type: 'TSInterfaceBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - body: deserializeVecTSSignature(pos + 24), + body: deserializeVecTSSignature(pos + 8), }; } @@ -1833,12 +1686,11 @@ function deserializeTSPropertySignature(pos) { type: 'TSPropertySignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - computed: deserializeBool(pos + 48), - optional: deserializeBool(pos + 49), - readonly: deserializeBool(pos + 50), - key: deserializePropertyKey(pos + 24), - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 40), + computed: deserializeBool(pos + 32), + optional: deserializeBool(pos + 33), + readonly: deserializeBool(pos + 34), + key: deserializePropertyKey(pos + 8), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 24), accessibility: null, static: false, }; @@ -1849,46 +1701,43 @@ function deserializeTSIndexSignature(pos) { type: 'TSIndexSignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - parameters: deserializeVecTSIndexSignatureName(pos + 24), - typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 48), - readonly: deserializeBool(pos + 56), - static: deserializeBool(pos + 57), + parameters: deserializeVecTSIndexSignatureName(pos + 8), + typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 32), + readonly: deserializeBool(pos + 40), + static: deserializeBool(pos + 41), accessibility: null, }; } function deserializeTSCallSignatureDeclaration(pos) { - const params = deserializeBoxFormalParameters(pos + 40); - const thisParam = deserializeOptionBoxTSThisParameter(pos + 32); + const params = deserializeBoxFormalParameters(pos + 24); + const thisParam = deserializeOptionBoxTSThisParameter(pos + 16); if (thisParam !== null) params.unshift(thisParam); return { type: 'TSCallSignatureDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), params, - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 48), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 32), }; } function deserializeTSMethodSignature(pos) { - const params = deserializeBoxFormalParameters(pos + 56); - const thisParam = deserializeOptionBoxTSThisParameter(pos + 48); + const params = deserializeBoxFormalParameters(pos + 40); + const thisParam = deserializeOptionBoxTSThisParameter(pos + 32); if (thisParam !== null) params.unshift(thisParam); return { type: 'TSMethodSignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - key: deserializePropertyKey(pos + 24), - computed: deserializeBool(pos + 76), - optional: deserializeBool(pos + 77), - kind: deserializeTSMethodSignatureKind(pos + 78), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40), + key: deserializePropertyKey(pos + 8), + computed: deserializeBool(pos + 60), + optional: deserializeBool(pos + 61), + kind: deserializeTSMethodSignatureKind(pos + 62), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), params, - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 64), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 48), accessibility: null, readonly: false, static: false, @@ -1900,10 +1749,9 @@ function deserializeTSConstructSignatureDeclaration(pos) { type: 'TSConstructSignatureDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), - params: deserializeBoxFormalParameters(pos + 32), - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 40), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), + params: deserializeBoxFormalParameters(pos + 16), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 24), }; } @@ -1912,11 +1760,10 @@ function deserializeTSIndexSignatureName(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], - name: deserializeStr(pos + 24), + name: deserializeStr(pos + 8), optional: false, - typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 40), + typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 24), }; } @@ -1925,9 +1772,8 @@ function deserializeTSInterfaceHeritage(pos) { type: 'TSInterfaceHeritage', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), + expression: deserializeExpression(pos + 8), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), }; } @@ -1936,21 +1782,20 @@ function deserializeTSTypePredicate(pos) { type: 'TSTypePredicate', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - parameterName: deserializeTSTypePredicateName(pos + 24), - asserts: deserializeBool(pos + 64), - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 56), + parameterName: deserializeTSTypePredicateName(pos + 8), + asserts: deserializeBool(pos + 32), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 24), }; } function deserializeTSModuleDeclaration(pos) { - const kind = deserializeTSModuleDeclarationKind(pos + 116), + const kind = deserializeTSModuleDeclarationKind(pos + 84), global = kind === 'global', start = deserializeU32(pos), end = deserializeU32(pos + 4), - declare = deserializeBool(pos + 117); - let id = deserializeTSModuleDeclarationName(pos + 24), - body = deserializeOptionTSModuleDeclarationBody(pos + 96); + declare = deserializeBool(pos + 85); + let id = deserializeTSModuleDeclarationName(pos + 8), + body = deserializeOptionTSModuleDeclarationBody(pos + 64); // Flatten `body`, and nest `id` if (body !== null && body.type === 'TSModuleDeclaration') { @@ -1991,13 +1836,12 @@ function deserializeTSModuleDeclaration(pos) { } function deserializeTSModuleBlock(pos) { - const body = deserializeVecDirective(pos + 24); - body.push(...deserializeVecStatement(pos + 48)); + const body = deserializeVecDirective(pos + 8); + body.push(...deserializeVecStatement(pos + 32)); return { type: 'TSModuleBlock', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), body, }; } @@ -2007,8 +1851,7 @@ function deserializeTSTypeLiteral(pos) { type: 'TSTypeLiteral', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - members: deserializeVecTSSignature(pos + 24), + members: deserializeVecTSSignature(pos + 8), }; } @@ -2017,8 +1860,7 @@ function deserializeTSInferType(pos) { type: 'TSInferType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeParameter: deserializeBoxTSTypeParameter(pos + 24), + typeParameter: deserializeBoxTSTypeParameter(pos + 8), }; } @@ -2027,9 +1869,8 @@ function deserializeTSTypeQuery(pos) { type: 'TSTypeQuery', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - exprName: deserializeTSTypeQueryExprName(pos + 24), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), + exprName: deserializeTSTypeQueryExprName(pos + 8), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), }; } @@ -2038,26 +1879,24 @@ function deserializeTSImportType(pos) { type: 'TSImportType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - argument: deserializeTSType(pos + 24), - options: deserializeOptionBoxObjectExpression(pos + 40), - qualifier: deserializeOptionTSTypeName(pos + 48), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 64), + argument: deserializeTSType(pos + 8), + options: deserializeOptionBoxObjectExpression(pos + 24), + qualifier: deserializeOptionTSTypeName(pos + 32), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 48), }; } function deserializeTSFunctionType(pos) { - const params = deserializeBoxFormalParameters(pos + 40); - const thisParam = deserializeOptionBoxTSThisParameter(pos + 32); + const params = deserializeBoxFormalParameters(pos + 24); + const thisParam = deserializeOptionBoxTSThisParameter(pos + 16); if (thisParam !== null) params.unshift(thisParam); return { type: 'TSFunctionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), params, - returnType: deserializeBoxTSTypeAnnotation(pos + 48), + returnType: deserializeBoxTSTypeAnnotation(pos + 32), }; } @@ -2066,29 +1905,27 @@ function deserializeTSConstructorType(pos) { type: 'TSConstructorType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - abstract: deserializeBool(pos + 48), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), - params: deserializeBoxFormalParameters(pos + 32), - returnType: deserializeBoxTSTypeAnnotation(pos + 40), + abstract: deserializeBool(pos + 32), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), + params: deserializeBoxFormalParameters(pos + 16), + returnType: deserializeBoxTSTypeAnnotation(pos + 24), }; } function deserializeTSMappedType(pos) { - const typeParameter = deserializeBoxTSTypeParameter(pos + 24); - let optional = deserializeOptionTSMappedTypeModifierOperator(pos + 68); + const typeParameter = deserializeBoxTSTypeParameter(pos + 8); + let optional = deserializeOptionTSMappedTypeModifierOperator(pos + 52); if (optional === null) optional = false; return { type: 'TSMappedType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), key: typeParameter.name, constraint: typeParameter.constraint, - nameType: deserializeOptionTSType(pos + 32), - typeAnnotation: deserializeOptionTSType(pos + 48), + nameType: deserializeOptionTSType(pos + 16), + typeAnnotation: deserializeOptionTSType(pos + 32), optional, - readonly: deserializeOptionTSMappedTypeModifierOperator(pos + 69), + readonly: deserializeOptionTSMappedTypeModifierOperator(pos + 53), }; } @@ -2097,9 +1934,8 @@ function deserializeTSTemplateLiteralType(pos) { type: 'TSTemplateLiteralType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - quasis: deserializeVecTemplateElement(pos + 24), - types: deserializeVecTSType(pos + 48), + quasis: deserializeVecTemplateElement(pos + 8), + types: deserializeVecTSType(pos + 32), }; } @@ -2108,9 +1944,8 @@ function deserializeTSAsExpression(pos) { type: 'TSAsExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), - typeAnnotation: deserializeTSType(pos + 40), + expression: deserializeExpression(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), }; } @@ -2119,9 +1954,8 @@ function deserializeTSSatisfiesExpression(pos) { type: 'TSSatisfiesExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), - typeAnnotation: deserializeTSType(pos + 40), + expression: deserializeExpression(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), }; } @@ -2130,9 +1964,8 @@ function deserializeTSTypeAssertion(pos) { type: 'TSTypeAssertion', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), - expression: deserializeExpression(pos + 40), + typeAnnotation: deserializeTSType(pos + 8), + expression: deserializeExpression(pos + 24), }; } @@ -2141,10 +1974,9 @@ function deserializeTSImportEqualsDeclaration(pos) { type: 'TSImportEqualsDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeBindingIdentifier(pos + 24), - moduleReference: deserializeTSModuleReference(pos + 72), - importKind: deserializeImportOrExportKind(pos + 88), + id: deserializeBindingIdentifier(pos + 8), + moduleReference: deserializeTSModuleReference(pos + 40), + importKind: deserializeImportOrExportKind(pos + 56), }; } @@ -2153,8 +1985,7 @@ function deserializeTSExternalModuleReference(pos) { type: 'TSExternalModuleReference', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeStringLiteral(pos + 24), + expression: deserializeStringLiteral(pos + 8), }; } @@ -2163,8 +1994,7 @@ function deserializeTSNonNullExpression(pos) { type: 'TSNonNullExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), + expression: deserializeExpression(pos + 8), }; } @@ -2173,8 +2003,7 @@ function deserializeDecorator(pos) { type: 'Decorator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), + expression: deserializeExpression(pos + 8), }; } @@ -2183,8 +2012,7 @@ function deserializeTSExportAssignment(pos) { type: 'TSExportAssignment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), + expression: deserializeExpression(pos + 8), }; } @@ -2193,8 +2021,7 @@ function deserializeTSNamespaceExportDeclaration(pos) { type: 'TSNamespaceExportDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeIdentifierName(pos + 24), + id: deserializeIdentifierName(pos + 8), }; } @@ -2203,9 +2030,8 @@ function deserializeTSInstantiationExpression(pos) { type: 'TSInstantiationExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), - typeArguments: deserializeBoxTSTypeParameterInstantiation(pos + 40), + expression: deserializeExpression(pos + 8), + typeArguments: deserializeBoxTSTypeParameterInstantiation(pos + 24), }; } @@ -2214,9 +2040,8 @@ function deserializeJSDocNullableType(pos) { type: 'TSJSDocNullableType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), - postfix: deserializeBool(pos + 40), + typeAnnotation: deserializeTSType(pos + 8), + postfix: deserializeBool(pos + 24), }; } @@ -2225,9 +2050,8 @@ function deserializeJSDocNonNullableType(pos) { type: 'TSJSDocNonNullableType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), - postfix: deserializeBool(pos + 40), + typeAnnotation: deserializeTSType(pos + 8), + postfix: deserializeBool(pos + 24), }; } @@ -2236,12 +2060,11 @@ function deserializeJSDocUnknownType(pos) { type: 'TSJSDocUnknownType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } function deserializeComment(pos) { - const type = deserializeCommentKind(pos + 28), + const type = deserializeCommentKind(pos + 12), start = deserializeU32(pos), end = deserializeU32(pos + 4); const endCut = type === 'Line' ? 0 : 2; @@ -2250,24 +2073,22 @@ function deserializeComment(pos) { value: sourceText.slice(start + 2, end - endCut), start, end, - range: deserializeOptionRangeArray(pos + 8), }; } function deserializeNameSpan(pos) { return { - value: deserializeStr(pos + 24), + value: deserializeStr(pos + 8), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } function deserializeImportEntry(pos) { return { - importName: deserializeImportImportName(pos + 64), - localName: deserializeNameSpan(pos + 112), - isType: deserializeBool(pos + 152), + importName: deserializeImportImportName(pos + 32), + localName: deserializeNameSpan(pos + 64), + isType: deserializeBool(pos + 88), }; } @@ -2275,12 +2096,11 @@ function deserializeExportEntry(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - moduleRequest: deserializeOptionNameSpan(pos + 48), - importName: deserializeExportImportName(pos + 88), - exportName: deserializeExportExportName(pos + 136), - localName: deserializeExportLocalName(pos + 184), - isType: deserializeBool(pos + 232), + moduleRequest: deserializeOptionNameSpan(pos + 16), + importName: deserializeExportImportName(pos + 40), + exportName: deserializeExportExportName(pos + 72), + localName: deserializeExportLocalName(pos + 104), + isType: deserializeBool(pos + 136), }; } @@ -2288,8 +2108,7 @@ function deserializeDynamicImport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - moduleRequest: deserializeSpan(pos + 24), + moduleRequest: deserializeSpan(pos + 8), }; } @@ -2297,7 +2116,6 @@ function deserializeSpan(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -2310,9 +2128,9 @@ function deserializeSourceType(pos) { function deserializeRawTransferData(pos) { return { program: deserializeProgram(pos), - comments: deserializeVecComment(pos + 160), - module: deserializeEcmaScriptModule(pos + 184), - errors: deserializeVecError(pos + 288), + comments: deserializeVecComment(pos + 128), + module: deserializeEcmaScriptModule(pos + 152), + errors: deserializeVecError(pos + 256), }; } @@ -2328,10 +2146,9 @@ function deserializeError(pos) { function deserializeErrorLabel(pos) { return { - message: deserializeOptionStr(pos + 24), + message: deserializeOptionStr(pos + 8), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -2349,9 +2166,8 @@ function deserializeStaticImport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - moduleRequest: deserializeNameSpan(pos + 24), - entries: deserializeVecImportEntry(pos + 64), + moduleRequest: deserializeNameSpan(pos + 8), + entries: deserializeVecImportEntry(pos + 32), }; } @@ -2359,8 +2175,7 @@ function deserializeStaticExport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - entries: deserializeVecExportEntry(pos + 24), + entries: deserializeVecExportEntry(pos + 8), }; } @@ -4242,13 +4057,13 @@ function deserializeVecComment(pos) { const endPos = pos + uint32[pos32 + 2] * 16; while (pos !== endPos) { arr.push(deserializeComment(pos)); - pos += 32; + pos += 16; } return arr; } function deserializeOptionHashbang(pos) { - if (uint8[pos + 8] === 2) return null; + if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; return deserializeHashbang(pos); } @@ -4259,7 +4074,7 @@ function deserializeVecDirective(pos) { const endPos = pos + uint32[pos32 + 2] * 72; while (pos !== endPos) { arr.push(deserializeDirective(pos)); - pos += 104; + pos += 72; } return arr; } @@ -4443,7 +4258,7 @@ function deserializeVecArrayExpressionElement(pos) { const endPos = pos + uint32[pos32 + 2] * 16; while (pos !== endPos) { arr.push(deserializeArrayExpressionElement(pos)); - pos += 32; + pos += 16; } return arr; } @@ -4487,7 +4302,7 @@ function deserializeVecTemplateElement(pos) { const endPos = pos + uint32[pos32 + 2] * 48; while (pos !== endPos) { arr.push(deserializeTemplateElement(pos)); - pos += 64; + pos += 48; } return arr; } @@ -4568,7 +4383,7 @@ function deserializeVecOptionAssignmentTargetMaybeDefault(pos) { } function deserializeOptionAssignmentTargetRest(pos) { - if (uint8[pos + 8] === 2) return null; + if (uint8[pos + 8] === 51) return null; return deserializeAssignmentTargetRest(pos); } @@ -4704,7 +4519,7 @@ function deserializeVecVariableDeclarator(pos) { const endPos = pos + uint32[pos32 + 2] * 64; while (pos !== endPos) { arr.push(deserializeVariableDeclarator(pos)); - pos += 80; + pos += 64; } return arr; } @@ -4720,7 +4535,7 @@ function deserializeOptionForStatementInit(pos) { } function deserializeOptionLabelIdentifier(pos) { - if (uint8[pos + 8] === 2) return null; + if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; return deserializeLabelIdentifier(pos); } @@ -4731,7 +4546,7 @@ function deserializeVecSwitchCase(pos) { const endPos = pos + uint32[pos32 + 2] * 48; while (pos !== endPos) { arr.push(deserializeSwitchCase(pos)); - pos += 64; + pos += 48; } return arr; } @@ -4751,7 +4566,7 @@ function deserializeOptionBoxBlockStatement(pos) { } function deserializeOptionCatchParameter(pos) { - if (uint8[pos + 8] === 2) return null; + if (uint8[pos + 32] === 2) return null; return deserializeCatchParameter(pos); } @@ -4787,7 +4602,7 @@ function deserializeVecBindingProperty(pos) { const endPos = pos + uint32[pos32 + 2] * 64; while (pos !== endPos) { arr.push(deserializeBindingProperty(pos)); - pos += 80; + pos += 64; } return arr; } @@ -4819,7 +4634,7 @@ function deserializeVecOptionBindingPattern(pos) { } function deserializeOptionBindingIdentifier(pos) { - if (uint8[pos + 8] === 2) return null; + if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; return deserializeBindingIdentifier(pos); } @@ -4861,7 +4676,7 @@ function deserializeVecFormalParameter(pos) { const endPos = pos + uint32[pos32 + 2] * 72; while (pos !== endPos) { arr.push(deserializeFormalParameter(pos)); - pos += 88; + pos += 72; } return arr; } @@ -4873,7 +4688,7 @@ function deserializeVecDecorator(pos) { const endPos = pos + uint32[pos32 + 2] * 24; while (pos !== endPos) { arr.push(deserializeDecorator(pos)); - pos += 40; + pos += 24; } return arr; } @@ -4890,7 +4705,7 @@ function deserializeVecTSClassImplements(pos) { const endPos = pos + uint32[pos32 + 2] * 32; while (pos !== endPos) { arr.push(deserializeTSClassImplements(pos)); - pos += 48; + pos += 32; } return arr; } @@ -5005,7 +4820,7 @@ function deserializeVecImportAttribute(pos) { const endPos = pos + uint32[pos32 + 2] * 112; while (pos !== endPos) { arr.push(deserializeImportAttribute(pos)); - pos += 160; + pos += 112; } return arr; } @@ -5022,13 +4837,13 @@ function deserializeVecExportSpecifier(pos) { const endPos = pos + uint32[pos32 + 2] * 128; while (pos !== endPos) { arr.push(deserializeExportSpecifier(pos)); - pos += 176; + pos += 128; } return arr; } function deserializeOptionStringLiteral(pos) { - if (uint8[pos + 8] === 2) return null; + if (uint8[pos + 40] === 2) return null; return deserializeStringLiteral(pos); } @@ -5126,7 +4941,7 @@ function deserializeVecTSEnumMember(pos) { const endPos = pos + uint32[pos32 + 2] * 40; while (pos !== endPos) { arr.push(deserializeTSEnumMember(pos)); - pos += 56; + pos += 40; } return arr; } @@ -5327,7 +5142,7 @@ function deserializeVecTSTypeParameter(pos) { const endPos = pos + uint32[pos32 + 2] * 80; while (pos !== endPos) { arr.push(deserializeTSTypeParameter(pos)); - pos += 112; + pos += 80; } return arr; } @@ -5339,7 +5154,7 @@ function deserializeVecTSInterfaceHeritage(pos) { const endPos = pos + uint32[pos32 + 2] * 32; while (pos !== endPos) { arr.push(deserializeTSInterfaceHeritage(pos)); - pos += 48; + pos += 32; } return arr; } @@ -5383,7 +5198,7 @@ function deserializeVecTSIndexSignatureName(pos) { const endPos = pos + uint32[pos32 + 2] * 32; while (pos !== endPos) { arr.push(deserializeTSIndexSignatureName(pos)); - pos += 48; + pos += 32; } return arr; } @@ -5425,15 +5240,10 @@ function deserializeU32(pos) { } function deserializeOptionNameSpan(pos) { - if (uint8[pos + 8] === 2) return null; + if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; return deserializeNameSpan(pos); } -function deserializeOptionRangeArray(pos) { - if (uint8[pos] === 0) return null; - return deserializeRangeArray(pos + 4); -} - function deserializeU64(pos) { const pos32 = pos >> 2; return uint32[pos32] + uint32[pos32 + 1] * 4294967296; @@ -5463,7 +5273,7 @@ function deserializeVecErrorLabel(pos) { const endPos = pos + uint32[pos32 + 2] * 24; while (pos !== endPos) { arr.push(deserializeErrorLabel(pos)); - pos += 40; + pos += 24; } return arr; } @@ -5475,7 +5285,7 @@ function deserializeVecStaticImport(pos) { const endPos = pos + uint32[pos32 + 2] * 56; while (pos !== endPos) { arr.push(deserializeStaticImport(pos)); - pos += 88; + pos += 56; } return arr; } @@ -5487,7 +5297,7 @@ function deserializeVecStaticExport(pos) { const endPos = pos + uint32[pos32 + 2] * 32; while (pos !== endPos) { arr.push(deserializeStaticExport(pos)); - pos += 48; + pos += 32; } return arr; } @@ -5499,7 +5309,7 @@ function deserializeVecDynamicImport(pos) { const endPos = pos + uint32[pos32 + 2] * 16; while (pos !== endPos) { arr.push(deserializeDynamicImport(pos)); - pos += 48; + pos += 16; } return arr; } @@ -5511,7 +5321,7 @@ function deserializeVecSpan(pos) { const endPos = pos + uint32[pos32 + 2] * 8; while (pos !== endPos) { arr.push(deserializeSpan(pos)); - pos += 24; + pos += 8; } return arr; } @@ -5523,7 +5333,7 @@ function deserializeVecImportEntry(pos) { const endPos = pos + uint32[pos32 + 2] * 96; while (pos !== endPos) { arr.push(deserializeImportEntry(pos)); - pos += 160; + pos += 96; } return arr; } @@ -5535,7 +5345,7 @@ function deserializeVecExportEntry(pos) { const endPos = pos + uint32[pos32 + 2] * 144; while (pos !== endPos) { arr.push(deserializeExportEntry(pos)); - pos += 240; + pos += 144; } return arr; } diff --git a/napi/parser/generated/deserialize/lazy.js b/napi/parser/generated/deserialize/lazy.js index 75f162f07f8b4..743cf074425f0 100644 --- a/napi/parser/generated/deserialize/lazy.js +++ b/napi/parser/generated/deserialize/lazy.js @@ -45,26 +45,21 @@ class Program { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get sourceType() { const internal = this.#internal; - return new SourceType(internal.pos + 156, internal.ast); + return new SourceType(internal.pos + 124, internal.ast); } get hashbang() { const internal = this.#internal; - return constructOptionHashbang(internal.pos + 64, internal.ast); + return constructOptionHashbang(internal.pos + 48, internal.ast); } get body() { const internal = this.#internal, cached = internal.$body; if (cached !== void 0) return cached; - return internal.$body = constructVecStatement(internal.pos + 128, internal.ast); + return internal.$body = constructVecStatement(internal.pos + 96, internal.ast); } toJSON() { @@ -72,7 +67,6 @@ class Program { type: 'Program', start: this.start, end: this.end, - range: this.range, sourceType: this.sourceType, hashbang: this.hashbang, body: this.body, @@ -204,16 +198,11 @@ class IdentifierName { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get name() { const internal = this.#internal, cached = internal.$name; if (cached !== void 0) return cached; - return internal.$name = constructStr(internal.pos + 24, internal.ast); + return internal.$name = constructStr(internal.pos + 8, internal.ast); } toJSON() { @@ -221,7 +210,6 @@ class IdentifierName { type: 'IdentifierName', start: this.start, end: this.end, - range: this.range, name: this.name, }; } @@ -258,16 +246,11 @@ class IdentifierReference { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get name() { const internal = this.#internal, cached = internal.$name; if (cached !== void 0) return cached; - return internal.$name = constructStr(internal.pos + 24, internal.ast); + return internal.$name = constructStr(internal.pos + 8, internal.ast); } toJSON() { @@ -275,7 +258,6 @@ class IdentifierReference { type: 'IdentifierReference', start: this.start, end: this.end, - range: this.range, name: this.name, }; } @@ -312,16 +294,11 @@ class BindingIdentifier { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get name() { const internal = this.#internal, cached = internal.$name; if (cached !== void 0) return cached; - return internal.$name = constructStr(internal.pos + 24, internal.ast); + return internal.$name = constructStr(internal.pos + 8, internal.ast); } toJSON() { @@ -329,7 +306,6 @@ class BindingIdentifier { type: 'BindingIdentifier', start: this.start, end: this.end, - range: this.range, name: this.name, }; } @@ -366,16 +342,11 @@ class LabelIdentifier { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get name() { const internal = this.#internal, cached = internal.$name; if (cached !== void 0) return cached; - return internal.$name = constructStr(internal.pos + 24, internal.ast); + return internal.$name = constructStr(internal.pos + 8, internal.ast); } toJSON() { @@ -383,7 +354,6 @@ class LabelIdentifier { type: 'LabelIdentifier', start: this.start, end: this.end, - range: this.range, name: this.name, }; } @@ -420,17 +390,11 @@ class ThisExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'ThisExpression', start: this.start, end: this.end, - range: this.range, }; } @@ -466,16 +430,11 @@ class ArrayExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get elements() { const internal = this.#internal, cached = internal.$elements; if (cached !== void 0) return cached; - return internal.$elements = constructVecArrayExpressionElement(internal.pos + 24, internal.ast); + return internal.$elements = constructVecArrayExpressionElement(internal.pos + 8, internal.ast); } toJSON() { @@ -483,7 +442,6 @@ class ArrayExpression { type: 'ArrayExpression', start: this.start, end: this.end, - range: this.range, elements: this.elements, }; } @@ -617,17 +575,11 @@ class Elision { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'Elision', start: this.start, end: this.end, - range: this.range, }; } @@ -663,16 +615,11 @@ class ObjectExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get properties() { const internal = this.#internal, cached = internal.$properties; if (cached !== void 0) return cached; - return internal.$properties = constructVecObjectPropertyKind(internal.pos + 24, internal.ast); + return internal.$properties = constructVecObjectPropertyKind(internal.pos + 8, internal.ast); } toJSON() { @@ -680,7 +627,6 @@ class ObjectExpression { type: 'ObjectExpression', start: this.start, end: this.end, - range: this.range, properties: this.properties, }; } @@ -728,39 +674,34 @@ class ObjectProperty { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get kind() { const internal = this.#internal; - return constructPropertyKind(internal.pos + 56, internal.ast); + return constructPropertyKind(internal.pos + 40, internal.ast); } get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 24, internal.ast); + return constructPropertyKey(internal.pos + 8, internal.ast); } get value() { const internal = this.#internal; - return constructExpression(internal.pos + 40, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get method() { const internal = this.#internal; - return constructBool(internal.pos + 57, internal.ast); + return constructBool(internal.pos + 41, internal.ast); } get shorthand() { const internal = this.#internal; - return constructBool(internal.pos + 58, internal.ast); + return constructBool(internal.pos + 42, internal.ast); } get computed() { const internal = this.#internal; - return constructBool(internal.pos + 59, internal.ast); + return constructBool(internal.pos + 43, internal.ast); } toJSON() { @@ -768,7 +709,6 @@ class ObjectProperty { type: 'ObjectProperty', start: this.start, end: this.end, - range: this.range, kind: this.kind, key: this.key, value: this.value, @@ -920,23 +860,18 @@ class TemplateLiteral { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get quasis() { const internal = this.#internal, cached = internal.$quasis; if (cached !== void 0) return cached; - return internal.$quasis = constructVecTemplateElement(internal.pos + 24, internal.ast); + return internal.$quasis = constructVecTemplateElement(internal.pos + 8, internal.ast); } get expressions() { const internal = this.#internal, cached = internal.$expressions; if (cached !== void 0) return cached; - return internal.$expressions = constructVecExpression(internal.pos + 48, internal.ast); + return internal.$expressions = constructVecExpression(internal.pos + 32, internal.ast); } toJSON() { @@ -944,7 +879,6 @@ class TemplateLiteral { type: 'TemplateLiteral', start: this.start, end: this.end, - range: this.range, quasis: this.quasis, expressions: this.expressions, }; @@ -982,24 +916,19 @@ class TaggedTemplateExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get tag() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); } get quasi() { const internal = this.#internal; - return new TemplateLiteral(internal.pos + 48, internal.ast); + return new TemplateLiteral(internal.pos + 32, internal.ast); } toJSON() { @@ -1007,7 +936,6 @@ class TaggedTemplateExpression { type: 'TaggedTemplateExpression', start: this.start, end: this.end, - range: this.range, tag: this.tag, typeArguments: this.typeArguments, quasi: this.quasi, @@ -1046,19 +974,14 @@ class TemplateElement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get value() { const internal = this.#internal; - return new TemplateElementValue(internal.pos + 24, internal.ast); + return new TemplateElementValue(internal.pos + 8, internal.ast); } get tail() { const internal = this.#internal; - return constructBool(internal.pos + 56, internal.ast); + return constructBool(internal.pos + 40, internal.ast); } toJSON() { @@ -1066,7 +989,6 @@ class TemplateElement { type: 'TemplateElement', start: this.start, end: this.end, - range: this.range, value: this.value, tail: this.tail, }; @@ -1159,24 +1081,19 @@ class ComputedMemberExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get object() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get property() { const internal = this.#internal; - return constructExpression(internal.pos + 40, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 56, internal.ast); + return constructBool(internal.pos + 40, internal.ast); } toJSON() { @@ -1184,7 +1101,6 @@ class ComputedMemberExpression { type: 'ComputedMemberExpression', start: this.start, end: this.end, - range: this.range, object: this.object, property: this.property, optional: this.optional, @@ -1223,24 +1139,19 @@ class StaticMemberExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get object() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get property() { const internal = this.#internal; - return new IdentifierName(internal.pos + 40, internal.ast); + return new IdentifierName(internal.pos + 24, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 80, internal.ast); + return constructBool(internal.pos + 48, internal.ast); } toJSON() { @@ -1248,7 +1159,6 @@ class StaticMemberExpression { type: 'StaticMemberExpression', start: this.start, end: this.end, - range: this.range, object: this.object, property: this.property, optional: this.optional, @@ -1287,24 +1197,19 @@ class PrivateFieldExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get object() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get property() { const internal = this.#internal; - return new PrivateIdentifier(internal.pos + 40, internal.ast); + return new PrivateIdentifier(internal.pos + 24, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 80, internal.ast); + return constructBool(internal.pos + 48, internal.ast); } toJSON() { @@ -1312,7 +1217,6 @@ class PrivateFieldExpression { type: 'PrivateFieldExpression', start: this.start, end: this.end, - range: this.range, object: this.object, property: this.property, optional: this.optional, @@ -1351,31 +1255,26 @@ class CallExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get callee() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); } get arguments() { const internal = this.#internal, cached = internal.$arguments; if (cached !== void 0) return cached; - return internal.$arguments = constructVecArgument(internal.pos + 48, internal.ast); + return internal.$arguments = constructVecArgument(internal.pos + 32, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 72, internal.ast); + return constructBool(internal.pos + 56, internal.ast); } toJSON() { @@ -1383,7 +1282,6 @@ class CallExpression { type: 'CallExpression', start: this.start, end: this.end, - range: this.range, callee: this.callee, typeArguments: this.typeArguments, arguments: this.arguments, @@ -1423,26 +1321,21 @@ class NewExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get callee() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); } get arguments() { const internal = this.#internal, cached = internal.$arguments; if (cached !== void 0) return cached; - return internal.$arguments = constructVecArgument(internal.pos + 48, internal.ast); + return internal.$arguments = constructVecArgument(internal.pos + 32, internal.ast); } toJSON() { @@ -1450,7 +1343,6 @@ class NewExpression { type: 'NewExpression', start: this.start, end: this.end, - range: this.range, callee: this.callee, typeArguments: this.typeArguments, arguments: this.arguments, @@ -1489,19 +1381,14 @@ class MetaProperty { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get meta() { const internal = this.#internal; - return new IdentifierName(internal.pos + 24, internal.ast); + return new IdentifierName(internal.pos + 8, internal.ast); } get property() { const internal = this.#internal; - return new IdentifierName(internal.pos + 64, internal.ast); + return new IdentifierName(internal.pos + 32, internal.ast); } toJSON() { @@ -1509,7 +1396,6 @@ class MetaProperty { type: 'MetaProperty', start: this.start, end: this.end, - range: this.range, meta: this.meta, property: this.property, }; @@ -1547,14 +1433,9 @@ class SpreadElement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get argument() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -1562,7 +1443,6 @@ class SpreadElement { type: 'SpreadElement', start: this.start, end: this.end, - range: this.range, argument: this.argument, }; } @@ -1694,24 +1574,19 @@ class UpdateExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get operator() { const internal = this.#internal; - return constructUpdateOperator(internal.pos + 40, internal.ast); + return constructUpdateOperator(internal.pos + 24, internal.ast); } get prefix() { const internal = this.#internal; - return constructBool(internal.pos + 41, internal.ast); + return constructBool(internal.pos + 25, internal.ast); } get argument() { const internal = this.#internal; - return constructSimpleAssignmentTarget(internal.pos + 24, internal.ast); + return constructSimpleAssignmentTarget(internal.pos + 8, internal.ast); } toJSON() { @@ -1719,7 +1594,6 @@ class UpdateExpression { type: 'UpdateExpression', start: this.start, end: this.end, - range: this.range, operator: this.operator, prefix: this.prefix, argument: this.argument, @@ -1758,19 +1632,14 @@ class UnaryExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get operator() { const internal = this.#internal; - return constructUnaryOperator(internal.pos + 40, internal.ast); + return constructUnaryOperator(internal.pos + 24, internal.ast); } get argument() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -1778,7 +1647,6 @@ class UnaryExpression { type: 'UnaryExpression', start: this.start, end: this.end, - range: this.range, operator: this.operator, argument: this.argument, }; @@ -1816,24 +1684,19 @@ class BinaryExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get left() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get operator() { const internal = this.#internal; - return constructBinaryOperator(internal.pos + 56, internal.ast); + return constructBinaryOperator(internal.pos + 40, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 40, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -1841,7 +1704,6 @@ class BinaryExpression { type: 'BinaryExpression', start: this.start, end: this.end, - range: this.range, left: this.left, operator: this.operator, right: this.right, @@ -1880,19 +1742,14 @@ class PrivateInExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get left() { const internal = this.#internal; - return new PrivateIdentifier(internal.pos + 24, internal.ast); + return new PrivateIdentifier(internal.pos + 8, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 64, internal.ast); + return constructExpression(internal.pos + 32, internal.ast); } toJSON() { @@ -1900,7 +1757,6 @@ class PrivateInExpression { type: 'PrivateInExpression', start: this.start, end: this.end, - range: this.range, left: this.left, right: this.right, }; @@ -1938,24 +1794,19 @@ class LogicalExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get left() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get operator() { const internal = this.#internal; - return constructLogicalOperator(internal.pos + 56, internal.ast); + return constructLogicalOperator(internal.pos + 40, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 40, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -1963,7 +1814,6 @@ class LogicalExpression { type: 'LogicalExpression', start: this.start, end: this.end, - range: this.range, left: this.left, operator: this.operator, right: this.right, @@ -2002,24 +1852,19 @@ class ConditionalExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get test() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get consequent() { const internal = this.#internal; - return constructExpression(internal.pos + 40, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get alternate() { const internal = this.#internal; - return constructExpression(internal.pos + 56, internal.ast); + return constructExpression(internal.pos + 40, internal.ast); } toJSON() { @@ -2027,7 +1872,6 @@ class ConditionalExpression { type: 'ConditionalExpression', start: this.start, end: this.end, - range: this.range, test: this.test, consequent: this.consequent, alternate: this.alternate, @@ -2066,24 +1910,19 @@ class AssignmentExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get operator() { const internal = this.#internal; - return constructAssignmentOperator(internal.pos + 56, internal.ast); + return constructAssignmentOperator(internal.pos + 40, internal.ast); } get left() { const internal = this.#internal; - return constructAssignmentTarget(internal.pos + 24, internal.ast); + return constructAssignmentTarget(internal.pos + 8, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 40, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -2091,7 +1930,6 @@ class AssignmentExpression { type: 'AssignmentExpression', start: this.start, end: this.end, - range: this.range, operator: this.operator, left: this.left, right: this.right, @@ -2191,16 +2029,11 @@ class ArrayAssignmentTarget { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get elements() { const internal = this.#internal, cached = internal.$elements; if (cached !== void 0) return cached; - return internal.$elements = constructVecOptionAssignmentTargetMaybeDefault(internal.pos + 24, internal.ast); + return internal.$elements = constructVecOptionAssignmentTargetMaybeDefault(internal.pos + 8, internal.ast); } toJSON() { @@ -2208,7 +2041,6 @@ class ArrayAssignmentTarget { type: 'ArrayAssignmentTarget', start: this.start, end: this.end, - range: this.range, elements: this.elements, }; } @@ -2245,16 +2077,11 @@ class ObjectAssignmentTarget { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get properties() { const internal = this.#internal, cached = internal.$properties; if (cached !== void 0) return cached; - return internal.$properties = constructVecAssignmentTargetProperty(internal.pos + 24, internal.ast); + return internal.$properties = constructVecAssignmentTargetProperty(internal.pos + 8, internal.ast); } toJSON() { @@ -2262,7 +2089,6 @@ class ObjectAssignmentTarget { type: 'ObjectAssignmentTarget', start: this.start, end: this.end, - range: this.range, properties: this.properties, }; } @@ -2299,14 +2125,9 @@ class AssignmentTargetRest { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get argument() { const internal = this.#internal; - return constructAssignmentTarget(internal.pos + 24, internal.ast); + return constructAssignmentTarget(internal.pos + 8, internal.ast); } toJSON() { @@ -2314,7 +2135,6 @@ class AssignmentTargetRest { type: 'AssignmentTargetRest', start: this.start, end: this.end, - range: this.range, argument: this.argument, }; } @@ -2380,19 +2200,14 @@ class AssignmentTargetWithDefault { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get left() { const internal = this.#internal; - return constructAssignmentTarget(internal.pos + 24, internal.ast); + return constructAssignmentTarget(internal.pos + 8, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 40, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -2400,7 +2215,6 @@ class AssignmentTargetWithDefault { type: 'AssignmentTargetWithDefault', start: this.start, end: this.end, - range: this.range, left: this.left, right: this.right, }; @@ -2449,19 +2263,14 @@ class AssignmentTargetPropertyIdentifier { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get key() { const internal = this.#internal; - return new IdentifierReference(internal.pos + 24, internal.ast); + return new IdentifierReference(internal.pos + 8, internal.ast); } get value() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 72, internal.ast); + return constructOptionExpression(internal.pos + 40, internal.ast); } toJSON() { @@ -2469,7 +2278,6 @@ class AssignmentTargetPropertyIdentifier { type: 'AssignmentTargetPropertyIdentifier', start: this.start, end: this.end, - range: this.range, key: this.key, value: this.value, }; @@ -2507,24 +2315,19 @@ class AssignmentTargetPropertyProperty { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 24, internal.ast); + return constructPropertyKey(internal.pos + 8, internal.ast); } get value() { const internal = this.#internal; - return constructAssignmentTargetMaybeDefault(internal.pos + 40, internal.ast); + return constructAssignmentTargetMaybeDefault(internal.pos + 24, internal.ast); } get computed() { const internal = this.#internal; - return constructBool(internal.pos + 56, internal.ast); + return constructBool(internal.pos + 40, internal.ast); } toJSON() { @@ -2532,7 +2335,6 @@ class AssignmentTargetPropertyProperty { type: 'AssignmentTargetPropertyProperty', start: this.start, end: this.end, - range: this.range, key: this.key, value: this.value, computed: this.computed, @@ -2571,16 +2373,11 @@ class SequenceExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expressions() { const internal = this.#internal, cached = internal.$expressions; if (cached !== void 0) return cached; - return internal.$expressions = constructVecExpression(internal.pos + 24, internal.ast); + return internal.$expressions = constructVecExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -2588,7 +2385,6 @@ class SequenceExpression { type: 'SequenceExpression', start: this.start, end: this.end, - range: this.range, expressions: this.expressions, }; } @@ -2625,17 +2421,11 @@ class Super { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'Super', start: this.start, end: this.end, - range: this.range, }; } @@ -2671,14 +2461,9 @@ class AwaitExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get argument() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -2686,7 +2471,6 @@ class AwaitExpression { type: 'AwaitExpression', start: this.start, end: this.end, - range: this.range, argument: this.argument, }; } @@ -2723,14 +2507,9 @@ class ChainExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return constructChainElement(internal.pos + 24, internal.ast); + return constructChainElement(internal.pos + 8, internal.ast); } toJSON() { @@ -2738,7 +2517,6 @@ class ChainExpression { type: 'ChainExpression', start: this.start, end: this.end, - range: this.range, expression: this.expression, }; } @@ -2792,14 +2570,9 @@ class ParenthesizedExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -2807,7 +2580,6 @@ class ParenthesizedExpression { type: 'ParenthesizedExpression', start: this.start, end: this.end, - range: this.range, expression: this.expression, }; } @@ -2915,21 +2687,16 @@ class Directive { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return new StringLiteral(internal.pos + 24, internal.ast); + return new StringLiteral(internal.pos + 8, internal.ast); } get directive() { const internal = this.#internal, cached = internal.$directive; if (cached !== void 0) return cached; - return internal.$directive = constructStr(internal.pos + 88, internal.ast); + return internal.$directive = constructStr(internal.pos + 56, internal.ast); } toJSON() { @@ -2937,7 +2704,6 @@ class Directive { type: 'Directive', start: this.start, end: this.end, - range: this.range, expression: this.expression, directive: this.directive, }; @@ -2975,16 +2741,11 @@ class Hashbang { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get value() { const internal = this.#internal, cached = internal.$value; if (cached !== void 0) return cached; - return internal.$value = constructStr(internal.pos + 24, internal.ast); + return internal.$value = constructStr(internal.pos + 8, internal.ast); } toJSON() { @@ -2992,7 +2753,6 @@ class Hashbang { type: 'Hashbang', start: this.start, end: this.end, - range: this.range, value: this.value, }; } @@ -3029,16 +2789,11 @@ class BlockStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get body() { const internal = this.#internal, cached = internal.$body; if (cached !== void 0) return cached; - return internal.$body = constructVecStatement(internal.pos + 24, internal.ast); + return internal.$body = constructVecStatement(internal.pos + 8, internal.ast); } toJSON() { @@ -3046,7 +2801,6 @@ class BlockStatement { type: 'BlockStatement', start: this.start, end: this.end, - range: this.range, body: this.body, }; } @@ -3106,26 +2860,21 @@ class VariableDeclaration { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get kind() { const internal = this.#internal; - return constructVariableDeclarationKind(internal.pos + 48, internal.ast); + return constructVariableDeclarationKind(internal.pos + 32, internal.ast); } get declarations() { const internal = this.#internal, cached = internal.$declarations; if (cached !== void 0) return cached; - return internal.$declarations = constructVecVariableDeclarator(internal.pos + 24, internal.ast); + return internal.$declarations = constructVecVariableDeclarator(internal.pos + 8, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 49, internal.ast); + return constructBool(internal.pos + 33, internal.ast); } toJSON() { @@ -3133,7 +2882,6 @@ class VariableDeclaration { type: 'VariableDeclaration', start: this.start, end: this.end, - range: this.range, kind: this.kind, declarations: this.declarations, declare: this.declare, @@ -3189,24 +2937,19 @@ class VariableDeclarator { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get id() { const internal = this.#internal; - return new BindingPattern(internal.pos + 24, internal.ast); + return new BindingPattern(internal.pos + 8, internal.ast); } get init() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 56, internal.ast); + return constructOptionExpression(internal.pos + 40, internal.ast); } get definite() { const internal = this.#internal; - return constructBool(internal.pos + 73, internal.ast); + return constructBool(internal.pos + 57, internal.ast); } toJSON() { @@ -3214,7 +2957,6 @@ class VariableDeclarator { type: 'VariableDeclarator', start: this.start, end: this.end, - range: this.range, id: this.id, init: this.init, definite: this.definite, @@ -3253,17 +2995,11 @@ class EmptyStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'EmptyStatement', start: this.start, end: this.end, - range: this.range, }; } @@ -3299,14 +3035,9 @@ class ExpressionStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -3314,7 +3045,6 @@ class ExpressionStatement { type: 'ExpressionStatement', start: this.start, end: this.end, - range: this.range, expression: this.expression, }; } @@ -3351,24 +3081,19 @@ class IfStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get test() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get consequent() { const internal = this.#internal; - return constructStatement(internal.pos + 40, internal.ast); + return constructStatement(internal.pos + 24, internal.ast); } get alternate() { const internal = this.#internal; - return constructOptionStatement(internal.pos + 56, internal.ast); + return constructOptionStatement(internal.pos + 40, internal.ast); } toJSON() { @@ -3376,7 +3101,6 @@ class IfStatement { type: 'IfStatement', start: this.start, end: this.end, - range: this.range, test: this.test, consequent: this.consequent, alternate: this.alternate, @@ -3415,19 +3139,14 @@ class DoWhileStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get body() { const internal = this.#internal; - return constructStatement(internal.pos + 24, internal.ast); + return constructStatement(internal.pos + 8, internal.ast); } get test() { const internal = this.#internal; - return constructExpression(internal.pos + 40, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -3435,7 +3154,6 @@ class DoWhileStatement { type: 'DoWhileStatement', start: this.start, end: this.end, - range: this.range, body: this.body, test: this.test, }; @@ -3473,19 +3191,14 @@ class WhileStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get test() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get body() { const internal = this.#internal; - return constructStatement(internal.pos + 40, internal.ast); + return constructStatement(internal.pos + 24, internal.ast); } toJSON() { @@ -3493,7 +3206,6 @@ class WhileStatement { type: 'WhileStatement', start: this.start, end: this.end, - range: this.range, test: this.test, body: this.body, }; @@ -3531,29 +3243,24 @@ class ForStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get init() { const internal = this.#internal; - return constructOptionForStatementInit(internal.pos + 24, internal.ast); + return constructOptionForStatementInit(internal.pos + 8, internal.ast); } get test() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 40, internal.ast); + return constructOptionExpression(internal.pos + 24, internal.ast); } get update() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 56, internal.ast); + return constructOptionExpression(internal.pos + 40, internal.ast); } get body() { const internal = this.#internal; - return constructStatement(internal.pos + 72, internal.ast); + return constructStatement(internal.pos + 56, internal.ast); } toJSON() { @@ -3561,7 +3268,6 @@ class ForStatement { type: 'ForStatement', start: this.start, end: this.end, - range: this.range, init: this.init, test: this.test, update: this.update, @@ -3696,24 +3402,19 @@ class ForInStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get left() { const internal = this.#internal; - return constructForStatementLeft(internal.pos + 24, internal.ast); + return constructForStatementLeft(internal.pos + 8, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 40, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get body() { const internal = this.#internal; - return constructStatement(internal.pos + 56, internal.ast); + return constructStatement(internal.pos + 40, internal.ast); } toJSON() { @@ -3721,7 +3422,6 @@ class ForInStatement { type: 'ForInStatement', start: this.start, end: this.end, - range: this.range, left: this.left, right: this.right, body: this.body, @@ -3789,29 +3489,24 @@ class ForOfStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get await() { const internal = this.#internal; - return constructBool(internal.pos + 76, internal.ast); + return constructBool(internal.pos + 60, internal.ast); } get left() { const internal = this.#internal; - return constructForStatementLeft(internal.pos + 24, internal.ast); + return constructForStatementLeft(internal.pos + 8, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 40, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } get body() { const internal = this.#internal; - return constructStatement(internal.pos + 56, internal.ast); + return constructStatement(internal.pos + 40, internal.ast); } toJSON() { @@ -3819,7 +3514,6 @@ class ForOfStatement { type: 'ForOfStatement', start: this.start, end: this.end, - range: this.range, await: this.await, left: this.left, right: this.right, @@ -3859,14 +3553,9 @@ class ContinueStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get label() { const internal = this.#internal; - return constructOptionLabelIdentifier(internal.pos + 24, internal.ast); + return constructOptionLabelIdentifier(internal.pos + 8, internal.ast); } toJSON() { @@ -3874,7 +3563,6 @@ class ContinueStatement { type: 'ContinueStatement', start: this.start, end: this.end, - range: this.range, label: this.label, }; } @@ -3911,14 +3599,9 @@ class BreakStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get label() { const internal = this.#internal; - return constructOptionLabelIdentifier(internal.pos + 24, internal.ast); + return constructOptionLabelIdentifier(internal.pos + 8, internal.ast); } toJSON() { @@ -3926,7 +3609,6 @@ class BreakStatement { type: 'BreakStatement', start: this.start, end: this.end, - range: this.range, label: this.label, }; } @@ -3963,14 +3645,9 @@ class ReturnStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get argument() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 24, internal.ast); + return constructOptionExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -3978,7 +3655,6 @@ class ReturnStatement { type: 'ReturnStatement', start: this.start, end: this.end, - range: this.range, argument: this.argument, }; } @@ -4015,19 +3691,14 @@ class WithStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get object() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get body() { const internal = this.#internal; - return constructStatement(internal.pos + 40, internal.ast); + return constructStatement(internal.pos + 24, internal.ast); } toJSON() { @@ -4035,7 +3706,6 @@ class WithStatement { type: 'WithStatement', start: this.start, end: this.end, - range: this.range, object: this.object, body: this.body, }; @@ -4073,21 +3743,16 @@ class SwitchStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get discriminant() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get cases() { const internal = this.#internal, cached = internal.$cases; if (cached !== void 0) return cached; - return internal.$cases = constructVecSwitchCase(internal.pos + 40, internal.ast); + return internal.$cases = constructVecSwitchCase(internal.pos + 24, internal.ast); } toJSON() { @@ -4095,7 +3760,6 @@ class SwitchStatement { type: 'SwitchStatement', start: this.start, end: this.end, - range: this.range, discriminant: this.discriminant, cases: this.cases, }; @@ -4133,21 +3797,16 @@ class SwitchCase { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get test() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 24, internal.ast); + return constructOptionExpression(internal.pos + 8, internal.ast); } get consequent() { const internal = this.#internal, cached = internal.$consequent; if (cached !== void 0) return cached; - return internal.$consequent = constructVecStatement(internal.pos + 40, internal.ast); + return internal.$consequent = constructVecStatement(internal.pos + 24, internal.ast); } toJSON() { @@ -4155,7 +3814,6 @@ class SwitchCase { type: 'SwitchCase', start: this.start, end: this.end, - range: this.range, test: this.test, consequent: this.consequent, }; @@ -4193,19 +3851,14 @@ class LabeledStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get label() { const internal = this.#internal; - return new LabelIdentifier(internal.pos + 24, internal.ast); + return new LabelIdentifier(internal.pos + 8, internal.ast); } get body() { const internal = this.#internal; - return constructStatement(internal.pos + 64, internal.ast); + return constructStatement(internal.pos + 32, internal.ast); } toJSON() { @@ -4213,7 +3866,6 @@ class LabeledStatement { type: 'LabeledStatement', start: this.start, end: this.end, - range: this.range, label: this.label, body: this.body, }; @@ -4251,14 +3903,9 @@ class ThrowStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get argument() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -4266,7 +3913,6 @@ class ThrowStatement { type: 'ThrowStatement', start: this.start, end: this.end, - range: this.range, argument: this.argument, }; } @@ -4303,24 +3949,19 @@ class TryStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get block() { const internal = this.#internal; - return constructBoxBlockStatement(internal.pos + 24, internal.ast); + return constructBoxBlockStatement(internal.pos + 8, internal.ast); } get handler() { const internal = this.#internal; - return constructOptionBoxCatchClause(internal.pos + 32, internal.ast); + return constructOptionBoxCatchClause(internal.pos + 16, internal.ast); } get finalizer() { const internal = this.#internal; - return constructOptionBoxBlockStatement(internal.pos + 40, internal.ast); + return constructOptionBoxBlockStatement(internal.pos + 24, internal.ast); } toJSON() { @@ -4328,7 +3969,6 @@ class TryStatement { type: 'TryStatement', start: this.start, end: this.end, - range: this.range, block: this.block, handler: this.handler, finalizer: this.finalizer, @@ -4367,19 +4007,14 @@ class CatchClause { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get param() { const internal = this.#internal; - return constructOptionCatchParameter(internal.pos + 24, internal.ast); + return constructOptionCatchParameter(internal.pos + 8, internal.ast); } get body() { const internal = this.#internal; - return constructBoxBlockStatement(internal.pos + 80, internal.ast); + return constructBoxBlockStatement(internal.pos + 48, internal.ast); } toJSON() { @@ -4387,7 +4022,6 @@ class CatchClause { type: 'CatchClause', start: this.start, end: this.end, - range: this.range, param: this.param, body: this.body, }; @@ -4416,7 +4050,7 @@ class CatchParameter { get pattern() { const internal = this.#internal; - return new BindingPattern(internal.pos + 24, internal.ast); + return new BindingPattern(internal.pos + 8, internal.ast); } toJSON() { @@ -4457,17 +4091,11 @@ class DebuggerStatement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'DebuggerStatement', start: this.start, end: this.end, - range: this.range, }; } @@ -4562,19 +4190,14 @@ class AssignmentPattern { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get left() { const internal = this.#internal; - return new BindingPattern(internal.pos + 24, internal.ast); + return new BindingPattern(internal.pos + 8, internal.ast); } get right() { const internal = this.#internal; - return constructExpression(internal.pos + 56, internal.ast); + return constructExpression(internal.pos + 40, internal.ast); } toJSON() { @@ -4582,7 +4205,6 @@ class AssignmentPattern { type: 'AssignmentPattern', start: this.start, end: this.end, - range: this.range, left: this.left, right: this.right, }; @@ -4620,16 +4242,11 @@ class ObjectPattern { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get properties() { const internal = this.#internal, cached = internal.$properties; if (cached !== void 0) return cached; - return internal.$properties = constructVecBindingProperty(internal.pos + 24, internal.ast); + return internal.$properties = constructVecBindingProperty(internal.pos + 8, internal.ast); } toJSON() { @@ -4637,7 +4254,6 @@ class ObjectPattern { type: 'ObjectPattern', start: this.start, end: this.end, - range: this.range, properties: this.properties, }; } @@ -4674,29 +4290,24 @@ class BindingProperty { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 24, internal.ast); + return constructPropertyKey(internal.pos + 8, internal.ast); } get value() { const internal = this.#internal; - return new BindingPattern(internal.pos + 40, internal.ast); + return new BindingPattern(internal.pos + 24, internal.ast); } get shorthand() { const internal = this.#internal; - return constructBool(internal.pos + 72, internal.ast); + return constructBool(internal.pos + 56, internal.ast); } get computed() { const internal = this.#internal; - return constructBool(internal.pos + 73, internal.ast); + return constructBool(internal.pos + 57, internal.ast); } toJSON() { @@ -4704,7 +4315,6 @@ class BindingProperty { type: 'BindingProperty', start: this.start, end: this.end, - range: this.range, key: this.key, value: this.value, shorthand: this.shorthand, @@ -4744,16 +4354,11 @@ class ArrayPattern { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get elements() { const internal = this.#internal, cached = internal.$elements; if (cached !== void 0) return cached; - return internal.$elements = constructVecOptionBindingPattern(internal.pos + 24, internal.ast); + return internal.$elements = constructVecOptionBindingPattern(internal.pos + 8, internal.ast); } toJSON() { @@ -4761,7 +4366,6 @@ class ArrayPattern { type: 'ArrayPattern', start: this.start, end: this.end, - range: this.range, elements: this.elements, }; } @@ -4798,14 +4402,9 @@ class BindingRestElement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get argument() { const internal = this.#internal; - return new BindingPattern(internal.pos + 24, internal.ast); + return new BindingPattern(internal.pos + 8, internal.ast); } toJSON() { @@ -4813,7 +4412,6 @@ class BindingRestElement { type: 'BindingRestElement', start: this.start, end: this.end, - range: this.range, argument: this.argument, }; } @@ -4849,61 +4447,55 @@ class Function { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get type() { const internal = this.#internal; - return constructFunctionType(internal.pos + 116, internal.ast); + return constructFunctionType(internal.pos + 84, internal.ast); } get id() { const internal = this.#internal; - return constructOptionBindingIdentifier(internal.pos + 24, internal.ast); + return constructOptionBindingIdentifier(internal.pos + 8, internal.ast); } get generator() { const internal = this.#internal; - return constructBool(internal.pos + 117, internal.ast); + return constructBool(internal.pos + 85, internal.ast); } get async() { const internal = this.#internal; - return constructBool(internal.pos + 118, internal.ast); + return constructBool(internal.pos + 86, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 119, internal.ast); + return constructBool(internal.pos + 87, internal.ast); } get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 72, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 40, internal.ast); } get params() { const internal = this.#internal; - return constructBoxFormalParameters(internal.pos + 88, internal.ast); + return constructBoxFormalParameters(internal.pos + 56, internal.ast); } get returnType() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 96, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 64, internal.ast); } get body() { const internal = this.#internal; - return constructOptionBoxFunctionBody(internal.pos + 104, internal.ast); + return constructOptionBoxFunctionBody(internal.pos + 72, internal.ast); } toJSON() { return { start: this.start, end: this.end, - range: this.range, type: this.type, id: this.id, generator: this.generator, @@ -4963,21 +4555,16 @@ class FormalParameters { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get kind() { const internal = this.#internal; - return constructFormalParameterKind(internal.pos + 56, internal.ast); + return constructFormalParameterKind(internal.pos + 40, internal.ast); } get items() { const internal = this.#internal, cached = internal.$items; if (cached !== void 0) return cached; - return internal.$items = constructVecFormalParameter(internal.pos + 24, internal.ast); + return internal.$items = constructVecFormalParameter(internal.pos + 8, internal.ast); } toJSON() { @@ -4985,7 +4572,6 @@ class FormalParameters { type: 'FormalParameters', start: this.start, end: this.end, - range: this.range, kind: this.kind, items: this.items, }; @@ -5016,12 +4602,12 @@ class FormalParameter { const internal = this.#internal, cached = internal.$decorators; if (cached !== void 0) return cached; - return internal.$decorators = constructVecDecorator(internal.pos + 24, internal.ast); + return internal.$decorators = constructVecDecorator(internal.pos + 8, internal.ast); } get pattern() { const internal = this.#internal; - return new BindingPattern(internal.pos + 48, internal.ast); + return new BindingPattern(internal.pos + 32, internal.ast); } toJSON() { @@ -5078,16 +4664,11 @@ class FunctionBody { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get body() { const internal = this.#internal, cached = internal.$body; if (cached !== void 0) return cached; - return internal.$body = constructVecStatement(internal.pos + 48, internal.ast); + return internal.$body = constructVecStatement(internal.pos + 32, internal.ast); } toJSON() { @@ -5095,7 +4676,6 @@ class FunctionBody { type: 'FunctionBody', start: this.start, end: this.end, - range: this.range, body: this.body, }; } @@ -5132,39 +4712,34 @@ class ArrowFunctionExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return constructBool(internal.pos + 60, internal.ast); + return constructBool(internal.pos + 44, internal.ast); } get async() { const internal = this.#internal; - return constructBool(internal.pos + 61, internal.ast); + return constructBool(internal.pos + 45, internal.ast); } get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 8, internal.ast); } get params() { const internal = this.#internal; - return constructBoxFormalParameters(internal.pos + 32, internal.ast); + return constructBoxFormalParameters(internal.pos + 16, internal.ast); } get returnType() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 24, internal.ast); } get body() { const internal = this.#internal; - return constructBoxFunctionBody(internal.pos + 48, internal.ast); + return constructBoxFunctionBody(internal.pos + 32, internal.ast); } toJSON() { @@ -5172,7 +4747,6 @@ class ArrowFunctionExpression { type: 'ArrowFunctionExpression', start: this.start, end: this.end, - range: this.range, expression: this.expression, async: this.async, typeParameters: this.typeParameters, @@ -5214,19 +4788,14 @@ class YieldExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get delegate() { const internal = this.#internal; - return constructBool(internal.pos + 40, internal.ast); + return constructBool(internal.pos + 24, internal.ast); } get argument() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 24, internal.ast); + return constructOptionExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -5234,7 +4803,6 @@ class YieldExpression { type: 'YieldExpression', start: this.start, end: this.end, - range: this.range, delegate: this.delegate, argument: this.argument, }; @@ -5271,70 +4839,64 @@ class Class { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get type() { const internal = this.#internal; - return constructClassType(internal.pos + 164, internal.ast); + return constructClassType(internal.pos + 132, internal.ast); } get decorators() { const internal = this.#internal, cached = internal.$decorators; if (cached !== void 0) return cached; - return internal.$decorators = constructVecDecorator(internal.pos + 24, internal.ast); + return internal.$decorators = constructVecDecorator(internal.pos + 8, internal.ast); } get id() { const internal = this.#internal; - return constructOptionBindingIdentifier(internal.pos + 48, internal.ast); + return constructOptionBindingIdentifier(internal.pos + 32, internal.ast); } get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 96, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 64, internal.ast); } get superClass() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 104, internal.ast); + return constructOptionExpression(internal.pos + 72, internal.ast); } get superTypeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 120, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 88, internal.ast); } get implements() { const internal = this.#internal, cached = internal.$implements; if (cached !== void 0) return cached; - return internal.$implements = constructVecTSClassImplements(internal.pos + 128, internal.ast); + return internal.$implements = constructVecTSClassImplements(internal.pos + 96, internal.ast); } get body() { const internal = this.#internal; - return constructBoxClassBody(internal.pos + 152, internal.ast); + return constructBoxClassBody(internal.pos + 120, internal.ast); } get abstract() { const internal = this.#internal; - return constructBool(internal.pos + 165, internal.ast); + return constructBool(internal.pos + 133, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 166, internal.ast); + return constructBool(internal.pos + 134, internal.ast); } toJSON() { return { start: this.start, end: this.end, - range: this.range, type: this.type, decorators: this.decorators, id: this.id, @@ -5391,16 +4953,11 @@ class ClassBody { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get body() { const internal = this.#internal, cached = internal.$body; if (cached !== void 0) return cached; - return internal.$body = constructVecClassElement(internal.pos + 24, internal.ast); + return internal.$body = constructVecClassElement(internal.pos + 8, internal.ast); } toJSON() { @@ -5408,7 +4965,6 @@ class ClassBody { type: 'ClassBody', start: this.start, end: this.end, - range: this.range, body: this.body, }; } @@ -5461,68 +5017,62 @@ class MethodDefinition { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get type() { const internal = this.#internal; - return constructMethodDefinitionType(internal.pos + 72, internal.ast); + return constructMethodDefinitionType(internal.pos + 56, internal.ast); } get decorators() { const internal = this.#internal, cached = internal.$decorators; if (cached !== void 0) return cached; - return internal.$decorators = constructVecDecorator(internal.pos + 24, internal.ast); + return internal.$decorators = constructVecDecorator(internal.pos + 8, internal.ast); } get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 48, internal.ast); + return constructPropertyKey(internal.pos + 32, internal.ast); } get value() { const internal = this.#internal; - return constructBoxFunction(internal.pos + 64, internal.ast); + return constructBoxFunction(internal.pos + 48, internal.ast); } get kind() { const internal = this.#internal; - return constructMethodDefinitionKind(internal.pos + 73, internal.ast); + return constructMethodDefinitionKind(internal.pos + 57, internal.ast); } get computed() { const internal = this.#internal; - return constructBool(internal.pos + 74, internal.ast); + return constructBool(internal.pos + 58, internal.ast); } get static() { const internal = this.#internal; - return constructBool(internal.pos + 75, internal.ast); + return constructBool(internal.pos + 59, internal.ast); } get override() { const internal = this.#internal; - return constructBool(internal.pos + 76, internal.ast); + return constructBool(internal.pos + 60, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 77, internal.ast); + return constructBool(internal.pos + 61, internal.ast); } get accessibility() { const internal = this.#internal; - return constructOptionTSAccessibility(internal.pos + 78, internal.ast); + return constructOptionTSAccessibility(internal.pos + 62, internal.ast); } toJSON() { return { start: this.start, end: this.end, - range: this.range, type: this.type, decorators: this.decorators, key: this.key, @@ -5578,83 +5128,77 @@ class PropertyDefinition { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get type() { const internal = this.#internal; - return constructPropertyDefinitionType(internal.pos + 88, internal.ast); + return constructPropertyDefinitionType(internal.pos + 72, internal.ast); } get decorators() { const internal = this.#internal, cached = internal.$decorators; if (cached !== void 0) return cached; - return internal.$decorators = constructVecDecorator(internal.pos + 24, internal.ast); + return internal.$decorators = constructVecDecorator(internal.pos + 8, internal.ast); } get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 48, internal.ast); + return constructPropertyKey(internal.pos + 32, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 64, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 48, internal.ast); } get value() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 72, internal.ast); + return constructOptionExpression(internal.pos + 56, internal.ast); } get computed() { const internal = this.#internal; - return constructBool(internal.pos + 89, internal.ast); + return constructBool(internal.pos + 73, internal.ast); } get static() { const internal = this.#internal; - return constructBool(internal.pos + 90, internal.ast); + return constructBool(internal.pos + 74, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 91, internal.ast); + return constructBool(internal.pos + 75, internal.ast); } get override() { const internal = this.#internal; - return constructBool(internal.pos + 92, internal.ast); + return constructBool(internal.pos + 76, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 93, internal.ast); + return constructBool(internal.pos + 77, internal.ast); } get definite() { const internal = this.#internal; - return constructBool(internal.pos + 94, internal.ast); + return constructBool(internal.pos + 78, internal.ast); } get readonly() { const internal = this.#internal; - return constructBool(internal.pos + 95, internal.ast); + return constructBool(internal.pos + 79, internal.ast); } get accessibility() { const internal = this.#internal; - return constructOptionTSAccessibility(internal.pos + 96, internal.ast); + return constructOptionTSAccessibility(internal.pos + 80, internal.ast); } toJSON() { return { start: this.start, end: this.end, - range: this.range, type: this.type, decorators: this.decorators, key: this.key, @@ -5729,16 +5273,11 @@ class PrivateIdentifier { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get name() { const internal = this.#internal, cached = internal.$name; if (cached !== void 0) return cached; - return internal.$name = constructStr(internal.pos + 24, internal.ast); + return internal.$name = constructStr(internal.pos + 8, internal.ast); } toJSON() { @@ -5746,7 +5285,6 @@ class PrivateIdentifier { type: 'PrivateIdentifier', start: this.start, end: this.end, - range: this.range, name: this.name, }; } @@ -5783,16 +5321,11 @@ class StaticBlock { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get body() { const internal = this.#internal, cached = internal.$body; if (cached !== void 0) return cached; - return internal.$body = constructVecStatement(internal.pos + 24, internal.ast); + return internal.$body = constructVecStatement(internal.pos + 8, internal.ast); } toJSON() { @@ -5800,7 +5333,6 @@ class StaticBlock { type: 'StaticBlock', start: this.start, end: this.end, - range: this.range, body: this.body, }; } @@ -5866,68 +5398,62 @@ class AccessorProperty { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get type() { const internal = this.#internal; - return constructAccessorPropertyType(internal.pos + 88, internal.ast); + return constructAccessorPropertyType(internal.pos + 72, internal.ast); } get decorators() { const internal = this.#internal, cached = internal.$decorators; if (cached !== void 0) return cached; - return internal.$decorators = constructVecDecorator(internal.pos + 24, internal.ast); + return internal.$decorators = constructVecDecorator(internal.pos + 8, internal.ast); } get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 48, internal.ast); + return constructPropertyKey(internal.pos + 32, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 64, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 48, internal.ast); } get value() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 72, internal.ast); + return constructOptionExpression(internal.pos + 56, internal.ast); } get computed() { const internal = this.#internal; - return constructBool(internal.pos + 89, internal.ast); + return constructBool(internal.pos + 73, internal.ast); } get static() { const internal = this.#internal; - return constructBool(internal.pos + 90, internal.ast); + return constructBool(internal.pos + 74, internal.ast); } get override() { const internal = this.#internal; - return constructBool(internal.pos + 91, internal.ast); + return constructBool(internal.pos + 75, internal.ast); } get definite() { const internal = this.#internal; - return constructBool(internal.pos + 92, internal.ast); + return constructBool(internal.pos + 76, internal.ast); } get accessibility() { const internal = this.#internal; - return constructOptionTSAccessibility(internal.pos + 93, internal.ast); + return constructOptionTSAccessibility(internal.pos + 77, internal.ast); } toJSON() { return { start: this.start, end: this.end, - range: this.range, type: this.type, decorators: this.decorators, key: this.key, @@ -5973,24 +5499,19 @@ class ImportExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get source() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get options() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 40, internal.ast); + return constructOptionExpression(internal.pos + 24, internal.ast); } get phase() { const internal = this.#internal; - return constructOptionImportPhase(internal.pos + 56, internal.ast); + return constructOptionImportPhase(internal.pos + 40, internal.ast); } toJSON() { @@ -5998,7 +5519,6 @@ class ImportExpression { type: 'ImportExpression', start: this.start, end: this.end, - range: this.range, source: this.source, options: this.options, phase: this.phase, @@ -6037,36 +5557,31 @@ class ImportDeclaration { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get specifiers() { const internal = this.#internal, cached = internal.$specifiers; if (cached !== void 0) return cached; - return internal.$specifiers = constructOptionVecImportDeclarationSpecifier(internal.pos + 24, internal.ast); + return internal.$specifiers = constructOptionVecImportDeclarationSpecifier(internal.pos + 8, internal.ast); } get source() { const internal = this.#internal; - return new StringLiteral(internal.pos + 48, internal.ast); + return new StringLiteral(internal.pos + 32, internal.ast); } get phase() { const internal = this.#internal; - return constructOptionImportPhase(internal.pos + 120, internal.ast); + return constructOptionImportPhase(internal.pos + 88, internal.ast); } get attributes() { const internal = this.#internal; - return constructOptionBoxWithClause(internal.pos + 112, internal.ast); + return constructOptionBoxWithClause(internal.pos + 80, internal.ast); } get importKind() { const internal = this.#internal; - return constructImportOrExportKind(internal.pos + 121, internal.ast); + return constructImportOrExportKind(internal.pos + 89, internal.ast); } toJSON() { @@ -6074,7 +5589,6 @@ class ImportDeclaration { type: 'ImportDeclaration', start: this.start, end: this.end, - range: this.range, specifiers: this.specifiers, source: this.source, phase: this.phase, @@ -6139,24 +5653,19 @@ class ImportSpecifier { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get imported() { const internal = this.#internal; - return constructModuleExportName(internal.pos + 24, internal.ast); + return constructModuleExportName(internal.pos + 8, internal.ast); } get local() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 96, internal.ast); + return new BindingIdentifier(internal.pos + 64, internal.ast); } get importKind() { const internal = this.#internal; - return constructImportOrExportKind(internal.pos + 144, internal.ast); + return constructImportOrExportKind(internal.pos + 96, internal.ast); } toJSON() { @@ -6164,7 +5673,6 @@ class ImportSpecifier { type: 'ImportSpecifier', start: this.start, end: this.end, - range: this.range, imported: this.imported, local: this.local, importKind: this.importKind, @@ -6203,14 +5711,9 @@ class ImportDefaultSpecifier { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get local() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 24, internal.ast); + return new BindingIdentifier(internal.pos + 8, internal.ast); } toJSON() { @@ -6218,7 +5721,6 @@ class ImportDefaultSpecifier { type: 'ImportDefaultSpecifier', start: this.start, end: this.end, - range: this.range, local: this.local, }; } @@ -6255,14 +5757,9 @@ class ImportNamespaceSpecifier { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get local() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 24, internal.ast); + return new BindingIdentifier(internal.pos + 8, internal.ast); } toJSON() { @@ -6270,7 +5767,6 @@ class ImportNamespaceSpecifier { type: 'ImportNamespaceSpecifier', start: this.start, end: this.end, - range: this.range, local: this.local, }; } @@ -6300,7 +5796,7 @@ class WithClause { const internal = this.#internal, cached = internal.$attributes; if (cached !== void 0) return cached; - return internal.$attributes = constructVecImportAttribute(internal.pos + 64, internal.ast); + return internal.$attributes = constructVecImportAttribute(internal.pos + 32, internal.ast); } toJSON() { @@ -6341,19 +5837,14 @@ class ImportAttribute { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get key() { const internal = this.#internal; - return constructImportAttributeKey(internal.pos + 24, internal.ast); + return constructImportAttributeKey(internal.pos + 8, internal.ast); } get value() { const internal = this.#internal; - return new StringLiteral(internal.pos + 96, internal.ast); + return new StringLiteral(internal.pos + 64, internal.ast); } toJSON() { @@ -6361,7 +5852,6 @@ class ImportAttribute { type: 'ImportAttribute', start: this.start, end: this.end, - range: this.range, key: this.key, value: this.value, }; @@ -6410,36 +5900,31 @@ class ExportNamedDeclaration { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get declaration() { const internal = this.#internal; - return constructOptionDeclaration(internal.pos + 24, internal.ast); + return constructOptionDeclaration(internal.pos + 8, internal.ast); } get specifiers() { const internal = this.#internal, cached = internal.$specifiers; if (cached !== void 0) return cached; - return internal.$specifiers = constructVecExportSpecifier(internal.pos + 40, internal.ast); + return internal.$specifiers = constructVecExportSpecifier(internal.pos + 24, internal.ast); } get source() { const internal = this.#internal; - return constructOptionStringLiteral(internal.pos + 64, internal.ast); + return constructOptionStringLiteral(internal.pos + 48, internal.ast); } get exportKind() { const internal = this.#internal; - return constructImportOrExportKind(internal.pos + 136, internal.ast); + return constructImportOrExportKind(internal.pos + 104, internal.ast); } get attributes() { const internal = this.#internal; - return constructOptionBoxWithClause(internal.pos + 128, internal.ast); + return constructOptionBoxWithClause(internal.pos + 96, internal.ast); } toJSON() { @@ -6447,7 +5932,6 @@ class ExportNamedDeclaration { type: 'ExportNamedDeclaration', start: this.start, end: this.end, - range: this.range, declaration: this.declaration, specifiers: this.specifiers, source: this.source, @@ -6488,14 +5972,9 @@ class ExportDefaultDeclaration { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get declaration() { const internal = this.#internal; - return constructExportDefaultDeclarationKind(internal.pos + 96, internal.ast); + return constructExportDefaultDeclarationKind(internal.pos + 64, internal.ast); } toJSON() { @@ -6503,7 +5982,6 @@ class ExportDefaultDeclaration { type: 'ExportDefaultDeclaration', start: this.start, end: this.end, - range: this.range, declaration: this.declaration, }; } @@ -6540,29 +6018,24 @@ class ExportAllDeclaration { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get exported() { const internal = this.#internal; - return constructOptionModuleExportName(internal.pos + 24, internal.ast); + return constructOptionModuleExportName(internal.pos + 8, internal.ast); } get source() { const internal = this.#internal; - return new StringLiteral(internal.pos + 96, internal.ast); + return new StringLiteral(internal.pos + 64, internal.ast); } get attributes() { const internal = this.#internal; - return constructOptionBoxWithClause(internal.pos + 160, internal.ast); + return constructOptionBoxWithClause(internal.pos + 112, internal.ast); } get exportKind() { const internal = this.#internal; - return constructImportOrExportKind(internal.pos + 168, internal.ast); + return constructImportOrExportKind(internal.pos + 120, internal.ast); } toJSON() { @@ -6570,7 +6043,6 @@ class ExportAllDeclaration { type: 'ExportAllDeclaration', start: this.start, end: this.end, - range: this.range, exported: this.exported, source: this.source, attributes: this.attributes, @@ -6610,24 +6082,19 @@ class ExportSpecifier { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get local() { const internal = this.#internal; - return constructModuleExportName(internal.pos + 24, internal.ast); + return constructModuleExportName(internal.pos + 8, internal.ast); } get exported() { const internal = this.#internal; - return constructModuleExportName(internal.pos + 96, internal.ast); + return constructModuleExportName(internal.pos + 64, internal.ast); } get exportKind() { const internal = this.#internal; - return constructImportOrExportKind(internal.pos + 168, internal.ast); + return constructImportOrExportKind(internal.pos + 120, internal.ast); } toJSON() { @@ -6635,7 +6102,6 @@ class ExportSpecifier { type: 'ExportSpecifier', start: this.start, end: this.end, - range: this.range, local: this.local, exported: this.exported, exportKind: this.exportKind, @@ -6786,21 +6252,16 @@ class V8IntrinsicExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get name() { const internal = this.#internal; - return new IdentifierName(internal.pos + 24, internal.ast); + return new IdentifierName(internal.pos + 8, internal.ast); } get arguments() { const internal = this.#internal, cached = internal.$arguments; if (cached !== void 0) return cached; - return internal.$arguments = constructVecArgument(internal.pos + 64, internal.ast); + return internal.$arguments = constructVecArgument(internal.pos + 32, internal.ast); } toJSON() { @@ -6808,7 +6269,6 @@ class V8IntrinsicExpression { type: 'V8IntrinsicExpression', start: this.start, end: this.end, - range: this.range, name: this.name, arguments: this.arguments, }; @@ -6846,14 +6306,9 @@ class BooleanLiteral { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get value() { const internal = this.#internal; - return constructBool(internal.pos + 24, internal.ast); + return constructBool(internal.pos + 8, internal.ast); } toJSON() { @@ -6861,7 +6316,6 @@ class BooleanLiteral { type: 'BooleanLiteral', start: this.start, end: this.end, - range: this.range, value: this.value, }; } @@ -6898,17 +6352,11 @@ class NullLiteral { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'NullLiteral', start: this.start, end: this.end, - range: this.range, }; } @@ -6944,21 +6392,16 @@ class NumericLiteral { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get value() { const internal = this.#internal; - return constructF64(internal.pos + 24, internal.ast); + return constructF64(internal.pos + 8, internal.ast); } get raw() { const internal = this.#internal, cached = internal.$raw; if (cached !== void 0) return cached; - return internal.$raw = constructOptionStr(internal.pos + 32, internal.ast); + return internal.$raw = constructOptionStr(internal.pos + 16, internal.ast); } toJSON() { @@ -6966,7 +6409,6 @@ class NumericLiteral { type: 'NumericLiteral', start: this.start, end: this.end, - range: this.range, value: this.value, raw: this.raw, }; @@ -7004,23 +6446,18 @@ class StringLiteral { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get value() { const internal = this.#internal, cached = internal.$value; if (cached !== void 0) return cached; - return internal.$value = constructStr(internal.pos + 24, internal.ast); + return internal.$value = constructStr(internal.pos + 8, internal.ast); } get raw() { const internal = this.#internal, cached = internal.$raw; if (cached !== void 0) return cached; - return internal.$raw = constructOptionStr(internal.pos + 40, internal.ast); + return internal.$raw = constructOptionStr(internal.pos + 24, internal.ast); } toJSON() { @@ -7028,7 +6465,6 @@ class StringLiteral { type: 'StringLiteral', start: this.start, end: this.end, - range: this.range, value: this.value, raw: this.raw, }; @@ -7066,23 +6502,18 @@ class BigIntLiteral { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get value() { const internal = this.#internal, cached = internal.$value; if (cached !== void 0) return cached; - return internal.$value = constructStr(internal.pos + 24, internal.ast); + return internal.$value = constructStr(internal.pos + 8, internal.ast); } get raw() { const internal = this.#internal, cached = internal.$raw; if (cached !== void 0) return cached; - return internal.$raw = constructOptionStr(internal.pos + 40, internal.ast); + return internal.$raw = constructOptionStr(internal.pos + 24, internal.ast); } toJSON() { @@ -7090,7 +6521,6 @@ class BigIntLiteral { type: 'BigIntLiteral', start: this.start, end: this.end, - range: this.range, value: this.value, raw: this.raw, }; @@ -7128,21 +6558,16 @@ class RegExpLiteral { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get regex() { const internal = this.#internal; - return new RegExp(internal.pos + 24, internal.ast); + return new RegExp(internal.pos + 8, internal.ast); } get raw() { const internal = this.#internal, cached = internal.$raw; if (cached !== void 0) return cached; - return internal.$raw = constructOptionStr(internal.pos + 56, internal.ast); + return internal.$raw = constructOptionStr(internal.pos + 40, internal.ast); } toJSON() { @@ -7150,7 +6575,6 @@ class RegExpLiteral { type: 'RegExpLiteral', start: this.start, end: this.end, - range: this.range, regex: this.regex, raw: this.raw, }; @@ -7286,26 +6710,21 @@ class JSXElement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get openingElement() { const internal = this.#internal; - return constructBoxJSXOpeningElement(internal.pos + 24, internal.ast); + return constructBoxJSXOpeningElement(internal.pos + 8, internal.ast); } get children() { const internal = this.#internal, cached = internal.$children; if (cached !== void 0) return cached; - return internal.$children = constructVecJSXChild(internal.pos + 32, internal.ast); + return internal.$children = constructVecJSXChild(internal.pos + 16, internal.ast); } get closingElement() { const internal = this.#internal; - return constructOptionBoxJSXClosingElement(internal.pos + 56, internal.ast); + return constructOptionBoxJSXClosingElement(internal.pos + 40, internal.ast); } toJSON() { @@ -7313,7 +6732,6 @@ class JSXElement { type: 'JSXElement', start: this.start, end: this.end, - range: this.range, openingElement: this.openingElement, children: this.children, closingElement: this.closingElement, @@ -7352,26 +6770,21 @@ class JSXOpeningElement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get name() { const internal = this.#internal; - return constructJSXElementName(internal.pos + 24, internal.ast); + return constructJSXElementName(internal.pos + 8, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); } get attributes() { const internal = this.#internal, cached = internal.$attributes; if (cached !== void 0) return cached; - return internal.$attributes = constructVecJSXAttributeItem(internal.pos + 48, internal.ast); + return internal.$attributes = constructVecJSXAttributeItem(internal.pos + 32, internal.ast); } toJSON() { @@ -7379,7 +6792,6 @@ class JSXOpeningElement { type: 'JSXOpeningElement', start: this.start, end: this.end, - range: this.range, name: this.name, typeArguments: this.typeArguments, attributes: this.attributes, @@ -7418,14 +6830,9 @@ class JSXClosingElement { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get name() { const internal = this.#internal; - return constructJSXElementName(internal.pos + 24, internal.ast); + return constructJSXElementName(internal.pos + 8, internal.ast); } toJSON() { @@ -7433,7 +6840,6 @@ class JSXClosingElement { type: 'JSXClosingElement', start: this.start, end: this.end, - range: this.range, name: this.name, }; } @@ -7470,26 +6876,21 @@ class JSXFragment { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get openingFragment() { const internal = this.#internal; - return new JSXOpeningFragment(internal.pos + 24, internal.ast); + return new JSXOpeningFragment(internal.pos + 8, internal.ast); } get children() { const internal = this.#internal, cached = internal.$children; if (cached !== void 0) return cached; - return internal.$children = constructVecJSXChild(internal.pos + 48, internal.ast); + return internal.$children = constructVecJSXChild(internal.pos + 16, internal.ast); } get closingFragment() { const internal = this.#internal; - return new JSXClosingFragment(internal.pos + 72, internal.ast); + return new JSXClosingFragment(internal.pos + 40, internal.ast); } toJSON() { @@ -7497,7 +6898,6 @@ class JSXFragment { type: 'JSXFragment', start: this.start, end: this.end, - range: this.range, openingFragment: this.openingFragment, children: this.children, closingFragment: this.closingFragment, @@ -7536,17 +6936,11 @@ class JSXOpeningFragment { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'JSXOpeningFragment', start: this.start, end: this.end, - range: this.range, }; } @@ -7582,17 +6976,11 @@ class JSXClosingFragment { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'JSXClosingFragment', start: this.start, end: this.end, - range: this.range, }; } @@ -7645,19 +7033,14 @@ class JSXNamespacedName { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get namespace() { const internal = this.#internal; - return new JSXIdentifier(internal.pos + 24, internal.ast); + return new JSXIdentifier(internal.pos + 8, internal.ast); } get name() { const internal = this.#internal; - return new JSXIdentifier(internal.pos + 64, internal.ast); + return new JSXIdentifier(internal.pos + 32, internal.ast); } toJSON() { @@ -7665,7 +7048,6 @@ class JSXNamespacedName { type: 'JSXNamespacedName', start: this.start, end: this.end, - range: this.range, namespace: this.namespace, name: this.name, }; @@ -7703,19 +7085,14 @@ class JSXMemberExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get object() { const internal = this.#internal; - return constructJSXMemberExpressionObject(internal.pos + 24, internal.ast); + return constructJSXMemberExpressionObject(internal.pos + 8, internal.ast); } get property() { const internal = this.#internal; - return new JSXIdentifier(internal.pos + 40, internal.ast); + return new JSXIdentifier(internal.pos + 24, internal.ast); } toJSON() { @@ -7723,7 +7100,6 @@ class JSXMemberExpression { type: 'JSXMemberExpression', start: this.start, end: this.end, - range: this.range, object: this.object, property: this.property, }; @@ -7774,14 +7150,9 @@ class JSXExpressionContainer { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return constructJSXExpression(internal.pos + 24, internal.ast); + return constructJSXExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -7789,7 +7160,6 @@ class JSXExpressionContainer { type: 'JSXExpressionContainer', start: this.start, end: this.end, - range: this.range, expression: this.expression, }; } @@ -7921,17 +7291,11 @@ class JSXEmptyExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'JSXEmptyExpression', start: this.start, end: this.end, - range: this.range, }; } @@ -7978,19 +7342,14 @@ class JSXAttribute { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get name() { const internal = this.#internal; - return constructJSXAttributeName(internal.pos + 24, internal.ast); + return constructJSXAttributeName(internal.pos + 8, internal.ast); } get value() { const internal = this.#internal; - return constructOptionJSXAttributeValue(internal.pos + 40, internal.ast); + return constructOptionJSXAttributeValue(internal.pos + 24, internal.ast); } toJSON() { @@ -7998,7 +7357,6 @@ class JSXAttribute { type: 'JSXAttribute', start: this.start, end: this.end, - range: this.range, name: this.name, value: this.value, }; @@ -8036,14 +7394,9 @@ class JSXSpreadAttribute { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get argument() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -8051,7 +7404,6 @@ class JSXSpreadAttribute { type: 'JSXSpreadAttribute', start: this.start, end: this.end, - range: this.range, argument: this.argument, }; } @@ -8114,16 +7466,11 @@ class JSXIdentifier { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get name() { const internal = this.#internal, cached = internal.$name; if (cached !== void 0) return cached; - return internal.$name = constructStr(internal.pos + 24, internal.ast); + return internal.$name = constructStr(internal.pos + 8, internal.ast); } toJSON() { @@ -8131,7 +7478,6 @@ class JSXIdentifier { type: 'JSXIdentifier', start: this.start, end: this.end, - range: this.range, name: this.name, }; } @@ -8185,14 +7531,9 @@ class JSXSpreadChild { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -8200,7 +7541,6 @@ class JSXSpreadChild { type: 'JSXSpreadChild', start: this.start, end: this.end, - range: this.range, expression: this.expression, }; } @@ -8237,23 +7577,18 @@ class JSXText { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get value() { const internal = this.#internal, cached = internal.$value; if (cached !== void 0) return cached; - return internal.$value = constructStr(internal.pos + 24, internal.ast); + return internal.$value = constructStr(internal.pos + 8, internal.ast); } get raw() { const internal = this.#internal, cached = internal.$raw; if (cached !== void 0) return cached; - return internal.$raw = constructOptionStr(internal.pos + 40, internal.ast); + return internal.$raw = constructOptionStr(internal.pos + 24, internal.ast); } toJSON() { @@ -8261,7 +7596,6 @@ class JSXText { type: 'JSXText', start: this.start, end: this.end, - range: this.range, value: this.value, raw: this.raw, }; @@ -8299,14 +7633,9 @@ class TSThisParameter { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get typeAnnotation() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 48, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 16, internal.ast); } toJSON() { @@ -8314,7 +7643,6 @@ class TSThisParameter { type: 'TSThisParameter', start: this.start, end: this.end, - range: this.range, typeAnnotation: this.typeAnnotation, }; } @@ -8351,29 +7679,24 @@ class TSEnumDeclaration { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get id() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 24, internal.ast); + return new BindingIdentifier(internal.pos + 8, internal.ast); } get body() { const internal = this.#internal; - return new TSEnumBody(internal.pos + 72, internal.ast); + return new TSEnumBody(internal.pos + 40, internal.ast); } get const() { const internal = this.#internal; - return constructBool(internal.pos + 124, internal.ast); + return constructBool(internal.pos + 76, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 125, internal.ast); + return constructBool(internal.pos + 77, internal.ast); } toJSON() { @@ -8381,7 +7704,6 @@ class TSEnumDeclaration { type: 'TSEnumDeclaration', start: this.start, end: this.end, - range: this.range, id: this.id, body: this.body, const: this.const, @@ -8421,16 +7743,11 @@ class TSEnumBody { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get members() { const internal = this.#internal, cached = internal.$members; if (cached !== void 0) return cached; - return internal.$members = constructVecTSEnumMember(internal.pos + 24, internal.ast); + return internal.$members = constructVecTSEnumMember(internal.pos + 8, internal.ast); } toJSON() { @@ -8438,7 +7755,6 @@ class TSEnumBody { type: 'TSEnumBody', start: this.start, end: this.end, - range: this.range, members: this.members, }; } @@ -8475,19 +7791,14 @@ class TSEnumMember { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get id() { const internal = this.#internal; - return constructTSEnumMemberName(internal.pos + 24, internal.ast); + return constructTSEnumMemberName(internal.pos + 8, internal.ast); } get initializer() { const internal = this.#internal; - return constructOptionExpression(internal.pos + 40, internal.ast); + return constructOptionExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -8495,7 +7806,6 @@ class TSEnumMember { type: 'TSEnumMember', start: this.start, end: this.end, - range: this.range, id: this.id, initializer: this.initializer, }; @@ -8548,14 +7858,9 @@ class TSTypeAnnotation { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 8, internal.ast); } toJSON() { @@ -8563,7 +7868,6 @@ class TSTypeAnnotation { type: 'TSTypeAnnotation', start: this.start, end: this.end, - range: this.range, typeAnnotation: this.typeAnnotation, }; } @@ -8600,14 +7904,9 @@ class TSLiteralType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get literal() { const internal = this.#internal; - return constructTSLiteral(internal.pos + 24, internal.ast); + return constructTSLiteral(internal.pos + 8, internal.ast); } toJSON() { @@ -8615,7 +7914,6 @@ class TSLiteralType { type: 'TSLiteralType', start: this.start, end: this.end, - range: this.range, literal: this.literal, }; } @@ -8752,29 +8050,24 @@ class TSConditionalType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get checkType() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 8, internal.ast); } get extendsType() { const internal = this.#internal; - return constructTSType(internal.pos + 40, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } get trueType() { const internal = this.#internal; - return constructTSType(internal.pos + 56, internal.ast); + return constructTSType(internal.pos + 40, internal.ast); } get falseType() { const internal = this.#internal; - return constructTSType(internal.pos + 72, internal.ast); + return constructTSType(internal.pos + 56, internal.ast); } toJSON() { @@ -8782,7 +8075,6 @@ class TSConditionalType { type: 'TSConditionalType', start: this.start, end: this.end, - range: this.range, checkType: this.checkType, extendsType: this.extendsType, trueType: this.trueType, @@ -8822,16 +8114,11 @@ class TSUnionType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get types() { const internal = this.#internal, cached = internal.$types; if (cached !== void 0) return cached; - return internal.$types = constructVecTSType(internal.pos + 24, internal.ast); + return internal.$types = constructVecTSType(internal.pos + 8, internal.ast); } toJSON() { @@ -8839,7 +8126,6 @@ class TSUnionType { type: 'TSUnionType', start: this.start, end: this.end, - range: this.range, types: this.types, }; } @@ -8876,16 +8162,11 @@ class TSIntersectionType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get types() { const internal = this.#internal, cached = internal.$types; if (cached !== void 0) return cached; - return internal.$types = constructVecTSType(internal.pos + 24, internal.ast); + return internal.$types = constructVecTSType(internal.pos + 8, internal.ast); } toJSON() { @@ -8893,7 +8174,6 @@ class TSIntersectionType { type: 'TSIntersectionType', start: this.start, end: this.end, - range: this.range, types: this.types, }; } @@ -8930,14 +8210,9 @@ class TSParenthesizedType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 8, internal.ast); } toJSON() { @@ -8945,7 +8220,6 @@ class TSParenthesizedType { type: 'TSParenthesizedType', start: this.start, end: this.end, - range: this.range, typeAnnotation: this.typeAnnotation, }; } @@ -8982,19 +8256,14 @@ class TSTypeOperator { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get operator() { const internal = this.#internal; - return constructTSTypeOperatorOperator(internal.pos + 40, internal.ast); + return constructTSTypeOperatorOperator(internal.pos + 24, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 8, internal.ast); } toJSON() { @@ -9002,7 +8271,6 @@ class TSTypeOperator { type: 'TSTypeOperator', start: this.start, end: this.end, - range: this.range, operator: this.operator, typeAnnotation: this.typeAnnotation, }; @@ -9053,14 +8321,9 @@ class TSArrayType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get elementType() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 8, internal.ast); } toJSON() { @@ -9068,7 +8331,6 @@ class TSArrayType { type: 'TSArrayType', start: this.start, end: this.end, - range: this.range, elementType: this.elementType, }; } @@ -9105,19 +8367,14 @@ class TSIndexedAccessType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get objectType() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 8, internal.ast); } get indexType() { const internal = this.#internal; - return constructTSType(internal.pos + 40, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } toJSON() { @@ -9125,7 +8382,6 @@ class TSIndexedAccessType { type: 'TSIndexedAccessType', start: this.start, end: this.end, - range: this.range, objectType: this.objectType, indexType: this.indexType, }; @@ -9163,16 +8419,11 @@ class TSTupleType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get elementTypes() { const internal = this.#internal, cached = internal.$elementTypes; if (cached !== void 0) return cached; - return internal.$elementTypes = constructVecTSTupleElement(internal.pos + 24, internal.ast); + return internal.$elementTypes = constructVecTSTupleElement(internal.pos + 8, internal.ast); } toJSON() { @@ -9180,7 +8431,6 @@ class TSTupleType { type: 'TSTupleType', start: this.start, end: this.end, - range: this.range, elementTypes: this.elementTypes, }; } @@ -9217,24 +8467,19 @@ class TSNamedTupleMember { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get label() { const internal = this.#internal; - return new IdentifierName(internal.pos + 24, internal.ast); + return new IdentifierName(internal.pos + 8, internal.ast); } get elementType() { const internal = this.#internal; - return constructTSTupleElement(internal.pos + 64, internal.ast); + return constructTSTupleElement(internal.pos + 32, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 80, internal.ast); + return constructBool(internal.pos + 48, internal.ast); } toJSON() { @@ -9242,7 +8487,6 @@ class TSNamedTupleMember { type: 'TSNamedTupleMember', start: this.start, end: this.end, - range: this.range, label: this.label, elementType: this.elementType, optional: this.optional, @@ -9281,14 +8525,9 @@ class TSOptionalType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 8, internal.ast); } toJSON() { @@ -9296,7 +8535,6 @@ class TSOptionalType { type: 'TSOptionalType', start: this.start, end: this.end, - range: this.range, typeAnnotation: this.typeAnnotation, }; } @@ -9333,14 +8571,9 @@ class TSRestType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 8, internal.ast); } toJSON() { @@ -9348,7 +8581,6 @@ class TSRestType { type: 'TSRestType', start: this.start, end: this.end, - range: this.range, typeAnnotation: this.typeAnnotation, }; } @@ -9470,17 +8702,11 @@ class TSAnyKeyword { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'TSAnyKeyword', start: this.start, end: this.end, - range: this.range, }; } @@ -9516,17 +8742,11 @@ class TSStringKeyword { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'TSStringKeyword', start: this.start, end: this.end, - range: this.range, }; } @@ -9562,17 +8782,11 @@ class TSBooleanKeyword { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'TSBooleanKeyword', start: this.start, end: this.end, - range: this.range, }; } @@ -9608,17 +8822,11 @@ class TSNumberKeyword { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'TSNumberKeyword', start: this.start, end: this.end, - range: this.range, }; } @@ -9654,17 +8862,11 @@ class TSNeverKeyword { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'TSNeverKeyword', start: this.start, end: this.end, - range: this.range, }; } @@ -9700,17 +8902,11 @@ class TSIntrinsicKeyword { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'TSIntrinsicKeyword', start: this.start, end: this.end, - range: this.range, }; } @@ -9741,14 +8937,9 @@ class TSUnknownKeyword { return constructU32(internal.pos, internal.ast); } - get end() { - const internal = this.#internal; - return constructU32(internal.pos + 4, internal.ast); - } - - get range() { + get end() { const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); + return constructU32(internal.pos + 4, internal.ast); } toJSON() { @@ -9756,7 +8947,6 @@ class TSUnknownKeyword { type: 'TSUnknownKeyword', start: this.start, end: this.end, - range: this.range, }; } @@ -9792,17 +8982,11 @@ class TSNullKeyword { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'TSNullKeyword', start: this.start, end: this.end, - range: this.range, }; } @@ -9838,17 +9022,11 @@ class TSUndefinedKeyword { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'TSUndefinedKeyword', start: this.start, end: this.end, - range: this.range, }; } @@ -9884,17 +9062,11 @@ class TSVoidKeyword { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'TSVoidKeyword', start: this.start, end: this.end, - range: this.range, }; } @@ -9930,17 +9102,11 @@ class TSSymbolKeyword { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'TSSymbolKeyword', start: this.start, end: this.end, - range: this.range, }; } @@ -9976,17 +9142,11 @@ class TSThisType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'TSThisType', start: this.start, end: this.end, - range: this.range, }; } @@ -10022,17 +9182,11 @@ class TSObjectKeyword { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'TSObjectKeyword', start: this.start, end: this.end, - range: this.range, }; } @@ -10068,17 +9222,11 @@ class TSBigIntKeyword { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'TSBigIntKeyword', start: this.start, end: this.end, - range: this.range, }; } @@ -10114,19 +9262,14 @@ class TSTypeReference { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get typeName() { const internal = this.#internal; - return constructTSTypeName(internal.pos + 24, internal.ast); + return constructTSTypeName(internal.pos + 8, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); } toJSON() { @@ -10134,7 +9277,6 @@ class TSTypeReference { type: 'TSTypeReference', start: this.start, end: this.end, - range: this.range, typeName: this.typeName, typeArguments: this.typeArguments, }; @@ -10183,19 +9325,14 @@ class TSQualifiedName { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get left() { const internal = this.#internal; - return constructTSTypeName(internal.pos + 24, internal.ast); + return constructTSTypeName(internal.pos + 8, internal.ast); } get right() { const internal = this.#internal; - return new IdentifierName(internal.pos + 40, internal.ast); + return new IdentifierName(internal.pos + 24, internal.ast); } toJSON() { @@ -10203,7 +9340,6 @@ class TSQualifiedName { type: 'TSQualifiedName', start: this.start, end: this.end, - range: this.range, left: this.left, right: this.right, }; @@ -10241,16 +9377,11 @@ class TSTypeParameterInstantiation { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get params() { const internal = this.#internal, cached = internal.$params; if (cached !== void 0) return cached; - return internal.$params = constructVecTSType(internal.pos + 24, internal.ast); + return internal.$params = constructVecTSType(internal.pos + 8, internal.ast); } toJSON() { @@ -10258,7 +9389,6 @@ class TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', start: this.start, end: this.end, - range: this.range, params: this.params, }; } @@ -10295,39 +9425,34 @@ class TSTypeParameter { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get name() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 24, internal.ast); + return new BindingIdentifier(internal.pos + 8, internal.ast); } get constraint() { const internal = this.#internal; - return constructOptionTSType(internal.pos + 72, internal.ast); + return constructOptionTSType(internal.pos + 40, internal.ast); } get default() { const internal = this.#internal; - return constructOptionTSType(internal.pos + 88, internal.ast); + return constructOptionTSType(internal.pos + 56, internal.ast); } get in() { const internal = this.#internal; - return constructBool(internal.pos + 104, internal.ast); + return constructBool(internal.pos + 72, internal.ast); } get out() { const internal = this.#internal; - return constructBool(internal.pos + 105, internal.ast); + return constructBool(internal.pos + 73, internal.ast); } get const() { const internal = this.#internal; - return constructBool(internal.pos + 106, internal.ast); + return constructBool(internal.pos + 74, internal.ast); } toJSON() { @@ -10335,7 +9460,6 @@ class TSTypeParameter { type: 'TSTypeParameter', start: this.start, end: this.end, - range: this.range, name: this.name, constraint: this.constraint, default: this.default, @@ -10377,16 +9501,11 @@ class TSTypeParameterDeclaration { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get params() { const internal = this.#internal, cached = internal.$params; if (cached !== void 0) return cached; - return internal.$params = constructVecTSTypeParameter(internal.pos + 24, internal.ast); + return internal.$params = constructVecTSTypeParameter(internal.pos + 8, internal.ast); } toJSON() { @@ -10394,7 +9513,6 @@ class TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', start: this.start, end: this.end, - range: this.range, params: this.params, }; } @@ -10431,29 +9549,24 @@ class TSTypeAliasDeclaration { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get id() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 24, internal.ast); + return new BindingIdentifier(internal.pos + 8, internal.ast); } get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 72, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 40, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 80, internal.ast); + return constructTSType(internal.pos + 48, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 100, internal.ast); + return constructBool(internal.pos + 68, internal.ast); } toJSON() { @@ -10461,7 +9574,6 @@ class TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', start: this.start, end: this.end, - range: this.range, id: this.id, typeParameters: this.typeParameters, typeAnnotation: this.typeAnnotation, @@ -10514,19 +9626,14 @@ class TSClassImplements { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return constructTSTypeName(internal.pos + 24, internal.ast); + return constructTSTypeName(internal.pos + 8, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); } toJSON() { @@ -10534,7 +9641,6 @@ class TSClassImplements { type: 'TSClassImplements', start: this.start, end: this.end, - range: this.range, expression: this.expression, typeArguments: this.typeArguments, }; @@ -10572,36 +9678,31 @@ class TSInterfaceDeclaration { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get id() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 24, internal.ast); + return new BindingIdentifier(internal.pos + 8, internal.ast); } get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 72, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 40, internal.ast); } get extends() { const internal = this.#internal, cached = internal.$extends; if (cached !== void 0) return cached; - return internal.$extends = constructVecTSInterfaceHeritage(internal.pos + 80, internal.ast); + return internal.$extends = constructVecTSInterfaceHeritage(internal.pos + 48, internal.ast); } get body() { const internal = this.#internal; - return constructBoxTSInterfaceBody(internal.pos + 104, internal.ast); + return constructBoxTSInterfaceBody(internal.pos + 72, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 116, internal.ast); + return constructBool(internal.pos + 84, internal.ast); } toJSON() { @@ -10609,7 +9710,6 @@ class TSInterfaceDeclaration { type: 'TSInterfaceDeclaration', start: this.start, end: this.end, - range: this.range, id: this.id, typeParameters: this.typeParameters, extends: this.extends, @@ -10650,16 +9750,11 @@ class TSInterfaceBody { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get body() { const internal = this.#internal, cached = internal.$body; if (cached !== void 0) return cached; - return internal.$body = constructVecTSSignature(internal.pos + 24, internal.ast); + return internal.$body = constructVecTSSignature(internal.pos + 8, internal.ast); } toJSON() { @@ -10667,7 +9762,6 @@ class TSInterfaceBody { type: 'TSInterfaceBody', start: this.start, end: this.end, - range: this.range, body: this.body, }; } @@ -10704,34 +9798,29 @@ class TSPropertySignature { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get computed() { const internal = this.#internal; - return constructBool(internal.pos + 48, internal.ast); + return constructBool(internal.pos + 32, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 49, internal.ast); + return constructBool(internal.pos + 33, internal.ast); } get readonly() { const internal = this.#internal; - return constructBool(internal.pos + 50, internal.ast); + return constructBool(internal.pos + 34, internal.ast); } get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 24, internal.ast); + return constructPropertyKey(internal.pos + 8, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 24, internal.ast); } toJSON() { @@ -10739,7 +9828,6 @@ class TSPropertySignature { type: 'TSPropertySignature', start: this.start, end: this.end, - range: this.range, computed: this.computed, optional: this.optional, readonly: this.readonly, @@ -10797,31 +9885,26 @@ class TSIndexSignature { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get parameters() { const internal = this.#internal, cached = internal.$parameters; if (cached !== void 0) return cached; - return internal.$parameters = constructVecTSIndexSignatureName(internal.pos + 24, internal.ast); + return internal.$parameters = constructVecTSIndexSignatureName(internal.pos + 8, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructBoxTSTypeAnnotation(internal.pos + 48, internal.ast); + return constructBoxTSTypeAnnotation(internal.pos + 32, internal.ast); } get readonly() { const internal = this.#internal; - return constructBool(internal.pos + 56, internal.ast); + return constructBool(internal.pos + 40, internal.ast); } get static() { const internal = this.#internal; - return constructBool(internal.pos + 57, internal.ast); + return constructBool(internal.pos + 41, internal.ast); } toJSON() { @@ -10829,7 +9912,6 @@ class TSIndexSignature { type: 'TSIndexSignature', start: this.start, end: this.end, - range: this.range, parameters: this.parameters, typeAnnotation: this.typeAnnotation, readonly: this.readonly, @@ -10869,24 +9951,19 @@ class TSCallSignatureDeclaration { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 8, internal.ast); } get params() { const internal = this.#internal; - return constructBoxFormalParameters(internal.pos + 40, internal.ast); + return constructBoxFormalParameters(internal.pos + 24, internal.ast); } get returnType() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 48, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 32, internal.ast); } toJSON() { @@ -10894,7 +9971,6 @@ class TSCallSignatureDeclaration { type: 'TSCallSignatureDeclaration', start: this.start, end: this.end, - range: this.range, typeParameters: this.typeParameters, params: this.params, returnType: this.returnType, @@ -10946,44 +10022,39 @@ class TSMethodSignature { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get key() { const internal = this.#internal; - return constructPropertyKey(internal.pos + 24, internal.ast); + return constructPropertyKey(internal.pos + 8, internal.ast); } get computed() { const internal = this.#internal; - return constructBool(internal.pos + 76, internal.ast); + return constructBool(internal.pos + 60, internal.ast); } get optional() { const internal = this.#internal; - return constructBool(internal.pos + 77, internal.ast); + return constructBool(internal.pos + 61, internal.ast); } get kind() { const internal = this.#internal; - return constructTSMethodSignatureKind(internal.pos + 78, internal.ast); + return constructTSMethodSignatureKind(internal.pos + 62, internal.ast); } get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 24, internal.ast); } get params() { const internal = this.#internal; - return constructBoxFormalParameters(internal.pos + 56, internal.ast); + return constructBoxFormalParameters(internal.pos + 40, internal.ast); } get returnType() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 64, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 48, internal.ast); } toJSON() { @@ -10991,7 +10062,6 @@ class TSMethodSignature { type: 'TSMethodSignature', start: this.start, end: this.end, - range: this.range, key: this.key, computed: this.computed, optional: this.optional, @@ -11034,24 +10104,19 @@ class TSConstructSignatureDeclaration { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 8, internal.ast); } get params() { const internal = this.#internal; - return constructBoxFormalParameters(internal.pos + 32, internal.ast); + return constructBoxFormalParameters(internal.pos + 16, internal.ast); } get returnType() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 24, internal.ast); } toJSON() { @@ -11059,7 +10124,6 @@ class TSConstructSignatureDeclaration { type: 'TSConstructSignatureDeclaration', start: this.start, end: this.end, - range: this.range, typeParameters: this.typeParameters, params: this.params, returnType: this.returnType, @@ -11098,21 +10162,16 @@ class TSIndexSignatureName { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get name() { const internal = this.#internal, cached = internal.$name; if (cached !== void 0) return cached; - return internal.$name = constructStr(internal.pos + 24, internal.ast); + return internal.$name = constructStr(internal.pos + 8, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructBoxTSTypeAnnotation(internal.pos + 40, internal.ast); + return constructBoxTSTypeAnnotation(internal.pos + 24, internal.ast); } toJSON() { @@ -11120,7 +10179,6 @@ class TSIndexSignatureName { type: 'TSIndexSignatureName', start: this.start, end: this.end, - range: this.range, name: this.name, typeAnnotation: this.typeAnnotation, }; @@ -11158,19 +10216,14 @@ class TSInterfaceHeritage { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); } toJSON() { @@ -11178,7 +10231,6 @@ class TSInterfaceHeritage { type: 'TSInterfaceHeritage', start: this.start, end: this.end, - range: this.range, expression: this.expression, typeArguments: this.typeArguments, }; @@ -11216,24 +10268,19 @@ class TSTypePredicate { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get parameterName() { const internal = this.#internal; - return constructTSTypePredicateName(internal.pos + 24, internal.ast); + return constructTSTypePredicateName(internal.pos + 8, internal.ast); } get asserts() { const internal = this.#internal; - return constructBool(internal.pos + 64, internal.ast); + return constructBool(internal.pos + 32, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructOptionBoxTSTypeAnnotation(internal.pos + 56, internal.ast); + return constructOptionBoxTSTypeAnnotation(internal.pos + 24, internal.ast); } toJSON() { @@ -11241,7 +10288,6 @@ class TSTypePredicate { type: 'TSTypePredicate', start: this.start, end: this.end, - range: this.range, parameterName: this.parameterName, asserts: this.asserts, typeAnnotation: this.typeAnnotation, @@ -11291,29 +10337,24 @@ class TSModuleDeclaration { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get id() { const internal = this.#internal; - return constructTSModuleDeclarationName(internal.pos + 24, internal.ast); + return constructTSModuleDeclarationName(internal.pos + 8, internal.ast); } get body() { const internal = this.#internal; - return constructOptionTSModuleDeclarationBody(internal.pos + 96, internal.ast); + return constructOptionTSModuleDeclarationBody(internal.pos + 64, internal.ast); } get kind() { const internal = this.#internal; - return constructTSModuleDeclarationKind(internal.pos + 116, internal.ast); + return constructTSModuleDeclarationKind(internal.pos + 84, internal.ast); } get declare() { const internal = this.#internal; - return constructBool(internal.pos + 117, internal.ast); + return constructBool(internal.pos + 85, internal.ast); } toJSON() { @@ -11321,7 +10362,6 @@ class TSModuleDeclaration { type: 'TSModuleDeclaration', start: this.start, end: this.end, - range: this.range, id: this.id, body: this.body, kind: this.kind, @@ -11396,16 +10436,11 @@ class TSModuleBlock { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get body() { const internal = this.#internal, cached = internal.$body; if (cached !== void 0) return cached; - return internal.$body = constructVecStatement(internal.pos + 48, internal.ast); + return internal.$body = constructVecStatement(internal.pos + 32, internal.ast); } toJSON() { @@ -11413,7 +10448,6 @@ class TSModuleBlock { type: 'TSModuleBlock', start: this.start, end: this.end, - range: this.range, body: this.body, }; } @@ -11450,16 +10484,11 @@ class TSTypeLiteral { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get members() { const internal = this.#internal, cached = internal.$members; if (cached !== void 0) return cached; - return internal.$members = constructVecTSSignature(internal.pos + 24, internal.ast); + return internal.$members = constructVecTSSignature(internal.pos + 8, internal.ast); } toJSON() { @@ -11467,7 +10496,6 @@ class TSTypeLiteral { type: 'TSTypeLiteral', start: this.start, end: this.end, - range: this.range, members: this.members, }; } @@ -11504,14 +10532,9 @@ class TSInferType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get typeParameter() { const internal = this.#internal; - return constructBoxTSTypeParameter(internal.pos + 24, internal.ast); + return constructBoxTSTypeParameter(internal.pos + 8, internal.ast); } toJSON() { @@ -11519,7 +10542,6 @@ class TSInferType { type: 'TSInferType', start: this.start, end: this.end, - range: this.range, typeParameter: this.typeParameter, }; } @@ -11556,19 +10578,14 @@ class TSTypeQuery { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get exprName() { const internal = this.#internal; - return constructTSTypeQueryExprName(internal.pos + 24, internal.ast); + return constructTSTypeQueryExprName(internal.pos + 8, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); } toJSON() { @@ -11576,7 +10593,6 @@ class TSTypeQuery { type: 'TSTypeQuery', start: this.start, end: this.end, - range: this.range, exprName: this.exprName, typeArguments: this.typeArguments, }; @@ -11627,29 +10643,24 @@ class TSImportType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get argument() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 8, internal.ast); } get options() { const internal = this.#internal; - return constructOptionBoxObjectExpression(internal.pos + 40, internal.ast); + return constructOptionBoxObjectExpression(internal.pos + 24, internal.ast); } get qualifier() { const internal = this.#internal; - return constructOptionTSTypeName(internal.pos + 48, internal.ast); + return constructOptionTSTypeName(internal.pos + 32, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 64, internal.ast); + return constructOptionBoxTSTypeParameterInstantiation(internal.pos + 48, internal.ast); } toJSON() { @@ -11657,7 +10668,6 @@ class TSImportType { type: 'TSImportType', start: this.start, end: this.end, - range: this.range, argument: this.argument, options: this.options, qualifier: this.qualifier, @@ -11697,24 +10707,19 @@ class TSFunctionType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 8, internal.ast); } get params() { const internal = this.#internal; - return constructBoxFormalParameters(internal.pos + 40, internal.ast); + return constructBoxFormalParameters(internal.pos + 24, internal.ast); } get returnType() { const internal = this.#internal; - return constructBoxTSTypeAnnotation(internal.pos + 48, internal.ast); + return constructBoxTSTypeAnnotation(internal.pos + 32, internal.ast); } toJSON() { @@ -11722,7 +10727,6 @@ class TSFunctionType { type: 'TSFunctionType', start: this.start, end: this.end, - range: this.range, typeParameters: this.typeParameters, params: this.params, returnType: this.returnType, @@ -11761,29 +10765,24 @@ class TSConstructorType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get abstract() { const internal = this.#internal; - return constructBool(internal.pos + 48, internal.ast); + return constructBool(internal.pos + 32, internal.ast); } get typeParameters() { const internal = this.#internal; - return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 24, internal.ast); + return constructOptionBoxTSTypeParameterDeclaration(internal.pos + 8, internal.ast); } get params() { const internal = this.#internal; - return constructBoxFormalParameters(internal.pos + 32, internal.ast); + return constructBoxFormalParameters(internal.pos + 16, internal.ast); } get returnType() { const internal = this.#internal; - return constructBoxTSTypeAnnotation(internal.pos + 40, internal.ast); + return constructBoxTSTypeAnnotation(internal.pos + 24, internal.ast); } toJSON() { @@ -11791,7 +10790,6 @@ class TSConstructorType { type: 'TSConstructorType', start: this.start, end: this.end, - range: this.range, abstract: this.abstract, typeParameters: this.typeParameters, params: this.params, @@ -11831,29 +10829,24 @@ class TSMappedType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get nameType() { const internal = this.#internal; - return constructOptionTSType(internal.pos + 32, internal.ast); + return constructOptionTSType(internal.pos + 16, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructOptionTSType(internal.pos + 48, internal.ast); + return constructOptionTSType(internal.pos + 32, internal.ast); } get optional() { const internal = this.#internal; - return constructOptionTSMappedTypeModifierOperator(internal.pos + 68, internal.ast); + return constructOptionTSMappedTypeModifierOperator(internal.pos + 52, internal.ast); } get readonly() { const internal = this.#internal; - return constructOptionTSMappedTypeModifierOperator(internal.pos + 69, internal.ast); + return constructOptionTSMappedTypeModifierOperator(internal.pos + 53, internal.ast); } toJSON() { @@ -11861,7 +10854,6 @@ class TSMappedType { type: 'TSMappedType', start: this.start, end: this.end, - range: this.range, nameType: this.nameType, typeAnnotation: this.typeAnnotation, optional: this.optional, @@ -11914,23 +10906,18 @@ class TSTemplateLiteralType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get quasis() { const internal = this.#internal, cached = internal.$quasis; if (cached !== void 0) return cached; - return internal.$quasis = constructVecTemplateElement(internal.pos + 24, internal.ast); + return internal.$quasis = constructVecTemplateElement(internal.pos + 8, internal.ast); } get types() { const internal = this.#internal, cached = internal.$types; if (cached !== void 0) return cached; - return internal.$types = constructVecTSType(internal.pos + 48, internal.ast); + return internal.$types = constructVecTSType(internal.pos + 32, internal.ast); } toJSON() { @@ -11938,7 +10925,6 @@ class TSTemplateLiteralType { type: 'TSTemplateLiteralType', start: this.start, end: this.end, - range: this.range, quasis: this.quasis, types: this.types, }; @@ -11976,19 +10962,14 @@ class TSAsExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 40, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } toJSON() { @@ -11996,7 +10977,6 @@ class TSAsExpression { type: 'TSAsExpression', start: this.start, end: this.end, - range: this.range, expression: this.expression, typeAnnotation: this.typeAnnotation, }; @@ -12034,19 +11014,14 @@ class TSSatisfiesExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 40, internal.ast); + return constructTSType(internal.pos + 24, internal.ast); } toJSON() { @@ -12054,7 +11029,6 @@ class TSSatisfiesExpression { type: 'TSSatisfiesExpression', start: this.start, end: this.end, - range: this.range, expression: this.expression, typeAnnotation: this.typeAnnotation, }; @@ -12092,19 +11066,14 @@ class TSTypeAssertion { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 8, internal.ast); } get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 40, internal.ast); + return constructExpression(internal.pos + 24, internal.ast); } toJSON() { @@ -12112,7 +11081,6 @@ class TSTypeAssertion { type: 'TSTypeAssertion', start: this.start, end: this.end, - range: this.range, typeAnnotation: this.typeAnnotation, expression: this.expression, }; @@ -12150,24 +11118,19 @@ class TSImportEqualsDeclaration { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get id() { const internal = this.#internal; - return new BindingIdentifier(internal.pos + 24, internal.ast); + return new BindingIdentifier(internal.pos + 8, internal.ast); } get moduleReference() { const internal = this.#internal; - return constructTSModuleReference(internal.pos + 72, internal.ast); + return constructTSModuleReference(internal.pos + 40, internal.ast); } get importKind() { const internal = this.#internal; - return constructImportOrExportKind(internal.pos + 88, internal.ast); + return constructImportOrExportKind(internal.pos + 56, internal.ast); } toJSON() { @@ -12175,7 +11138,6 @@ class TSImportEqualsDeclaration { type: 'TSImportEqualsDeclaration', start: this.start, end: this.end, - range: this.range, id: this.id, moduleReference: this.moduleReference, importKind: this.importKind, @@ -12227,14 +11189,9 @@ class TSExternalModuleReference { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return new StringLiteral(internal.pos + 24, internal.ast); + return new StringLiteral(internal.pos + 8, internal.ast); } toJSON() { @@ -12242,7 +11199,6 @@ class TSExternalModuleReference { type: 'TSExternalModuleReference', start: this.start, end: this.end, - range: this.range, expression: this.expression, }; } @@ -12279,14 +11235,9 @@ class TSNonNullExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -12294,7 +11245,6 @@ class TSNonNullExpression { type: 'TSNonNullExpression', start: this.start, end: this.end, - range: this.range, expression: this.expression, }; } @@ -12331,14 +11281,9 @@ class Decorator { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -12346,7 +11291,6 @@ class Decorator { type: 'Decorator', start: this.start, end: this.end, - range: this.range, expression: this.expression, }; } @@ -12383,14 +11327,9 @@ class TSExportAssignment { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } toJSON() { @@ -12398,7 +11337,6 @@ class TSExportAssignment { type: 'TSExportAssignment', start: this.start, end: this.end, - range: this.range, expression: this.expression, }; } @@ -12435,14 +11373,9 @@ class TSNamespaceExportDeclaration { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get id() { const internal = this.#internal; - return new IdentifierName(internal.pos + 24, internal.ast); + return new IdentifierName(internal.pos + 8, internal.ast); } toJSON() { @@ -12450,7 +11383,6 @@ class TSNamespaceExportDeclaration { type: 'TSNamespaceExportDeclaration', start: this.start, end: this.end, - range: this.range, id: this.id, }; } @@ -12487,19 +11419,14 @@ class TSInstantiationExpression { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get expression() { const internal = this.#internal; - return constructExpression(internal.pos + 24, internal.ast); + return constructExpression(internal.pos + 8, internal.ast); } get typeArguments() { const internal = this.#internal; - return constructBoxTSTypeParameterInstantiation(internal.pos + 40, internal.ast); + return constructBoxTSTypeParameterInstantiation(internal.pos + 24, internal.ast); } toJSON() { @@ -12507,7 +11434,6 @@ class TSInstantiationExpression { type: 'TSInstantiationExpression', start: this.start, end: this.end, - range: this.range, expression: this.expression, typeArguments: this.typeArguments, }; @@ -12556,19 +11482,14 @@ class JSDocNullableType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 8, internal.ast); } get postfix() { const internal = this.#internal; - return constructBool(internal.pos + 40, internal.ast); + return constructBool(internal.pos + 24, internal.ast); } toJSON() { @@ -12576,7 +11497,6 @@ class JSDocNullableType { type: 'JSDocNullableType', start: this.start, end: this.end, - range: this.range, typeAnnotation: this.typeAnnotation, postfix: this.postfix, }; @@ -12614,19 +11534,14 @@ class JSDocNonNullableType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get typeAnnotation() { const internal = this.#internal; - return constructTSType(internal.pos + 24, internal.ast); + return constructTSType(internal.pos + 8, internal.ast); } get postfix() { const internal = this.#internal; - return constructBool(internal.pos + 40, internal.ast); + return constructBool(internal.pos + 24, internal.ast); } toJSON() { @@ -12634,7 +11549,6 @@ class JSDocNonNullableType { type: 'JSDocNonNullableType', start: this.start, end: this.end, - range: this.range, typeAnnotation: this.typeAnnotation, postfix: this.postfix, }; @@ -12672,17 +11586,11 @@ class JSDocUnknownType { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { type: 'JSDocUnknownType', start: this.start, end: this.end, - range: this.range, }; } @@ -12728,21 +11636,15 @@ class Comment { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get type() { const internal = this.#internal; - return constructCommentKind(internal.pos + 28, internal.ast); + return constructCommentKind(internal.pos + 12, internal.ast); } toJSON() { return { start: this.start, end: this.end, - range: this.range, type: this.type, }; } @@ -12772,7 +11674,7 @@ class NameSpan { const internal = this.#internal, cached = internal.$value; if (cached !== void 0) return cached; - return internal.$value = constructStr(internal.pos + 24, internal.ast); + return internal.$value = constructStr(internal.pos + 8, internal.ast); } get start() { @@ -12785,17 +11687,11 @@ class NameSpan { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { value: this.value, start: this.start, end: this.end, - range: this.range, }; } @@ -12822,17 +11718,17 @@ class ImportEntry { get importName() { const internal = this.#internal; - return constructImportImportName(internal.pos + 64, internal.ast); + return constructImportImportName(internal.pos + 32, internal.ast); } get localName() { const internal = this.#internal; - return new NameSpan(internal.pos + 112, internal.ast); + return new NameSpan(internal.pos + 64, internal.ast); } get isType() { const internal = this.#internal; - return constructBool(internal.pos + 152, internal.ast); + return constructBool(internal.pos + 88, internal.ast); } toJSON() { @@ -12887,41 +11783,35 @@ class ExportEntry { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get moduleRequest() { const internal = this.#internal; - return constructOptionNameSpan(internal.pos + 48, internal.ast); + return constructOptionNameSpan(internal.pos + 16, internal.ast); } get importName() { const internal = this.#internal; - return constructExportImportName(internal.pos + 88, internal.ast); + return constructExportImportName(internal.pos + 40, internal.ast); } get exportName() { const internal = this.#internal; - return constructExportExportName(internal.pos + 136, internal.ast); + return constructExportExportName(internal.pos + 72, internal.ast); } get localName() { const internal = this.#internal; - return constructExportLocalName(internal.pos + 184, internal.ast); + return constructExportLocalName(internal.pos + 104, internal.ast); } get isType() { const internal = this.#internal; - return constructBool(internal.pos + 232, internal.ast); + return constructBool(internal.pos + 136, internal.ast); } toJSON() { return { start: this.start, end: this.end, - range: this.range, moduleRequest: this.moduleRequest, importName: this.importName, exportName: this.exportName, @@ -13002,21 +11892,15 @@ class DynamicImport { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get moduleRequest() { const internal = this.#internal; - return new Span(internal.pos + 24, internal.ast); + return new Span(internal.pos + 8, internal.ast); } toJSON() { return { start: this.start, end: this.end, - range: this.range, moduleRequest: this.moduleRequest, }; } @@ -13187,16 +12071,10 @@ class Span { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { start: this.start, end: this.end, - range: this.range, }; } @@ -13274,19 +12152,19 @@ class RawTransferData { const internal = this.#internal, cached = internal.$comments; if (cached !== void 0) return cached; - return internal.$comments = constructVecComment(internal.pos + 160, internal.ast); + return internal.$comments = constructVecComment(internal.pos + 128, internal.ast); } get module() { const internal = this.#internal; - return new EcmaScriptModule(internal.pos + 184, internal.ast); + return new EcmaScriptModule(internal.pos + 152, internal.ast); } get errors() { const internal = this.#internal, cached = internal.$errors; if (cached !== void 0) return cached; - return internal.$errors = constructVecError(internal.pos + 288, internal.ast); + return internal.$errors = constructVecError(internal.pos + 256, internal.ast); } toJSON() { @@ -13400,7 +12278,7 @@ class ErrorLabel { const internal = this.#internal, cached = internal.$message; if (cached !== void 0) return cached; - return internal.$message = constructOptionStr(internal.pos + 24, internal.ast); + return internal.$message = constructOptionStr(internal.pos + 8, internal.ast); } get start() { @@ -13413,17 +12291,11 @@ class ErrorLabel { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - toJSON() { return { message: this.message, start: this.start, end: this.end, - range: this.range, }; } @@ -13529,28 +12401,22 @@ class StaticImport { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get moduleRequest() { const internal = this.#internal; - return new NameSpan(internal.pos + 24, internal.ast); + return new NameSpan(internal.pos + 8, internal.ast); } get entries() { const internal = this.#internal, cached = internal.$entries; if (cached !== void 0) return cached; - return internal.$entries = constructVecImportEntry(internal.pos + 64, internal.ast); + return internal.$entries = constructVecImportEntry(internal.pos + 32, internal.ast); } toJSON() { return { start: this.start, end: this.end, - range: this.range, moduleRequest: this.moduleRequest, entries: this.entries, }; @@ -13587,23 +12453,17 @@ class StaticExport { return constructU32(internal.pos + 4, internal.ast); } - get range() { - const internal = this.#internal; - return constructOptionRangeArray(internal.pos + 8, internal.ast); - } - get entries() { const internal = this.#internal, cached = internal.$entries; if (cached !== void 0) return cached; - return internal.$entries = constructVecExportEntry(internal.pos + 24, internal.ast); + return internal.$entries = constructVecExportEntry(internal.pos + 8, internal.ast); } toJSON() { return { start: this.start, end: this.end, - range: this.range, entries: this.entries, }; } @@ -13652,7 +12512,7 @@ function constructVecComment(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 32, + 16, constructComment, ast, ); @@ -13663,7 +12523,7 @@ function constructComment(pos, ast) { } function constructOptionHashbang(pos, ast) { - if (ast.buffer[pos + 8] === 2) return null; + if (ast.buffer.uint32[(pos + 8) >> 2] === 0 && ast.buffer.uint32[(pos + 12) >> 2] === 0) return null; return new Hashbang(pos, ast); } @@ -13673,7 +12533,7 @@ function constructVecDirective(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 104, + 72, constructDirective, ast, ); @@ -13861,7 +12721,7 @@ function constructVecArrayExpressionElement(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 32, + 16, constructArrayExpressionElement, ast, ); @@ -13905,7 +12765,7 @@ function constructVecTemplateElement(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 64, + 48, constructTemplateElement, ast, ); @@ -13991,7 +12851,7 @@ function constructVecOptionAssignmentTargetMaybeDefault(pos, ast) { } function constructOptionAssignmentTargetRest(pos, ast) { - if (ast.buffer[pos + 8] === 2) return null; + if (ast.buffer[pos + 8] === 51) return null; return new AssignmentTargetRest(pos, ast); } @@ -14126,7 +12986,7 @@ function constructVecVariableDeclarator(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 80, + 64, constructVariableDeclarator, ast, ); @@ -14147,7 +13007,7 @@ function constructOptionForStatementInit(pos, ast) { } function constructOptionLabelIdentifier(pos, ast) { - if (ast.buffer[pos + 8] === 2) return null; + if (ast.buffer.uint32[(pos + 8) >> 2] === 0 && ast.buffer.uint32[(pos + 12) >> 2] === 0) return null; return new LabelIdentifier(pos, ast); } @@ -14157,7 +13017,7 @@ function constructVecSwitchCase(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 64, + 48, constructSwitchCase, ast, ); @@ -14182,7 +13042,7 @@ function constructOptionBoxBlockStatement(pos, ast) { } function constructOptionCatchParameter(pos, ast) { - if (ast.buffer[pos + 8] === 2) return null; + if (ast.buffer[pos + 32] === 2) return null; return new CatchParameter(pos, ast); } @@ -14217,7 +13077,7 @@ function constructVecBindingProperty(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 80, + 64, constructBindingProperty, ast, ); @@ -14254,7 +13114,7 @@ function constructVecOptionBindingPattern(pos, ast) { } function constructOptionBindingIdentifier(pos, ast) { - if (ast.buffer[pos + 8] === 2) return null; + if (ast.buffer.uint32[(pos + 8) >> 2] === 0 && ast.buffer.uint32[(pos + 12) >> 2] === 0) return null; return new BindingIdentifier(pos, ast); } @@ -14295,7 +13155,7 @@ function constructVecFormalParameter(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 88, + 72, constructFormalParameter, ast, ); @@ -14311,7 +13171,7 @@ function constructVecDecorator(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 40, + 24, constructDecorator, ast, ); @@ -14332,7 +13192,7 @@ function constructVecTSClassImplements(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 48, + 32, constructTSClassImplements, ast, ); @@ -14451,7 +13311,7 @@ function constructVecImportAttribute(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 160, + 112, constructImportAttribute, ast, ); @@ -14472,7 +13332,7 @@ function constructVecExportSpecifier(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 176, + 128, constructExportSpecifier, ast, ); @@ -14483,7 +13343,7 @@ function constructExportSpecifier(pos, ast) { } function constructOptionStringLiteral(pos, ast) { - if (ast.buffer[pos + 8] === 2) return null; + if (ast.buffer[pos + 40] === 2) return null; return new StringLiteral(pos, ast); } @@ -14580,7 +13440,7 @@ function constructVecTSEnumMember(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 56, + 40, constructTSEnumMember, ast, ); @@ -14785,7 +13645,7 @@ function constructVecTSTypeParameter(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 112, + 80, constructTSTypeParameter, ast, ); @@ -14801,7 +13661,7 @@ function constructVecTSInterfaceHeritage(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 48, + 32, constructTSInterfaceHeritage, ast, ); @@ -14849,7 +13709,7 @@ function constructVecTSIndexSignatureName(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 48, + 32, constructTSIndexSignatureName, ast, ); @@ -14896,15 +13756,10 @@ function constructU32(pos, ast) { } function constructOptionNameSpan(pos, ast) { - if (ast.buffer[pos + 8] === 2) return null; + if (ast.buffer.uint32[(pos + 8) >> 2] === 0 && ast.buffer.uint32[(pos + 12) >> 2] === 0) return null; return new NameSpan(pos, ast); } -function constructOptionRangeArray(pos, ast) { - if (ast.buffer[pos] === 0) return null; - return constructRangeArray(pos + 4, ast); -} - function constructU64(pos, ast) { const { uint32 } = ast.buffer, pos32 = pos >> 2; @@ -14938,7 +13793,7 @@ function constructVecErrorLabel(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 40, + 24, constructErrorLabel, ast, ); @@ -14954,7 +13809,7 @@ function constructVecStaticImport(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 88, + 56, constructStaticImport, ast, ); @@ -14970,7 +13825,7 @@ function constructVecStaticExport(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 48, + 32, constructStaticExport, ast, ); @@ -14986,7 +13841,7 @@ function constructVecDynamicImport(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 48, + 16, constructDynamicImport, ast, ); @@ -15002,7 +13857,7 @@ function constructVecSpan(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 24, + 8, constructSpan, ast, ); @@ -15018,7 +13873,7 @@ function constructVecImportEntry(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 160, + 96, constructImportEntry, ast, ); @@ -15034,7 +13889,7 @@ function constructVecExportEntry(pos, ast) { return new NodeArray( uint32[pos32], uint32[pos32 + 2], - 240, + 144, constructExportEntry, ast, ); diff --git a/napi/parser/generated/deserialize/ts.js b/napi/parser/generated/deserialize/ts.js index 9ca86216fad20..7f4469207060c 100644 --- a/napi/parser/generated/deserialize/ts.js +++ b/napi/parser/generated/deserialize/ts.js @@ -35,8 +35,8 @@ function deserialize(buffer, sourceTextInput, sourceLenInput) { } function deserializeProgram(pos) { - const body = deserializeVecDirective(pos + 104); - body.push(...deserializeVecStatement(pos + 128)); + const body = deserializeVecDirective(pos + 72); + body.push(...deserializeVecStatement(pos + 96)); const end = deserializeU32(pos + 4); @@ -62,8 +62,8 @@ function deserializeProgram(pos) { start, end, body, - sourceType: deserializeModuleKind(pos + 157), - hashbang: deserializeOptionHashbang(pos + 64), + sourceType: deserializeModuleKind(pos + 125), + hashbang: deserializeOptionHashbang(pos + 48), }; return program; } @@ -73,9 +73,8 @@ function deserializeIdentifierName(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], - name: deserializeStr(pos + 24), + name: deserializeStr(pos + 8), optional: false, typeAnnotation: null, }; @@ -86,9 +85,8 @@ function deserializeIdentifierReference(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], - name: deserializeStr(pos + 24), + name: deserializeStr(pos + 8), optional: false, typeAnnotation: null, }; @@ -99,9 +97,8 @@ function deserializeBindingIdentifier(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], - name: deserializeStr(pos + 24), + name: deserializeStr(pos + 8), optional: false, typeAnnotation: null, }; @@ -112,9 +109,8 @@ function deserializeLabelIdentifier(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], - name: deserializeStr(pos + 24), + name: deserializeStr(pos + 8), optional: false, typeAnnotation: null, }; @@ -125,7 +121,6 @@ function deserializeThisExpression(pos) { type: 'ThisExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -134,8 +129,7 @@ function deserializeArrayExpression(pos) { type: 'ArrayExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - elements: deserializeVecArrayExpressionElement(pos + 24), + elements: deserializeVecArrayExpressionElement(pos + 8), }; } @@ -148,8 +142,7 @@ function deserializeObjectExpression(pos) { type: 'ObjectExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - properties: deserializeVecObjectPropertyKind(pos + 24), + properties: deserializeVecObjectPropertyKind(pos + 8), }; } @@ -158,13 +151,12 @@ function deserializeObjectProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - kind: deserializePropertyKind(pos + 56), - key: deserializePropertyKey(pos + 24), - value: deserializeExpression(pos + 40), - method: deserializeBool(pos + 57), - shorthand: deserializeBool(pos + 58), - computed: deserializeBool(pos + 59), + kind: deserializePropertyKind(pos + 40), + key: deserializePropertyKey(pos + 8), + value: deserializeExpression(pos + 24), + method: deserializeBool(pos + 41), + shorthand: deserializeBool(pos + 42), + computed: deserializeBool(pos + 43), optional: false, }; } @@ -174,9 +166,8 @@ function deserializeTemplateLiteral(pos) { type: 'TemplateLiteral', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - quasis: deserializeVecTemplateElement(pos + 24), - expressions: deserializeVecExpression(pos + 48), + quasis: deserializeVecTemplateElement(pos + 8), + expressions: deserializeVecExpression(pos + 32), }; } @@ -185,19 +176,18 @@ function deserializeTaggedTemplateExpression(pos) { type: 'TaggedTemplateExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - tag: deserializeExpression(pos + 24), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), - quasi: deserializeTemplateLiteral(pos + 48), + tag: deserializeExpression(pos + 8), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), + quasi: deserializeTemplateLiteral(pos + 32), }; } function deserializeTemplateElement(pos) { - const tail = deserializeBool(pos + 56), + const tail = deserializeBool(pos + 40), start = deserializeU32(pos) - 1, end = deserializeU32(pos + 4) + 2 - tail, - value = deserializeTemplateElementValue(pos + 24); - if (value.cooked !== null && deserializeBool(pos + 57)) { + value = deserializeTemplateElementValue(pos + 8); + if (value.cooked !== null && deserializeBool(pos + 41)) { value.cooked = value.cooked .replace(/\uFFFD(.{4})/g, (_, hex) => String.fromCodePoint(parseInt(hex, 16))); } @@ -216,10 +206,9 @@ function deserializeComputedMemberExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - object: deserializeExpression(pos + 24), - property: deserializeExpression(pos + 40), - optional: deserializeBool(pos + 56), + object: deserializeExpression(pos + 8), + property: deserializeExpression(pos + 24), + optional: deserializeBool(pos + 40), computed: true, }; } @@ -229,10 +218,9 @@ function deserializeStaticMemberExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - object: deserializeExpression(pos + 24), - property: deserializeIdentifierName(pos + 40), - optional: deserializeBool(pos + 80), + object: deserializeExpression(pos + 8), + property: deserializeIdentifierName(pos + 24), + optional: deserializeBool(pos + 48), computed: false, }; } @@ -242,10 +230,9 @@ function deserializePrivateFieldExpression(pos) { type: 'MemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - object: deserializeExpression(pos + 24), - property: deserializePrivateIdentifier(pos + 40), - optional: deserializeBool(pos + 80), + object: deserializeExpression(pos + 8), + property: deserializePrivateIdentifier(pos + 24), + optional: deserializeBool(pos + 48), computed: false, }; } @@ -255,11 +242,10 @@ function deserializeCallExpression(pos) { type: 'CallExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - callee: deserializeExpression(pos + 24), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), - arguments: deserializeVecArgument(pos + 48), - optional: deserializeBool(pos + 72), + callee: deserializeExpression(pos + 8), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), + arguments: deserializeVecArgument(pos + 32), + optional: deserializeBool(pos + 56), }; } @@ -268,10 +254,9 @@ function deserializeNewExpression(pos) { type: 'NewExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - callee: deserializeExpression(pos + 24), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), - arguments: deserializeVecArgument(pos + 48), + callee: deserializeExpression(pos + 8), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), + arguments: deserializeVecArgument(pos + 32), }; } @@ -280,9 +265,8 @@ function deserializeMetaProperty(pos) { type: 'MetaProperty', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - meta: deserializeIdentifierName(pos + 24), - property: deserializeIdentifierName(pos + 64), + meta: deserializeIdentifierName(pos + 8), + property: deserializeIdentifierName(pos + 32), }; } @@ -291,8 +275,7 @@ function deserializeSpreadElement(pos) { type: 'SpreadElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - argument: deserializeExpression(pos + 24), + argument: deserializeExpression(pos + 8), }; } @@ -301,10 +284,9 @@ function deserializeUpdateExpression(pos) { type: 'UpdateExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - operator: deserializeUpdateOperator(pos + 40), - prefix: deserializeBool(pos + 41), - argument: deserializeSimpleAssignmentTarget(pos + 24), + operator: deserializeUpdateOperator(pos + 24), + prefix: deserializeBool(pos + 25), + argument: deserializeSimpleAssignmentTarget(pos + 8), }; } @@ -313,9 +295,8 @@ function deserializeUnaryExpression(pos) { type: 'UnaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - operator: deserializeUnaryOperator(pos + 40), - argument: deserializeExpression(pos + 24), + operator: deserializeUnaryOperator(pos + 24), + argument: deserializeExpression(pos + 8), prefix: true, }; } @@ -325,10 +306,9 @@ function deserializeBinaryExpression(pos) { type: 'BinaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - left: deserializeExpression(pos + 24), - operator: deserializeBinaryOperator(pos + 56), - right: deserializeExpression(pos + 40), + left: deserializeExpression(pos + 8), + operator: deserializeBinaryOperator(pos + 40), + right: deserializeExpression(pos + 24), }; } @@ -337,10 +317,9 @@ function deserializePrivateInExpression(pos) { type: 'BinaryExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - left: deserializePrivateIdentifier(pos + 24), + left: deserializePrivateIdentifier(pos + 8), operator: 'in', - right: deserializeExpression(pos + 64), + right: deserializeExpression(pos + 32), }; } @@ -349,10 +328,9 @@ function deserializeLogicalExpression(pos) { type: 'LogicalExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - left: deserializeExpression(pos + 24), - operator: deserializeLogicalOperator(pos + 56), - right: deserializeExpression(pos + 40), + left: deserializeExpression(pos + 8), + operator: deserializeLogicalOperator(pos + 40), + right: deserializeExpression(pos + 24), }; } @@ -361,10 +339,9 @@ function deserializeConditionalExpression(pos) { type: 'ConditionalExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - test: deserializeExpression(pos + 24), - consequent: deserializeExpression(pos + 40), - alternate: deserializeExpression(pos + 56), + test: deserializeExpression(pos + 8), + consequent: deserializeExpression(pos + 24), + alternate: deserializeExpression(pos + 40), }; } @@ -373,22 +350,20 @@ function deserializeAssignmentExpression(pos) { type: 'AssignmentExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - operator: deserializeAssignmentOperator(pos + 56), - left: deserializeAssignmentTarget(pos + 24), - right: deserializeExpression(pos + 40), + operator: deserializeAssignmentOperator(pos + 40), + left: deserializeAssignmentTarget(pos + 8), + right: deserializeExpression(pos + 24), }; } function deserializeArrayAssignmentTarget(pos) { - const elements = deserializeVecOptionAssignmentTargetMaybeDefault(pos + 24); - const rest = deserializeOptionAssignmentTargetRest(pos + 48); + const elements = deserializeVecOptionAssignmentTargetMaybeDefault(pos + 8); + const rest = deserializeOptionAssignmentTargetRest(pos + 32); if (rest !== null) elements.push(rest); return { type: 'ArrayPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], elements, optional: false, @@ -397,14 +372,13 @@ function deserializeArrayAssignmentTarget(pos) { } function deserializeObjectAssignmentTarget(pos) { - const properties = deserializeVecAssignmentTargetProperty(pos + 24); - const rest = deserializeOptionAssignmentTargetRest(pos + 48); + const properties = deserializeVecAssignmentTargetProperty(pos + 8); + const rest = deserializeOptionAssignmentTargetRest(pos + 32); if (rest !== null) properties.push(rest); return { type: 'ObjectPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], properties, optional: false, @@ -417,9 +391,8 @@ function deserializeAssignmentTargetRest(pos) { type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], - argument: deserializeAssignmentTarget(pos + 24), + argument: deserializeAssignmentTarget(pos + 8), optional: false, typeAnnotation: null, value: null, @@ -431,10 +404,9 @@ function deserializeAssignmentTargetWithDefault(pos) { type: 'AssignmentPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], - left: deserializeAssignmentTarget(pos + 24), - right: deserializeExpression(pos + 40), + left: deserializeAssignmentTarget(pos + 8), + right: deserializeExpression(pos + 24), optional: false, typeAnnotation: null, }; @@ -443,8 +415,8 @@ function deserializeAssignmentTargetWithDefault(pos) { function deserializeAssignmentTargetPropertyIdentifier(pos) { const start = deserializeU32(pos), end = deserializeU32(pos + 4), - key = deserializeIdentifierReference(pos + 24); - const init = deserializeOptionExpression(pos + 72), + key = deserializeIdentifierReference(pos + 8); + const init = deserializeOptionExpression(pos + 40), keyCopy = { ...key }, value = init === null ? keyCopy @@ -462,7 +434,6 @@ function deserializeAssignmentTargetPropertyIdentifier(pos) { type: 'Property', start, end, - range: deserializeOptionRangeArray(pos + 8), kind: 'init', key, value, @@ -478,13 +449,12 @@ function deserializeAssignmentTargetPropertyProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), kind: 'init', - key: deserializePropertyKey(pos + 24), - value: deserializeAssignmentTargetMaybeDefault(pos + 40), + key: deserializePropertyKey(pos + 8), + value: deserializeAssignmentTargetMaybeDefault(pos + 24), method: false, shorthand: false, - computed: deserializeBool(pos + 56), + computed: deserializeBool(pos + 40), optional: false, }; } @@ -494,8 +464,7 @@ function deserializeSequenceExpression(pos) { type: 'SequenceExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expressions: deserializeVecExpression(pos + 24), + expressions: deserializeVecExpression(pos + 8), }; } @@ -504,7 +473,6 @@ function deserializeSuper(pos) { type: 'Super', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -513,8 +481,7 @@ function deserializeAwaitExpression(pos) { type: 'AwaitExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - argument: deserializeExpression(pos + 24), + argument: deserializeExpression(pos + 8), }; } @@ -523,8 +490,7 @@ function deserializeChainExpression(pos) { type: 'ChainExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeChainElement(pos + 24), + expression: deserializeChainElement(pos + 8), }; } @@ -533,8 +499,7 @@ function deserializeParenthesizedExpression(pos) { type: 'ParenthesizedExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), + expression: deserializeExpression(pos + 8), }; } @@ -543,9 +508,8 @@ function deserializeDirective(pos) { type: 'ExpressionStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeStringLiteral(pos + 24), - directive: deserializeStr(pos + 88), + expression: deserializeStringLiteral(pos + 8), + directive: deserializeStr(pos + 56), }; } @@ -554,8 +518,7 @@ function deserializeHashbang(pos) { type: 'Hashbang', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - value: deserializeStr(pos + 24), + value: deserializeStr(pos + 8), }; } @@ -564,8 +527,7 @@ function deserializeBlockStatement(pos) { type: 'BlockStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - body: deserializeVecStatement(pos + 24), + body: deserializeVecStatement(pos + 8), }; } @@ -574,10 +536,9 @@ function deserializeVariableDeclaration(pos) { type: 'VariableDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - kind: deserializeVariableDeclarationKind(pos + 48), - declarations: deserializeVecVariableDeclarator(pos + 24), - declare: deserializeBool(pos + 49), + kind: deserializeVariableDeclarationKind(pos + 32), + declarations: deserializeVecVariableDeclarator(pos + 8), + declare: deserializeBool(pos + 33), }; } @@ -586,10 +547,9 @@ function deserializeVariableDeclarator(pos) { type: 'VariableDeclarator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeBindingPattern(pos + 24), - init: deserializeOptionExpression(pos + 56), - definite: deserializeBool(pos + 73), + id: deserializeBindingPattern(pos + 8), + init: deserializeOptionExpression(pos + 40), + definite: deserializeBool(pos + 57), }; } @@ -598,7 +558,6 @@ function deserializeEmptyStatement(pos) { type: 'EmptyStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -607,8 +566,7 @@ function deserializeExpressionStatement(pos) { type: 'ExpressionStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), + expression: deserializeExpression(pos + 8), directive: null, }; } @@ -618,10 +576,9 @@ function deserializeIfStatement(pos) { type: 'IfStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - test: deserializeExpression(pos + 24), - consequent: deserializeStatement(pos + 40), - alternate: deserializeOptionStatement(pos + 56), + test: deserializeExpression(pos + 8), + consequent: deserializeStatement(pos + 24), + alternate: deserializeOptionStatement(pos + 40), }; } @@ -630,9 +587,8 @@ function deserializeDoWhileStatement(pos) { type: 'DoWhileStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - body: deserializeStatement(pos + 24), - test: deserializeExpression(pos + 40), + body: deserializeStatement(pos + 8), + test: deserializeExpression(pos + 24), }; } @@ -641,9 +597,8 @@ function deserializeWhileStatement(pos) { type: 'WhileStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - test: deserializeExpression(pos + 24), - body: deserializeStatement(pos + 40), + test: deserializeExpression(pos + 8), + body: deserializeStatement(pos + 24), }; } @@ -652,11 +607,10 @@ function deserializeForStatement(pos) { type: 'ForStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - init: deserializeOptionForStatementInit(pos + 24), - test: deserializeOptionExpression(pos + 40), - update: deserializeOptionExpression(pos + 56), - body: deserializeStatement(pos + 72), + init: deserializeOptionForStatementInit(pos + 8), + test: deserializeOptionExpression(pos + 24), + update: deserializeOptionExpression(pos + 40), + body: deserializeStatement(pos + 56), }; } @@ -665,10 +619,9 @@ function deserializeForInStatement(pos) { type: 'ForInStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - left: deserializeForStatementLeft(pos + 24), - right: deserializeExpression(pos + 40), - body: deserializeStatement(pos + 56), + left: deserializeForStatementLeft(pos + 8), + right: deserializeExpression(pos + 24), + body: deserializeStatement(pos + 40), }; } @@ -677,11 +630,10 @@ function deserializeForOfStatement(pos) { type: 'ForOfStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - await: deserializeBool(pos + 76), - left: deserializeForStatementLeft(pos + 24), - right: deserializeExpression(pos + 40), - body: deserializeStatement(pos + 56), + await: deserializeBool(pos + 60), + left: deserializeForStatementLeft(pos + 8), + right: deserializeExpression(pos + 24), + body: deserializeStatement(pos + 40), }; } @@ -690,8 +642,7 @@ function deserializeContinueStatement(pos) { type: 'ContinueStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - label: deserializeOptionLabelIdentifier(pos + 24), + label: deserializeOptionLabelIdentifier(pos + 8), }; } @@ -700,8 +651,7 @@ function deserializeBreakStatement(pos) { type: 'BreakStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - label: deserializeOptionLabelIdentifier(pos + 24), + label: deserializeOptionLabelIdentifier(pos + 8), }; } @@ -710,8 +660,7 @@ function deserializeReturnStatement(pos) { type: 'ReturnStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - argument: deserializeOptionExpression(pos + 24), + argument: deserializeOptionExpression(pos + 8), }; } @@ -720,9 +669,8 @@ function deserializeWithStatement(pos) { type: 'WithStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - object: deserializeExpression(pos + 24), - body: deserializeStatement(pos + 40), + object: deserializeExpression(pos + 8), + body: deserializeStatement(pos + 24), }; } @@ -731,9 +679,8 @@ function deserializeSwitchStatement(pos) { type: 'SwitchStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - discriminant: deserializeExpression(pos + 24), - cases: deserializeVecSwitchCase(pos + 40), + discriminant: deserializeExpression(pos + 8), + cases: deserializeVecSwitchCase(pos + 24), }; } @@ -742,9 +689,8 @@ function deserializeSwitchCase(pos) { type: 'SwitchCase', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - test: deserializeOptionExpression(pos + 24), - consequent: deserializeVecStatement(pos + 40), + test: deserializeOptionExpression(pos + 8), + consequent: deserializeVecStatement(pos + 24), }; } @@ -753,9 +699,8 @@ function deserializeLabeledStatement(pos) { type: 'LabeledStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - label: deserializeLabelIdentifier(pos + 24), - body: deserializeStatement(pos + 64), + label: deserializeLabelIdentifier(pos + 8), + body: deserializeStatement(pos + 32), }; } @@ -764,8 +709,7 @@ function deserializeThrowStatement(pos) { type: 'ThrowStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - argument: deserializeExpression(pos + 24), + argument: deserializeExpression(pos + 8), }; } @@ -774,10 +718,9 @@ function deserializeTryStatement(pos) { type: 'TryStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - block: deserializeBoxBlockStatement(pos + 24), - handler: deserializeOptionBoxCatchClause(pos + 32), - finalizer: deserializeOptionBoxBlockStatement(pos + 40), + block: deserializeBoxBlockStatement(pos + 8), + handler: deserializeOptionBoxCatchClause(pos + 16), + finalizer: deserializeOptionBoxBlockStatement(pos + 24), }; } @@ -786,14 +729,13 @@ function deserializeCatchClause(pos) { type: 'CatchClause', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - param: deserializeOptionCatchParameter(pos + 24), - body: deserializeBoxBlockStatement(pos + 80), + param: deserializeOptionCatchParameter(pos + 8), + body: deserializeBoxBlockStatement(pos + 48), }; } function deserializeCatchParameter(pos) { - return deserializeBindingPattern(pos + 24); + return deserializeBindingPattern(pos + 8); } function deserializeDebuggerStatement(pos) { @@ -801,7 +743,6 @@ function deserializeDebuggerStatement(pos) { type: 'DebuggerStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -817,24 +758,22 @@ function deserializeAssignmentPattern(pos) { type: 'AssignmentPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], - left: deserializeBindingPattern(pos + 24), - right: deserializeExpression(pos + 56), + left: deserializeBindingPattern(pos + 8), + right: deserializeExpression(pos + 40), optional: false, typeAnnotation: null, }; } function deserializeObjectPattern(pos) { - const properties = deserializeVecBindingProperty(pos + 24); - const rest = deserializeOptionBoxBindingRestElement(pos + 48); + const properties = deserializeVecBindingProperty(pos + 8); + const rest = deserializeOptionBoxBindingRestElement(pos + 32); if (rest !== null) properties.push(rest); return { type: 'ObjectPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], properties, optional: false, @@ -847,26 +786,24 @@ function deserializeBindingProperty(pos) { type: 'Property', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), kind: 'init', - key: deserializePropertyKey(pos + 24), - value: deserializeBindingPattern(pos + 40), + key: deserializePropertyKey(pos + 8), + value: deserializeBindingPattern(pos + 24), method: false, - shorthand: deserializeBool(pos + 72), - computed: deserializeBool(pos + 73), + shorthand: deserializeBool(pos + 56), + computed: deserializeBool(pos + 57), optional: false, }; } function deserializeArrayPattern(pos) { - const elements = deserializeVecOptionBindingPattern(pos + 24); - const rest = deserializeOptionBoxBindingRestElement(pos + 48); + const elements = deserializeVecOptionBindingPattern(pos + 8); + const rest = deserializeOptionBoxBindingRestElement(pos + 32); if (rest !== null) elements.push(rest); return { type: 'ArrayPattern', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], elements, optional: false, @@ -879,9 +816,8 @@ function deserializeBindingRestElement(pos) { type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], - argument: deserializeBindingPattern(pos + 24), + argument: deserializeBindingPattern(pos + 8), optional: false, typeAnnotation: null, value: null, @@ -889,39 +825,38 @@ function deserializeBindingRestElement(pos) { } function deserializeFunction(pos) { - const params = deserializeBoxFormalParameters(pos + 88); - const thisParam = deserializeOptionBoxTSThisParameter(pos + 80); + const params = deserializeBoxFormalParameters(pos + 56); + const thisParam = deserializeOptionBoxTSThisParameter(pos + 48); if (thisParam !== null) params.unshift(thisParam); return { - type: deserializeFunctionType(pos + 116), + type: deserializeFunctionType(pos + 84), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeOptionBindingIdentifier(pos + 24), - generator: deserializeBool(pos + 117), - async: deserializeBool(pos + 118), - declare: deserializeBool(pos + 119), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), + id: deserializeOptionBindingIdentifier(pos + 8), + generator: deserializeBool(pos + 85), + async: deserializeBool(pos + 86), + declare: deserializeBool(pos + 87), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40), params, - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 96), - body: deserializeOptionBoxFunctionBody(pos + 104), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 64), + body: deserializeOptionBoxFunctionBody(pos + 72), expression: false, }; } function deserializeFormalParameters(pos) { - const params = deserializeVecFormalParameter(pos + 24); - if (uint32[(pos + 48) >> 2] !== 0 && uint32[(pos + 52) >> 2] !== 0) { - pos = uint32[(pos + 48) >> 2]; + const params = deserializeVecFormalParameter(pos + 8); + if (uint32[(pos + 32) >> 2] !== 0 && uint32[(pos + 36) >> 2] !== 0) { + pos = uint32[(pos + 32) >> 2]; params.push({ type: 'RestElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), decorators: [], - argument: deserializeBindingPatternKind(pos + 24), - optional: deserializeBool(pos + 48), + argument: deserializeBindingPatternKind(pos + 8), + optional: deserializeBool(pos + 32), typeAnnotation: deserializeOptionBoxTSTypeAnnotation( - pos + 40, + pos + 24, ), value: null, }); @@ -930,24 +865,24 @@ function deserializeFormalParameters(pos) { } function deserializeFormalParameter(pos) { - const accessibility = deserializeOptionTSAccessibility(pos + 80), - readonly = deserializeBool(pos + 81), - override = deserializeBool(pos + 82); + const accessibility = deserializeOptionTSAccessibility(pos + 64), + readonly = deserializeBool(pos + 65), + override = deserializeBool(pos + 66); let param; if (accessibility === null && !readonly && !override) { - param = deserializeBindingPatternKind(pos + 48); - param.decorators = deserializeVecDecorator(pos + 24); - param.optional = deserializeBool(pos + 72); - param.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 64); + param = deserializeBindingPatternKind(pos + 32); + param.decorators = deserializeVecDecorator(pos + 8); + param.optional = deserializeBool(pos + 56); + param.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 48); } else { param = { type: 'TSParameterProperty', start: deserializeU32(pos), end: deserializeU32(pos + 4), accessibility, - decorators: deserializeVecDecorator(pos + 24), + decorators: deserializeVecDecorator(pos + 8), override, - parameter: deserializeBindingPattern(pos + 48), + parameter: deserializeBindingPattern(pos + 32), readonly, static: false, }; @@ -956,30 +891,28 @@ function deserializeFormalParameter(pos) { } function deserializeFunctionBody(pos) { - const body = deserializeVecDirective(pos + 24); - body.push(...deserializeVecStatement(pos + 48)); + const body = deserializeVecDirective(pos + 8); + body.push(...deserializeVecStatement(pos + 32)); return { type: 'BlockStatement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), body, }; } function deserializeArrowFunctionExpression(pos) { - const expression = deserializeBool(pos + 60); - let body = deserializeBoxFunctionBody(pos + 48); + const expression = deserializeBool(pos + 44); + let body = deserializeBoxFunctionBody(pos + 32); return { type: 'ArrowFunctionExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), expression, - async: deserializeBool(pos + 61), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), - params: deserializeBoxFormalParameters(pos + 32), - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 40), + async: deserializeBool(pos + 45), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), + params: deserializeBoxFormalParameters(pos + 16), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 24), body: expression ? body.body[0].expression : body, id: null, generator: false, @@ -991,27 +924,25 @@ function deserializeYieldExpression(pos) { type: 'YieldExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - delegate: deserializeBool(pos + 40), - argument: deserializeOptionExpression(pos + 24), + delegate: deserializeBool(pos + 24), + argument: deserializeOptionExpression(pos + 8), }; } function deserializeClass(pos) { return { - type: deserializeClassType(pos + 164), + type: deserializeClassType(pos + 132), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - decorators: deserializeVecDecorator(pos + 24), - id: deserializeOptionBindingIdentifier(pos + 48), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 96), - superClass: deserializeOptionExpression(pos + 104), - superTypeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 120), - implements: deserializeVecTSClassImplements(pos + 128), - body: deserializeBoxClassBody(pos + 152), - abstract: deserializeBool(pos + 165), - declare: deserializeBool(pos + 166), + decorators: deserializeVecDecorator(pos + 8), + id: deserializeOptionBindingIdentifier(pos + 32), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 64), + superClass: deserializeOptionExpression(pos + 72), + superTypeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 88), + implements: deserializeVecTSClassImplements(pos + 96), + body: deserializeBoxClassBody(pos + 120), + abstract: deserializeBool(pos + 133), + declare: deserializeBool(pos + 134), }; } @@ -1020,47 +951,44 @@ function deserializeClassBody(pos) { type: 'ClassBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - body: deserializeVecClassElement(pos + 24), + body: deserializeVecClassElement(pos + 8), }; } function deserializeMethodDefinition(pos) { return { - type: deserializeMethodDefinitionType(pos + 72), + type: deserializeMethodDefinitionType(pos + 56), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - decorators: deserializeVecDecorator(pos + 24), - key: deserializePropertyKey(pos + 48), - value: deserializeBoxFunction(pos + 64), - kind: deserializeMethodDefinitionKind(pos + 73), - computed: deserializeBool(pos + 74), - static: deserializeBool(pos + 75), - override: deserializeBool(pos + 76), - optional: deserializeBool(pos + 77), - accessibility: deserializeOptionTSAccessibility(pos + 78), + decorators: deserializeVecDecorator(pos + 8), + key: deserializePropertyKey(pos + 32), + value: deserializeBoxFunction(pos + 48), + kind: deserializeMethodDefinitionKind(pos + 57), + computed: deserializeBool(pos + 58), + static: deserializeBool(pos + 59), + override: deserializeBool(pos + 60), + optional: deserializeBool(pos + 61), + accessibility: deserializeOptionTSAccessibility(pos + 62), }; } function deserializePropertyDefinition(pos) { return { - type: deserializePropertyDefinitionType(pos + 88), + type: deserializePropertyDefinitionType(pos + 72), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - decorators: deserializeVecDecorator(pos + 24), - key: deserializePropertyKey(pos + 48), - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 64), - value: deserializeOptionExpression(pos + 72), - computed: deserializeBool(pos + 89), - static: deserializeBool(pos + 90), - declare: deserializeBool(pos + 91), - override: deserializeBool(pos + 92), - optional: deserializeBool(pos + 93), - definite: deserializeBool(pos + 94), - readonly: deserializeBool(pos + 95), - accessibility: deserializeOptionTSAccessibility(pos + 96), + decorators: deserializeVecDecorator(pos + 8), + key: deserializePropertyKey(pos + 32), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 48), + value: deserializeOptionExpression(pos + 56), + computed: deserializeBool(pos + 73), + static: deserializeBool(pos + 74), + declare: deserializeBool(pos + 75), + override: deserializeBool(pos + 76), + optional: deserializeBool(pos + 77), + definite: deserializeBool(pos + 78), + readonly: deserializeBool(pos + 79), + accessibility: deserializeOptionTSAccessibility(pos + 80), }; } @@ -1069,8 +997,7 @@ function deserializePrivateIdentifier(pos) { type: 'PrivateIdentifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeStr(pos + 24), + name: deserializeStr(pos + 8), }; } @@ -1079,26 +1006,24 @@ function deserializeStaticBlock(pos) { type: 'StaticBlock', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - body: deserializeVecStatement(pos + 24), + body: deserializeVecStatement(pos + 8), }; } function deserializeAccessorProperty(pos) { return { - type: deserializeAccessorPropertyType(pos + 88), + type: deserializeAccessorPropertyType(pos + 72), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - decorators: deserializeVecDecorator(pos + 24), - key: deserializePropertyKey(pos + 48), - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 64), - value: deserializeOptionExpression(pos + 72), - computed: deserializeBool(pos + 89), - static: deserializeBool(pos + 90), - override: deserializeBool(pos + 91), - definite: deserializeBool(pos + 92), - accessibility: deserializeOptionTSAccessibility(pos + 93), + decorators: deserializeVecDecorator(pos + 8), + key: deserializePropertyKey(pos + 32), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 48), + value: deserializeOptionExpression(pos + 56), + computed: deserializeBool(pos + 73), + static: deserializeBool(pos + 74), + override: deserializeBool(pos + 75), + definite: deserializeBool(pos + 76), + accessibility: deserializeOptionTSAccessibility(pos + 77), declare: false, optional: false, readonly: false, @@ -1110,27 +1035,25 @@ function deserializeImportExpression(pos) { type: 'ImportExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - source: deserializeExpression(pos + 24), - options: deserializeOptionExpression(pos + 40), - phase: deserializeOptionImportPhase(pos + 56), + source: deserializeExpression(pos + 8), + options: deserializeOptionExpression(pos + 24), + phase: deserializeOptionImportPhase(pos + 40), }; } function deserializeImportDeclaration(pos) { - let specifiers = deserializeOptionVecImportDeclarationSpecifier(pos + 24); + let specifiers = deserializeOptionVecImportDeclarationSpecifier(pos + 8); if (specifiers === null) specifiers = []; - const withClause = deserializeOptionBoxWithClause(pos + 112); + const withClause = deserializeOptionBoxWithClause(pos + 80); return { type: 'ImportDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), specifiers, - source: deserializeStringLiteral(pos + 48), - phase: deserializeOptionImportPhase(pos + 120), + source: deserializeStringLiteral(pos + 32), + phase: deserializeOptionImportPhase(pos + 88), attributes: withClause === null ? [] : withClause.attributes, - importKind: deserializeImportOrExportKind(pos + 121), + importKind: deserializeImportOrExportKind(pos + 89), }; } @@ -1139,10 +1062,9 @@ function deserializeImportSpecifier(pos) { type: 'ImportSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - imported: deserializeModuleExportName(pos + 24), - local: deserializeBindingIdentifier(pos + 96), - importKind: deserializeImportOrExportKind(pos + 144), + imported: deserializeModuleExportName(pos + 8), + local: deserializeBindingIdentifier(pos + 64), + importKind: deserializeImportOrExportKind(pos + 96), }; } @@ -1151,8 +1073,7 @@ function deserializeImportDefaultSpecifier(pos) { type: 'ImportDefaultSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - local: deserializeBindingIdentifier(pos + 24), + local: deserializeBindingIdentifier(pos + 8), }; } @@ -1161,14 +1082,13 @@ function deserializeImportNamespaceSpecifier(pos) { type: 'ImportNamespaceSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - local: deserializeBindingIdentifier(pos + 24), + local: deserializeBindingIdentifier(pos + 8), }; } function deserializeWithClause(pos) { return { - attributes: deserializeVecImportAttribute(pos + 64), + attributes: deserializeVecImportAttribute(pos + 32), }; } @@ -1177,23 +1097,21 @@ function deserializeImportAttribute(pos) { type: 'ImportAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - key: deserializeImportAttributeKey(pos + 24), - value: deserializeStringLiteral(pos + 96), + key: deserializeImportAttributeKey(pos + 8), + value: deserializeStringLiteral(pos + 64), }; } function deserializeExportNamedDeclaration(pos) { - const withClause = deserializeOptionBoxWithClause(pos + 128); + const withClause = deserializeOptionBoxWithClause(pos + 96); return { type: 'ExportNamedDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - declaration: deserializeOptionDeclaration(pos + 24), - specifiers: deserializeVecExportSpecifier(pos + 40), - source: deserializeOptionStringLiteral(pos + 64), - exportKind: deserializeImportOrExportKind(pos + 136), + declaration: deserializeOptionDeclaration(pos + 8), + specifiers: deserializeVecExportSpecifier(pos + 24), + source: deserializeOptionStringLiteral(pos + 48), + exportKind: deserializeImportOrExportKind(pos + 104), attributes: withClause === null ? [] : withClause.attributes, }; } @@ -1203,23 +1121,21 @@ function deserializeExportDefaultDeclaration(pos) { type: 'ExportDefaultDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - declaration: deserializeExportDefaultDeclarationKind(pos + 96), + declaration: deserializeExportDefaultDeclarationKind(pos + 64), exportKind: 'value', }; } function deserializeExportAllDeclaration(pos) { - const withClause = deserializeOptionBoxWithClause(pos + 160); + const withClause = deserializeOptionBoxWithClause(pos + 112); return { type: 'ExportAllDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - exported: deserializeOptionModuleExportName(pos + 24), - source: deserializeStringLiteral(pos + 96), + exported: deserializeOptionModuleExportName(pos + 8), + source: deserializeStringLiteral(pos + 64), attributes: withClause === null ? [] : withClause.attributes, - exportKind: deserializeImportOrExportKind(pos + 168), + exportKind: deserializeImportOrExportKind(pos + 120), }; } @@ -1228,10 +1144,9 @@ function deserializeExportSpecifier(pos) { type: 'ExportSpecifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - local: deserializeModuleExportName(pos + 24), - exported: deserializeModuleExportName(pos + 96), - exportKind: deserializeImportOrExportKind(pos + 168), + local: deserializeModuleExportName(pos + 8), + exported: deserializeModuleExportName(pos + 64), + exportKind: deserializeImportOrExportKind(pos + 120), }; } @@ -1240,21 +1155,19 @@ function deserializeV8IntrinsicExpression(pos) { type: 'V8IntrinsicExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeIdentifierName(pos + 24), - arguments: deserializeVecArgument(pos + 64), + name: deserializeIdentifierName(pos + 8), + arguments: deserializeVecArgument(pos + 32), }; } function deserializeBooleanLiteral(pos) { const start = deserializeU32(pos), end = deserializeU32(pos + 4), - value = deserializeBool(pos + 24); + value = deserializeBool(pos + 8); return { type: 'Literal', start, end, - range: deserializeOptionRangeArray(pos + 8), value, raw: (start === 0 && end === 0) ? null : value + '', }; @@ -1267,7 +1180,6 @@ function deserializeNullLiteral(pos) { type: 'Literal', start, end, - range: deserializeOptionRangeArray(pos + 8), value: null, raw: (start === 0 && end === 0) ? null : 'null', }; @@ -1278,42 +1190,39 @@ function deserializeNumericLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - value: deserializeF64(pos + 24), - raw: deserializeOptionStr(pos + 32), + value: deserializeF64(pos + 8), + raw: deserializeOptionStr(pos + 16), }; } function deserializeStringLiteral(pos) { - let value = deserializeStr(pos + 24); - if (deserializeBool(pos + 56)) { + let value = deserializeStr(pos + 8); + if (deserializeBool(pos + 40)) { value = value.replace(/\uFFFD(.{4})/g, (_, hex) => String.fromCodePoint(parseInt(hex, 16))); } return { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), value, - raw: deserializeOptionStr(pos + 40), + raw: deserializeOptionStr(pos + 24), }; } function deserializeBigIntLiteral(pos) { - const bigint = deserializeStr(pos + 24); + const bigint = deserializeStr(pos + 8); return { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), value: BigInt(bigint), - raw: deserializeOptionStr(pos + 40), + raw: deserializeOptionStr(pos + 24), bigint, }; } function deserializeRegExpLiteral(pos) { - const regex = deserializeRegExp(pos + 24); + const regex = deserializeRegExp(pos + 8); let value = null; try { value = new RegExp(regex.pattern, regex.flags); @@ -1322,9 +1231,8 @@ function deserializeRegExpLiteral(pos) { type: 'Literal', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), value, - raw: deserializeOptionStr(pos + 56), + raw: deserializeOptionStr(pos + 40), regex, }; } @@ -1358,16 +1266,15 @@ function deserializeRegExpFlags(pos) { } function deserializeJSXElement(pos) { - const closingElement = deserializeOptionBoxJSXClosingElement(pos + 56); - const openingElement = deserializeBoxJSXOpeningElement(pos + 24); + const closingElement = deserializeOptionBoxJSXClosingElement(pos + 40); + const openingElement = deserializeBoxJSXOpeningElement(pos + 8); if (closingElement === null) openingElement.selfClosing = true; return { type: 'JSXElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), openingElement, - children: deserializeVecJSXChild(pos + 32), + children: deserializeVecJSXChild(pos + 16), closingElement, }; } @@ -1377,10 +1284,9 @@ function deserializeJSXOpeningElement(pos) { type: 'JSXOpeningElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeJSXElementName(pos + 24), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), - attributes: deserializeVecJSXAttributeItem(pos + 48), + name: deserializeJSXElementName(pos + 8), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), + attributes: deserializeVecJSXAttributeItem(pos + 32), selfClosing: false, }; } @@ -1390,8 +1296,7 @@ function deserializeJSXClosingElement(pos) { type: 'JSXClosingElement', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeJSXElementName(pos + 24), + name: deserializeJSXElementName(pos + 8), }; } @@ -1400,10 +1305,9 @@ function deserializeJSXFragment(pos) { type: 'JSXFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - openingFragment: deserializeJSXOpeningFragment(pos + 24), - children: deserializeVecJSXChild(pos + 48), - closingFragment: deserializeJSXClosingFragment(pos + 72), + openingFragment: deserializeJSXOpeningFragment(pos + 8), + children: deserializeVecJSXChild(pos + 16), + closingFragment: deserializeJSXClosingFragment(pos + 40), }; } @@ -1412,7 +1316,6 @@ function deserializeJSXOpeningFragment(pos) { type: 'JSXOpeningFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1421,7 +1324,6 @@ function deserializeJSXClosingFragment(pos) { type: 'JSXClosingFragment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1430,9 +1332,8 @@ function deserializeJSXNamespacedName(pos) { type: 'JSXNamespacedName', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - namespace: deserializeJSXIdentifier(pos + 24), - name: deserializeJSXIdentifier(pos + 64), + namespace: deserializeJSXIdentifier(pos + 8), + name: deserializeJSXIdentifier(pos + 32), }; } @@ -1441,9 +1342,8 @@ function deserializeJSXMemberExpression(pos) { type: 'JSXMemberExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - object: deserializeJSXMemberExpressionObject(pos + 24), - property: deserializeJSXIdentifier(pos + 40), + object: deserializeJSXMemberExpressionObject(pos + 8), + property: deserializeJSXIdentifier(pos + 24), }; } @@ -1452,8 +1352,7 @@ function deserializeJSXExpressionContainer(pos) { type: 'JSXExpressionContainer', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeJSXExpression(pos + 24), + expression: deserializeJSXExpression(pos + 8), }; } @@ -1462,7 +1361,6 @@ function deserializeJSXEmptyExpression(pos) { type: 'JSXEmptyExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1471,9 +1369,8 @@ function deserializeJSXAttribute(pos) { type: 'JSXAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeJSXAttributeName(pos + 24), - value: deserializeOptionJSXAttributeValue(pos + 40), + name: deserializeJSXAttributeName(pos + 8), + value: deserializeOptionJSXAttributeValue(pos + 24), }; } @@ -1482,8 +1379,7 @@ function deserializeJSXSpreadAttribute(pos) { type: 'JSXSpreadAttribute', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - argument: deserializeExpression(pos + 24), + argument: deserializeExpression(pos + 8), }; } @@ -1492,8 +1388,7 @@ function deserializeJSXIdentifier(pos) { type: 'JSXIdentifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeStr(pos + 24), + name: deserializeStr(pos + 8), }; } @@ -1502,8 +1397,7 @@ function deserializeJSXSpreadChild(pos) { type: 'JSXSpreadChild', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), + expression: deserializeExpression(pos + 8), }; } @@ -1512,9 +1406,8 @@ function deserializeJSXText(pos) { type: 'JSXText', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - value: deserializeStr(pos + 24), - raw: deserializeOptionStr(pos + 40), + value: deserializeStr(pos + 8), + raw: deserializeOptionStr(pos + 24), }; } @@ -1523,11 +1416,10 @@ function deserializeTSThisParameter(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], name: 'this', optional: false, - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 48), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 16), }; } @@ -1536,11 +1428,10 @@ function deserializeTSEnumDeclaration(pos) { type: 'TSEnumDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeBindingIdentifier(pos + 24), - body: deserializeTSEnumBody(pos + 72), - const: deserializeBool(pos + 124), - declare: deserializeBool(pos + 125), + id: deserializeBindingIdentifier(pos + 8), + body: deserializeTSEnumBody(pos + 40), + const: deserializeBool(pos + 76), + declare: deserializeBool(pos + 77), }; } @@ -1549,8 +1440,7 @@ function deserializeTSEnumBody(pos) { type: 'TSEnumBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - members: deserializeVecTSEnumMember(pos + 24), + members: deserializeVecTSEnumMember(pos + 8), }; } @@ -1559,10 +1449,9 @@ function deserializeTSEnumMember(pos) { type: 'TSEnumMember', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeTSEnumMemberName(pos + 24), - initializer: deserializeOptionExpression(pos + 40), - computed: deserializeU8(pos + 24) > 1, + id: deserializeTSEnumMemberName(pos + 8), + initializer: deserializeOptionExpression(pos + 24), + computed: deserializeU8(pos + 8) > 1, }; } @@ -1571,8 +1460,7 @@ function deserializeTSTypeAnnotation(pos) { type: 'TSTypeAnnotation', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), + typeAnnotation: deserializeTSType(pos + 8), }; } @@ -1581,8 +1469,7 @@ function deserializeTSLiteralType(pos) { type: 'TSLiteralType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - literal: deserializeTSLiteral(pos + 24), + literal: deserializeTSLiteral(pos + 8), }; } @@ -1591,11 +1478,10 @@ function deserializeTSConditionalType(pos) { type: 'TSConditionalType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - checkType: deserializeTSType(pos + 24), - extendsType: deserializeTSType(pos + 40), - trueType: deserializeTSType(pos + 56), - falseType: deserializeTSType(pos + 72), + checkType: deserializeTSType(pos + 8), + extendsType: deserializeTSType(pos + 24), + trueType: deserializeTSType(pos + 40), + falseType: deserializeTSType(pos + 56), }; } @@ -1604,8 +1490,7 @@ function deserializeTSUnionType(pos) { type: 'TSUnionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - types: deserializeVecTSType(pos + 24), + types: deserializeVecTSType(pos + 8), }; } @@ -1614,8 +1499,7 @@ function deserializeTSIntersectionType(pos) { type: 'TSIntersectionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - types: deserializeVecTSType(pos + 24), + types: deserializeVecTSType(pos + 8), }; } @@ -1624,8 +1508,7 @@ function deserializeTSParenthesizedType(pos) { type: 'TSParenthesizedType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), + typeAnnotation: deserializeTSType(pos + 8), }; } @@ -1634,9 +1517,8 @@ function deserializeTSTypeOperator(pos) { type: 'TSTypeOperator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - operator: deserializeTSTypeOperatorOperator(pos + 40), - typeAnnotation: deserializeTSType(pos + 24), + operator: deserializeTSTypeOperatorOperator(pos + 24), + typeAnnotation: deserializeTSType(pos + 8), }; } @@ -1645,8 +1527,7 @@ function deserializeTSArrayType(pos) { type: 'TSArrayType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - elementType: deserializeTSType(pos + 24), + elementType: deserializeTSType(pos + 8), }; } @@ -1655,9 +1536,8 @@ function deserializeTSIndexedAccessType(pos) { type: 'TSIndexedAccessType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - objectType: deserializeTSType(pos + 24), - indexType: deserializeTSType(pos + 40), + objectType: deserializeTSType(pos + 8), + indexType: deserializeTSType(pos + 24), }; } @@ -1666,8 +1546,7 @@ function deserializeTSTupleType(pos) { type: 'TSTupleType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - elementTypes: deserializeVecTSTupleElement(pos + 24), + elementTypes: deserializeVecTSTupleElement(pos + 8), }; } @@ -1676,10 +1555,9 @@ function deserializeTSNamedTupleMember(pos) { type: 'TSNamedTupleMember', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - label: deserializeIdentifierName(pos + 24), - elementType: deserializeTSTupleElement(pos + 64), - optional: deserializeBool(pos + 80), + label: deserializeIdentifierName(pos + 8), + elementType: deserializeTSTupleElement(pos + 32), + optional: deserializeBool(pos + 48), }; } @@ -1688,8 +1566,7 @@ function deserializeTSOptionalType(pos) { type: 'TSOptionalType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), + typeAnnotation: deserializeTSType(pos + 8), }; } @@ -1698,8 +1575,7 @@ function deserializeTSRestType(pos) { type: 'TSRestType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), + typeAnnotation: deserializeTSType(pos + 8), }; } @@ -1708,7 +1584,6 @@ function deserializeTSAnyKeyword(pos) { type: 'TSAnyKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1717,7 +1592,6 @@ function deserializeTSStringKeyword(pos) { type: 'TSStringKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1726,7 +1600,6 @@ function deserializeTSBooleanKeyword(pos) { type: 'TSBooleanKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1735,7 +1608,6 @@ function deserializeTSNumberKeyword(pos) { type: 'TSNumberKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1744,7 +1616,6 @@ function deserializeTSNeverKeyword(pos) { type: 'TSNeverKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1753,7 +1624,6 @@ function deserializeTSIntrinsicKeyword(pos) { type: 'TSIntrinsicKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1762,7 +1632,6 @@ function deserializeTSUnknownKeyword(pos) { type: 'TSUnknownKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1771,7 +1640,6 @@ function deserializeTSNullKeyword(pos) { type: 'TSNullKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1780,7 +1648,6 @@ function deserializeTSUndefinedKeyword(pos) { type: 'TSUndefinedKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1789,7 +1656,6 @@ function deserializeTSVoidKeyword(pos) { type: 'TSVoidKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1798,7 +1664,6 @@ function deserializeTSSymbolKeyword(pos) { type: 'TSSymbolKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1807,7 +1672,6 @@ function deserializeTSThisType(pos) { type: 'TSThisType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1816,7 +1680,6 @@ function deserializeTSObjectKeyword(pos) { type: 'TSObjectKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1825,7 +1688,6 @@ function deserializeTSBigIntKeyword(pos) { type: 'TSBigIntKeyword', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -1834,9 +1696,8 @@ function deserializeTSTypeReference(pos) { type: 'TSTypeReference', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeName: deserializeTSTypeName(pos + 24), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), + typeName: deserializeTSTypeName(pos + 8), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), }; } @@ -1845,9 +1706,8 @@ function deserializeTSQualifiedName(pos) { type: 'TSQualifiedName', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - left: deserializeTSTypeName(pos + 24), - right: deserializeIdentifierName(pos + 40), + left: deserializeTSTypeName(pos + 8), + right: deserializeIdentifierName(pos + 24), }; } @@ -1856,8 +1716,7 @@ function deserializeTSTypeParameterInstantiation(pos) { type: 'TSTypeParameterInstantiation', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - params: deserializeVecTSType(pos + 24), + params: deserializeVecTSType(pos + 8), }; } @@ -1866,13 +1725,12 @@ function deserializeTSTypeParameter(pos) { type: 'TSTypeParameter', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - name: deserializeBindingIdentifier(pos + 24), - constraint: deserializeOptionTSType(pos + 72), - default: deserializeOptionTSType(pos + 88), - in: deserializeBool(pos + 104), - out: deserializeBool(pos + 105), - const: deserializeBool(pos + 106), + name: deserializeBindingIdentifier(pos + 8), + constraint: deserializeOptionTSType(pos + 40), + default: deserializeOptionTSType(pos + 56), + in: deserializeBool(pos + 72), + out: deserializeBool(pos + 73), + const: deserializeBool(pos + 74), }; } @@ -1881,8 +1739,7 @@ function deserializeTSTypeParameterDeclaration(pos) { type: 'TSTypeParameterDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - params: deserializeVecTSTypeParameter(pos + 24), + params: deserializeVecTSTypeParameter(pos + 8), }; } @@ -1891,16 +1748,15 @@ function deserializeTSTypeAliasDeclaration(pos) { type: 'TSTypeAliasDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeBindingIdentifier(pos + 24), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), - typeAnnotation: deserializeTSType(pos + 80), - declare: deserializeBool(pos + 100), + id: deserializeBindingIdentifier(pos + 8), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40), + typeAnnotation: deserializeTSType(pos + 48), + declare: deserializeBool(pos + 68), }; } function deserializeTSClassImplements(pos) { - let expression = deserializeTSTypeName(pos + 24); + let expression = deserializeTSTypeName(pos + 8); if (expression.type === 'TSQualifiedName') { let parent = expression = { type: 'MemberExpression', @@ -1929,9 +1785,8 @@ function deserializeTSClassImplements(pos) { type: 'TSClassImplements', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), expression, - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), }; } @@ -1940,12 +1795,11 @@ function deserializeTSInterfaceDeclaration(pos) { type: 'TSInterfaceDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeBindingIdentifier(pos + 24), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), - extends: deserializeVecTSInterfaceHeritage(pos + 80), - body: deserializeBoxTSInterfaceBody(pos + 104), - declare: deserializeBool(pos + 116), + id: deserializeBindingIdentifier(pos + 8), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40), + extends: deserializeVecTSInterfaceHeritage(pos + 48), + body: deserializeBoxTSInterfaceBody(pos + 72), + declare: deserializeBool(pos + 84), }; } @@ -1954,8 +1808,7 @@ function deserializeTSInterfaceBody(pos) { type: 'TSInterfaceBody', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - body: deserializeVecTSSignature(pos + 24), + body: deserializeVecTSSignature(pos + 8), }; } @@ -1964,12 +1817,11 @@ function deserializeTSPropertySignature(pos) { type: 'TSPropertySignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - computed: deserializeBool(pos + 48), - optional: deserializeBool(pos + 49), - readonly: deserializeBool(pos + 50), - key: deserializePropertyKey(pos + 24), - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 40), + computed: deserializeBool(pos + 32), + optional: deserializeBool(pos + 33), + readonly: deserializeBool(pos + 34), + key: deserializePropertyKey(pos + 8), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 24), accessibility: null, static: false, }; @@ -1980,46 +1832,43 @@ function deserializeTSIndexSignature(pos) { type: 'TSIndexSignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - parameters: deserializeVecTSIndexSignatureName(pos + 24), - typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 48), - readonly: deserializeBool(pos + 56), - static: deserializeBool(pos + 57), + parameters: deserializeVecTSIndexSignatureName(pos + 8), + typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 32), + readonly: deserializeBool(pos + 40), + static: deserializeBool(pos + 41), accessibility: null, }; } function deserializeTSCallSignatureDeclaration(pos) { - const params = deserializeBoxFormalParameters(pos + 40); - const thisParam = deserializeOptionBoxTSThisParameter(pos + 32); + const params = deserializeBoxFormalParameters(pos + 24); + const thisParam = deserializeOptionBoxTSThisParameter(pos + 16); if (thisParam !== null) params.unshift(thisParam); return { type: 'TSCallSignatureDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), params, - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 48), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 32), }; } function deserializeTSMethodSignature(pos) { - const params = deserializeBoxFormalParameters(pos + 56); - const thisParam = deserializeOptionBoxTSThisParameter(pos + 48); + const params = deserializeBoxFormalParameters(pos + 40); + const thisParam = deserializeOptionBoxTSThisParameter(pos + 32); if (thisParam !== null) params.unshift(thisParam); return { type: 'TSMethodSignature', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - key: deserializePropertyKey(pos + 24), - computed: deserializeBool(pos + 76), - optional: deserializeBool(pos + 77), - kind: deserializeTSMethodSignatureKind(pos + 78), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40), + key: deserializePropertyKey(pos + 8), + computed: deserializeBool(pos + 60), + optional: deserializeBool(pos + 61), + kind: deserializeTSMethodSignatureKind(pos + 62), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), params, - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 64), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 48), accessibility: null, readonly: false, static: false, @@ -2031,10 +1880,9 @@ function deserializeTSConstructSignatureDeclaration(pos) { type: 'TSConstructSignatureDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), - params: deserializeBoxFormalParameters(pos + 32), - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 40), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), + params: deserializeBoxFormalParameters(pos + 16), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 24), }; } @@ -2043,11 +1891,10 @@ function deserializeTSIndexSignatureName(pos) { type: 'Identifier', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), decorators: [], - name: deserializeStr(pos + 24), + name: deserializeStr(pos + 8), optional: false, - typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 40), + typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 24), }; } @@ -2056,9 +1903,8 @@ function deserializeTSInterfaceHeritage(pos) { type: 'TSInterfaceHeritage', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), + expression: deserializeExpression(pos + 8), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), }; } @@ -2067,21 +1913,20 @@ function deserializeTSTypePredicate(pos) { type: 'TSTypePredicate', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - parameterName: deserializeTSTypePredicateName(pos + 24), - asserts: deserializeBool(pos + 64), - typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 56), + parameterName: deserializeTSTypePredicateName(pos + 8), + asserts: deserializeBool(pos + 32), + typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 24), }; } function deserializeTSModuleDeclaration(pos) { - const kind = deserializeTSModuleDeclarationKind(pos + 116), + const kind = deserializeTSModuleDeclarationKind(pos + 84), global = kind === 'global', start = deserializeU32(pos), end = deserializeU32(pos + 4), - declare = deserializeBool(pos + 117); - let id = deserializeTSModuleDeclarationName(pos + 24), - body = deserializeOptionTSModuleDeclarationBody(pos + 96); + declare = deserializeBool(pos + 85); + let id = deserializeTSModuleDeclarationName(pos + 8), + body = deserializeOptionTSModuleDeclarationBody(pos + 64); // Flatten `body`, and nest `id` if (body !== null && body.type === 'TSModuleDeclaration') { @@ -2122,13 +1967,12 @@ function deserializeTSModuleDeclaration(pos) { } function deserializeTSModuleBlock(pos) { - const body = deserializeVecDirective(pos + 24); - body.push(...deserializeVecStatement(pos + 48)); + const body = deserializeVecDirective(pos + 8); + body.push(...deserializeVecStatement(pos + 32)); return { type: 'TSModuleBlock', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), body, }; } @@ -2138,8 +1982,7 @@ function deserializeTSTypeLiteral(pos) { type: 'TSTypeLiteral', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - members: deserializeVecTSSignature(pos + 24), + members: deserializeVecTSSignature(pos + 8), }; } @@ -2148,8 +1991,7 @@ function deserializeTSInferType(pos) { type: 'TSInferType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeParameter: deserializeBoxTSTypeParameter(pos + 24), + typeParameter: deserializeBoxTSTypeParameter(pos + 8), }; } @@ -2158,9 +2000,8 @@ function deserializeTSTypeQuery(pos) { type: 'TSTypeQuery', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - exprName: deserializeTSTypeQueryExprName(pos + 24), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 40), + exprName: deserializeTSTypeQueryExprName(pos + 8), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 24), }; } @@ -2169,26 +2010,24 @@ function deserializeTSImportType(pos) { type: 'TSImportType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - argument: deserializeTSType(pos + 24), - options: deserializeOptionBoxObjectExpression(pos + 40), - qualifier: deserializeOptionTSTypeName(pos + 48), - typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 64), + argument: deserializeTSType(pos + 8), + options: deserializeOptionBoxObjectExpression(pos + 24), + qualifier: deserializeOptionTSTypeName(pos + 32), + typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 48), }; } function deserializeTSFunctionType(pos) { - const params = deserializeBoxFormalParameters(pos + 40); - const thisParam = deserializeOptionBoxTSThisParameter(pos + 32); + const params = deserializeBoxFormalParameters(pos + 24); + const thisParam = deserializeOptionBoxTSThisParameter(pos + 16); if (thisParam !== null) params.unshift(thisParam); return { type: 'TSFunctionType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), params, - returnType: deserializeBoxTSTypeAnnotation(pos + 48), + returnType: deserializeBoxTSTypeAnnotation(pos + 32), }; } @@ -2197,29 +2036,27 @@ function deserializeTSConstructorType(pos) { type: 'TSConstructorType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - abstract: deserializeBool(pos + 48), - typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 24), - params: deserializeBoxFormalParameters(pos + 32), - returnType: deserializeBoxTSTypeAnnotation(pos + 40), + abstract: deserializeBool(pos + 32), + typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), + params: deserializeBoxFormalParameters(pos + 16), + returnType: deserializeBoxTSTypeAnnotation(pos + 24), }; } function deserializeTSMappedType(pos) { - const typeParameter = deserializeBoxTSTypeParameter(pos + 24); - let optional = deserializeOptionTSMappedTypeModifierOperator(pos + 68); + const typeParameter = deserializeBoxTSTypeParameter(pos + 8); + let optional = deserializeOptionTSMappedTypeModifierOperator(pos + 52); if (optional === null) optional = false; return { type: 'TSMappedType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), key: typeParameter.name, constraint: typeParameter.constraint, - nameType: deserializeOptionTSType(pos + 32), - typeAnnotation: deserializeOptionTSType(pos + 48), + nameType: deserializeOptionTSType(pos + 16), + typeAnnotation: deserializeOptionTSType(pos + 32), optional, - readonly: deserializeOptionTSMappedTypeModifierOperator(pos + 69), + readonly: deserializeOptionTSMappedTypeModifierOperator(pos + 53), }; } @@ -2228,9 +2065,8 @@ function deserializeTSTemplateLiteralType(pos) { type: 'TSTemplateLiteralType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - quasis: deserializeVecTemplateElement(pos + 24), - types: deserializeVecTSType(pos + 48), + quasis: deserializeVecTemplateElement(pos + 8), + types: deserializeVecTSType(pos + 32), }; } @@ -2239,9 +2075,8 @@ function deserializeTSAsExpression(pos) { type: 'TSAsExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), - typeAnnotation: deserializeTSType(pos + 40), + expression: deserializeExpression(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), }; } @@ -2250,9 +2085,8 @@ function deserializeTSSatisfiesExpression(pos) { type: 'TSSatisfiesExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), - typeAnnotation: deserializeTSType(pos + 40), + expression: deserializeExpression(pos + 8), + typeAnnotation: deserializeTSType(pos + 24), }; } @@ -2261,9 +2095,8 @@ function deserializeTSTypeAssertion(pos) { type: 'TSTypeAssertion', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), - expression: deserializeExpression(pos + 40), + typeAnnotation: deserializeTSType(pos + 8), + expression: deserializeExpression(pos + 24), }; } @@ -2272,10 +2105,9 @@ function deserializeTSImportEqualsDeclaration(pos) { type: 'TSImportEqualsDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeBindingIdentifier(pos + 24), - moduleReference: deserializeTSModuleReference(pos + 72), - importKind: deserializeImportOrExportKind(pos + 88), + id: deserializeBindingIdentifier(pos + 8), + moduleReference: deserializeTSModuleReference(pos + 40), + importKind: deserializeImportOrExportKind(pos + 56), }; } @@ -2284,8 +2116,7 @@ function deserializeTSExternalModuleReference(pos) { type: 'TSExternalModuleReference', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeStringLiteral(pos + 24), + expression: deserializeStringLiteral(pos + 8), }; } @@ -2294,8 +2125,7 @@ function deserializeTSNonNullExpression(pos) { type: 'TSNonNullExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), + expression: deserializeExpression(pos + 8), }; } @@ -2304,8 +2134,7 @@ function deserializeDecorator(pos) { type: 'Decorator', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), + expression: deserializeExpression(pos + 8), }; } @@ -2314,8 +2143,7 @@ function deserializeTSExportAssignment(pos) { type: 'TSExportAssignment', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), + expression: deserializeExpression(pos + 8), }; } @@ -2324,8 +2152,7 @@ function deserializeTSNamespaceExportDeclaration(pos) { type: 'TSNamespaceExportDeclaration', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - id: deserializeIdentifierName(pos + 24), + id: deserializeIdentifierName(pos + 8), }; } @@ -2334,9 +2161,8 @@ function deserializeTSInstantiationExpression(pos) { type: 'TSInstantiationExpression', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - expression: deserializeExpression(pos + 24), - typeArguments: deserializeBoxTSTypeParameterInstantiation(pos + 40), + expression: deserializeExpression(pos + 8), + typeArguments: deserializeBoxTSTypeParameterInstantiation(pos + 24), }; } @@ -2345,9 +2171,8 @@ function deserializeJSDocNullableType(pos) { type: 'TSJSDocNullableType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), - postfix: deserializeBool(pos + 40), + typeAnnotation: deserializeTSType(pos + 8), + postfix: deserializeBool(pos + 24), }; } @@ -2356,9 +2181,8 @@ function deserializeJSDocNonNullableType(pos) { type: 'TSJSDocNonNullableType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - typeAnnotation: deserializeTSType(pos + 24), - postfix: deserializeBool(pos + 40), + typeAnnotation: deserializeTSType(pos + 8), + postfix: deserializeBool(pos + 24), }; } @@ -2367,12 +2191,11 @@ function deserializeJSDocUnknownType(pos) { type: 'TSJSDocUnknownType', start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } function deserializeComment(pos) { - const type = deserializeCommentKind(pos + 28), + const type = deserializeCommentKind(pos + 12), start = deserializeU32(pos), end = deserializeU32(pos + 4); const endCut = type === 'Line' ? 0 : 2; @@ -2381,24 +2204,22 @@ function deserializeComment(pos) { value: sourceText.slice(start + 2, end - endCut), start, end, - range: deserializeOptionRangeArray(pos + 8), }; } function deserializeNameSpan(pos) { return { - value: deserializeStr(pos + 24), + value: deserializeStr(pos + 8), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } function deserializeImportEntry(pos) { return { - importName: deserializeImportImportName(pos + 64), - localName: deserializeNameSpan(pos + 112), - isType: deserializeBool(pos + 152), + importName: deserializeImportImportName(pos + 32), + localName: deserializeNameSpan(pos + 64), + isType: deserializeBool(pos + 88), }; } @@ -2406,12 +2227,11 @@ function deserializeExportEntry(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - moduleRequest: deserializeOptionNameSpan(pos + 48), - importName: deserializeExportImportName(pos + 88), - exportName: deserializeExportExportName(pos + 136), - localName: deserializeExportLocalName(pos + 184), - isType: deserializeBool(pos + 232), + moduleRequest: deserializeOptionNameSpan(pos + 16), + importName: deserializeExportImportName(pos + 40), + exportName: deserializeExportExportName(pos + 72), + localName: deserializeExportLocalName(pos + 104), + isType: deserializeBool(pos + 136), }; } @@ -2419,8 +2239,7 @@ function deserializeDynamicImport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - moduleRequest: deserializeSpan(pos + 24), + moduleRequest: deserializeSpan(pos + 8), }; } @@ -2428,7 +2247,6 @@ function deserializeSpan(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -2441,9 +2259,9 @@ function deserializeSourceType(pos) { function deserializeRawTransferData(pos) { return { program: deserializeProgram(pos), - comments: deserializeVecComment(pos + 160), - module: deserializeEcmaScriptModule(pos + 184), - errors: deserializeVecError(pos + 288), + comments: deserializeVecComment(pos + 128), + module: deserializeEcmaScriptModule(pos + 152), + errors: deserializeVecError(pos + 256), }; } @@ -2459,10 +2277,9 @@ function deserializeError(pos) { function deserializeErrorLabel(pos) { return { - message: deserializeOptionStr(pos + 24), + message: deserializeOptionStr(pos + 8), start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), }; } @@ -2480,9 +2297,8 @@ function deserializeStaticImport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - moduleRequest: deserializeNameSpan(pos + 24), - entries: deserializeVecImportEntry(pos + 64), + moduleRequest: deserializeNameSpan(pos + 8), + entries: deserializeVecImportEntry(pos + 32), }; } @@ -2490,8 +2306,7 @@ function deserializeStaticExport(pos) { return { start: deserializeU32(pos), end: deserializeU32(pos + 4), - range: deserializeOptionRangeArray(pos + 8), - entries: deserializeVecExportEntry(pos + 24), + entries: deserializeVecExportEntry(pos + 8), }; } @@ -4373,13 +4188,13 @@ function deserializeVecComment(pos) { const endPos = pos + uint32[pos32 + 2] * 16; while (pos !== endPos) { arr.push(deserializeComment(pos)); - pos += 32; + pos += 16; } return arr; } function deserializeOptionHashbang(pos) { - if (uint8[pos + 8] === 2) return null; + if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; return deserializeHashbang(pos); } @@ -4390,7 +4205,7 @@ function deserializeVecDirective(pos) { const endPos = pos + uint32[pos32 + 2] * 72; while (pos !== endPos) { arr.push(deserializeDirective(pos)); - pos += 104; + pos += 72; } return arr; } @@ -4574,7 +4389,7 @@ function deserializeVecArrayExpressionElement(pos) { const endPos = pos + uint32[pos32 + 2] * 16; while (pos !== endPos) { arr.push(deserializeArrayExpressionElement(pos)); - pos += 32; + pos += 16; } return arr; } @@ -4618,7 +4433,7 @@ function deserializeVecTemplateElement(pos) { const endPos = pos + uint32[pos32 + 2] * 48; while (pos !== endPos) { arr.push(deserializeTemplateElement(pos)); - pos += 64; + pos += 48; } return arr; } @@ -4699,7 +4514,7 @@ function deserializeVecOptionAssignmentTargetMaybeDefault(pos) { } function deserializeOptionAssignmentTargetRest(pos) { - if (uint8[pos + 8] === 2) return null; + if (uint8[pos + 8] === 51) return null; return deserializeAssignmentTargetRest(pos); } @@ -4835,7 +4650,7 @@ function deserializeVecVariableDeclarator(pos) { const endPos = pos + uint32[pos32 + 2] * 64; while (pos !== endPos) { arr.push(deserializeVariableDeclarator(pos)); - pos += 80; + pos += 64; } return arr; } @@ -4851,7 +4666,7 @@ function deserializeOptionForStatementInit(pos) { } function deserializeOptionLabelIdentifier(pos) { - if (uint8[pos + 8] === 2) return null; + if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; return deserializeLabelIdentifier(pos); } @@ -4862,7 +4677,7 @@ function deserializeVecSwitchCase(pos) { const endPos = pos + uint32[pos32 + 2] * 48; while (pos !== endPos) { arr.push(deserializeSwitchCase(pos)); - pos += 64; + pos += 48; } return arr; } @@ -4882,7 +4697,7 @@ function deserializeOptionBoxBlockStatement(pos) { } function deserializeOptionCatchParameter(pos) { - if (uint8[pos + 8] === 2) return null; + if (uint8[pos + 32] === 2) return null; return deserializeCatchParameter(pos); } @@ -4918,7 +4733,7 @@ function deserializeVecBindingProperty(pos) { const endPos = pos + uint32[pos32 + 2] * 64; while (pos !== endPos) { arr.push(deserializeBindingProperty(pos)); - pos += 80; + pos += 64; } return arr; } @@ -4950,7 +4765,7 @@ function deserializeVecOptionBindingPattern(pos) { } function deserializeOptionBindingIdentifier(pos) { - if (uint8[pos + 8] === 2) return null; + if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; return deserializeBindingIdentifier(pos); } @@ -4992,7 +4807,7 @@ function deserializeVecFormalParameter(pos) { const endPos = pos + uint32[pos32 + 2] * 72; while (pos !== endPos) { arr.push(deserializeFormalParameter(pos)); - pos += 88; + pos += 72; } return arr; } @@ -5004,7 +4819,7 @@ function deserializeVecDecorator(pos) { const endPos = pos + uint32[pos32 + 2] * 24; while (pos !== endPos) { arr.push(deserializeDecorator(pos)); - pos += 40; + pos += 24; } return arr; } @@ -5021,7 +4836,7 @@ function deserializeVecTSClassImplements(pos) { const endPos = pos + uint32[pos32 + 2] * 32; while (pos !== endPos) { arr.push(deserializeTSClassImplements(pos)); - pos += 48; + pos += 32; } return arr; } @@ -5136,7 +4951,7 @@ function deserializeVecImportAttribute(pos) { const endPos = pos + uint32[pos32 + 2] * 112; while (pos !== endPos) { arr.push(deserializeImportAttribute(pos)); - pos += 160; + pos += 112; } return arr; } @@ -5153,13 +4968,13 @@ function deserializeVecExportSpecifier(pos) { const endPos = pos + uint32[pos32 + 2] * 128; while (pos !== endPos) { arr.push(deserializeExportSpecifier(pos)); - pos += 176; + pos += 128; } return arr; } function deserializeOptionStringLiteral(pos) { - if (uint8[pos + 8] === 2) return null; + if (uint8[pos + 40] === 2) return null; return deserializeStringLiteral(pos); } @@ -5257,7 +5072,7 @@ function deserializeVecTSEnumMember(pos) { const endPos = pos + uint32[pos32 + 2] * 40; while (pos !== endPos) { arr.push(deserializeTSEnumMember(pos)); - pos += 56; + pos += 40; } return arr; } @@ -5458,7 +5273,7 @@ function deserializeVecTSTypeParameter(pos) { const endPos = pos + uint32[pos32 + 2] * 80; while (pos !== endPos) { arr.push(deserializeTSTypeParameter(pos)); - pos += 112; + pos += 80; } return arr; } @@ -5470,7 +5285,7 @@ function deserializeVecTSInterfaceHeritage(pos) { const endPos = pos + uint32[pos32 + 2] * 32; while (pos !== endPos) { arr.push(deserializeTSInterfaceHeritage(pos)); - pos += 48; + pos += 32; } return arr; } @@ -5514,7 +5329,7 @@ function deserializeVecTSIndexSignatureName(pos) { const endPos = pos + uint32[pos32 + 2] * 32; while (pos !== endPos) { arr.push(deserializeTSIndexSignatureName(pos)); - pos += 48; + pos += 32; } return arr; } @@ -5556,15 +5371,10 @@ function deserializeU32(pos) { } function deserializeOptionNameSpan(pos) { - if (uint8[pos + 8] === 2) return null; + if (uint32[(pos + 8) >> 2] === 0 && uint32[(pos + 12) >> 2] === 0) return null; return deserializeNameSpan(pos); } -function deserializeOptionRangeArray(pos) { - if (uint8[pos] === 0) return null; - return deserializeRangeArray(pos + 4); -} - function deserializeU64(pos) { const pos32 = pos >> 2; return uint32[pos32] + uint32[pos32 + 1] * 4294967296; @@ -5594,7 +5404,7 @@ function deserializeVecErrorLabel(pos) { const endPos = pos + uint32[pos32 + 2] * 24; while (pos !== endPos) { arr.push(deserializeErrorLabel(pos)); - pos += 40; + pos += 24; } return arr; } @@ -5606,7 +5416,7 @@ function deserializeVecStaticImport(pos) { const endPos = pos + uint32[pos32 + 2] * 56; while (pos !== endPos) { arr.push(deserializeStaticImport(pos)); - pos += 88; + pos += 56; } return arr; } @@ -5618,7 +5428,7 @@ function deserializeVecStaticExport(pos) { const endPos = pos + uint32[pos32 + 2] * 32; while (pos !== endPos) { arr.push(deserializeStaticExport(pos)); - pos += 48; + pos += 32; } return arr; } @@ -5630,7 +5440,7 @@ function deserializeVecDynamicImport(pos) { const endPos = pos + uint32[pos32 + 2] * 16; while (pos !== endPos) { arr.push(deserializeDynamicImport(pos)); - pos += 48; + pos += 16; } return arr; } @@ -5642,7 +5452,7 @@ function deserializeVecSpan(pos) { const endPos = pos + uint32[pos32 + 2] * 8; while (pos !== endPos) { arr.push(deserializeSpan(pos)); - pos += 24; + pos += 8; } return arr; } @@ -5654,7 +5464,7 @@ function deserializeVecImportEntry(pos) { const endPos = pos + uint32[pos32 + 2] * 96; while (pos !== endPos) { arr.push(deserializeImportEntry(pos)); - pos += 160; + pos += 96; } return arr; } @@ -5666,7 +5476,7 @@ function deserializeVecExportEntry(pos) { const endPos = pos + uint32[pos32 + 2] * 144; while (pos !== endPos) { arr.push(deserializeExportEntry(pos)); - pos += 240; + pos += 144; } return arr; } diff --git a/napi/parser/src/generated/assert_layouts.rs b/napi/parser/src/generated/assert_layouts.rs index 85e4b0e77f689..09ef615c73394 100644 --- a/napi/parser/src/generated/assert_layouts.rs +++ b/napi/parser/src/generated/assert_layouts.rs @@ -10,12 +10,12 @@ use crate::raw_transfer_types::*; #[cfg(target_pointer_width = "64")] const _: () = { // Padding: 0 bytes - assert!(size_of::() == 312); + assert!(size_of::() == 280); assert!(align_of::() == 8); assert!(offset_of!(RawTransferData, program) == 0); - assert!(offset_of!(RawTransferData, comments) == 160); - assert!(offset_of!(RawTransferData, module) == 184); - assert!(offset_of!(RawTransferData, errors) == 288); + assert!(offset_of!(RawTransferData, comments) == 128); + assert!(offset_of!(RawTransferData, module) == 152); + assert!(offset_of!(RawTransferData, errors) == 256); // Padding: 7 bytes assert!(size_of::() == 80); @@ -30,9 +30,9 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 8); - assert!(offset_of!(ErrorLabel, message) == 24); + assert!(offset_of!(ErrorLabel, message) == 8); assert!(offset_of!(ErrorLabel, span) == 0); // Padding: 7 bytes @@ -45,28 +45,28 @@ const _: () = { assert!(offset_of!(EcmaScriptModule, import_metas) == 72); // Padding: 0 bytes - assert!(size_of::() == 88); + assert!(size_of::() == 56); assert!(align_of::() == 8); assert!(offset_of!(StaticImport, span) == 0); - assert!(offset_of!(StaticImport, module_request) == 24); - assert!(offset_of!(StaticImport, entries) == 64); + assert!(offset_of!(StaticImport, module_request) == 8); + assert!(offset_of!(StaticImport, entries) == 32); // Padding: 0 bytes - assert!(size_of::() == 48); + assert!(size_of::() == 32); assert!(align_of::() == 8); assert!(offset_of!(StaticExport, span) == 0); - assert!(offset_of!(StaticExport, entries) == 24); + assert!(offset_of!(StaticExport, entries) == 8); }; #[cfg(target_pointer_width = "32")] const _: () = { // Padding: 0 bytes - assert!(size_of::() == 220); + assert!(size_of::() == 188); assert!(align_of::() == 4); assert!(offset_of!(RawTransferData, program) == 0); - assert!(offset_of!(RawTransferData, comments) == 120); - assert!(offset_of!(RawTransferData, module) == 136); - assert!(offset_of!(RawTransferData, errors) == 204); + assert!(offset_of!(RawTransferData, comments) == 88); + assert!(offset_of!(RawTransferData, module) == 104); + assert!(offset_of!(RawTransferData, errors) == 172); // Padding: 3 bytes assert!(size_of::() == 44); @@ -81,9 +81,9 @@ const _: () = { assert!(align_of::() == 1); // Padding: 0 bytes - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(align_of::() == 4); - assert!(offset_of!(ErrorLabel, message) == 24); + assert!(offset_of!(ErrorLabel, message) == 8); assert!(offset_of!(ErrorLabel, span) == 0); // Padding: 3 bytes @@ -96,17 +96,17 @@ const _: () = { assert!(offset_of!(EcmaScriptModule, import_metas) == 48); // Padding: 0 bytes - assert!(size_of::() == 72); + assert!(size_of::() == 40); assert!(align_of::() == 4); assert!(offset_of!(StaticImport, span) == 0); - assert!(offset_of!(StaticImport, module_request) == 24); - assert!(offset_of!(StaticImport, entries) == 56); + assert!(offset_of!(StaticImport, module_request) == 8); + assert!(offset_of!(StaticImport, entries) == 24); // Padding: 0 bytes - assert!(size_of::() == 40); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(StaticExport, span) == 0); - assert!(offset_of!(StaticExport, entries) == 24); + assert!(offset_of!(StaticExport, entries) == 8); }; #[cfg(not(any(target_pointer_width = "64", target_pointer_width = "32")))] diff --git a/napi/parser/src/generated/derive_estree.rs b/napi/parser/src/generated/derive_estree.rs index 4a86d424e15ea..b894a373a1694 100644 --- a/napi/parser/src/generated/derive_estree.rs +++ b/napi/parser/src/generated/derive_estree.rs @@ -48,9 +48,6 @@ impl ESTree for ErrorLabel<'_> { state.serialize_field("message", &self.message); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -72,9 +69,6 @@ impl ESTree for StaticImport<'_> { let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("moduleRequest", &self.module_request); state.serialize_field("entries", &self.entries); state.end(); @@ -86,9 +80,6 @@ impl ESTree for StaticExport<'_> { let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if state.range() { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.serialize_field("entries", &self.entries); state.end(); } From 2657bba19b1d1c788a754fb9bc4aff252d666653 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Fri, 20 Jun 2025 16:55:26 +0200 Subject: [PATCH 21/42] chore: keep only parser and serializers options for now --- crates/oxc_ast/src/lib.rs | 2 +- crates/oxc_regular_expression/src/ast.rs | 2 +- crates/oxc_span/src/span.rs | 8 ++--- napi/parser/Cargo.toml | 2 +- napi/parser/index.d.ts | 13 --------- napi/playground/src/lib.rs | 1 - npm/oxc-types/types.d.ts | 1 - tasks/ast_tools/src/derives/estree.rs | 29 +++++-------------- .../src/generators/assert_layouts.rs | 4 --- .../ast_tools/src/generators/raw_transfer.rs | 2 +- .../src/generators/raw_transfer_lazy.rs | 1 - tasks/ast_tools/src/generators/typescript.rs | 1 - tasks/ast_tools/src/parse/parse.rs | 10 ++----- 13 files changed, 15 insertions(+), 61 deletions(-) diff --git a/crates/oxc_ast/src/lib.rs b/crates/oxc_ast/src/lib.rs index a035617029520..31d9e4fcf7473 100644 --- a/crates/oxc_ast/src/lib.rs +++ b/crates/oxc_ast/src/lib.rs @@ -44,7 +44,7 @@ #![warn(missing_docs)] #[cfg(feature = "serialize")] -pub mod serialize; +mod serialize; pub mod ast; mod ast_builder_impl; diff --git a/crates/oxc_regular_expression/src/ast.rs b/crates/oxc_regular_expression/src/ast.rs index 0e09efdcfb1a8..af0a51e199618 100644 --- a/crates/oxc_regular_expression/src/ast.rs +++ b/crates/oxc_regular_expression/src/ast.rs @@ -332,6 +332,6 @@ pub struct NamedReference<'a> { fn size_asserts() { use std::mem::size_of; - assert!(size_of::() == 32); + assert!(size_of::() == 16); assert!(size_of::() == 16); } diff --git a/crates/oxc_span/src/span.rs b/crates/oxc_span/src/span.rs index 17a58686641dc..bebd5ed35bee3 100644 --- a/crates/oxc_span/src/span.rs +++ b/crates/oxc_span/src/span.rs @@ -85,10 +85,6 @@ pub struct Span { /// The zero-based end offset of the span. This may be equal to [`start`](Span::start) if /// the span is empty, but should not be less than it. pub end: u32, - - /// A [number, number] which indicates the start/end index of the node in the file contents. - pub range: Option<[i32; 2]>, - /// Align `Span` on 8 on 64-bit platforms #[estree(skip)] _align: PointerAlign, @@ -104,7 +100,7 @@ impl Span { /// #[inline] pub const fn new(start: u32, end: u32) -> Self { - Self { start, end, range: None, _align: PointerAlign::new() } + Self { start, end, _align: PointerAlign::new() } } /// Create a new empty [`Span`] that starts and ends at an offset position. @@ -731,7 +727,7 @@ mod size_asserts { use super::Span; - const _: () = assert!(size_of::() == 24); + const _: () = assert!(size_of::() == 8); #[cfg(target_pointer_width = "64")] const _: () = assert!(align_of::() == 8); diff --git a/napi/parser/Cargo.toml b/napi/parser/Cargo.toml index e73acb16baaf0..9c3978d9fb34c 100644 --- a/napi/parser/Cargo.toml +++ b/napi/parser/Cargo.toml @@ -24,7 +24,7 @@ doctest = false [dependencies] oxc = { workspace = true, features = ["ast_visit", "regular_expression", "semantic", "serialize"] } oxc_ast_macros = { workspace = true } -oxc_estree = { workspace = true, features = ["serialize"] } +oxc_estree = { workspace = true } oxc_napi = { workspace = true } rustc-hash = { workspace = true } diff --git a/napi/parser/index.d.ts b/napi/parser/index.d.ts index 03640378c69dd..a863e91ace313 100644 --- a/napi/parser/index.d.ts +++ b/napi/parser/index.d.ts @@ -189,13 +189,6 @@ export interface ParserOptions { * The type of the file is determined from `lang` option, or extension of provided `filename`. */ astType?: 'js' | 'ts' - /** - * Controls whether the `range` property is included on AST nodes. - * The `range` property is a [number, number] which indicates the start/end index of the node in the file contents. - * - * @default false - */ - range?: boolean /** * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST. * @@ -253,12 +246,6 @@ export declare function rawTransferSupported(): boolean export interface Span { start: number end: number - /** - * An array of two numbers. - * Both numbers are a 0-based index which is the position in the array of source code characters. - * The first is the start position of the node, the second is the end position of the node. - */ - range?: [number, number] } export interface StaticExport { diff --git a/napi/playground/src/lib.rs b/napi/playground/src/lib.rs index 4a0c834b6a001..553f96d98e670 100644 --- a/napi/playground/src/lib.rs +++ b/napi/playground/src/lib.rs @@ -124,7 +124,6 @@ impl Oxc { allow_v8_intrinsics: parser_options .allow_v8_intrinsics .unwrap_or(default_parser_options.allow_v8_intrinsics), - range: false, }; let ParserReturn { mut program, errors, mut module_record, .. } = Parser::new(&allocator, &source_text, source_type) diff --git a/npm/oxc-types/types.d.ts b/npm/oxc-types/types.d.ts index ab37436b5a084..a8cf8a3da531b 100644 --- a/npm/oxc-types/types.d.ts +++ b/npm/oxc-types/types.d.ts @@ -1515,7 +1515,6 @@ export type UpdateOperator = '++' | '--'; export interface Span { start: number; end: number; - range: [number, number] | null; } export type ModuleKind = 'script' | 'module'; diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index f23e849eea4bf..6833071c33140 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -69,14 +69,14 @@ impl Derive for DeriveESTree { fn prelude(&self) -> TokenStream { quote! { - #![allow(unused_imports, clippy::match_same_arms, clippy::semicolon_if_nothing_returned)] + #![allow(unused_imports, clippy::match_same_arms, clippy::semicolon_if_nothing_returned)] - ///@@line_break - use oxc_estree::{ - Concat2, Concat3, ESTree, FlatStructSerializer, - JsonSafeString, Serializer, StructSerializer, - }; - } + ///@@line_break + use oxc_estree::{ + Concat2, Concat3, ESTree, FlatStructSerializer, + JsonSafeString, Serializer, StructSerializer, + }; + } } /// Generate implementation of `ESTree` for a struct or enum. @@ -435,24 +435,9 @@ impl<'s> StructSerializerGenerator<'s> { let field_name_ident = field.ident(); - // Special case for `Span` fields - add conditional range serialization - if let TypeDef::Struct(inner_struct_def) = field.type_def(self.schema) { - if inner_struct_def.name() == "Span" && field.name() == "span" { - self.stmts.extend(quote! { - state.serialize_field("start", &#self_path.#field_name_ident.start); - state.serialize_field("end", &#self_path.#field_name_ident.end); - if state.range() { - state.serialize_field("range", &[#self_path.#field_name_ident.start, #self_path.#field_name_ident.end]); - } - }); - return; - } - } - if should_flatten_field(field, self.schema) { if can_flatten_field_inline(field, self.krate, self.schema) { let inner_struct_def = field.type_def(self.schema).as_struct().unwrap(); - self.generate_stmts_for_struct( inner_struct_def, "e!(#self_path.#field_name_ident), diff --git a/tasks/ast_tools/src/generators/assert_layouts.rs b/tasks/ast_tools/src/generators/assert_layouts.rs index 4a8572d06fd8e..dbc227bc18933 100644 --- a/tasks/ast_tools/src/generators/assert_layouts.rs +++ b/tasks/ast_tools/src/generators/assert_layouts.rs @@ -476,10 +476,6 @@ fn calculate_layout_for_primitive(primitive_def: &PrimitiveDef) -> Layout { layout_64: PlatformLayout::from_size_align(0, 8), layout_32: PlatformLayout::from_size_align(0, 4), }, - "RangeArray" => Layout { - layout_64: PlatformLayout::from_size_align(12, 4), // Option<[i32; 2]> is Option<12 bytes aligned at 4> - layout_32: PlatformLayout::from_size_align(12, 4), - }, name => panic!("Unknown primitive type: {name}"), } } diff --git a/tasks/ast_tools/src/generators/raw_transfer.rs b/tasks/ast_tools/src/generators/raw_transfer.rs index 4077e4910529e..538942a739a10 100644 --- a/tasks/ast_tools/src/generators/raw_transfer.rs +++ b/tasks/ast_tools/src/generators/raw_transfer.rs @@ -471,12 +471,12 @@ fn generate_enum( /// Generate deserialize function for a primitive. fn generate_primitive(primitive_def: &PrimitiveDef, code: &mut String, schema: &Schema) { + #[expect(clippy::match_same_arms)] let ret = match primitive_def.name() { // Reuse deserializer for `&str` "Atom" => return, // Dummy type "PointerAlign" => return, - "RangeArray" => return, "bool" => "return uint8[pos] === 1;", "u8" => "return uint8[pos];", // "u16" => "return uint16[pos >> 1];", diff --git a/tasks/ast_tools/src/generators/raw_transfer_lazy.rs b/tasks/ast_tools/src/generators/raw_transfer_lazy.rs index 9359cf969671a..4b49cd9a768f7 100644 --- a/tasks/ast_tools/src/generators/raw_transfer_lazy.rs +++ b/tasks/ast_tools/src/generators/raw_transfer_lazy.rs @@ -583,7 +583,6 @@ fn generate_primitive(primitive_def: &PrimitiveDef, code: &mut String, schema: & "Atom" => return, // Dummy type "PointerAlign" => return, - "RangeArray" => return, "bool" => "return ast.buffer[pos] === 1;", "u8" => "return ast.buffer[pos];", // "u16" => "return uint16[pos >> 1];", diff --git a/tasks/ast_tools/src/generators/typescript.rs b/tasks/ast_tools/src/generators/typescript.rs index 1b22f46affcb2..9592ae7d9307f 100644 --- a/tasks/ast_tools/src/generators/typescript.rs +++ b/tasks/ast_tools/src/generators/typescript.rs @@ -377,7 +377,6 @@ fn ts_type_name<'s>(type_def: &'s TypeDef, schema: &'s Schema) -> Cow<'s, str> { | "f32" | "f64" => "number", "bool" => "boolean", "&str" | "Atom" => "string", - "RangeArray" => "[number, number]", name => name, }), TypeDef::Option(option_def) => { diff --git a/tasks/ast_tools/src/parse/parse.rs b/tasks/ast_tools/src/parse/parse.rs index f90f75771551f..7a7f0662e8a4b 100644 --- a/tasks/ast_tools/src/parse/parse.rs +++ b/tasks/ast_tools/src/parse/parse.rs @@ -5,8 +5,8 @@ use quote::ToTokens; use rustc_hash::FxHashMap; use syn::{ AttrStyle, Attribute, Expr, ExprLit, Field, Fields, GenericArgument, Generics, Ident, ItemEnum, - ItemStruct, Lit, Meta, MetaList, PathArguments, PathSegment, Type, TypeArray, TypePath, - TypeReference, Variant, Visibility as SynVisibility, punctuated::Punctuated, token::Comma, + ItemStruct, Lit, Meta, MetaList, PathArguments, PathSegment, Type, TypePath, TypeReference, + Variant, Visibility as SynVisibility, punctuated::Punctuated, token::Comma, }; use crate::{ @@ -226,7 +226,6 @@ impl<'c> Parser<'c> { // TODO: Remove the need for this by adding // `#[cfg_attr(target_pointer_width = "64", repr(align(8)))]` to all AST types "PointerAlign" => primitive("PointerAlign"), - "RangeArray" => primitive("RangeArray"), _ => panic!("Unknown type: {name}"), }; self.create_new_type(type_def) @@ -502,7 +501,6 @@ impl<'c> Parser<'c> { match ty { Type::Path(type_path) => self.parse_type_path(type_path), Type::Reference(type_ref) => self.parse_type_reference(type_ref), - Type::Array(type_array) => Some(self.parse_type_array(type_array)), _ => None, } } @@ -585,10 +583,6 @@ impl<'c> Parser<'c> { Some(self.type_id("&str")) } - fn parse_type_array(&mut self, _type_array: &TypeArray) -> TypeId { - self.type_id("RangeArray") - } - /// Parse attributes on struct or enum with parsers provided by [`Derive`]s and [`Generator`]s. /// /// [`Derive`]: crate::Derive From 84af8294b04b6c1284acdf44f4ffc608c79e4823 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Fri, 20 Jun 2025 18:32:58 +0200 Subject: [PATCH 22/42] feat: update serializer --- crates/oxc_ast/src/serialize/js.rs | 77 +++++++++-- crates/oxc_ast/src/serialize/jsx.rs | 4 + crates/oxc_ast/src/serialize/literal.rs | 4 + crates/oxc_ast/src/serialize/mod.rs | 42 ++---- crates/oxc_ast/src/serialize/ts.rs | 8 ++ crates/oxc_estree/src/serialize/config.rs | 129 ++++++++++++------ crates/oxc_estree/src/serialize/mod.rs | 23 +++- crates/oxc_estree/src/serialize/structs.rs | 2 +- .../oxc_syntax/src/generated/derive_estree.rs | 12 ++ napi/parser/index.d.ts | 7 + napi/parser/src/convert.rs | 2 +- napi/parser/src/generated/derive_estree.rs | 12 ++ napi/parser/src/lib.rs | 30 +++- napi/parser/src/types.rs | 5 - napi/playground/src/lib.rs | 1 + tasks/ast_tools/src/derives/estree.rs | 17 +++ 16 files changed, 272 insertions(+), 103 deletions(-) diff --git a/crates/oxc_ast/src/serialize/js.rs b/crates/oxc_ast/src/serialize/js.rs index 54103e6a3101b..04e91db9c5f89 100644 --- a/crates/oxc_ast/src/serialize/js.rs +++ b/crates/oxc_ast/src/serialize/js.rs @@ -8,6 +8,8 @@ use crate::ast::*; use super::{EmptyArray, Null}; +use oxc_span::GetSpan; + // ---------------------------------------- // Binding patterns and function params // ---------------------------------------- @@ -54,6 +56,7 @@ struct BindingPatternKindAndTsFields<'a, 'b> { impl ESTree for BindingPatternKindAndTsFields<'_, '_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); match &self.kind { @@ -61,6 +64,9 @@ impl ESTree for BindingPatternKindAndTsFields<'_, '_> { state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &ident.span.start); state.serialize_field("end", &ident.span.end); + if range { + state.serialize_field("range", &[ident.span.start, ident.span.end]); + } state.serialize_field("decorators", &self.decorators); state.serialize_field("name", &JsonSafeString(ident.name.as_str())); } @@ -68,6 +74,9 @@ impl ESTree for BindingPatternKindAndTsFields<'_, '_> { state.serialize_field("type", &JsonSafeString("ObjectPattern")); state.serialize_field("start", &object.span.start); state.serialize_field("end", &object.span.end); + if range { + state.serialize_field("range", &[object.span.start, object.span.end]); + } state.serialize_field("decorators", &self.decorators); state.serialize_field("properties", &Concat2(&object.properties, &object.rest)); } @@ -75,6 +84,9 @@ impl ESTree for BindingPatternKindAndTsFields<'_, '_> { state.serialize_field("type", &JsonSafeString("ArrayPattern")); state.serialize_field("start", &array.span.start); state.serialize_field("end", &array.span.end); + if range { + state.serialize_field("range", &[array.span.start, array.span.end]); + } state.serialize_field("decorators", &self.decorators); state.serialize_field("elements", &Concat2(&array.elements, &array.rest)); } @@ -82,6 +94,9 @@ impl ESTree for BindingPatternKindAndTsFields<'_, '_> { state.serialize_field("type", &JsonSafeString("AssignmentPattern")); state.serialize_field("start", &assignment.span.start); state.serialize_field("end", &assignment.span.end); + if range { + state.serialize_field("range", &[assignment.span.start, assignment.span.end]); + } state.serialize_field("decorators", &self.decorators); state.serialize_field("left", &assignment.left); state.serialize_field("right", &assignment.right); @@ -165,10 +180,14 @@ struct FormalParametersRest<'a, 'b>(&'b BindingRestElement<'a>); impl ESTree for FormalParametersRest<'_, '_> { fn serialize(&self, serializer: S) { let rest = self.0; + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("RestElement")); state.serialize_field("start", &rest.span.start); state.serialize_field("end", &rest.span.end); + if range { + state.serialize_field("range", &[rest.span.start, rest.span.end]); + } state.serialize_ts_field("decorators", &EmptyArray(())); state.serialize_field("argument", &rest.argument.kind); state.serialize_ts_field("optional", &rest.argument.optional); @@ -225,10 +244,14 @@ impl ESTree for FormalParameterConverter<'_, '_> { if S::INCLUDE_TS_FIELDS { if param.has_modifier() { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSParameterProperty")); state.serialize_field("start", ¶m.span.start); state.serialize_field("end", ¶m.span.end); + if range { + state.serialize_field("range", &[param.span.start, param.span.end]); + } state.serialize_field("accessibility", ¶m.accessibility); state.serialize_field("decorators", ¶m.decorators); state.serialize_field("override", ¶m.r#override); @@ -395,10 +418,38 @@ pub struct ArrowFunctionExpressionBody<'a>(pub &'a ArrowFunctionExpression<'a>); impl ESTree for ArrowFunctionExpressionBody<'_> { fn serialize(&self, serializer: S) { - if let Some(expression) = self.0.get_expression() { - expression.serialize(serializer); + let arrow_expr = self.0; + if arrow_expr.expression { + // Expression body is represented as a `FunctionBody` with a single `ExpressionStatement` + // which contains the expression. + if let Some(Statement::ExpressionStatement(expr_stmt)) = arrow_expr.body.statements.get(0) { + expr_stmt.expression.serialize(serializer); + } else { + // Should be unreachable for a valid AST. + // Serialize as a `BlockStatement` as a fallback. + let range = serializer.range(); + let mut state = serializer.serialize_struct(); + state.serialize_field("type", &JsonSafeString("BlockStatement")); + state.serialize_field("start", &arrow_expr.body.span.start); + state.serialize_field("end", &arrow_expr.body.span.end); + if range { + state.serialize_field("range", &[arrow_expr.body.span.start, arrow_expr.body.span.end]); + } + state.serialize_field("body", &arrow_expr.body.statements); + state.end(); + } } else { - self.0.body.serialize(serializer); + let body = &arrow_expr.body; + let range = serializer.range(); + let mut state = serializer.serialize_struct(); + state.serialize_field("type", &JsonSafeString("BlockStatement")); + state.serialize_field("start", &body.span.start); + state.serialize_field("end", &body.span.end); + if range { + state.serialize_field("range", &[body.span.start, body.span.end]); + } + state.serialize_field("body", &body.statements); + state.end(); } } } @@ -436,19 +487,23 @@ pub struct AssignmentTargetPropertyIdentifierInit<'a>( impl ESTree for AssignmentTargetPropertyIdentifierInit<'_> { fn serialize(&self, serializer: S) { - if let Some(init) = &self.0.init { + let prop = self.0; + if let Some(init) = &prop.init { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AssignmentPattern")); - state.serialize_field("start", &self.0.span.start); - state.serialize_field("end", &self.0.span.end); - state.serialize_ts_field("decorators", &EmptyArray(())); - state.serialize_field("left", &self.0.binding); + let start = prop.binding.span.start; + let end = init.span().end; + state.serialize_field("start", &start); + state.serialize_field("end", &end); + if range { + state.serialize_field("range", &[start, end]); + } + state.serialize_field("left", &prop.binding); state.serialize_field("right", init); - state.serialize_ts_field("optional", &false); - state.serialize_ts_field("typeAnnotation", &Null(())); state.end(); } else { - self.0.binding.serialize(serializer); + prop.binding.serialize(serializer); } } } diff --git a/crates/oxc_ast/src/serialize/jsx.rs b/crates/oxc_ast/src/serialize/jsx.rs index 7a7fa9cf93356..281aeb7baf5e7 100644 --- a/crates/oxc_ast/src/serialize/jsx.rs +++ b/crates/oxc_ast/src/serialize/jsx.rs @@ -22,10 +22,14 @@ impl ESTree for JSXElementOpeningElement<'_, '_> { let element = self.0; let opening_element = element.opening_element.as_ref(); + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXOpeningElement")); state.serialize_field("start", &opening_element.span.start); state.serialize_field("end", &opening_element.span.end); + if range { + state.serialize_field("range", &[opening_element.span.start, opening_element.span.end]); + } state.serialize_field("name", &opening_element.name); state.serialize_ts_field("typeArguments", &opening_element.type_arguments); state.serialize_field("attributes", &opening_element.attributes); diff --git a/crates/oxc_ast/src/serialize/literal.rs b/crates/oxc_ast/src/serialize/literal.rs index 25f2dba47b65b..fc3bafea23143 100644 --- a/crates/oxc_ast/src/serialize/literal.rs +++ b/crates/oxc_ast/src/serialize/literal.rs @@ -209,6 +209,7 @@ pub struct TemplateElementConverter<'a, 'b>(pub &'b TemplateElement<'a>); impl ESTree for TemplateElementConverter<'_, '_> { fn serialize(&self, serializer: S) { let element = self.0; + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TemplateElement")); @@ -219,6 +220,9 @@ impl ESTree for TemplateElementConverter<'_, '_> { } state.serialize_field("start", &span.start); state.serialize_field("end", &span.end); + if range { + state.serialize_field("range", &[span.start, span.end]); + } state.serialize_field("value", &TemplateElementValue(element)); state.serialize_field("tail", &element.tail); diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index f8259d6b77050..e35e155b2f3f8 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -3,20 +3,13 @@ use std::cmp; use oxc_ast_macros::ast_meta; use oxc_estree::{ CompactFixesJSSerializer, CompactFixesTSSerializer, CompactJSSerializer, CompactTSSerializer, - Concat2, ConfigFixesJS, ConfigFixesTS, ESTree, JsonSafeString, PrettyFixesJSSerializer, - PrettyFixesTSSerializer, PrettyJSSerializer, PrettyTSSerializer, Serializer, StructSerializer, + Concat2, ESTree, JsonSafeString, PrettyFixesJSSerializer, PrettyFixesTSSerializer, + PrettyJSSerializer, PrettyTSSerializer, Serializer, StructSerializer, }; use oxc_span::GetSpan; use crate::ast::*; -/// Options for ESTree serialization -#[derive(Clone, Copy)] -pub struct SerializationOptions { - /// Include range field [start, end] in each node - pub range: bool, -} - pub mod basic; pub mod js; pub mod jsx; @@ -87,35 +80,15 @@ impl Program<'_> { /// Serialize AST to ESTree JSON, including TypeScript fields, with list of fixes. pub fn to_estree_ts_json_with_fixes(&self) -> String { - self.to_estree_ts_json_with_fixes_and_options(None) - } - - /// Serialize AST to ESTree JSON, without TypeScript fields, with list of fixes. - pub fn to_estree_js_json_with_fixes(&self) -> String { - self.to_estree_js_json_with_fixes_and_options(None) - } - - /// Serialize AST to ESTree JSON, including TypeScript fields, with list of fixes and serialization options. - pub fn to_estree_ts_json_with_fixes_and_options( - &self, - options: Option<&SerializationOptions>, - ) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let range = options.map_or(false, |opts| opts.range); - let config = ConfigFixesTS::with_ranges(range); - let serializer = CompactFixesTSSerializer::with_config_and_capacity(config, capacity); + let serializer = CompactFixesTSSerializer::with_capacity(capacity); serializer.serialize_with_fixes(self) } - /// Serialize AST to ESTree JSON, without TypeScript fields, with list of fixes and serialization options. - pub fn to_estree_js_json_with_fixes_and_options( - &self, - options: Option<&SerializationOptions>, - ) -> String { + /// Serialize AST to ESTree JSON, without TypeScript fields, with list of fixes. + pub fn to_estree_js_json_with_fixes(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let range = options.map_or(false, |opts| opts.range); - let config = ConfigFixesJS::with_ranges(range); - let serializer = CompactFixesJSSerializer::with_config_and_capacity(config, capacity); + let serializer = CompactFixesJSSerializer::with_capacity(capacity); serializer.serialize_with_fixes(self) } @@ -195,11 +168,12 @@ impl ESTree for ProgramConverter<'_, '_> { let span_start = if S::INCLUDE_TS_FIELDS { get_ts_start_span(program) } else { program.span.start }; + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Program")); state.serialize_field("start", &span_start); state.serialize_field("end", &program.span.end); - if state.range() { + if range { state.serialize_field("range", &[span_start, program.span.end]); } state.serialize_field("body", &Concat2(&program.directives, &program.body)); diff --git a/crates/oxc_ast/src/serialize/ts.rs b/crates/oxc_ast/src/serialize/ts.rs index 6f40cc0305a4f..33d17c97ee702 100644 --- a/crates/oxc_ast/src/serialize/ts.rs +++ b/crates/oxc_ast/src/serialize/ts.rs @@ -99,10 +99,14 @@ impl ESTree for TSModuleDeclarationConverter<'_, '_> { fn serialize(&self, serializer: S) { let module = self.0; + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSModuleDeclaration")); state.serialize_field("start", &module.span.start); state.serialize_field("end", &module.span.end); + if range { + state.serialize_field("range", &[module.span.start, module.span.end]); + } match &module.body { Some(TSModuleDeclarationBody::TSModuleDeclaration(inner_module)) => { @@ -171,10 +175,14 @@ impl ESTree for TSModuleDeclarationIdParts<'_, '_> { let span_start = parts[0].span.start; let (&last, rest) = parts.split_last().unwrap(); + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSQualifiedName")); state.serialize_field("start", &span_start); state.serialize_field("end", &last.span.end); + if range { + state.serialize_field("range", &[span_start, last.span.end]); + } if rest.len() == 1 { // Only one part remaining (e.g. `X`). Serialize as `Identifier`. diff --git a/crates/oxc_estree/src/serialize/config.rs b/crates/oxc_estree/src/serialize/config.rs index 60bc44dd9e2fc..8f6ed7d5709b6 100644 --- a/crates/oxc_estree/src/serialize/config.rs +++ b/crates/oxc_estree/src/serialize/config.rs @@ -4,121 +4,166 @@ pub trait Config { const INCLUDE_TS_FIELDS: bool; /// `true` if should record paths to `Literal` nodes that need fixing on JS side const FIXES: bool; + /// `true` if `range` field should be emitted + const RANGES: bool; fn new() -> Self; - /// Whether to include range information in the serialized output - fn ranges(&self) -> bool; + /// Whether to include range information in the serialized output (runtime helper) + #[inline(always)] + fn ranges(&self) -> bool { + Self::RANGES + } } /// Config for serializing AST with TypeScript fields, -pub struct ConfigTS { - ranges: bool, -} +pub struct ConfigTS; + +impl Config for ConfigTS { + const INCLUDE_TS_FIELDS: bool = true; + const FIXES: bool = false; + const RANGES: bool = false; -impl ConfigTS { - /// Create a new ConfigTS with the specified ranges setting #[inline(always)] - pub fn with_ranges(ranges: bool) -> Self { - Self { ranges } + fn new() -> Self { + Self + } + + #[inline] + fn ranges(&self) -> bool { + false } } -impl Config for ConfigTS { +/// Config for serializing AST with TypeScript fields, with ranges. +pub struct ConfigTSWithRanges; + +impl Config for ConfigTSWithRanges { const INCLUDE_TS_FIELDS: bool = true; const FIXES: bool = false; + const RANGES: bool = true; #[inline(always)] fn new() -> Self { - Self { ranges: false } + Self } #[inline] fn ranges(&self) -> bool { - self.ranges + true } } /// Config for serializing AST without TypeScript fields. -pub struct ConfigJS { - ranges: bool, -} +pub struct ConfigJS; + +impl Config for ConfigJS { + const INCLUDE_TS_FIELDS: bool = false; + const FIXES: bool = false; + const RANGES: bool = false; -impl ConfigJS { - /// Create a new ConfigJS with the specified ranges setting #[inline(always)] - pub fn with_ranges(ranges: bool) -> Self { - Self { ranges } + fn new() -> Self { + Self + } + + #[inline] + fn ranges(&self) -> bool { + false } } -impl Config for ConfigJS { +/// Config for serializing AST without TypeScript fields, with ranges. +pub struct ConfigJSWithRanges; + +impl Config for ConfigJSWithRanges { const INCLUDE_TS_FIELDS: bool = false; const FIXES: bool = false; + const RANGES: bool = true; #[inline(always)] fn new() -> Self { - Self { ranges: false } + Self } #[inline] fn ranges(&self) -> bool { - self.ranges + true } } /// Config for serializing AST with TypeScript fields, with fixes. -pub struct ConfigFixesTS { - ranges: bool, -} +pub struct ConfigFixesTS; + +impl Config for ConfigFixesTS { + const INCLUDE_TS_FIELDS: bool = true; + const FIXES: bool = true; + const RANGES: bool = false; -impl ConfigFixesTS { - /// Create a new ConfigFixesTS with the specified ranges setting #[inline(always)] - pub fn with_ranges(ranges: bool) -> Self { - Self { ranges } + fn new() -> Self { + Self + } + + #[inline] + fn ranges(&self) -> bool { + false } } -impl Config for ConfigFixesTS { +/// Config for serializing AST with TypeScript fields, with fixes, with ranges. +pub struct ConfigFixesTSWithRanges; + +impl Config for ConfigFixesTSWithRanges { const INCLUDE_TS_FIELDS: bool = true; const FIXES: bool = true; + const RANGES: bool = true; #[inline(always)] fn new() -> Self { - Self { ranges: false } + Self } #[inline] fn ranges(&self) -> bool { - self.ranges + true } } /// Config for serializing AST without TypeScript fields, with fixes. -pub struct ConfigFixesJS { - ranges: bool, -} +pub struct ConfigFixesJS; + +impl Config for ConfigFixesJS { + const INCLUDE_TS_FIELDS: bool = false; + const FIXES: bool = true; + const RANGES: bool = false; -impl ConfigFixesJS { - /// Create a new ConfigFixesJS with the specified ranges setting #[inline(always)] - pub fn with_ranges(ranges: bool) -> Self { - Self { ranges } + fn new() -> Self { + Self + } + + #[inline] + fn ranges(&self) -> bool { + false } } -impl Config for ConfigFixesJS { +/// Config for serializing AST without TypeScript fields, with fixes, with ranges. +pub struct ConfigFixesJSWithRanges; + +impl Config for ConfigFixesJSWithRanges { const INCLUDE_TS_FIELDS: bool = false; const FIXES: bool = true; + const RANGES: bool = true; #[inline(always)] fn new() -> Self { - Self { ranges: false } + Self } #[inline] fn ranges(&self) -> bool { - self.ranges + true } } diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index c993b338a552a..42bc81366b687 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -19,7 +19,10 @@ use sequences::ESTreeSequenceSerializer; use structs::ESTreeStructSerializer; pub use concat::{Concat2, Concat3, ConcatElement}; -pub use config::{Config, ConfigFixesJS, ConfigFixesTS, ConfigJS, ConfigTS}; +pub use config::{ + Config, ConfigFixesJS, ConfigFixesJSWithRanges, ConfigFixesTS, ConfigFixesTSWithRanges, + ConfigJS, ConfigJSWithRanges, ConfigTS, ConfigTSWithRanges, +}; pub use sequences::SequenceSerializer; pub use strings::{JsonSafeString, LoneSurrogatesString}; @@ -87,15 +90,31 @@ pub type PrettyJSSerializer = ESTreeSerializer; /// ESTree serializer which produces compact JSON, including TypeScript fields. pub type CompactFixesTSSerializer = ESTreeSerializer; +/// ESTree serializer which produces compact JSON, including TypeScript fields, with ranges. +pub type CompactFixesTSWithRangesSerializer = + ESTreeSerializer; + /// ESTree serializer which produces compact JSON, excluding TypeScript fields. pub type CompactFixesJSSerializer = ESTreeSerializer; +/// ESTree serializer which produces compact JSON, excluding TypeScript fields, with ranges. +pub type CompactFixesJSWithRangesSerializer = + ESTreeSerializer; + /// ESTree serializer which produces pretty JSON, including TypeScript fields. pub type PrettyFixesTSSerializer = ESTreeSerializer; +/// ESTree serializer which produces pretty JSON, including TypeScript fields, with ranges. +pub type PrettyFixesTSWithRangesSerializer = + ESTreeSerializer; + /// ESTree serializer which produces pretty JSON, excluding TypeScript fields. pub type PrettyFixesJSSerializer = ESTreeSerializer; +/// ESTree serializer which produces pretty JSON, excluding TypeScript fields, with ranges. +pub type PrettyFixesJSWithRangesSerializer = + ESTreeSerializer; + /// ESTree serializer. pub struct ESTreeSerializer { buffer: CodeBuffer, @@ -192,7 +211,7 @@ impl<'s, C: Config, F: Formatter> Serializer for &'s mut ESTreeSerializer type SequenceSerializer = ESTreeSequenceSerializer<'s, C, F>; fn range(&self) -> bool { - self.config.ranges() + C::RANGES } /// Serialize struct. diff --git a/crates/oxc_estree/src/serialize/structs.rs b/crates/oxc_estree/src/serialize/structs.rs index 68fb082285c4e..5c6005b83f18e 100644 --- a/crates/oxc_estree/src/serialize/structs.rs +++ b/crates/oxc_estree/src/serialize/structs.rs @@ -151,7 +151,7 @@ impl StructSerializer for ESTreeStructSerializer<'_, C, } fn range(&self) -> bool { - self.serializer.config.ranges() + C::RANGES } } diff --git a/crates/oxc_syntax/src/generated/derive_estree.rs b/crates/oxc_syntax/src/generated/derive_estree.rs index 40139563a60e0..c48c875fd56fe 100644 --- a/crates/oxc_syntax/src/generated/derive_estree.rs +++ b/crates/oxc_syntax/src/generated/derive_estree.rs @@ -12,10 +12,14 @@ use crate::operator::*; impl ESTree for NameSpan<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("value", &self.name); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -46,6 +50,7 @@ impl ESTree for ImportImportName<'_> { impl ESTree for ExportEntry<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); @@ -54,6 +59,9 @@ impl ESTree for ExportEntry<'_> { state.serialize_field("exportName", &self.export_name); state.serialize_field("localName", &self.local_name); state.serialize_field("isType", &self.is_type); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -95,10 +103,14 @@ impl ESTree for ExportLocalName<'_> { impl ESTree for DynamicImport { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("moduleRequest", &self.module_request); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } diff --git a/napi/parser/index.d.ts b/napi/parser/index.d.ts index a863e91ace313..c3f38a08fce33 100644 --- a/napi/parser/index.d.ts +++ b/napi/parser/index.d.ts @@ -189,6 +189,13 @@ export interface ParserOptions { * The type of the file is determined from `lang` option, or extension of provided `filename`. */ astType?: 'js' | 'ts' + /** + * Controls whether the `range` property is included on AST nodes. + * The `range` property is a [number, number] which indicates the start/end index of the node in the file contents. + * + * @default false + */ + range?: boolean /** * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST. * diff --git a/napi/parser/src/convert.rs b/napi/parser/src/convert.rs index d9d9f025cf6e5..3838646b59ab0 100644 --- a/napi/parser/src/convert.rs +++ b/napi/parser/src/convert.rs @@ -79,7 +79,7 @@ impl From<&ModuleRecord<'_>> for EcmaScriptModule { impl From<&oxc::span::Span> for Span { fn from(span: &oxc::span::Span) -> Self { - Self { start: span.start, end: span.end, range: span.range.map(|arr| vec![arr[0], arr[1]]) } + Self { start: span.start, end: span.end } } } diff --git a/napi/parser/src/generated/derive_estree.rs b/napi/parser/src/generated/derive_estree.rs index b894a373a1694..6584034652178 100644 --- a/napi/parser/src/generated/derive_estree.rs +++ b/napi/parser/src/generated/derive_estree.rs @@ -44,10 +44,14 @@ impl ESTree for ErrorSeverity { impl ESTree for ErrorLabel<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("message", &self.message); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -66,21 +70,29 @@ impl ESTree for EcmaScriptModule<'_> { impl ESTree for StaticImport<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("moduleRequest", &self.module_request); state.serialize_field("entries", &self.entries); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for StaticExport<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("entries", &self.entries); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } diff --git a/napi/parser/src/lib.rs b/napi/parser/src/lib.rs index ef632e1c9e085..7361fb2541a66 100644 --- a/napi/parser/src/lib.rs +++ b/napi/parser/src/lib.rs @@ -15,11 +15,14 @@ use napi_derive::napi; use oxc::{ allocator::Allocator, - ast::serialize::SerializationOptions, parser::{ParseOptions, Parser, ParserReturn}, semantic::SemanticBuilder, span::SourceType, }; +use oxc_estree::{ + CompactFixesJSSerializer, CompactFixesJSWithRangesSerializer, CompactFixesTSSerializer, + CompactFixesTSWithRangesSerializer, +}; use oxc_napi::{Comment, OxcError, convert_utf8_to_utf16, get_source_type}; mod convert; @@ -77,6 +80,7 @@ fn parse_with_return(filename: &str, source_text: String, options: &ParserOption let source_type = get_source_type(filename, options.lang.as_deref(), options.source_type.as_deref()); let ast_type = get_ast_type(source_type, options); + let range = options.range.unwrap_or(false); let ret = parse(&allocator, source_type, &source_text, options); let mut program = ret.program; @@ -108,16 +112,28 @@ fn parse_with_return(filename: &str, source_text: String, options: &ParserOption ); } - program.to_estree_js_json_with_fixes_and_options(Some(&SerializationOptions { - range: options.range.unwrap_or(false), - })) + if range { + let capacity = program.source_text.len() * 16; + let serializer = CompactFixesJSWithRangesSerializer::with_capacity(capacity); + serializer.serialize_with_fixes(&program) + } else { + let capacity = program.source_text.len() * 16; + let serializer = CompactFixesJSSerializer::with_capacity(capacity); + serializer.serialize_with_fixes(&program) + } } AstType::TypeScript => { // Note: `@typescript-eslint/parser` ignores hashbangs, // See: https://github.com/typescript-eslint/typescript-eslint/issues/6500 - program.to_estree_ts_json_with_fixes_and_options(Some(&SerializationOptions { - range: options.range.unwrap_or(false), - })) + if range { + let capacity = program.source_text.len() * 16; + let serializer = CompactFixesTSWithRangesSerializer::with_capacity(capacity); + serializer.serialize_with_fixes(&program) + } else { + let capacity = program.source_text.len() * 16; + let serializer = CompactFixesTSSerializer::with_capacity(capacity); + serializer.serialize_with_fixes(&program) + } } }; diff --git a/napi/parser/src/types.rs b/napi/parser/src/types.rs index 8f7abc5cc4aba..6aef7ae725d09 100644 --- a/napi/parser/src/types.rs +++ b/napi/parser/src/types.rs @@ -101,11 +101,6 @@ pub struct EcmaScriptModule { pub struct Span { pub start: u32, pub end: u32, - /// An array of two numbers. - /// Both numbers are a 0-based index which is the position in the array of source code characters. - /// The first is the start position of the node, the second is the end position of the node. - #[napi(ts_type = "[number, number]")] - pub range: Option>, } #[napi(object)] diff --git a/napi/playground/src/lib.rs b/napi/playground/src/lib.rs index 553f96d98e670..4a0c834b6a001 100644 --- a/napi/playground/src/lib.rs +++ b/napi/playground/src/lib.rs @@ -124,6 +124,7 @@ impl Oxc { allow_v8_intrinsics: parser_options .allow_v8_intrinsics .unwrap_or(default_parser_options.allow_v8_intrinsics), + range: false, }; let ParserReturn { mut program, errors, mut module_record, .. } = Parser::new(&allocator, &source_text, source_type) diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index 6833071c33140..94b9f9482a601 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -375,11 +375,28 @@ fn generate_body_for_struct(struct_def: &StructDef, schema: &Schema) -> TokenStr quote!() }; + // Check if struct has a span field for range support + let has_span_field = struct_def.fields.iter().any(|field| field.name() == "span"); + let (range_declaration, range_field) = if has_span_field { + ( + quote! { let range = serializer.range(); }, + quote! { + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } + } + ) + } else { + (quote!(), quote!()) + }; + let stmts = g.stmts; quote! { + #range_declaration let mut state = serializer.serialize_struct(); #type_field #stmts + #range_field state.end(); } } From 3181b9d6638605a760893ca02336a60b12199efc Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Fri, 20 Jun 2025 18:33:17 +0200 Subject: [PATCH 23/42] chore: format --- crates/oxc_ast/src/serialize/js.rs | 9 +++++++-- tasks/ast_tools/src/derives/estree.rs | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/oxc_ast/src/serialize/js.rs b/crates/oxc_ast/src/serialize/js.rs index 04e91db9c5f89..2762a792486f7 100644 --- a/crates/oxc_ast/src/serialize/js.rs +++ b/crates/oxc_ast/src/serialize/js.rs @@ -422,7 +422,9 @@ impl ESTree for ArrowFunctionExpressionBody<'_> { if arrow_expr.expression { // Expression body is represented as a `FunctionBody` with a single `ExpressionStatement` // which contains the expression. - if let Some(Statement::ExpressionStatement(expr_stmt)) = arrow_expr.body.statements.get(0) { + if let Some(Statement::ExpressionStatement(expr_stmt)) = + arrow_expr.body.statements.get(0) + { expr_stmt.expression.serialize(serializer); } else { // Should be unreachable for a valid AST. @@ -433,7 +435,10 @@ impl ESTree for ArrowFunctionExpressionBody<'_> { state.serialize_field("start", &arrow_expr.body.span.start); state.serialize_field("end", &arrow_expr.body.span.end); if range { - state.serialize_field("range", &[arrow_expr.body.span.start, arrow_expr.body.span.end]); + state.serialize_field( + "range", + &[arrow_expr.body.span.start, arrow_expr.body.span.end], + ); } state.serialize_field("body", &arrow_expr.body.statements); state.end(); diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index 94b9f9482a601..deb43afc20d48 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -384,7 +384,7 @@ fn generate_body_for_struct(struct_def: &StructDef, schema: &Schema) -> TokenStr if range { state.serialize_field("range", &[self.span.start, self.span.end]); } - } + }, ) } else { (quote!(), quote!()) From 5d10c65283291966439f1ba3ca8df2f4867ec135 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Fri, 20 Jun 2025 18:50:12 +0200 Subject: [PATCH 24/42] chore: remove unnecessary --- crates/oxc_ast/src/serialize/js.rs | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/crates/oxc_ast/src/serialize/js.rs b/crates/oxc_ast/src/serialize/js.rs index 2762a792486f7..fc9e957f09ded 100644 --- a/crates/oxc_ast/src/serialize/js.rs +++ b/crates/oxc_ast/src/serialize/js.rs @@ -429,32 +429,10 @@ impl ESTree for ArrowFunctionExpressionBody<'_> { } else { // Should be unreachable for a valid AST. // Serialize as a `BlockStatement` as a fallback. - let range = serializer.range(); - let mut state = serializer.serialize_struct(); - state.serialize_field("type", &JsonSafeString("BlockStatement")); - state.serialize_field("start", &arrow_expr.body.span.start); - state.serialize_field("end", &arrow_expr.body.span.end); - if range { - state.serialize_field( - "range", - &[arrow_expr.body.span.start, arrow_expr.body.span.end], - ); - } - state.serialize_field("body", &arrow_expr.body.statements); - state.end(); + arrow_expr.body.serialize(serializer); } } else { - let body = &arrow_expr.body; - let range = serializer.range(); - let mut state = serializer.serialize_struct(); - state.serialize_field("type", &JsonSafeString("BlockStatement")); - state.serialize_field("start", &body.span.start); - state.serialize_field("end", &body.span.end); - if range { - state.serialize_field("range", &[body.span.start, body.span.end]); - } - state.serialize_field("body", &body.statements); - state.end(); + arrow_expr.body.serialize(serializer); } } } From fbeea432e5e5cfd3e69be02fcdf477940ea0a182 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Fri, 20 Jun 2025 19:43:44 +0200 Subject: [PATCH 25/42] chore: remove unnecessary custom serializerss updates --- crates/oxc_ast/src/serialize/js.rs | 60 +++++-------------------- crates/oxc_ast/src/serialize/jsx.rs | 4 -- crates/oxc_ast/src/serialize/literal.rs | 4 -- crates/oxc_ast/src/serialize/ts.rs | 8 ---- crates/oxc_parser/src/lib.rs | 7 --- napi/parser/index.d.ts | 7 --- napi/parser/src/lib.rs | 1 - napi/playground/src/lib.rs | 1 - 8 files changed, 11 insertions(+), 81 deletions(-) diff --git a/crates/oxc_ast/src/serialize/js.rs b/crates/oxc_ast/src/serialize/js.rs index fc9e957f09ded..54103e6a3101b 100644 --- a/crates/oxc_ast/src/serialize/js.rs +++ b/crates/oxc_ast/src/serialize/js.rs @@ -8,8 +8,6 @@ use crate::ast::*; use super::{EmptyArray, Null}; -use oxc_span::GetSpan; - // ---------------------------------------- // Binding patterns and function params // ---------------------------------------- @@ -56,7 +54,6 @@ struct BindingPatternKindAndTsFields<'a, 'b> { impl ESTree for BindingPatternKindAndTsFields<'_, '_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); let mut state = serializer.serialize_struct(); match &self.kind { @@ -64,9 +61,6 @@ impl ESTree for BindingPatternKindAndTsFields<'_, '_> { state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &ident.span.start); state.serialize_field("end", &ident.span.end); - if range { - state.serialize_field("range", &[ident.span.start, ident.span.end]); - } state.serialize_field("decorators", &self.decorators); state.serialize_field("name", &JsonSafeString(ident.name.as_str())); } @@ -74,9 +68,6 @@ impl ESTree for BindingPatternKindAndTsFields<'_, '_> { state.serialize_field("type", &JsonSafeString("ObjectPattern")); state.serialize_field("start", &object.span.start); state.serialize_field("end", &object.span.end); - if range { - state.serialize_field("range", &[object.span.start, object.span.end]); - } state.serialize_field("decorators", &self.decorators); state.serialize_field("properties", &Concat2(&object.properties, &object.rest)); } @@ -84,9 +75,6 @@ impl ESTree for BindingPatternKindAndTsFields<'_, '_> { state.serialize_field("type", &JsonSafeString("ArrayPattern")); state.serialize_field("start", &array.span.start); state.serialize_field("end", &array.span.end); - if range { - state.serialize_field("range", &[array.span.start, array.span.end]); - } state.serialize_field("decorators", &self.decorators); state.serialize_field("elements", &Concat2(&array.elements, &array.rest)); } @@ -94,9 +82,6 @@ impl ESTree for BindingPatternKindAndTsFields<'_, '_> { state.serialize_field("type", &JsonSafeString("AssignmentPattern")); state.serialize_field("start", &assignment.span.start); state.serialize_field("end", &assignment.span.end); - if range { - state.serialize_field("range", &[assignment.span.start, assignment.span.end]); - } state.serialize_field("decorators", &self.decorators); state.serialize_field("left", &assignment.left); state.serialize_field("right", &assignment.right); @@ -180,14 +165,10 @@ struct FormalParametersRest<'a, 'b>(&'b BindingRestElement<'a>); impl ESTree for FormalParametersRest<'_, '_> { fn serialize(&self, serializer: S) { let rest = self.0; - let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("RestElement")); state.serialize_field("start", &rest.span.start); state.serialize_field("end", &rest.span.end); - if range { - state.serialize_field("range", &[rest.span.start, rest.span.end]); - } state.serialize_ts_field("decorators", &EmptyArray(())); state.serialize_field("argument", &rest.argument.kind); state.serialize_ts_field("optional", &rest.argument.optional); @@ -244,14 +225,10 @@ impl ESTree for FormalParameterConverter<'_, '_> { if S::INCLUDE_TS_FIELDS { if param.has_modifier() { - let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSParameterProperty")); state.serialize_field("start", ¶m.span.start); state.serialize_field("end", ¶m.span.end); - if range { - state.serialize_field("range", &[param.span.start, param.span.end]); - } state.serialize_field("accessibility", ¶m.accessibility); state.serialize_field("decorators", ¶m.decorators); state.serialize_field("override", ¶m.r#override); @@ -418,21 +395,10 @@ pub struct ArrowFunctionExpressionBody<'a>(pub &'a ArrowFunctionExpression<'a>); impl ESTree for ArrowFunctionExpressionBody<'_> { fn serialize(&self, serializer: S) { - let arrow_expr = self.0; - if arrow_expr.expression { - // Expression body is represented as a `FunctionBody` with a single `ExpressionStatement` - // which contains the expression. - if let Some(Statement::ExpressionStatement(expr_stmt)) = - arrow_expr.body.statements.get(0) - { - expr_stmt.expression.serialize(serializer); - } else { - // Should be unreachable for a valid AST. - // Serialize as a `BlockStatement` as a fallback. - arrow_expr.body.serialize(serializer); - } + if let Some(expression) = self.0.get_expression() { + expression.serialize(serializer); } else { - arrow_expr.body.serialize(serializer); + self.0.body.serialize(serializer); } } } @@ -470,23 +436,19 @@ pub struct AssignmentTargetPropertyIdentifierInit<'a>( impl ESTree for AssignmentTargetPropertyIdentifierInit<'_> { fn serialize(&self, serializer: S) { - let prop = self.0; - if let Some(init) = &prop.init { - let range = serializer.range(); + if let Some(init) = &self.0.init { let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AssignmentPattern")); - let start = prop.binding.span.start; - let end = init.span().end; - state.serialize_field("start", &start); - state.serialize_field("end", &end); - if range { - state.serialize_field("range", &[start, end]); - } - state.serialize_field("left", &prop.binding); + state.serialize_field("start", &self.0.span.start); + state.serialize_field("end", &self.0.span.end); + state.serialize_ts_field("decorators", &EmptyArray(())); + state.serialize_field("left", &self.0.binding); state.serialize_field("right", init); + state.serialize_ts_field("optional", &false); + state.serialize_ts_field("typeAnnotation", &Null(())); state.end(); } else { - prop.binding.serialize(serializer); + self.0.binding.serialize(serializer); } } } diff --git a/crates/oxc_ast/src/serialize/jsx.rs b/crates/oxc_ast/src/serialize/jsx.rs index 281aeb7baf5e7..7a7fa9cf93356 100644 --- a/crates/oxc_ast/src/serialize/jsx.rs +++ b/crates/oxc_ast/src/serialize/jsx.rs @@ -22,14 +22,10 @@ impl ESTree for JSXElementOpeningElement<'_, '_> { let element = self.0; let opening_element = element.opening_element.as_ref(); - let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXOpeningElement")); state.serialize_field("start", &opening_element.span.start); state.serialize_field("end", &opening_element.span.end); - if range { - state.serialize_field("range", &[opening_element.span.start, opening_element.span.end]); - } state.serialize_field("name", &opening_element.name); state.serialize_ts_field("typeArguments", &opening_element.type_arguments); state.serialize_field("attributes", &opening_element.attributes); diff --git a/crates/oxc_ast/src/serialize/literal.rs b/crates/oxc_ast/src/serialize/literal.rs index fc3bafea23143..25f2dba47b65b 100644 --- a/crates/oxc_ast/src/serialize/literal.rs +++ b/crates/oxc_ast/src/serialize/literal.rs @@ -209,7 +209,6 @@ pub struct TemplateElementConverter<'a, 'b>(pub &'b TemplateElement<'a>); impl ESTree for TemplateElementConverter<'_, '_> { fn serialize(&self, serializer: S) { let element = self.0; - let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TemplateElement")); @@ -220,9 +219,6 @@ impl ESTree for TemplateElementConverter<'_, '_> { } state.serialize_field("start", &span.start); state.serialize_field("end", &span.end); - if range { - state.serialize_field("range", &[span.start, span.end]); - } state.serialize_field("value", &TemplateElementValue(element)); state.serialize_field("tail", &element.tail); diff --git a/crates/oxc_ast/src/serialize/ts.rs b/crates/oxc_ast/src/serialize/ts.rs index 33d17c97ee702..6f40cc0305a4f 100644 --- a/crates/oxc_ast/src/serialize/ts.rs +++ b/crates/oxc_ast/src/serialize/ts.rs @@ -99,14 +99,10 @@ impl ESTree for TSModuleDeclarationConverter<'_, '_> { fn serialize(&self, serializer: S) { let module = self.0; - let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSModuleDeclaration")); state.serialize_field("start", &module.span.start); state.serialize_field("end", &module.span.end); - if range { - state.serialize_field("range", &[module.span.start, module.span.end]); - } match &module.body { Some(TSModuleDeclarationBody::TSModuleDeclaration(inner_module)) => { @@ -175,14 +171,10 @@ impl ESTree for TSModuleDeclarationIdParts<'_, '_> { let span_start = parts[0].span.start; let (&last, rest) = parts.split_last().unwrap(); - let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSQualifiedName")); state.serialize_field("start", &span_start); state.serialize_field("end", &last.span.end); - if range { - state.serialize_field("range", &[span_start, last.span.end]); - } if rest.len() == 1 { // Only one part remaining (e.g. `X`). Serialize as `Identifier`. diff --git a/crates/oxc_parser/src/lib.rs b/crates/oxc_parser/src/lib.rs index dd6014d62203c..98726e1b47e5a 100644 --- a/crates/oxc_parser/src/lib.rs +++ b/crates/oxc_parser/src/lib.rs @@ -221,12 +221,6 @@ pub struct ParseOptions { /// /// [`V8IntrinsicExpression`]: oxc_ast::ast::V8IntrinsicExpression pub allow_v8_intrinsics: bool, - - /// Controls whether the `range` information is included to each node. - /// The `range` property is a [number, number] which indicates the start/end index of the node in the file contents. - /// - /// Default: `false` - pub range: bool, } impl Default for ParseOptions { @@ -237,7 +231,6 @@ impl Default for ParseOptions { allow_return_outside_function: false, preserve_parens: true, allow_v8_intrinsics: false, - range: false, } } } diff --git a/napi/parser/index.d.ts b/napi/parser/index.d.ts index c3f38a08fce33..a863e91ace313 100644 --- a/napi/parser/index.d.ts +++ b/napi/parser/index.d.ts @@ -189,13 +189,6 @@ export interface ParserOptions { * The type of the file is determined from `lang` option, or extension of provided `filename`. */ astType?: 'js' | 'ts' - /** - * Controls whether the `range` property is included on AST nodes. - * The `range` property is a [number, number] which indicates the start/end index of the node in the file contents. - * - * @default false - */ - range?: boolean /** * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST. * diff --git a/napi/parser/src/lib.rs b/napi/parser/src/lib.rs index 7361fb2541a66..8250ff2c58217 100644 --- a/napi/parser/src/lib.rs +++ b/napi/parser/src/lib.rs @@ -69,7 +69,6 @@ fn parse<'a>( Parser::new(allocator, source_text, source_type) .with_options(ParseOptions { preserve_parens: options.preserve_parens.unwrap_or(true), - range: options.range.unwrap_or(false), ..ParseOptions::default() }) .parse() diff --git a/napi/playground/src/lib.rs b/napi/playground/src/lib.rs index 4a0c834b6a001..553f96d98e670 100644 --- a/napi/playground/src/lib.rs +++ b/napi/playground/src/lib.rs @@ -124,7 +124,6 @@ impl Oxc { allow_v8_intrinsics: parser_options .allow_v8_intrinsics .unwrap_or(default_parser_options.allow_v8_intrinsics), - range: false, }; let ParserReturn { mut program, errors, mut module_record, .. } = Parser::new(&allocator, &source_text, source_type) From 09daca08cd59a4e5f1dfd9c8670be269de1b6940 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Fri, 20 Jun 2025 20:41:36 +0200 Subject: [PATCH 26/42] chore: avoid multiplying the configs --- crates/oxc_ast/src/serialize/mod.rs | 22 ++-- crates/oxc_estree/src/serialize/config.rs | 133 +++++---------------- crates/oxc_estree/src/serialize/mod.rs | 31 ++--- crates/oxc_estree/src/serialize/structs.rs | 18 +-- napi/parser/src/lib.rs | 27 ++--- napi/parser/test/parse.test.ts | 6 +- 6 files changed, 64 insertions(+), 173 deletions(-) diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index e35e155b2f3f8..832545d20a7df 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -49,7 +49,7 @@ impl Program<'_> { /// Serialize AST to ESTree JSON, including TypeScript fields. pub fn to_estree_ts_json(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let mut serializer = CompactTSSerializer::with_capacity(capacity); + let mut serializer = CompactTSSerializer::with_capacity(capacity, false); self.serialize(&mut serializer); serializer.into_string() } @@ -57,7 +57,7 @@ impl Program<'_> { /// Serialize AST to ESTree JSON, without TypeScript fields. pub fn to_estree_js_json(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let mut serializer = CompactJSSerializer::with_capacity(capacity); + let mut serializer = CompactJSSerializer::with_capacity(capacity, false); self.serialize(&mut serializer); serializer.into_string() } @@ -65,7 +65,7 @@ impl Program<'_> { /// Serialize AST to pretty-printed ESTree JSON, including TypeScript fields. pub fn to_pretty_estree_ts_json(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let mut serializer = PrettyTSSerializer::with_capacity(capacity); + let mut serializer = PrettyTSSerializer::with_capacity(capacity, false); self.serialize(&mut serializer); serializer.into_string() } @@ -73,7 +73,7 @@ impl Program<'_> { /// Serialize AST to pretty-printed ESTree JSON, without TypeScript fields. pub fn to_pretty_estree_js_json(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let mut serializer = PrettyJSSerializer::with_capacity(capacity); + let mut serializer = PrettyJSSerializer::with_capacity(capacity, false); self.serialize(&mut serializer); serializer.into_string() } @@ -81,28 +81,28 @@ impl Program<'_> { /// Serialize AST to ESTree JSON, including TypeScript fields, with list of fixes. pub fn to_estree_ts_json_with_fixes(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let serializer = CompactFixesTSSerializer::with_capacity(capacity); + let serializer = CompactFixesTSSerializer::with_capacity(capacity, false); serializer.serialize_with_fixes(self) } /// Serialize AST to ESTree JSON, without TypeScript fields, with list of fixes. pub fn to_estree_js_json_with_fixes(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let serializer = CompactFixesJSSerializer::with_capacity(capacity); + let serializer = CompactFixesJSSerializer::with_capacity(capacity, false); serializer.serialize_with_fixes(self) } /// Serialize AST to pretty-printed ESTree JSON, including TypeScript fields, with list of fixes. pub fn to_pretty_estree_ts_json_with_fixes(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let serializer = PrettyFixesTSSerializer::with_capacity(capacity); + let serializer = PrettyFixesTSSerializer::with_capacity(capacity, false); serializer.serialize_with_fixes(self) } /// Serialize AST to pretty-printed ESTree JSON, without TypeScript fields, with list of fixes. pub fn to_pretty_estree_js_json_with_fixes(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let serializer = PrettyFixesJSSerializer::with_capacity(capacity); + let serializer = PrettyFixesJSSerializer::with_capacity(capacity, false); serializer.serialize_with_fixes(self) } } @@ -173,12 +173,12 @@ impl ESTree for ProgramConverter<'_, '_> { state.serialize_field("type", &JsonSafeString("Program")); state.serialize_field("start", &span_start); state.serialize_field("end", &program.span.end); - if range { - state.serialize_field("range", &[span_start, program.span.end]); - } state.serialize_field("body", &Concat2(&program.directives, &program.body)); state.serialize_field("sourceType", &program.source_type.module_kind()); state.serialize_field("hashbang", &program.hashbang); + if range { + state.serialize_field("range", &[span_start, program.span.end]); + } state.end(); } } diff --git a/crates/oxc_estree/src/serialize/config.rs b/crates/oxc_estree/src/serialize/config.rs index 8f6ed7d5709b6..6b615191c5e90 100644 --- a/crates/oxc_estree/src/serialize/config.rs +++ b/crates/oxc_estree/src/serialize/config.rs @@ -4,166 +4,89 @@ pub trait Config { const INCLUDE_TS_FIELDS: bool; /// `true` if should record paths to `Literal` nodes that need fixing on JS side const FIXES: bool; - /// `true` if `range` field should be emitted - const RANGES: bool; - fn new() -> Self; + fn new(ranges: bool) -> Self; - /// Whether to include range information in the serialized output (runtime helper) - #[inline(always)] - fn ranges(&self) -> bool { - Self::RANGES - } + /// Whether to include range information in the serialized output + fn ranges(&self) -> bool; } -/// Config for serializing AST with TypeScript fields, -pub struct ConfigTS; +/// Config for serializing AST with TypeScript fields. +pub struct ConfigTS { + ranges: bool, +} impl Config for ConfigTS { const INCLUDE_TS_FIELDS: bool = true; const FIXES: bool = false; - const RANGES: bool = false; #[inline(always)] - fn new() -> Self { - Self - } - - #[inline] - fn ranges(&self) -> bool { - false + fn new(ranges: bool) -> Self { + Self { ranges } } -} - -/// Config for serializing AST with TypeScript fields, with ranges. -pub struct ConfigTSWithRanges; - -impl Config for ConfigTSWithRanges { - const INCLUDE_TS_FIELDS: bool = true; - const FIXES: bool = false; - const RANGES: bool = true; #[inline(always)] - fn new() -> Self { - Self - } - - #[inline] fn ranges(&self) -> bool { - true + self.ranges } } /// Config for serializing AST without TypeScript fields. -pub struct ConfigJS; +pub struct ConfigJS { + ranges: bool, +} impl Config for ConfigJS { const INCLUDE_TS_FIELDS: bool = false; const FIXES: bool = false; - const RANGES: bool = false; #[inline(always)] - fn new() -> Self { - Self - } - - #[inline] - fn ranges(&self) -> bool { - false + fn new(ranges: bool) -> Self { + Self { ranges } } -} - -/// Config for serializing AST without TypeScript fields, with ranges. -pub struct ConfigJSWithRanges; - -impl Config for ConfigJSWithRanges { - const INCLUDE_TS_FIELDS: bool = false; - const FIXES: bool = false; - const RANGES: bool = true; #[inline(always)] - fn new() -> Self { - Self - } - - #[inline] fn ranges(&self) -> bool { - true + self.ranges } } /// Config for serializing AST with TypeScript fields, with fixes. -pub struct ConfigFixesTS; +pub struct ConfigFixesTS { + ranges: bool, +} impl Config for ConfigFixesTS { const INCLUDE_TS_FIELDS: bool = true; const FIXES: bool = true; - const RANGES: bool = false; #[inline(always)] - fn new() -> Self { - Self - } - - #[inline] - fn ranges(&self) -> bool { - false + fn new(ranges: bool) -> Self { + Self { ranges } } -} - -/// Config for serializing AST with TypeScript fields, with fixes, with ranges. -pub struct ConfigFixesTSWithRanges; - -impl Config for ConfigFixesTSWithRanges { - const INCLUDE_TS_FIELDS: bool = true; - const FIXES: bool = true; - const RANGES: bool = true; #[inline(always)] - fn new() -> Self { - Self - } - - #[inline] fn ranges(&self) -> bool { - true + self.ranges } } /// Config for serializing AST without TypeScript fields, with fixes. -pub struct ConfigFixesJS; +pub struct ConfigFixesJS { + ranges: bool, +} impl Config for ConfigFixesJS { const INCLUDE_TS_FIELDS: bool = false; const FIXES: bool = true; - const RANGES: bool = false; #[inline(always)] - fn new() -> Self { - Self - } - - #[inline] - fn ranges(&self) -> bool { - false + fn new(ranges: bool) -> Self { + Self { ranges } } -} - -/// Config for serializing AST without TypeScript fields, with fixes, with ranges. -pub struct ConfigFixesJSWithRanges; - -impl Config for ConfigFixesJSWithRanges { - const INCLUDE_TS_FIELDS: bool = false; - const FIXES: bool = true; - const RANGES: bool = true; #[inline(always)] - fn new() -> Self { - Self - } - - #[inline] fn ranges(&self) -> bool { - true + self.ranges } } diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index 42bc81366b687..f3bad09f04650 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -20,8 +20,7 @@ use structs::ESTreeStructSerializer; pub use concat::{Concat2, Concat3, ConcatElement}; pub use config::{ - Config, ConfigFixesJS, ConfigFixesJSWithRanges, ConfigFixesTS, ConfigFixesTSWithRanges, - ConfigJS, ConfigJSWithRanges, ConfigTS, ConfigTSWithRanges, + Config, ConfigFixesJS, ConfigFixesTS, ConfigJS, ConfigTS, }; pub use sequences::SequenceSerializer; @@ -90,31 +89,15 @@ pub type PrettyJSSerializer = ESTreeSerializer; /// ESTree serializer which produces compact JSON, including TypeScript fields. pub type CompactFixesTSSerializer = ESTreeSerializer; -/// ESTree serializer which produces compact JSON, including TypeScript fields, with ranges. -pub type CompactFixesTSWithRangesSerializer = - ESTreeSerializer; - /// ESTree serializer which produces compact JSON, excluding TypeScript fields. pub type CompactFixesJSSerializer = ESTreeSerializer; -/// ESTree serializer which produces compact JSON, excluding TypeScript fields, with ranges. -pub type CompactFixesJSWithRangesSerializer = - ESTreeSerializer; - /// ESTree serializer which produces pretty JSON, including TypeScript fields. pub type PrettyFixesTSSerializer = ESTreeSerializer; -/// ESTree serializer which produces pretty JSON, including TypeScript fields, with ranges. -pub type PrettyFixesTSWithRangesSerializer = - ESTreeSerializer; - /// ESTree serializer which produces pretty JSON, excluding TypeScript fields. pub type PrettyFixesJSSerializer = ESTreeSerializer; -/// ESTree serializer which produces pretty JSON, excluding TypeScript fields, with ranges. -pub type PrettyFixesJSWithRangesSerializer = - ESTreeSerializer; - /// ESTree serializer. pub struct ESTreeSerializer { buffer: CodeBuffer, @@ -126,24 +109,24 @@ pub struct ESTreeSerializer { impl ESTreeSerializer { /// Create new [`ESTreeSerializer`]. - pub fn new() -> Self { + pub fn new(ranges: bool) -> Self { Self { buffer: CodeBuffer::new(), formatter: F::new(), trace_path: NonEmptyStack::new(TracePathPart::Index(0)), fixes_buffer: CodeBuffer::new(), - config: C::new(), + config: C::new(ranges), } } /// Create new [`ESTreeSerializer`] with specified buffer capacity. - pub fn with_capacity(capacity: usize) -> Self { + pub fn with_capacity(capacity: usize, ranges: bool) -> Self { Self { buffer: CodeBuffer::with_capacity(capacity), formatter: F::new(), trace_path: NonEmptyStack::new(TracePathPart::Index(0)), fixes_buffer: CodeBuffer::new(), - config: C::new(), + config: C::new(ranges), } } @@ -199,7 +182,7 @@ impl ESTreeSerializer { impl Default for ESTreeSerializer { #[inline(always)] fn default() -> Self { - Self::new() + Self::new(false) } } @@ -211,7 +194,7 @@ impl<'s, C: Config, F: Formatter> Serializer for &'s mut ESTreeSerializer type SequenceSerializer = ESTreeSequenceSerializer<'s, C, F>; fn range(&self) -> bool { - C::RANGES + self.config.ranges() } /// Serialize struct. diff --git a/crates/oxc_estree/src/serialize/structs.rs b/crates/oxc_estree/src/serialize/structs.rs index 5c6005b83f18e..358b6bdddac0f 100644 --- a/crates/oxc_estree/src/serialize/structs.rs +++ b/crates/oxc_estree/src/serialize/structs.rs @@ -151,7 +151,7 @@ impl StructSerializer for ESTreeStructSerializer<'_, C, } fn range(&self) -> bool { - C::RANGES + self.serializer.config.ranges() } } @@ -364,7 +364,7 @@ mod tests { maybe_not_bar: None, }; - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -372,7 +372,7 @@ mod tests { r#"{"n":123,"u":12345,"bar":{"yes":"yup","no":"nope"},"empty":{},"hello":"hi!","maybe_bar":{"yes":"hell yeah!","no":"not a chance in a million, mate"},"maybe_not_bar":null}"# ); - let mut serializer = PrettyTSSerializer::new(); + let mut serializer = PrettyTSSerializer::new(false); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -453,7 +453,7 @@ mod tests { outer2: "out2", }; - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); outer.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -461,7 +461,7 @@ mod tests { r#"{"outer1":"out1","inner1":"in1","innermost1":"inin1","innermost2":"inin2","inner2":"in2","outer2":"out2"}"# ); - let mut serializer = PrettyTSSerializer::new(); + let mut serializer = PrettyTSSerializer::new(false); outer.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -499,12 +499,12 @@ mod tests { let foo = Foo { js: 1, ts: 2, js_only: 3, more_js: 4 }; - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, r#"{"js":1,"ts":2,"moreJs":4}"#); - let mut serializer = PrettyTSSerializer::new(); + let mut serializer = PrettyTSSerializer::new(false); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -516,12 +516,12 @@ mod tests { }"# ); - let mut serializer = CompactJSSerializer::new(); + let mut serializer = CompactJSSerializer::new(false); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, r#"{"js":1,"jsOnly":3,"moreJs":4}"#); - let mut serializer = PrettyJSSerializer::new(); + let mut serializer = PrettyJSSerializer::new(false); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( diff --git a/napi/parser/src/lib.rs b/napi/parser/src/lib.rs index 8250ff2c58217..b35464a56464d 100644 --- a/napi/parser/src/lib.rs +++ b/napi/parser/src/lib.rs @@ -20,8 +20,7 @@ use oxc::{ span::SourceType, }; use oxc_estree::{ - CompactFixesJSSerializer, CompactFixesJSWithRangesSerializer, CompactFixesTSSerializer, - CompactFixesTSWithRangesSerializer, + CompactFixesJSSerializer, CompactFixesTSSerializer, }; use oxc_napi::{Comment, OxcError, convert_utf8_to_utf16, get_source_type}; @@ -111,28 +110,16 @@ fn parse_with_return(filename: &str, source_text: String, options: &ParserOption ); } - if range { - let capacity = program.source_text.len() * 16; - let serializer = CompactFixesJSWithRangesSerializer::with_capacity(capacity); - serializer.serialize_with_fixes(&program) - } else { - let capacity = program.source_text.len() * 16; - let serializer = CompactFixesJSSerializer::with_capacity(capacity); - serializer.serialize_with_fixes(&program) - } + let capacity = program.source_text.len() * 16; + let serializer = CompactFixesJSSerializer::with_capacity(capacity, range); + serializer.serialize_with_fixes(&program) } AstType::TypeScript => { // Note: `@typescript-eslint/parser` ignores hashbangs, // See: https://github.com/typescript-eslint/typescript-eslint/issues/6500 - if range { - let capacity = program.source_text.len() * 16; - let serializer = CompactFixesTSWithRangesSerializer::with_capacity(capacity); - serializer.serialize_with_fixes(&program) - } else { - let capacity = program.source_text.len() * 16; - let serializer = CompactFixesTSSerializer::with_capacity(capacity); - serializer.serialize_with_fixes(&program) - } + let capacity = program.source_text.len() * 16; + let serializer = CompactFixesTSSerializer::with_capacity(capacity, range); + serializer.serialize_with_fixes(&program) } }; diff --git a/napi/parser/test/parse.test.ts b/napi/parser/test/parse.test.ts index 1b07a90842b22..6ad2eeaff9173 100644 --- a/napi/parser/test/parse.test.ts +++ b/napi/parser/test/parse.test.ts @@ -692,14 +692,12 @@ describe('parse', () => { it('should not include range when false', () => { const ret = parseSync('test.js', '(x)', { range: false }); - expect(ret.program.body[0].start).toBe(0); expect(ret.program.body[0].range).toBeUndefined(); }); it('should include range by default', () => { - const ret = parseSync('test.js', '(x)', { range: true }); - expect(ret.program.body[0].start).toBe(0); - expect(ret.program.body[0].range).toEqual([0, 3]); + const ret = parseSync('test.js', '(x)'); + expect(ret.program.body[0].range).toBeUndefined(); }); }); }); From fe16f2cfcf63676d6d1743d139a0472ed1ca8704 Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Fri, 20 Jun 2025 20:42:07 +0200 Subject: [PATCH 27/42] chore: fmt --- crates/oxc_estree/src/serialize/mod.rs | 4 +--- napi/parser/src/lib.rs | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index f3bad09f04650..5ed8827f75c36 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -19,9 +19,7 @@ use sequences::ESTreeSequenceSerializer; use structs::ESTreeStructSerializer; pub use concat::{Concat2, Concat3, ConcatElement}; -pub use config::{ - Config, ConfigFixesJS, ConfigFixesTS, ConfigJS, ConfigTS, -}; +pub use config::{Config, ConfigFixesJS, ConfigFixesTS, ConfigJS, ConfigTS}; pub use sequences::SequenceSerializer; pub use strings::{JsonSafeString, LoneSurrogatesString}; diff --git a/napi/parser/src/lib.rs b/napi/parser/src/lib.rs index b35464a56464d..0f0997fd45878 100644 --- a/napi/parser/src/lib.rs +++ b/napi/parser/src/lib.rs @@ -19,9 +19,7 @@ use oxc::{ semantic::SemanticBuilder, span::SourceType, }; -use oxc_estree::{ - CompactFixesJSSerializer, CompactFixesTSSerializer, -}; +use oxc_estree::{CompactFixesJSSerializer, CompactFixesTSSerializer}; use oxc_napi::{Comment, OxcError, convert_utf8_to_utf16, get_source_type}; mod convert; From 26e67dbaaf7477a97b72e2166d3a9f6758cb64da Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Fri, 20 Jun 2025 21:00:07 +0200 Subject: [PATCH 28/42] chore: try to simplify --- crates/oxc_ast/src/serialize/mod.rs | 16 +++++----- crates/oxc_estree/src/serialize/mod.rs | 29 +++++++++---------- crates/oxc_estree/src/serialize/structs.rs | 16 +++++----- .../oxc_syntax/src/generated/derive_estree.rs | 12 -------- napi/parser/src/lib.rs | 4 +-- 5 files changed, 32 insertions(+), 45 deletions(-) diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index 832545d20a7df..5299115087c43 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -49,7 +49,7 @@ impl Program<'_> { /// Serialize AST to ESTree JSON, including TypeScript fields. pub fn to_estree_ts_json(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let mut serializer = CompactTSSerializer::with_capacity(capacity, false); + let mut serializer = CompactTSSerializer::with_capacity(capacity); self.serialize(&mut serializer); serializer.into_string() } @@ -57,7 +57,7 @@ impl Program<'_> { /// Serialize AST to ESTree JSON, without TypeScript fields. pub fn to_estree_js_json(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let mut serializer = CompactJSSerializer::with_capacity(capacity, false); + let mut serializer = CompactJSSerializer::with_capacity(capacity); self.serialize(&mut serializer); serializer.into_string() } @@ -65,7 +65,7 @@ impl Program<'_> { /// Serialize AST to pretty-printed ESTree JSON, including TypeScript fields. pub fn to_pretty_estree_ts_json(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let mut serializer = PrettyTSSerializer::with_capacity(capacity, false); + let mut serializer = PrettyTSSerializer::with_capacity(capacity); self.serialize(&mut serializer); serializer.into_string() } @@ -73,7 +73,7 @@ impl Program<'_> { /// Serialize AST to pretty-printed ESTree JSON, without TypeScript fields. pub fn to_pretty_estree_js_json(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let mut serializer = PrettyJSSerializer::with_capacity(capacity, false); + let mut serializer = PrettyJSSerializer::with_capacity(capacity); self.serialize(&mut serializer); serializer.into_string() } @@ -81,28 +81,28 @@ impl Program<'_> { /// Serialize AST to ESTree JSON, including TypeScript fields, with list of fixes. pub fn to_estree_ts_json_with_fixes(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let serializer = CompactFixesTSSerializer::with_capacity(capacity, false); + let serializer = CompactFixesTSSerializer::with_capacity(capacity); serializer.serialize_with_fixes(self) } /// Serialize AST to ESTree JSON, without TypeScript fields, with list of fixes. pub fn to_estree_js_json_with_fixes(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let serializer = CompactFixesJSSerializer::with_capacity(capacity, false); + let serializer = CompactFixesJSSerializer::with_capacity(capacity); serializer.serialize_with_fixes(self) } /// Serialize AST to pretty-printed ESTree JSON, including TypeScript fields, with list of fixes. pub fn to_pretty_estree_ts_json_with_fixes(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let serializer = PrettyFixesTSSerializer::with_capacity(capacity, false); + let serializer = PrettyFixesTSSerializer::with_capacity(capacity); serializer.serialize_with_fixes(self) } /// Serialize AST to pretty-printed ESTree JSON, without TypeScript fields, with list of fixes. pub fn to_pretty_estree_js_json_with_fixes(&self) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let serializer = PrettyFixesJSSerializer::with_capacity(capacity, false); + let serializer = PrettyFixesJSSerializer::with_capacity(capacity); serializer.serialize_with_fixes(self) } } diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index 5ed8827f75c36..ddf01a4210e54 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -106,8 +106,13 @@ pub struct ESTreeSerializer { } impl ESTreeSerializer { - /// Create new [`ESTreeSerializer`]. - pub fn new(ranges: bool) -> Self { + /// Create new [`ESTreeSerializer`] with ranges disabled. + pub fn new() -> Self { + Self::new_with_ranges(false) + } + + /// Create new [`ESTreeSerializer`] with specified ranges setting. + pub fn new_with_ranges(ranges: bool) -> Self { Self { buffer: CodeBuffer::new(), formatter: F::new(), @@ -117,25 +122,19 @@ impl ESTreeSerializer { } } - /// Create new [`ESTreeSerializer`] with specified buffer capacity. - pub fn with_capacity(capacity: usize, ranges: bool) -> Self { - Self { - buffer: CodeBuffer::with_capacity(capacity), - formatter: F::new(), - trace_path: NonEmptyStack::new(TracePathPart::Index(0)), - fixes_buffer: CodeBuffer::new(), - config: C::new(ranges), - } + /// Create new [`ESTreeSerializer`] with specified buffer capacity and ranges disabled. + pub fn with_capacity(capacity: usize) -> Self { + Self::with_capacity_and_ranges(capacity, false) } - /// Create new [`ESTreeSerializer`] with specified config and buffer capacity. - pub fn with_config_and_capacity(config: C, capacity: usize) -> Self { + /// Create new [`ESTreeSerializer`] with specified buffer capacity and ranges setting. + pub fn with_capacity_and_ranges(capacity: usize, ranges: bool) -> Self { Self { buffer: CodeBuffer::with_capacity(capacity), formatter: F::new(), trace_path: NonEmptyStack::new(TracePathPart::Index(0)), fixes_buffer: CodeBuffer::new(), - config, + config: C::new(ranges), } } @@ -180,7 +179,7 @@ impl ESTreeSerializer { impl Default for ESTreeSerializer { #[inline(always)] fn default() -> Self { - Self::new(false) + Self::new() } } diff --git a/crates/oxc_estree/src/serialize/structs.rs b/crates/oxc_estree/src/serialize/structs.rs index 358b6bdddac0f..68fb082285c4e 100644 --- a/crates/oxc_estree/src/serialize/structs.rs +++ b/crates/oxc_estree/src/serialize/structs.rs @@ -364,7 +364,7 @@ mod tests { maybe_not_bar: None, }; - let mut serializer = CompactTSSerializer::new(false); + let mut serializer = CompactTSSerializer::new(); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -372,7 +372,7 @@ mod tests { r#"{"n":123,"u":12345,"bar":{"yes":"yup","no":"nope"},"empty":{},"hello":"hi!","maybe_bar":{"yes":"hell yeah!","no":"not a chance in a million, mate"},"maybe_not_bar":null}"# ); - let mut serializer = PrettyTSSerializer::new(false); + let mut serializer = PrettyTSSerializer::new(); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -453,7 +453,7 @@ mod tests { outer2: "out2", }; - let mut serializer = CompactTSSerializer::new(false); + let mut serializer = CompactTSSerializer::new(); outer.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -461,7 +461,7 @@ mod tests { r#"{"outer1":"out1","inner1":"in1","innermost1":"inin1","innermost2":"inin2","inner2":"in2","outer2":"out2"}"# ); - let mut serializer = PrettyTSSerializer::new(false); + let mut serializer = PrettyTSSerializer::new(); outer.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -499,12 +499,12 @@ mod tests { let foo = Foo { js: 1, ts: 2, js_only: 3, more_js: 4 }; - let mut serializer = CompactTSSerializer::new(false); + let mut serializer = CompactTSSerializer::new(); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, r#"{"js":1,"ts":2,"moreJs":4}"#); - let mut serializer = PrettyTSSerializer::new(false); + let mut serializer = PrettyTSSerializer::new(); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -516,12 +516,12 @@ mod tests { }"# ); - let mut serializer = CompactJSSerializer::new(false); + let mut serializer = CompactJSSerializer::new(); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, r#"{"js":1,"jsOnly":3,"moreJs":4}"#); - let mut serializer = PrettyJSSerializer::new(false); + let mut serializer = PrettyJSSerializer::new(); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( diff --git a/crates/oxc_syntax/src/generated/derive_estree.rs b/crates/oxc_syntax/src/generated/derive_estree.rs index c48c875fd56fe..40139563a60e0 100644 --- a/crates/oxc_syntax/src/generated/derive_estree.rs +++ b/crates/oxc_syntax/src/generated/derive_estree.rs @@ -12,14 +12,10 @@ use crate::operator::*; impl ESTree for NameSpan<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("value", &self.name); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -50,7 +46,6 @@ impl ESTree for ImportImportName<'_> { impl ESTree for ExportEntry<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); @@ -59,9 +54,6 @@ impl ESTree for ExportEntry<'_> { state.serialize_field("exportName", &self.export_name); state.serialize_field("localName", &self.local_name); state.serialize_field("isType", &self.is_type); - if range { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -103,14 +95,10 @@ impl ESTree for ExportLocalName<'_> { impl ESTree for DynamicImport { fn serialize(&self, serializer: S) { - let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("moduleRequest", &self.module_request); - if range { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } diff --git a/napi/parser/src/lib.rs b/napi/parser/src/lib.rs index 0f0997fd45878..c3149354e9ee5 100644 --- a/napi/parser/src/lib.rs +++ b/napi/parser/src/lib.rs @@ -109,14 +109,14 @@ fn parse_with_return(filename: &str, source_text: String, options: &ParserOption } let capacity = program.source_text.len() * 16; - let serializer = CompactFixesJSSerializer::with_capacity(capacity, range); + let serializer = CompactFixesJSSerializer::with_capacity_and_ranges(capacity, range); serializer.serialize_with_fixes(&program) } AstType::TypeScript => { // Note: `@typescript-eslint/parser` ignores hashbangs, // See: https://github.com/typescript-eslint/typescript-eslint/issues/6500 let capacity = program.source_text.len() * 16; - let serializer = CompactFixesTSSerializer::with_capacity(capacity, range); + let serializer = CompactFixesTSSerializer::with_capacity_and_ranges(capacity, range); serializer.serialize_with_fixes(&program) } }; From 1088610bf57795c8b84643d5d47c18235f130fbb Mon Sep 17 00:00:00 2001 From: bacarybruno Date: Fri, 20 Jun 2025 21:03:52 +0200 Subject: [PATCH 29/42] chore: revert generated code --- napi/parser/src/generated/derive_estree.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/napi/parser/src/generated/derive_estree.rs b/napi/parser/src/generated/derive_estree.rs index 6584034652178..b894a373a1694 100644 --- a/napi/parser/src/generated/derive_estree.rs +++ b/napi/parser/src/generated/derive_estree.rs @@ -44,14 +44,10 @@ impl ESTree for ErrorSeverity { impl ESTree for ErrorLabel<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("message", &self.message); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } @@ -70,29 +66,21 @@ impl ESTree for EcmaScriptModule<'_> { impl ESTree for StaticImport<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("moduleRequest", &self.module_request); state.serialize_field("entries", &self.entries); - if range { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } impl ESTree for StaticExport<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("entries", &self.entries); - if range { - state.serialize_field("range", &[self.span.start, self.span.end]); - } state.end(); } } From ffb1396c94696e65804debbf755baabf657eedee Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 24 Jun 2025 01:02:37 +0100 Subject: [PATCH 30/42] Update generated code --- crates/oxc_ast/src/generated/derive_estree.rs | 716 ++++++++++++++++++ .../oxc_syntax/src/generated/derive_estree.rs | 12 + napi/parser/src/generated/derive_estree.rs | 12 + 3 files changed, 740 insertions(+) diff --git a/crates/oxc_ast/src/generated/derive_estree.rs b/crates/oxc_ast/src/generated/derive_estree.rs index dd5c22b0a3e69..60d64a6305f61 100644 --- a/crates/oxc_ast/src/generated/derive_estree.rs +++ b/crates/oxc_ast/src/generated/derive_estree.rs @@ -71,6 +71,7 @@ impl ESTree for Expression<'_> { impl ESTree for IdentifierName<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); @@ -79,12 +80,16 @@ impl ESTree for IdentifierName<'_> { state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for IdentifierReference<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); @@ -93,12 +98,16 @@ impl ESTree for IdentifierReference<'_> { state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for BindingIdentifier<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); @@ -107,12 +116,16 @@ impl ESTree for BindingIdentifier<'_> { state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for LabelIdentifier<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); @@ -121,27 +134,38 @@ impl ESTree for LabelIdentifier<'_> { state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ThisExpression { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ThisExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ArrayExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrayExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("elements", &self.elements); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -206,11 +230,15 @@ impl ESTree for Elision { impl ESTree for ObjectExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ObjectExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("properties", &self.properties); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -226,6 +254,7 @@ impl ESTree for ObjectPropertyKind<'_> { impl ESTree for ObjectProperty<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); state.serialize_field("start", &self.span.start); @@ -237,6 +266,9 @@ impl ESTree for ObjectProperty<'_> { state.serialize_field("shorthand", &self.shorthand); state.serialize_field("computed", &self.computed); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -305,18 +337,23 @@ impl ESTree for PropertyKind { impl ESTree for TemplateLiteral<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TemplateLiteral")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("quasis", &self.quasis); state.serialize_field("expressions", &self.expressions); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TaggedTemplateExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TaggedTemplateExpression")); state.serialize_field("start", &self.span.start); @@ -324,6 +361,9 @@ impl ESTree for TaggedTemplateExpression<'_> { state.serialize_field("tag", &self.tag); state.serialize_ts_field("typeArguments", &self.type_arguments); state.serialize_field("quasi", &self.quasi); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -355,6 +395,7 @@ impl ESTree for MemberExpression<'_> { impl ESTree for ComputedMemberExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MemberExpression")); state.serialize_field("start", &self.span.start); @@ -363,12 +404,16 @@ impl ESTree for ComputedMemberExpression<'_> { state.serialize_field("property", &self.expression); state.serialize_field("optional", &self.optional); state.serialize_field("computed", &crate::serialize::basic::True(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for StaticMemberExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MemberExpression")); state.serialize_field("start", &self.span.start); @@ -377,12 +422,16 @@ impl ESTree for StaticMemberExpression<'_> { state.serialize_field("property", &self.property); state.serialize_field("optional", &self.optional); state.serialize_field("computed", &crate::serialize::basic::False(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for PrivateFieldExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MemberExpression")); state.serialize_field("start", &self.span.start); @@ -391,12 +440,16 @@ impl ESTree for PrivateFieldExpression<'_> { state.serialize_field("property", &self.field); state.serialize_field("optional", &self.optional); state.serialize_field("computed", &crate::serialize::basic::False(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for CallExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("CallExpression")); state.serialize_field("start", &self.span.start); @@ -405,12 +458,16 @@ impl ESTree for CallExpression<'_> { state.serialize_ts_field("typeArguments", &self.type_arguments); state.serialize_field("arguments", &self.arguments); state.serialize_field("optional", &self.optional); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for NewExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("NewExpression")); state.serialize_field("start", &self.span.start); @@ -418,29 +475,40 @@ impl ESTree for NewExpression<'_> { state.serialize_field("callee", &self.callee); state.serialize_ts_field("typeArguments", &self.type_arguments); state.serialize_field("arguments", &self.arguments); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for MetaProperty<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MetaProperty")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("meta", &self.meta); state.serialize_field("property", &self.property); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for SpreadElement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SpreadElement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -498,6 +566,7 @@ impl ESTree for Argument<'_> { impl ESTree for UpdateExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("UpdateExpression")); state.serialize_field("start", &self.span.start); @@ -505,12 +574,16 @@ impl ESTree for UpdateExpression<'_> { state.serialize_field("operator", &self.operator); state.serialize_field("prefix", &self.prefix); state.serialize_field("argument", &self.argument); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for UnaryExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("UnaryExpression")); state.serialize_field("start", &self.span.start); @@ -518,12 +591,16 @@ impl ESTree for UnaryExpression<'_> { state.serialize_field("operator", &self.operator); state.serialize_field("argument", &self.argument); state.serialize_field("prefix", &crate::serialize::basic::True(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for BinaryExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BinaryExpression")); state.serialize_field("start", &self.span.start); @@ -531,12 +608,16 @@ impl ESTree for BinaryExpression<'_> { state.serialize_field("left", &self.left); state.serialize_field("operator", &self.operator); state.serialize_field("right", &self.right); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for PrivateInExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BinaryExpression")); state.serialize_field("start", &self.span.start); @@ -544,12 +625,16 @@ impl ESTree for PrivateInExpression<'_> { state.serialize_field("left", &self.left); state.serialize_field("operator", &crate::serialize::basic::In(self)); state.serialize_field("right", &self.right); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for LogicalExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("LogicalExpression")); state.serialize_field("start", &self.span.start); @@ -557,12 +642,16 @@ impl ESTree for LogicalExpression<'_> { state.serialize_field("left", &self.left); state.serialize_field("operator", &self.operator); state.serialize_field("right", &self.right); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ConditionalExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ConditionalExpression")); state.serialize_field("start", &self.span.start); @@ -570,12 +659,16 @@ impl ESTree for ConditionalExpression<'_> { state.serialize_field("test", &self.test); state.serialize_field("consequent", &self.consequent); state.serialize_field("alternate", &self.alternate); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for AssignmentExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AssignmentExpression")); state.serialize_field("start", &self.span.start); @@ -583,6 +676,9 @@ impl ESTree for AssignmentExpression<'_> { state.serialize_field("operator", &self.operator); state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -630,6 +726,7 @@ impl ESTree for AssignmentTargetPattern<'_> { impl ESTree for ArrayAssignmentTarget<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrayPattern")); state.serialize_field("start", &self.span.start); @@ -638,12 +735,16 @@ impl ESTree for ArrayAssignmentTarget<'_> { state.serialize_field("elements", &Concat2(&self.elements, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ObjectAssignmentTarget<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ObjectPattern")); state.serialize_field("start", &self.span.start); @@ -652,12 +753,16 @@ impl ESTree for ObjectAssignmentTarget<'_> { state.serialize_field("properties", &Concat2(&self.properties, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for AssignmentTargetRest<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("RestElement")); state.serialize_field("start", &self.span.start); @@ -667,6 +772,9 @@ impl ESTree for AssignmentTargetRest<'_> { state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); state.serialize_ts_field("value", &crate::serialize::basic::TsNull(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -691,6 +799,7 @@ impl ESTree for AssignmentTargetMaybeDefault<'_> { impl ESTree for AssignmentTargetWithDefault<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AssignmentPattern")); state.serialize_field("start", &self.span.start); @@ -700,6 +809,9 @@ impl ESTree for AssignmentTargetWithDefault<'_> { state.serialize_field("right", &self.init); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -715,6 +827,7 @@ impl ESTree for AssignmentTargetProperty<'_> { impl ESTree for AssignmentTargetPropertyIdentifier<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); state.serialize_field("start", &self.span.start); @@ -729,12 +842,16 @@ impl ESTree for AssignmentTargetPropertyIdentifier<'_> { state.serialize_field("shorthand", &crate::serialize::basic::True(self)); state.serialize_field("computed", &crate::serialize::basic::False(self)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for AssignmentTargetPropertyProperty<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); state.serialize_field("start", &self.span.start); @@ -746,49 +863,68 @@ impl ESTree for AssignmentTargetPropertyProperty<'_> { state.serialize_field("shorthand", &crate::serialize::basic::False(self)); state.serialize_field("computed", &self.computed); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for SequenceExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SequenceExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expressions", &self.expressions); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for Super { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Super")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for AwaitExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AwaitExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ChainExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ChainExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -807,11 +943,15 @@ impl ESTree for ChainElement<'_> { impl ESTree for ParenthesizedExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ParenthesizedExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -857,34 +997,46 @@ impl ESTree for Statement<'_> { impl ESTree for Directive<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExpressionStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); state.serialize_field("directive", &self.directive); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for Hashbang<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Hashbang")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for BlockStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BlockStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -906,6 +1058,7 @@ impl ESTree for Declaration<'_> { impl ESTree for VariableDeclaration<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("VariableDeclaration")); state.serialize_field("start", &self.span.start); @@ -913,6 +1066,9 @@ impl ESTree for VariableDeclaration<'_> { state.serialize_field("kind", &self.kind); state.serialize_field("declarations", &self.declarations); state.serialize_ts_field("declare", &self.declare); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -931,6 +1087,7 @@ impl ESTree for VariableDeclarationKind { impl ESTree for VariableDeclarator<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("VariableDeclarator")); state.serialize_field("start", &self.span.start); @@ -938,22 +1095,30 @@ impl ESTree for VariableDeclarator<'_> { state.serialize_field("id", &self.id); state.serialize_field("init", &self.init); state.serialize_ts_field("definite", &self.definite); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for EmptyStatement { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("EmptyStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ExpressionStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExpressionStatement")); state.serialize_field("start", &self.span.start); @@ -963,12 +1128,16 @@ impl ESTree for ExpressionStatement<'_> { "directive", &crate::serialize::ts::ExpressionStatementDirective(self), ); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for IfStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("IfStatement")); state.serialize_field("start", &self.span.start); @@ -976,36 +1145,48 @@ impl ESTree for IfStatement<'_> { state.serialize_field("test", &self.test); state.serialize_field("consequent", &self.consequent); state.serialize_field("alternate", &self.alternate); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for DoWhileStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("DoWhileStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); state.serialize_field("test", &self.test); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for WhileStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("WhileStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("test", &self.test); state.serialize_field("body", &self.body); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ForStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ForStatement")); state.serialize_field("start", &self.span.start); @@ -1014,6 +1195,9 @@ impl ESTree for ForStatement<'_> { state.serialize_field("test", &self.test); state.serialize_field("update", &self.update); state.serialize_field("body", &self.body); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1071,6 +1255,7 @@ impl ESTree for ForStatementInit<'_> { impl ESTree for ForInStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ForInStatement")); state.serialize_field("start", &self.span.start); @@ -1078,6 +1263,9 @@ impl ESTree for ForInStatement<'_> { state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); state.serialize_field("body", &self.body); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1102,6 +1290,7 @@ impl ESTree for ForStatementLeft<'_> { impl ESTree for ForOfStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ForOfStatement")); state.serialize_field("start", &self.span.start); @@ -1110,104 +1299,140 @@ impl ESTree for ForOfStatement<'_> { state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); state.serialize_field("body", &self.body); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ContinueStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ContinueStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("label", &self.label); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for BreakStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BreakStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("label", &self.label); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ReturnStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ReturnStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for WithStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("WithStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("object", &self.object); state.serialize_field("body", &self.body); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for SwitchStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SwitchStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("discriminant", &self.discriminant); state.serialize_field("cases", &self.cases); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for SwitchCase<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SwitchCase")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("test", &self.test); state.serialize_field("consequent", &self.consequent); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for LabeledStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("LabeledStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("label", &self.label); state.serialize_field("body", &self.body); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ThrowStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ThrowStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TryStatement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TryStatement")); state.serialize_field("start", &self.span.start); @@ -1215,18 +1440,25 @@ impl ESTree for TryStatement<'_> { state.serialize_field("block", &self.block); state.serialize_field("handler", &self.handler); state.serialize_field("finalizer", &self.finalizer); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for CatchClause<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("CatchClause")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("param", &self.param); state.serialize_field("body", &self.body); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1239,10 +1471,14 @@ impl ESTree for CatchParameter<'_> { impl ESTree for DebuggerStatement { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("DebuggerStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1266,6 +1502,7 @@ impl ESTree for BindingPatternKind<'_> { impl ESTree for AssignmentPattern<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AssignmentPattern")); state.serialize_field("start", &self.span.start); @@ -1275,12 +1512,16 @@ impl ESTree for AssignmentPattern<'_> { state.serialize_field("right", &self.right); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ObjectPattern<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ObjectPattern")); state.serialize_field("start", &self.span.start); @@ -1289,12 +1530,16 @@ impl ESTree for ObjectPattern<'_> { state.serialize_field("properties", &Concat2(&self.properties, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for BindingProperty<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); state.serialize_field("start", &self.span.start); @@ -1306,12 +1551,16 @@ impl ESTree for BindingProperty<'_> { state.serialize_field("shorthand", &self.shorthand); state.serialize_field("computed", &self.computed); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ArrayPattern<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrayPattern")); state.serialize_field("start", &self.span.start); @@ -1320,12 +1569,16 @@ impl ESTree for ArrayPattern<'_> { state.serialize_field("elements", &Concat2(&self.elements, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for BindingRestElement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("RestElement")); state.serialize_field("start", &self.span.start); @@ -1335,12 +1588,16 @@ impl ESTree for BindingRestElement<'_> { state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); state.serialize_ts_field("value", &crate::serialize::basic::TsNull(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for Function<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); @@ -1354,6 +1611,9 @@ impl ESTree for Function<'_> { state.serialize_ts_field("returnType", &self.return_type); state.serialize_field("body", &self.body); state.serialize_field("expression", &crate::serialize::basic::False(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1402,17 +1662,22 @@ impl ESTree for FormalParameterKind { impl ESTree for FunctionBody<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BlockStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &Concat2(&self.directives, &self.statements)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ArrowFunctionExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrowFunctionExpression")); state.serialize_field("start", &self.span.start); @@ -1425,24 +1690,32 @@ impl ESTree for ArrowFunctionExpression<'_> { state.serialize_field("body", &crate::serialize::js::ArrowFunctionExpressionBody(self)); state.serialize_field("id", &crate::serialize::basic::Null(self)); state.serialize_field("generator", &crate::serialize::basic::False(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for YieldExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("YieldExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("delegate", &self.delegate); state.serialize_field("argument", &self.argument); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for Class<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); @@ -1456,6 +1729,9 @@ impl ESTree for Class<'_> { state.serialize_field("body", &self.body); state.serialize_ts_field("abstract", &self.r#abstract); state.serialize_ts_field("declare", &self.declare); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1471,11 +1747,15 @@ impl ESTree for ClassType { impl ESTree for ClassBody<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ClassBody")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1494,6 +1774,7 @@ impl ESTree for ClassElement<'_> { impl ESTree for MethodDefinition<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); @@ -1507,6 +1788,9 @@ impl ESTree for MethodDefinition<'_> { state.serialize_ts_field("override", &self.r#override); state.serialize_ts_field("optional", &self.optional); state.serialize_ts_field("accessibility", &self.accessibility); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1524,6 +1808,7 @@ impl ESTree for MethodDefinitionType { impl ESTree for PropertyDefinition<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); @@ -1540,6 +1825,9 @@ impl ESTree for PropertyDefinition<'_> { state.serialize_ts_field("definite", &self.definite); state.serialize_ts_field("readonly", &self.readonly); state.serialize_ts_field("accessibility", &self.accessibility); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1568,22 +1856,30 @@ impl ESTree for MethodDefinitionKind { impl ESTree for PrivateIdentifier<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("PrivateIdentifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for StaticBlock<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("StaticBlock")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1614,6 +1910,7 @@ impl ESTree for AccessorPropertyType { impl ESTree for AccessorProperty<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); @@ -1630,12 +1927,16 @@ impl ESTree for AccessorProperty<'_> { state.serialize_ts_field("declare", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("readonly", &crate::serialize::basic::TsFalse(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ImportExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportExpression")); state.serialize_field("start", &self.span.start); @@ -1643,12 +1944,16 @@ impl ESTree for ImportExpression<'_> { state.serialize_field("source", &self.source); state.serialize_field("options", &self.options); state.serialize_field("phase", &self.phase); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ImportDeclaration<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportDeclaration")); state.serialize_field("start", &self.span.start); @@ -1664,6 +1969,9 @@ impl ESTree for ImportDeclaration<'_> { &crate::serialize::js::ImportDeclarationWithClause(self), ); state.serialize_ts_field("importKind", &self.import_kind); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1689,6 +1997,7 @@ impl ESTree for ImportDeclarationSpecifier<'_> { impl ESTree for ImportSpecifier<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportSpecifier")); state.serialize_field("start", &self.span.start); @@ -1696,48 +2005,67 @@ impl ESTree for ImportSpecifier<'_> { state.serialize_field("imported", &self.imported); state.serialize_field("local", &self.local); state.serialize_ts_field("importKind", &self.import_kind); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ImportDefaultSpecifier<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportDefaultSpecifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("local", &self.local); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ImportNamespaceSpecifier<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportNamespaceSpecifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("local", &self.local); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for WithClause<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("attributes", &self.with_entries); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ImportAttribute<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportAttribute")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("key", &self.key); state.serialize_field("value", &self.value); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1753,6 +2081,7 @@ impl ESTree for ImportAttributeKey<'_> { impl ESTree for ExportNamedDeclaration<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportNamedDeclaration")); state.serialize_field("start", &self.span.start); @@ -1765,24 +2094,32 @@ impl ESTree for ExportNamedDeclaration<'_> { "attributes", &crate::serialize::js::ExportNamedDeclarationWithClause(self), ); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ExportDefaultDeclaration<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportDefaultDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("declaration", &self.declaration); state.serialize_ts_field("exportKind", &crate::serialize::basic::TsValue(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ExportAllDeclaration<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportAllDeclaration")); state.serialize_field("start", &self.span.start); @@ -1794,12 +2131,16 @@ impl ESTree for ExportAllDeclaration<'_> { &crate::serialize::js::ExportAllDeclarationWithClause(self), ); state.serialize_ts_field("exportKind", &self.export_kind); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for ExportSpecifier<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportSpecifier")); state.serialize_field("start", &self.span.start); @@ -1807,6 +2148,9 @@ impl ESTree for ExportSpecifier<'_> { state.serialize_field("local", &self.local); state.serialize_field("exported", &self.exported); state.serialize_ts_field("exportKind", &self.export_kind); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1876,66 +2220,87 @@ impl ESTree for ModuleExportName<'_> { impl ESTree for V8IntrinsicExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("V8IntrinsicExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); state.serialize_field("arguments", &self.arguments); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for BooleanLiteral { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); state.serialize_field("raw", &crate::serialize::literal::BooleanLiteralRaw(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for NullLiteral { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &crate::serialize::basic::Null(self)); state.serialize_field("raw", &crate::serialize::literal::NullLiteralRaw(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for NumericLiteral<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); state.serialize_field("raw", &self.raw.map(|s| JsonSafeString(s.as_str()))); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for StringLiteral<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &crate::serialize::literal::StringLiteralValue(self)); state.serialize_field("raw", &self.raw); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for BigIntLiteral<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); @@ -1943,12 +2308,16 @@ impl ESTree for BigIntLiteral<'_> { state.serialize_field("value", &crate::serialize::literal::BigIntLiteralValue(self)); state.serialize_field("raw", &self.raw.map(|s| JsonSafeString(s.as_str()))); state.serialize_field("bigint", &crate::serialize::literal::BigIntLiteralBigint(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for RegExpLiteral<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); @@ -1956,6 +2325,9 @@ impl ESTree for RegExpLiteral<'_> { state.serialize_field("value", &crate::serialize::literal::RegExpLiteralValue(self)); state.serialize_field("raw", &self.raw); state.serialize_field("regex", &self.regex); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -1985,6 +2357,7 @@ impl ESTree for RegExpFlags { impl ESTree for JSXElement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXElement")); state.serialize_field("start", &self.span.start); @@ -1995,12 +2368,16 @@ impl ESTree for JSXElement<'_> { ); state.serialize_field("children", &self.children); state.serialize_field("closingElement", &self.closing_element); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for JSXOpeningElement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXOpeningElement")); state.serialize_field("start", &self.span.start); @@ -2012,23 +2389,31 @@ impl ESTree for JSXOpeningElement<'_> { "selfClosing", &crate::serialize::jsx::JSXOpeningElementSelfClosing(self), ); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for JSXClosingElement<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXClosingElement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for JSXFragment<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXFragment")); state.serialize_field("start", &self.span.start); @@ -2036,28 +2421,39 @@ impl ESTree for JSXFragment<'_> { state.serialize_field("openingFragment", &self.opening_fragment); state.serialize_field("children", &self.children); state.serialize_field("closingFragment", &self.closing_fragment); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for JSXOpeningFragment { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXOpeningFragment")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_js_field("attributes", &crate::serialize::basic::JsEmptyArray(self)); state.serialize_js_field("selfClosing", &crate::serialize::basic::JsFalse(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for JSXClosingFragment { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXClosingFragment")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2080,24 +2476,32 @@ impl ESTree for JSXElementName<'_> { impl ESTree for JSXNamespacedName<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXNamespacedName")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("namespace", &self.namespace); state.serialize_field("name", &self.name); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for JSXMemberExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXMemberExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("object", &self.object); state.serialize_field("property", &self.property); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2118,11 +2522,15 @@ impl ESTree for JSXMemberExpressionObject<'_> { impl ESTree for JSXExpressionContainer<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXExpressionContainer")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2180,10 +2588,14 @@ impl ESTree for JSXExpression<'_> { impl ESTree for JSXEmptyExpression { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXEmptyExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2199,23 +2611,31 @@ impl ESTree for JSXAttributeItem<'_> { impl ESTree for JSXAttribute<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXAttribute")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); state.serialize_field("value", &self.value); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for JSXSpreadAttribute<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXSpreadAttribute")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2242,11 +2662,15 @@ impl ESTree for JSXAttributeValue<'_> { impl ESTree for JSXIdentifier<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXIdentifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &JsonSafeString(self.name.as_str())); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2265,29 +2689,38 @@ impl ESTree for JSXChild<'_> { impl ESTree for JSXSpreadChild<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXSpreadChild")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for JSXText<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXText")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); state.serialize_field("raw", &self.raw); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSThisParameter<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); @@ -2296,12 +2729,16 @@ impl ESTree for TSThisParameter<'_> { state.serialize_field("name", &crate::serialize::basic::This(self)); state.serialize_field("optional", &crate::serialize::basic::False(self)); state.serialize_field("typeAnnotation", &self.type_annotation); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSEnumDeclaration<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSEnumDeclaration")); state.serialize_field("start", &self.span.start); @@ -2310,23 +2747,31 @@ impl ESTree for TSEnumDeclaration<'_> { state.serialize_field("body", &self.body); state.serialize_field("const", &self.r#const); state.serialize_field("declare", &self.declare); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSEnumBody<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSEnumBody")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("members", &self.members); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSEnumMember<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSEnumMember")); state.serialize_field("start", &self.span.start); @@ -2334,6 +2779,9 @@ impl ESTree for TSEnumMember<'_> { state.serialize_field("id", &self.id); state.serialize_field("initializer", &self.initializer); state.serialize_field("computed", &crate::serialize::ts::TSEnumMemberComputed(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2351,22 +2799,30 @@ impl ESTree for TSEnumMemberName<'_> { impl ESTree for TSTypeAnnotation<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeAnnotation")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSLiteralType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSLiteralType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("literal", &self.literal); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2430,6 +2886,7 @@ impl ESTree for TSType<'_> { impl ESTree for TSConditionalType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSConditionalType")); state.serialize_field("start", &self.span.start); @@ -2438,51 +2895,70 @@ impl ESTree for TSConditionalType<'_> { state.serialize_field("extendsType", &self.extends_type); state.serialize_field("trueType", &self.true_type); state.serialize_field("falseType", &self.false_type); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSUnionType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSUnionType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("types", &self.types); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSIntersectionType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIntersectionType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("types", &self.types); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSParenthesizedType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSParenthesizedType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSTypeOperator<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeOperator")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("operator", &self.operator); state.serialize_field("typeAnnotation", &self.type_annotation); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2499,40 +2975,53 @@ impl ESTree for TSTypeOperatorOperator { impl ESTree for TSArrayType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSArrayType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("elementType", &self.element_type); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSIndexedAccessType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIndexedAccessType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("objectType", &self.object_type); state.serialize_field("indexType", &self.index_type); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSTupleType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTupleType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("elementTypes", &self.element_types); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSNamedTupleMember<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNamedTupleMember")); state.serialize_field("start", &self.span.start); @@ -2540,28 +3029,39 @@ impl ESTree for TSNamedTupleMember<'_> { state.serialize_field("label", &self.label); state.serialize_field("elementType", &self.element_type); state.serialize_field("optional", &self.optional); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSOptionalType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSOptionalType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSRestType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSRestType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2614,152 +3114,212 @@ impl ESTree for TSTupleElement<'_> { impl ESTree for TSAnyKeyword { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSAnyKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSStringKeyword { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSStringKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSBooleanKeyword { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSBooleanKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSNumberKeyword { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNumberKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSNeverKeyword { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNeverKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSIntrinsicKeyword { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIntrinsicKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSUnknownKeyword { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSUnknownKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSNullKeyword { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNullKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSUndefinedKeyword { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSUndefinedKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSVoidKeyword { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSVoidKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSSymbolKeyword { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSSymbolKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSThisType { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSThisType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSObjectKeyword { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSObjectKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSBigIntKeyword { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSBigIntKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSTypeReference<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeReference")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeName", &self.type_name); state.serialize_field("typeArguments", &self.type_arguments); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2777,29 +3337,38 @@ impl ESTree for TSTypeName<'_> { impl ESTree for TSQualifiedName<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSQualifiedName")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSTypeParameterInstantiation<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeParameterInstantiation")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("params", &self.params); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSTypeParameter<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeParameter")); state.serialize_field("start", &self.span.start); @@ -2810,23 +3379,31 @@ impl ESTree for TSTypeParameter<'_> { state.serialize_field("in", &self.r#in); state.serialize_field("out", &self.out); state.serialize_field("const", &self.r#const); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSTypeParameterDeclaration<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeParameterDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("params", &self.params); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSTypeAliasDeclaration<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeAliasDeclaration")); state.serialize_field("start", &self.span.start); @@ -2835,6 +3412,9 @@ impl ESTree for TSTypeAliasDeclaration<'_> { state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("declare", &self.declare); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2851,6 +3431,7 @@ impl ESTree for TSAccessibility { impl ESTree for TSClassImplements<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSClassImplements")); state.serialize_field("start", &self.span.start); @@ -2860,12 +3441,16 @@ impl ESTree for TSClassImplements<'_> { &crate::serialize::ts::TSClassImplementsExpression(self), ); state.serialize_field("typeArguments", &self.type_arguments); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSInterfaceDeclaration<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInterfaceDeclaration")); state.serialize_field("start", &self.span.start); @@ -2875,23 +3460,31 @@ impl ESTree for TSInterfaceDeclaration<'_> { state.serialize_field("extends", &self.extends); state.serialize_field("body", &self.body); state.serialize_field("declare", &self.declare); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSInterfaceBody<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInterfaceBody")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSPropertySignature<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSPropertySignature")); state.serialize_field("start", &self.span.start); @@ -2903,6 +3496,9 @@ impl ESTree for TSPropertySignature<'_> { state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("accessibility", &crate::serialize::basic::Null(self)); state.serialize_field("static", &crate::serialize::basic::False(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2921,6 +3517,7 @@ impl ESTree for TSSignature<'_> { impl ESTree for TSIndexSignature<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIndexSignature")); state.serialize_field("start", &self.span.start); @@ -2930,12 +3527,16 @@ impl ESTree for TSIndexSignature<'_> { state.serialize_field("readonly", &self.readonly); state.serialize_field("static", &self.r#static); state.serialize_field("accessibility", &crate::serialize::basic::Null(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSCallSignatureDeclaration<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSCallSignatureDeclaration")); state.serialize_field("start", &self.span.start); @@ -2946,6 +3547,9 @@ impl ESTree for TSCallSignatureDeclaration<'_> { &crate::serialize::ts::TSCallSignatureDeclarationParams(self), ); state.serialize_field("returnType", &self.return_type); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -2962,6 +3566,7 @@ impl ESTree for TSMethodSignatureKind { impl ESTree for TSMethodSignature<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSMethodSignature")); state.serialize_field("start", &self.span.start); @@ -2976,12 +3581,16 @@ impl ESTree for TSMethodSignature<'_> { state.serialize_field("accessibility", &crate::serialize::basic::Null(self)); state.serialize_field("readonly", &crate::serialize::basic::False(self)); state.serialize_field("static", &crate::serialize::basic::False(self)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSConstructSignatureDeclaration<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSConstructSignatureDeclaration")); state.serialize_field("start", &self.span.start); @@ -2989,12 +3598,16 @@ impl ESTree for TSConstructSignatureDeclaration<'_> { state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("params", &self.params); state.serialize_field("returnType", &self.return_type); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSIndexSignatureName<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); @@ -3003,24 +3616,32 @@ impl ESTree for TSIndexSignatureName<'_> { state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_field("optional", &crate::serialize::basic::False(self)); state.serialize_field("typeAnnotation", &self.type_annotation); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSInterfaceHeritage<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInterfaceHeritage")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); state.serialize_field("typeArguments", &self.type_arguments); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSTypePredicate<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypePredicate")); state.serialize_field("start", &self.span.start); @@ -3028,6 +3649,9 @@ impl ESTree for TSTypePredicate<'_> { state.serialize_field("parameterName", &self.parameter_name); state.serialize_field("asserts", &self.asserts); state.serialize_field("typeAnnotation", &self.type_annotation); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3077,45 +3701,61 @@ impl ESTree for TSModuleDeclarationBody<'_> { impl ESTree for TSModuleBlock<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSModuleBlock")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &Concat2(&self.directives, &self.body)); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSTypeLiteral<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeLiteral")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("members", &self.members); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSInferType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInferType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeParameter", &self.type_parameter); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSTypeQuery<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeQuery")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("exprName", &self.expr_name); state.serialize_field("typeArguments", &self.type_arguments); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3134,6 +3774,7 @@ impl ESTree for TSTypeQueryExprName<'_> { impl ESTree for TSImportType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSImportType")); state.serialize_field("start", &self.span.start); @@ -3142,12 +3783,16 @@ impl ESTree for TSImportType<'_> { state.serialize_field("options", &self.options); state.serialize_field("qualifier", &self.qualifier); state.serialize_field("typeArguments", &self.type_arguments); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSFunctionType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSFunctionType")); state.serialize_field("start", &self.span.start); @@ -3155,12 +3800,16 @@ impl ESTree for TSFunctionType<'_> { state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("params", &crate::serialize::ts::TSFunctionTypeParams(self)); state.serialize_field("returnType", &self.return_type); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSConstructorType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSConstructorType")); state.serialize_field("start", &self.span.start); @@ -3169,12 +3818,16 @@ impl ESTree for TSConstructorType<'_> { state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("params", &self.params); state.serialize_field("returnType", &self.return_type); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSMappedType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSMappedType")); state.serialize_field("start", &self.span.start); @@ -3185,6 +3838,9 @@ impl ESTree for TSMappedType<'_> { state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("optional", &crate::serialize::ts::TSMappedTypeOptional(self)); state.serialize_field("readonly", &self.readonly); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3201,54 +3857,71 @@ impl ESTree for TSMappedTypeModifierOperator { impl ESTree for TSTemplateLiteralType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTemplateLiteralType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("quasis", &self.quasis); state.serialize_field("types", &self.types); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSAsExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSAsExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); state.serialize_field("typeAnnotation", &self.type_annotation); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSSatisfiesExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSSatisfiesExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); state.serialize_field("typeAnnotation", &self.type_annotation); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSTypeAssertion<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeAssertion")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("expression", &self.expression); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSImportEqualsDeclaration<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSImportEqualsDeclaration")); state.serialize_field("start", &self.span.start); @@ -3256,6 +3929,9 @@ impl ESTree for TSImportEqualsDeclaration<'_> { state.serialize_field("id", &self.id); state.serialize_field("moduleReference", &self.module_reference); state.serialize_field("importKind", &self.import_kind); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3274,67 +3950,91 @@ impl ESTree for TSModuleReference<'_> { impl ESTree for TSExternalModuleReference<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSExternalModuleReference")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSNonNullExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNonNullExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for Decorator<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Decorator")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSExportAssignment<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSExportAssignment")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSNamespaceExportDeclaration<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNamespaceExportDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for TSInstantiationExpression<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInstantiationExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); state.serialize_field("typeArguments", &self.type_arguments); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3350,34 +4050,46 @@ impl ESTree for ImportOrExportKind { impl ESTree for JSDocNullableType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSJSDocNullableType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("postfix", &self.postfix); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for JSDocNonNullableType<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSJSDocNonNullableType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("postfix", &self.postfix); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for JSDocUnknownType { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSJSDocUnknownType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -3393,11 +4105,15 @@ impl ESTree for CommentKind { impl ESTree for Comment { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.kind); state.serialize_field("value", &crate::serialize::CommentValue(self)); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } diff --git a/crates/oxc_syntax/src/generated/derive_estree.rs b/crates/oxc_syntax/src/generated/derive_estree.rs index 40139563a60e0..c48c875fd56fe 100644 --- a/crates/oxc_syntax/src/generated/derive_estree.rs +++ b/crates/oxc_syntax/src/generated/derive_estree.rs @@ -12,10 +12,14 @@ use crate::operator::*; impl ESTree for NameSpan<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("value", &self.name); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -46,6 +50,7 @@ impl ESTree for ImportImportName<'_> { impl ESTree for ExportEntry<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); @@ -54,6 +59,9 @@ impl ESTree for ExportEntry<'_> { state.serialize_field("exportName", &self.export_name); state.serialize_field("localName", &self.local_name); state.serialize_field("isType", &self.is_type); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -95,10 +103,14 @@ impl ESTree for ExportLocalName<'_> { impl ESTree for DynamicImport { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("moduleRequest", &self.module_request); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } diff --git a/napi/parser/src/generated/derive_estree.rs b/napi/parser/src/generated/derive_estree.rs index b894a373a1694..6584034652178 100644 --- a/napi/parser/src/generated/derive_estree.rs +++ b/napi/parser/src/generated/derive_estree.rs @@ -44,10 +44,14 @@ impl ESTree for ErrorSeverity { impl ESTree for ErrorLabel<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("message", &self.message); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } @@ -66,21 +70,29 @@ impl ESTree for EcmaScriptModule<'_> { impl ESTree for StaticImport<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("moduleRequest", &self.module_request); state.serialize_field("entries", &self.entries); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } impl ESTree for StaticExport<'_> { fn serialize(&self, serializer: S) { + let range = serializer.range(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("entries", &self.entries); + if range { + state.serialize_field("range", &[self.span.start, self.span.end]); + } state.end(); } } From 8a37a120c2fbf6f01b70676fd7f2daf0eb96142a Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 24 Jun 2025 01:04:01 +0100 Subject: [PATCH 31/42] Restore line break --- crates/oxc_estree/src/serialize/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index ddf01a4210e54..b7c076e43bf53 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -4,6 +4,7 @@ use std::mem; use itoa::Buffer as ItoaBuffer; + use oxc_data_structures::{code_buffer::CodeBuffer, stack::NonEmptyStack}; mod blanket; From 49380164bc6d49f8ba15a2b95eafdf95837d197d Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 24 Jun 2025 01:09:07 +0100 Subject: [PATCH 32/42] Rename `range` to `ranges` --- crates/oxc_ast/src/generated/derive_estree.rs | 716 +++++++++--------- crates/oxc_ast/src/serialize/mod.rs | 4 +- crates/oxc_estree/src/serialize/mod.rs | 4 +- crates/oxc_estree/src/serialize/structs.rs | 12 +- .../oxc_syntax/src/generated/derive_estree.rs | 12 +- napi/parser/src/generated/derive_estree.rs | 12 +- tasks/ast_tools/src/derives/estree.rs | 4 +- 7 files changed, 382 insertions(+), 382 deletions(-) diff --git a/crates/oxc_ast/src/generated/derive_estree.rs b/crates/oxc_ast/src/generated/derive_estree.rs index 60d64a6305f61..72c02c77f6785 100644 --- a/crates/oxc_ast/src/generated/derive_estree.rs +++ b/crates/oxc_ast/src/generated/derive_estree.rs @@ -71,7 +71,7 @@ impl ESTree for Expression<'_> { impl ESTree for IdentifierName<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); @@ -80,7 +80,7 @@ impl ESTree for IdentifierName<'_> { state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -89,7 +89,7 @@ impl ESTree for IdentifierName<'_> { impl ESTree for IdentifierReference<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); @@ -98,7 +98,7 @@ impl ESTree for IdentifierReference<'_> { state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -107,7 +107,7 @@ impl ESTree for IdentifierReference<'_> { impl ESTree for BindingIdentifier<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); @@ -116,7 +116,7 @@ impl ESTree for BindingIdentifier<'_> { state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -125,7 +125,7 @@ impl ESTree for BindingIdentifier<'_> { impl ESTree for LabelIdentifier<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); @@ -134,7 +134,7 @@ impl ESTree for LabelIdentifier<'_> { state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -143,12 +143,12 @@ impl ESTree for LabelIdentifier<'_> { impl ESTree for ThisExpression { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ThisExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -157,13 +157,13 @@ impl ESTree for ThisExpression { impl ESTree for ArrayExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrayExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("elements", &self.elements); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -230,13 +230,13 @@ impl ESTree for Elision { impl ESTree for ObjectExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ObjectExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("properties", &self.properties); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -254,7 +254,7 @@ impl ESTree for ObjectPropertyKind<'_> { impl ESTree for ObjectProperty<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); state.serialize_field("start", &self.span.start); @@ -266,7 +266,7 @@ impl ESTree for ObjectProperty<'_> { state.serialize_field("shorthand", &self.shorthand); state.serialize_field("computed", &self.computed); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -337,14 +337,14 @@ impl ESTree for PropertyKind { impl ESTree for TemplateLiteral<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TemplateLiteral")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("quasis", &self.quasis); state.serialize_field("expressions", &self.expressions); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -353,7 +353,7 @@ impl ESTree for TemplateLiteral<'_> { impl ESTree for TaggedTemplateExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TaggedTemplateExpression")); state.serialize_field("start", &self.span.start); @@ -361,7 +361,7 @@ impl ESTree for TaggedTemplateExpression<'_> { state.serialize_field("tag", &self.tag); state.serialize_ts_field("typeArguments", &self.type_arguments); state.serialize_field("quasi", &self.quasi); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -395,7 +395,7 @@ impl ESTree for MemberExpression<'_> { impl ESTree for ComputedMemberExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MemberExpression")); state.serialize_field("start", &self.span.start); @@ -404,7 +404,7 @@ impl ESTree for ComputedMemberExpression<'_> { state.serialize_field("property", &self.expression); state.serialize_field("optional", &self.optional); state.serialize_field("computed", &crate::serialize::basic::True(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -413,7 +413,7 @@ impl ESTree for ComputedMemberExpression<'_> { impl ESTree for StaticMemberExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MemberExpression")); state.serialize_field("start", &self.span.start); @@ -422,7 +422,7 @@ impl ESTree for StaticMemberExpression<'_> { state.serialize_field("property", &self.property); state.serialize_field("optional", &self.optional); state.serialize_field("computed", &crate::serialize::basic::False(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -431,7 +431,7 @@ impl ESTree for StaticMemberExpression<'_> { impl ESTree for PrivateFieldExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MemberExpression")); state.serialize_field("start", &self.span.start); @@ -440,7 +440,7 @@ impl ESTree for PrivateFieldExpression<'_> { state.serialize_field("property", &self.field); state.serialize_field("optional", &self.optional); state.serialize_field("computed", &crate::serialize::basic::False(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -449,7 +449,7 @@ impl ESTree for PrivateFieldExpression<'_> { impl ESTree for CallExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("CallExpression")); state.serialize_field("start", &self.span.start); @@ -458,7 +458,7 @@ impl ESTree for CallExpression<'_> { state.serialize_ts_field("typeArguments", &self.type_arguments); state.serialize_field("arguments", &self.arguments); state.serialize_field("optional", &self.optional); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -467,7 +467,7 @@ impl ESTree for CallExpression<'_> { impl ESTree for NewExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("NewExpression")); state.serialize_field("start", &self.span.start); @@ -475,7 +475,7 @@ impl ESTree for NewExpression<'_> { state.serialize_field("callee", &self.callee); state.serialize_ts_field("typeArguments", &self.type_arguments); state.serialize_field("arguments", &self.arguments); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -484,14 +484,14 @@ impl ESTree for NewExpression<'_> { impl ESTree for MetaProperty<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("MetaProperty")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("meta", &self.meta); state.serialize_field("property", &self.property); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -500,13 +500,13 @@ impl ESTree for MetaProperty<'_> { impl ESTree for SpreadElement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SpreadElement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -566,7 +566,7 @@ impl ESTree for Argument<'_> { impl ESTree for UpdateExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("UpdateExpression")); state.serialize_field("start", &self.span.start); @@ -574,7 +574,7 @@ impl ESTree for UpdateExpression<'_> { state.serialize_field("operator", &self.operator); state.serialize_field("prefix", &self.prefix); state.serialize_field("argument", &self.argument); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -583,7 +583,7 @@ impl ESTree for UpdateExpression<'_> { impl ESTree for UnaryExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("UnaryExpression")); state.serialize_field("start", &self.span.start); @@ -591,7 +591,7 @@ impl ESTree for UnaryExpression<'_> { state.serialize_field("operator", &self.operator); state.serialize_field("argument", &self.argument); state.serialize_field("prefix", &crate::serialize::basic::True(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -600,7 +600,7 @@ impl ESTree for UnaryExpression<'_> { impl ESTree for BinaryExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BinaryExpression")); state.serialize_field("start", &self.span.start); @@ -608,7 +608,7 @@ impl ESTree for BinaryExpression<'_> { state.serialize_field("left", &self.left); state.serialize_field("operator", &self.operator); state.serialize_field("right", &self.right); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -617,7 +617,7 @@ impl ESTree for BinaryExpression<'_> { impl ESTree for PrivateInExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BinaryExpression")); state.serialize_field("start", &self.span.start); @@ -625,7 +625,7 @@ impl ESTree for PrivateInExpression<'_> { state.serialize_field("left", &self.left); state.serialize_field("operator", &crate::serialize::basic::In(self)); state.serialize_field("right", &self.right); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -634,7 +634,7 @@ impl ESTree for PrivateInExpression<'_> { impl ESTree for LogicalExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("LogicalExpression")); state.serialize_field("start", &self.span.start); @@ -642,7 +642,7 @@ impl ESTree for LogicalExpression<'_> { state.serialize_field("left", &self.left); state.serialize_field("operator", &self.operator); state.serialize_field("right", &self.right); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -651,7 +651,7 @@ impl ESTree for LogicalExpression<'_> { impl ESTree for ConditionalExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ConditionalExpression")); state.serialize_field("start", &self.span.start); @@ -659,7 +659,7 @@ impl ESTree for ConditionalExpression<'_> { state.serialize_field("test", &self.test); state.serialize_field("consequent", &self.consequent); state.serialize_field("alternate", &self.alternate); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -668,7 +668,7 @@ impl ESTree for ConditionalExpression<'_> { impl ESTree for AssignmentExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AssignmentExpression")); state.serialize_field("start", &self.span.start); @@ -676,7 +676,7 @@ impl ESTree for AssignmentExpression<'_> { state.serialize_field("operator", &self.operator); state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -726,7 +726,7 @@ impl ESTree for AssignmentTargetPattern<'_> { impl ESTree for ArrayAssignmentTarget<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrayPattern")); state.serialize_field("start", &self.span.start); @@ -735,7 +735,7 @@ impl ESTree for ArrayAssignmentTarget<'_> { state.serialize_field("elements", &Concat2(&self.elements, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -744,7 +744,7 @@ impl ESTree for ArrayAssignmentTarget<'_> { impl ESTree for ObjectAssignmentTarget<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ObjectPattern")); state.serialize_field("start", &self.span.start); @@ -753,7 +753,7 @@ impl ESTree for ObjectAssignmentTarget<'_> { state.serialize_field("properties", &Concat2(&self.properties, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -762,7 +762,7 @@ impl ESTree for ObjectAssignmentTarget<'_> { impl ESTree for AssignmentTargetRest<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("RestElement")); state.serialize_field("start", &self.span.start); @@ -772,7 +772,7 @@ impl ESTree for AssignmentTargetRest<'_> { state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); state.serialize_ts_field("value", &crate::serialize::basic::TsNull(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -799,7 +799,7 @@ impl ESTree for AssignmentTargetMaybeDefault<'_> { impl ESTree for AssignmentTargetWithDefault<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AssignmentPattern")); state.serialize_field("start", &self.span.start); @@ -809,7 +809,7 @@ impl ESTree for AssignmentTargetWithDefault<'_> { state.serialize_field("right", &self.init); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -827,7 +827,7 @@ impl ESTree for AssignmentTargetProperty<'_> { impl ESTree for AssignmentTargetPropertyIdentifier<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); state.serialize_field("start", &self.span.start); @@ -842,7 +842,7 @@ impl ESTree for AssignmentTargetPropertyIdentifier<'_> { state.serialize_field("shorthand", &crate::serialize::basic::True(self)); state.serialize_field("computed", &crate::serialize::basic::False(self)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -851,7 +851,7 @@ impl ESTree for AssignmentTargetPropertyIdentifier<'_> { impl ESTree for AssignmentTargetPropertyProperty<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); state.serialize_field("start", &self.span.start); @@ -863,7 +863,7 @@ impl ESTree for AssignmentTargetPropertyProperty<'_> { state.serialize_field("shorthand", &crate::serialize::basic::False(self)); state.serialize_field("computed", &self.computed); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -872,13 +872,13 @@ impl ESTree for AssignmentTargetPropertyProperty<'_> { impl ESTree for SequenceExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SequenceExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expressions", &self.expressions); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -887,12 +887,12 @@ impl ESTree for SequenceExpression<'_> { impl ESTree for Super { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Super")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -901,13 +901,13 @@ impl ESTree for Super { impl ESTree for AwaitExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AwaitExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -916,13 +916,13 @@ impl ESTree for AwaitExpression<'_> { impl ESTree for ChainExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ChainExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -943,13 +943,13 @@ impl ESTree for ChainElement<'_> { impl ESTree for ParenthesizedExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ParenthesizedExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -997,14 +997,14 @@ impl ESTree for Statement<'_> { impl ESTree for Directive<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExpressionStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); state.serialize_field("directive", &self.directive); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1013,13 +1013,13 @@ impl ESTree for Directive<'_> { impl ESTree for Hashbang<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Hashbang")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1028,13 +1028,13 @@ impl ESTree for Hashbang<'_> { impl ESTree for BlockStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BlockStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1058,7 +1058,7 @@ impl ESTree for Declaration<'_> { impl ESTree for VariableDeclaration<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("VariableDeclaration")); state.serialize_field("start", &self.span.start); @@ -1066,7 +1066,7 @@ impl ESTree for VariableDeclaration<'_> { state.serialize_field("kind", &self.kind); state.serialize_field("declarations", &self.declarations); state.serialize_ts_field("declare", &self.declare); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1087,7 +1087,7 @@ impl ESTree for VariableDeclarationKind { impl ESTree for VariableDeclarator<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("VariableDeclarator")); state.serialize_field("start", &self.span.start); @@ -1095,7 +1095,7 @@ impl ESTree for VariableDeclarator<'_> { state.serialize_field("id", &self.id); state.serialize_field("init", &self.init); state.serialize_ts_field("definite", &self.definite); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1104,12 +1104,12 @@ impl ESTree for VariableDeclarator<'_> { impl ESTree for EmptyStatement { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("EmptyStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1118,7 +1118,7 @@ impl ESTree for EmptyStatement { impl ESTree for ExpressionStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExpressionStatement")); state.serialize_field("start", &self.span.start); @@ -1128,7 +1128,7 @@ impl ESTree for ExpressionStatement<'_> { "directive", &crate::serialize::ts::ExpressionStatementDirective(self), ); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1137,7 +1137,7 @@ impl ESTree for ExpressionStatement<'_> { impl ESTree for IfStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("IfStatement")); state.serialize_field("start", &self.span.start); @@ -1145,7 +1145,7 @@ impl ESTree for IfStatement<'_> { state.serialize_field("test", &self.test); state.serialize_field("consequent", &self.consequent); state.serialize_field("alternate", &self.alternate); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1154,14 +1154,14 @@ impl ESTree for IfStatement<'_> { impl ESTree for DoWhileStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("DoWhileStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); state.serialize_field("test", &self.test); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1170,14 +1170,14 @@ impl ESTree for DoWhileStatement<'_> { impl ESTree for WhileStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("WhileStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("test", &self.test); state.serialize_field("body", &self.body); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1186,7 +1186,7 @@ impl ESTree for WhileStatement<'_> { impl ESTree for ForStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ForStatement")); state.serialize_field("start", &self.span.start); @@ -1195,7 +1195,7 @@ impl ESTree for ForStatement<'_> { state.serialize_field("test", &self.test); state.serialize_field("update", &self.update); state.serialize_field("body", &self.body); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1255,7 +1255,7 @@ impl ESTree for ForStatementInit<'_> { impl ESTree for ForInStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ForInStatement")); state.serialize_field("start", &self.span.start); @@ -1263,7 +1263,7 @@ impl ESTree for ForInStatement<'_> { state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); state.serialize_field("body", &self.body); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1290,7 +1290,7 @@ impl ESTree for ForStatementLeft<'_> { impl ESTree for ForOfStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ForOfStatement")); state.serialize_field("start", &self.span.start); @@ -1299,7 +1299,7 @@ impl ESTree for ForOfStatement<'_> { state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); state.serialize_field("body", &self.body); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1308,13 +1308,13 @@ impl ESTree for ForOfStatement<'_> { impl ESTree for ContinueStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ContinueStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("label", &self.label); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1323,13 +1323,13 @@ impl ESTree for ContinueStatement<'_> { impl ESTree for BreakStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BreakStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("label", &self.label); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1338,13 +1338,13 @@ impl ESTree for BreakStatement<'_> { impl ESTree for ReturnStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ReturnStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1353,14 +1353,14 @@ impl ESTree for ReturnStatement<'_> { impl ESTree for WithStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("WithStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("object", &self.object); state.serialize_field("body", &self.body); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1369,14 +1369,14 @@ impl ESTree for WithStatement<'_> { impl ESTree for SwitchStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SwitchStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("discriminant", &self.discriminant); state.serialize_field("cases", &self.cases); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1385,14 +1385,14 @@ impl ESTree for SwitchStatement<'_> { impl ESTree for SwitchCase<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("SwitchCase")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("test", &self.test); state.serialize_field("consequent", &self.consequent); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1401,14 +1401,14 @@ impl ESTree for SwitchCase<'_> { impl ESTree for LabeledStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("LabeledStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("label", &self.label); state.serialize_field("body", &self.body); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1417,13 +1417,13 @@ impl ESTree for LabeledStatement<'_> { impl ESTree for ThrowStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ThrowStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1432,7 +1432,7 @@ impl ESTree for ThrowStatement<'_> { impl ESTree for TryStatement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TryStatement")); state.serialize_field("start", &self.span.start); @@ -1440,7 +1440,7 @@ impl ESTree for TryStatement<'_> { state.serialize_field("block", &self.block); state.serialize_field("handler", &self.handler); state.serialize_field("finalizer", &self.finalizer); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1449,14 +1449,14 @@ impl ESTree for TryStatement<'_> { impl ESTree for CatchClause<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("CatchClause")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("param", &self.param); state.serialize_field("body", &self.body); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1471,12 +1471,12 @@ impl ESTree for CatchParameter<'_> { impl ESTree for DebuggerStatement { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("DebuggerStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1502,7 +1502,7 @@ impl ESTree for BindingPatternKind<'_> { impl ESTree for AssignmentPattern<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("AssignmentPattern")); state.serialize_field("start", &self.span.start); @@ -1512,7 +1512,7 @@ impl ESTree for AssignmentPattern<'_> { state.serialize_field("right", &self.right); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1521,7 +1521,7 @@ impl ESTree for AssignmentPattern<'_> { impl ESTree for ObjectPattern<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ObjectPattern")); state.serialize_field("start", &self.span.start); @@ -1530,7 +1530,7 @@ impl ESTree for ObjectPattern<'_> { state.serialize_field("properties", &Concat2(&self.properties, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1539,7 +1539,7 @@ impl ESTree for ObjectPattern<'_> { impl ESTree for BindingProperty<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Property")); state.serialize_field("start", &self.span.start); @@ -1551,7 +1551,7 @@ impl ESTree for BindingProperty<'_> { state.serialize_field("shorthand", &self.shorthand); state.serialize_field("computed", &self.computed); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1560,7 +1560,7 @@ impl ESTree for BindingProperty<'_> { impl ESTree for ArrayPattern<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrayPattern")); state.serialize_field("start", &self.span.start); @@ -1569,7 +1569,7 @@ impl ESTree for ArrayPattern<'_> { state.serialize_field("elements", &Concat2(&self.elements, &self.rest)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1578,7 +1578,7 @@ impl ESTree for ArrayPattern<'_> { impl ESTree for BindingRestElement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("RestElement")); state.serialize_field("start", &self.span.start); @@ -1588,7 +1588,7 @@ impl ESTree for BindingRestElement<'_> { state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("typeAnnotation", &crate::serialize::basic::TsNull(self)); state.serialize_ts_field("value", &crate::serialize::basic::TsNull(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1597,7 +1597,7 @@ impl ESTree for BindingRestElement<'_> { impl ESTree for Function<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); @@ -1611,7 +1611,7 @@ impl ESTree for Function<'_> { state.serialize_ts_field("returnType", &self.return_type); state.serialize_field("body", &self.body); state.serialize_field("expression", &crate::serialize::basic::False(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1662,13 +1662,13 @@ impl ESTree for FormalParameterKind { impl ESTree for FunctionBody<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("BlockStatement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &Concat2(&self.directives, &self.statements)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1677,7 +1677,7 @@ impl ESTree for FunctionBody<'_> { impl ESTree for ArrowFunctionExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ArrowFunctionExpression")); state.serialize_field("start", &self.span.start); @@ -1690,7 +1690,7 @@ impl ESTree for ArrowFunctionExpression<'_> { state.serialize_field("body", &crate::serialize::js::ArrowFunctionExpressionBody(self)); state.serialize_field("id", &crate::serialize::basic::Null(self)); state.serialize_field("generator", &crate::serialize::basic::False(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1699,14 +1699,14 @@ impl ESTree for ArrowFunctionExpression<'_> { impl ESTree for YieldExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("YieldExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("delegate", &self.delegate); state.serialize_field("argument", &self.argument); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1715,7 +1715,7 @@ impl ESTree for YieldExpression<'_> { impl ESTree for Class<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); @@ -1729,7 +1729,7 @@ impl ESTree for Class<'_> { state.serialize_field("body", &self.body); state.serialize_ts_field("abstract", &self.r#abstract); state.serialize_ts_field("declare", &self.declare); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1747,13 +1747,13 @@ impl ESTree for ClassType { impl ESTree for ClassBody<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ClassBody")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1774,7 +1774,7 @@ impl ESTree for ClassElement<'_> { impl ESTree for MethodDefinition<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); @@ -1788,7 +1788,7 @@ impl ESTree for MethodDefinition<'_> { state.serialize_ts_field("override", &self.r#override); state.serialize_ts_field("optional", &self.optional); state.serialize_ts_field("accessibility", &self.accessibility); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1808,7 +1808,7 @@ impl ESTree for MethodDefinitionType { impl ESTree for PropertyDefinition<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); @@ -1825,7 +1825,7 @@ impl ESTree for PropertyDefinition<'_> { state.serialize_ts_field("definite", &self.definite); state.serialize_ts_field("readonly", &self.readonly); state.serialize_ts_field("accessibility", &self.accessibility); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1856,13 +1856,13 @@ impl ESTree for MethodDefinitionKind { impl ESTree for PrivateIdentifier<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("PrivateIdentifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1871,13 +1871,13 @@ impl ESTree for PrivateIdentifier<'_> { impl ESTree for StaticBlock<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("StaticBlock")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1910,7 +1910,7 @@ impl ESTree for AccessorPropertyType { impl ESTree for AccessorProperty<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.r#type); state.serialize_field("start", &self.span.start); @@ -1927,7 +1927,7 @@ impl ESTree for AccessorProperty<'_> { state.serialize_ts_field("declare", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("optional", &crate::serialize::basic::TsFalse(self)); state.serialize_ts_field("readonly", &crate::serialize::basic::TsFalse(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1936,7 +1936,7 @@ impl ESTree for AccessorProperty<'_> { impl ESTree for ImportExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportExpression")); state.serialize_field("start", &self.span.start); @@ -1944,7 +1944,7 @@ impl ESTree for ImportExpression<'_> { state.serialize_field("source", &self.source); state.serialize_field("options", &self.options); state.serialize_field("phase", &self.phase); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1953,7 +1953,7 @@ impl ESTree for ImportExpression<'_> { impl ESTree for ImportDeclaration<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportDeclaration")); state.serialize_field("start", &self.span.start); @@ -1969,7 +1969,7 @@ impl ESTree for ImportDeclaration<'_> { &crate::serialize::js::ImportDeclarationWithClause(self), ); state.serialize_ts_field("importKind", &self.import_kind); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -1997,7 +1997,7 @@ impl ESTree for ImportDeclarationSpecifier<'_> { impl ESTree for ImportSpecifier<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportSpecifier")); state.serialize_field("start", &self.span.start); @@ -2005,7 +2005,7 @@ impl ESTree for ImportSpecifier<'_> { state.serialize_field("imported", &self.imported); state.serialize_field("local", &self.local); state.serialize_ts_field("importKind", &self.import_kind); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2014,13 +2014,13 @@ impl ESTree for ImportSpecifier<'_> { impl ESTree for ImportDefaultSpecifier<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportDefaultSpecifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("local", &self.local); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2029,13 +2029,13 @@ impl ESTree for ImportDefaultSpecifier<'_> { impl ESTree for ImportNamespaceSpecifier<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportNamespaceSpecifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("local", &self.local); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2044,10 +2044,10 @@ impl ESTree for ImportNamespaceSpecifier<'_> { impl ESTree for WithClause<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("attributes", &self.with_entries); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2056,14 +2056,14 @@ impl ESTree for WithClause<'_> { impl ESTree for ImportAttribute<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ImportAttribute")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("key", &self.key); state.serialize_field("value", &self.value); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2081,7 +2081,7 @@ impl ESTree for ImportAttributeKey<'_> { impl ESTree for ExportNamedDeclaration<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportNamedDeclaration")); state.serialize_field("start", &self.span.start); @@ -2094,7 +2094,7 @@ impl ESTree for ExportNamedDeclaration<'_> { "attributes", &crate::serialize::js::ExportNamedDeclarationWithClause(self), ); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2103,14 +2103,14 @@ impl ESTree for ExportNamedDeclaration<'_> { impl ESTree for ExportDefaultDeclaration<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportDefaultDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("declaration", &self.declaration); state.serialize_ts_field("exportKind", &crate::serialize::basic::TsValue(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2119,7 +2119,7 @@ impl ESTree for ExportDefaultDeclaration<'_> { impl ESTree for ExportAllDeclaration<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportAllDeclaration")); state.serialize_field("start", &self.span.start); @@ -2131,7 +2131,7 @@ impl ESTree for ExportAllDeclaration<'_> { &crate::serialize::js::ExportAllDeclarationWithClause(self), ); state.serialize_ts_field("exportKind", &self.export_kind); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2140,7 +2140,7 @@ impl ESTree for ExportAllDeclaration<'_> { impl ESTree for ExportSpecifier<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("ExportSpecifier")); state.serialize_field("start", &self.span.start); @@ -2148,7 +2148,7 @@ impl ESTree for ExportSpecifier<'_> { state.serialize_field("local", &self.local); state.serialize_field("exported", &self.exported); state.serialize_ts_field("exportKind", &self.export_kind); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2220,14 +2220,14 @@ impl ESTree for ModuleExportName<'_> { impl ESTree for V8IntrinsicExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("V8IntrinsicExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); state.serialize_field("arguments", &self.arguments); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2236,14 +2236,14 @@ impl ESTree for V8IntrinsicExpression<'_> { impl ESTree for BooleanLiteral { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); state.serialize_field("raw", &crate::serialize::literal::BooleanLiteralRaw(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2252,14 +2252,14 @@ impl ESTree for BooleanLiteral { impl ESTree for NullLiteral { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &crate::serialize::basic::Null(self)); state.serialize_field("raw", &crate::serialize::literal::NullLiteralRaw(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2268,14 +2268,14 @@ impl ESTree for NullLiteral { impl ESTree for NumericLiteral<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); state.serialize_field("raw", &self.raw.map(|s| JsonSafeString(s.as_str()))); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2284,14 +2284,14 @@ impl ESTree for NumericLiteral<'_> { impl ESTree for StringLiteral<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &crate::serialize::literal::StringLiteralValue(self)); state.serialize_field("raw", &self.raw); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2300,7 +2300,7 @@ impl ESTree for StringLiteral<'_> { impl ESTree for BigIntLiteral<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); @@ -2308,7 +2308,7 @@ impl ESTree for BigIntLiteral<'_> { state.serialize_field("value", &crate::serialize::literal::BigIntLiteralValue(self)); state.serialize_field("raw", &self.raw.map(|s| JsonSafeString(s.as_str()))); state.serialize_field("bigint", &crate::serialize::literal::BigIntLiteralBigint(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2317,7 +2317,7 @@ impl ESTree for BigIntLiteral<'_> { impl ESTree for RegExpLiteral<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Literal")); state.serialize_field("start", &self.span.start); @@ -2325,7 +2325,7 @@ impl ESTree for RegExpLiteral<'_> { state.serialize_field("value", &crate::serialize::literal::RegExpLiteralValue(self)); state.serialize_field("raw", &self.raw); state.serialize_field("regex", &self.regex); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2357,7 +2357,7 @@ impl ESTree for RegExpFlags { impl ESTree for JSXElement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXElement")); state.serialize_field("start", &self.span.start); @@ -2368,7 +2368,7 @@ impl ESTree for JSXElement<'_> { ); state.serialize_field("children", &self.children); state.serialize_field("closingElement", &self.closing_element); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2377,7 +2377,7 @@ impl ESTree for JSXElement<'_> { impl ESTree for JSXOpeningElement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXOpeningElement")); state.serialize_field("start", &self.span.start); @@ -2389,7 +2389,7 @@ impl ESTree for JSXOpeningElement<'_> { "selfClosing", &crate::serialize::jsx::JSXOpeningElementSelfClosing(self), ); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2398,13 +2398,13 @@ impl ESTree for JSXOpeningElement<'_> { impl ESTree for JSXClosingElement<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXClosingElement")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2413,7 +2413,7 @@ impl ESTree for JSXClosingElement<'_> { impl ESTree for JSXFragment<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXFragment")); state.serialize_field("start", &self.span.start); @@ -2421,7 +2421,7 @@ impl ESTree for JSXFragment<'_> { state.serialize_field("openingFragment", &self.opening_fragment); state.serialize_field("children", &self.children); state.serialize_field("closingFragment", &self.closing_fragment); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2430,14 +2430,14 @@ impl ESTree for JSXFragment<'_> { impl ESTree for JSXOpeningFragment { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXOpeningFragment")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_js_field("attributes", &crate::serialize::basic::JsEmptyArray(self)); state.serialize_js_field("selfClosing", &crate::serialize::basic::JsFalse(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2446,12 +2446,12 @@ impl ESTree for JSXOpeningFragment { impl ESTree for JSXClosingFragment { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXClosingFragment")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2476,14 +2476,14 @@ impl ESTree for JSXElementName<'_> { impl ESTree for JSXNamespacedName<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXNamespacedName")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("namespace", &self.namespace); state.serialize_field("name", &self.name); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2492,14 +2492,14 @@ impl ESTree for JSXNamespacedName<'_> { impl ESTree for JSXMemberExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXMemberExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("object", &self.object); state.serialize_field("property", &self.property); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2522,13 +2522,13 @@ impl ESTree for JSXMemberExpressionObject<'_> { impl ESTree for JSXExpressionContainer<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXExpressionContainer")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2588,12 +2588,12 @@ impl ESTree for JSXExpression<'_> { impl ESTree for JSXEmptyExpression { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXEmptyExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2611,14 +2611,14 @@ impl ESTree for JSXAttributeItem<'_> { impl ESTree for JSXAttribute<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXAttribute")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &self.name); state.serialize_field("value", &self.value); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2627,13 +2627,13 @@ impl ESTree for JSXAttribute<'_> { impl ESTree for JSXSpreadAttribute<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXSpreadAttribute")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("argument", &self.argument); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2662,13 +2662,13 @@ impl ESTree for JSXAttributeValue<'_> { impl ESTree for JSXIdentifier<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXIdentifier")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("name", &JsonSafeString(self.name.as_str())); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2689,13 +2689,13 @@ impl ESTree for JSXChild<'_> { impl ESTree for JSXSpreadChild<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXSpreadChild")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2704,14 +2704,14 @@ impl ESTree for JSXSpreadChild<'_> { impl ESTree for JSXText<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("JSXText")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("value", &self.value); state.serialize_field("raw", &self.raw); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2720,7 +2720,7 @@ impl ESTree for JSXText<'_> { impl ESTree for TSThisParameter<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); @@ -2729,7 +2729,7 @@ impl ESTree for TSThisParameter<'_> { state.serialize_field("name", &crate::serialize::basic::This(self)); state.serialize_field("optional", &crate::serialize::basic::False(self)); state.serialize_field("typeAnnotation", &self.type_annotation); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2738,7 +2738,7 @@ impl ESTree for TSThisParameter<'_> { impl ESTree for TSEnumDeclaration<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSEnumDeclaration")); state.serialize_field("start", &self.span.start); @@ -2747,7 +2747,7 @@ impl ESTree for TSEnumDeclaration<'_> { state.serialize_field("body", &self.body); state.serialize_field("const", &self.r#const); state.serialize_field("declare", &self.declare); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2756,13 +2756,13 @@ impl ESTree for TSEnumDeclaration<'_> { impl ESTree for TSEnumBody<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSEnumBody")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("members", &self.members); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2771,7 +2771,7 @@ impl ESTree for TSEnumBody<'_> { impl ESTree for TSEnumMember<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSEnumMember")); state.serialize_field("start", &self.span.start); @@ -2779,7 +2779,7 @@ impl ESTree for TSEnumMember<'_> { state.serialize_field("id", &self.id); state.serialize_field("initializer", &self.initializer); state.serialize_field("computed", &crate::serialize::ts::TSEnumMemberComputed(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2799,13 +2799,13 @@ impl ESTree for TSEnumMemberName<'_> { impl ESTree for TSTypeAnnotation<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeAnnotation")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2814,13 +2814,13 @@ impl ESTree for TSTypeAnnotation<'_> { impl ESTree for TSLiteralType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSLiteralType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("literal", &self.literal); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2886,7 +2886,7 @@ impl ESTree for TSType<'_> { impl ESTree for TSConditionalType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSConditionalType")); state.serialize_field("start", &self.span.start); @@ -2895,7 +2895,7 @@ impl ESTree for TSConditionalType<'_> { state.serialize_field("extendsType", &self.extends_type); state.serialize_field("trueType", &self.true_type); state.serialize_field("falseType", &self.false_type); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2904,13 +2904,13 @@ impl ESTree for TSConditionalType<'_> { impl ESTree for TSUnionType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSUnionType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("types", &self.types); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2919,13 +2919,13 @@ impl ESTree for TSUnionType<'_> { impl ESTree for TSIntersectionType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIntersectionType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("types", &self.types); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2934,13 +2934,13 @@ impl ESTree for TSIntersectionType<'_> { impl ESTree for TSParenthesizedType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSParenthesizedType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2949,14 +2949,14 @@ impl ESTree for TSParenthesizedType<'_> { impl ESTree for TSTypeOperator<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeOperator")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("operator", &self.operator); state.serialize_field("typeAnnotation", &self.type_annotation); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2975,13 +2975,13 @@ impl ESTree for TSTypeOperatorOperator { impl ESTree for TSArrayType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSArrayType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("elementType", &self.element_type); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -2990,14 +2990,14 @@ impl ESTree for TSArrayType<'_> { impl ESTree for TSIndexedAccessType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIndexedAccessType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("objectType", &self.object_type); state.serialize_field("indexType", &self.index_type); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3006,13 +3006,13 @@ impl ESTree for TSIndexedAccessType<'_> { impl ESTree for TSTupleType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTupleType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("elementTypes", &self.element_types); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3021,7 +3021,7 @@ impl ESTree for TSTupleType<'_> { impl ESTree for TSNamedTupleMember<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNamedTupleMember")); state.serialize_field("start", &self.span.start); @@ -3029,7 +3029,7 @@ impl ESTree for TSNamedTupleMember<'_> { state.serialize_field("label", &self.label); state.serialize_field("elementType", &self.element_type); state.serialize_field("optional", &self.optional); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3038,13 +3038,13 @@ impl ESTree for TSNamedTupleMember<'_> { impl ESTree for TSOptionalType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSOptionalType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3053,13 +3053,13 @@ impl ESTree for TSOptionalType<'_> { impl ESTree for TSRestType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSRestType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3114,12 +3114,12 @@ impl ESTree for TSTupleElement<'_> { impl ESTree for TSAnyKeyword { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSAnyKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3128,12 +3128,12 @@ impl ESTree for TSAnyKeyword { impl ESTree for TSStringKeyword { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSStringKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3142,12 +3142,12 @@ impl ESTree for TSStringKeyword { impl ESTree for TSBooleanKeyword { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSBooleanKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3156,12 +3156,12 @@ impl ESTree for TSBooleanKeyword { impl ESTree for TSNumberKeyword { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNumberKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3170,12 +3170,12 @@ impl ESTree for TSNumberKeyword { impl ESTree for TSNeverKeyword { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNeverKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3184,12 +3184,12 @@ impl ESTree for TSNeverKeyword { impl ESTree for TSIntrinsicKeyword { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIntrinsicKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3198,12 +3198,12 @@ impl ESTree for TSIntrinsicKeyword { impl ESTree for TSUnknownKeyword { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSUnknownKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3212,12 +3212,12 @@ impl ESTree for TSUnknownKeyword { impl ESTree for TSNullKeyword { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNullKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3226,12 +3226,12 @@ impl ESTree for TSNullKeyword { impl ESTree for TSUndefinedKeyword { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSUndefinedKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3240,12 +3240,12 @@ impl ESTree for TSUndefinedKeyword { impl ESTree for TSVoidKeyword { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSVoidKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3254,12 +3254,12 @@ impl ESTree for TSVoidKeyword { impl ESTree for TSSymbolKeyword { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSSymbolKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3268,12 +3268,12 @@ impl ESTree for TSSymbolKeyword { impl ESTree for TSThisType { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSThisType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3282,12 +3282,12 @@ impl ESTree for TSThisType { impl ESTree for TSObjectKeyword { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSObjectKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3296,12 +3296,12 @@ impl ESTree for TSObjectKeyword { impl ESTree for TSBigIntKeyword { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSBigIntKeyword")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3310,14 +3310,14 @@ impl ESTree for TSBigIntKeyword { impl ESTree for TSTypeReference<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeReference")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeName", &self.type_name); state.serialize_field("typeArguments", &self.type_arguments); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3337,14 +3337,14 @@ impl ESTree for TSTypeName<'_> { impl ESTree for TSQualifiedName<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSQualifiedName")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("left", &self.left); state.serialize_field("right", &self.right); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3353,13 +3353,13 @@ impl ESTree for TSQualifiedName<'_> { impl ESTree for TSTypeParameterInstantiation<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeParameterInstantiation")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("params", &self.params); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3368,7 +3368,7 @@ impl ESTree for TSTypeParameterInstantiation<'_> { impl ESTree for TSTypeParameter<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeParameter")); state.serialize_field("start", &self.span.start); @@ -3379,7 +3379,7 @@ impl ESTree for TSTypeParameter<'_> { state.serialize_field("in", &self.r#in); state.serialize_field("out", &self.out); state.serialize_field("const", &self.r#const); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3388,13 +3388,13 @@ impl ESTree for TSTypeParameter<'_> { impl ESTree for TSTypeParameterDeclaration<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeParameterDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("params", &self.params); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3403,7 +3403,7 @@ impl ESTree for TSTypeParameterDeclaration<'_> { impl ESTree for TSTypeAliasDeclaration<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeAliasDeclaration")); state.serialize_field("start", &self.span.start); @@ -3412,7 +3412,7 @@ impl ESTree for TSTypeAliasDeclaration<'_> { state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("declare", &self.declare); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3431,7 +3431,7 @@ impl ESTree for TSAccessibility { impl ESTree for TSClassImplements<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSClassImplements")); state.serialize_field("start", &self.span.start); @@ -3441,7 +3441,7 @@ impl ESTree for TSClassImplements<'_> { &crate::serialize::ts::TSClassImplementsExpression(self), ); state.serialize_field("typeArguments", &self.type_arguments); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3450,7 +3450,7 @@ impl ESTree for TSClassImplements<'_> { impl ESTree for TSInterfaceDeclaration<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInterfaceDeclaration")); state.serialize_field("start", &self.span.start); @@ -3460,7 +3460,7 @@ impl ESTree for TSInterfaceDeclaration<'_> { state.serialize_field("extends", &self.extends); state.serialize_field("body", &self.body); state.serialize_field("declare", &self.declare); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3469,13 +3469,13 @@ impl ESTree for TSInterfaceDeclaration<'_> { impl ESTree for TSInterfaceBody<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInterfaceBody")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &self.body); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3484,7 +3484,7 @@ impl ESTree for TSInterfaceBody<'_> { impl ESTree for TSPropertySignature<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSPropertySignature")); state.serialize_field("start", &self.span.start); @@ -3496,7 +3496,7 @@ impl ESTree for TSPropertySignature<'_> { state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("accessibility", &crate::serialize::basic::Null(self)); state.serialize_field("static", &crate::serialize::basic::False(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3517,7 +3517,7 @@ impl ESTree for TSSignature<'_> { impl ESTree for TSIndexSignature<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSIndexSignature")); state.serialize_field("start", &self.span.start); @@ -3527,7 +3527,7 @@ impl ESTree for TSIndexSignature<'_> { state.serialize_field("readonly", &self.readonly); state.serialize_field("static", &self.r#static); state.serialize_field("accessibility", &crate::serialize::basic::Null(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3536,7 +3536,7 @@ impl ESTree for TSIndexSignature<'_> { impl ESTree for TSCallSignatureDeclaration<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSCallSignatureDeclaration")); state.serialize_field("start", &self.span.start); @@ -3547,7 +3547,7 @@ impl ESTree for TSCallSignatureDeclaration<'_> { &crate::serialize::ts::TSCallSignatureDeclarationParams(self), ); state.serialize_field("returnType", &self.return_type); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3566,7 +3566,7 @@ impl ESTree for TSMethodSignatureKind { impl ESTree for TSMethodSignature<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSMethodSignature")); state.serialize_field("start", &self.span.start); @@ -3581,7 +3581,7 @@ impl ESTree for TSMethodSignature<'_> { state.serialize_field("accessibility", &crate::serialize::basic::Null(self)); state.serialize_field("readonly", &crate::serialize::basic::False(self)); state.serialize_field("static", &crate::serialize::basic::False(self)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3590,7 +3590,7 @@ impl ESTree for TSMethodSignature<'_> { impl ESTree for TSConstructSignatureDeclaration<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSConstructSignatureDeclaration")); state.serialize_field("start", &self.span.start); @@ -3598,7 +3598,7 @@ impl ESTree for TSConstructSignatureDeclaration<'_> { state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("params", &self.params); state.serialize_field("returnType", &self.return_type); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3607,7 +3607,7 @@ impl ESTree for TSConstructSignatureDeclaration<'_> { impl ESTree for TSIndexSignatureName<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Identifier")); state.serialize_field("start", &self.span.start); @@ -3616,7 +3616,7 @@ impl ESTree for TSIndexSignatureName<'_> { state.serialize_field("name", &JsonSafeString(self.name.as_str())); state.serialize_field("optional", &crate::serialize::basic::False(self)); state.serialize_field("typeAnnotation", &self.type_annotation); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3625,14 +3625,14 @@ impl ESTree for TSIndexSignatureName<'_> { impl ESTree for TSInterfaceHeritage<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInterfaceHeritage")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); state.serialize_field("typeArguments", &self.type_arguments); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3641,7 +3641,7 @@ impl ESTree for TSInterfaceHeritage<'_> { impl ESTree for TSTypePredicate<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypePredicate")); state.serialize_field("start", &self.span.start); @@ -3649,7 +3649,7 @@ impl ESTree for TSTypePredicate<'_> { state.serialize_field("parameterName", &self.parameter_name); state.serialize_field("asserts", &self.asserts); state.serialize_field("typeAnnotation", &self.type_annotation); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3701,13 +3701,13 @@ impl ESTree for TSModuleDeclarationBody<'_> { impl ESTree for TSModuleBlock<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSModuleBlock")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("body", &Concat2(&self.directives, &self.body)); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3716,13 +3716,13 @@ impl ESTree for TSModuleBlock<'_> { impl ESTree for TSTypeLiteral<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeLiteral")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("members", &self.members); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3731,13 +3731,13 @@ impl ESTree for TSTypeLiteral<'_> { impl ESTree for TSInferType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInferType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeParameter", &self.type_parameter); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3746,14 +3746,14 @@ impl ESTree for TSInferType<'_> { impl ESTree for TSTypeQuery<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeQuery")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("exprName", &self.expr_name); state.serialize_field("typeArguments", &self.type_arguments); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3774,7 +3774,7 @@ impl ESTree for TSTypeQueryExprName<'_> { impl ESTree for TSImportType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSImportType")); state.serialize_field("start", &self.span.start); @@ -3783,7 +3783,7 @@ impl ESTree for TSImportType<'_> { state.serialize_field("options", &self.options); state.serialize_field("qualifier", &self.qualifier); state.serialize_field("typeArguments", &self.type_arguments); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3792,7 +3792,7 @@ impl ESTree for TSImportType<'_> { impl ESTree for TSFunctionType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSFunctionType")); state.serialize_field("start", &self.span.start); @@ -3800,7 +3800,7 @@ impl ESTree for TSFunctionType<'_> { state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("params", &crate::serialize::ts::TSFunctionTypeParams(self)); state.serialize_field("returnType", &self.return_type); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3809,7 +3809,7 @@ impl ESTree for TSFunctionType<'_> { impl ESTree for TSConstructorType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSConstructorType")); state.serialize_field("start", &self.span.start); @@ -3818,7 +3818,7 @@ impl ESTree for TSConstructorType<'_> { state.serialize_field("typeParameters", &self.type_parameters); state.serialize_field("params", &self.params); state.serialize_field("returnType", &self.return_type); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3827,7 +3827,7 @@ impl ESTree for TSConstructorType<'_> { impl ESTree for TSMappedType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSMappedType")); state.serialize_field("start", &self.span.start); @@ -3838,7 +3838,7 @@ impl ESTree for TSMappedType<'_> { state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("optional", &crate::serialize::ts::TSMappedTypeOptional(self)); state.serialize_field("readonly", &self.readonly); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3857,14 +3857,14 @@ impl ESTree for TSMappedTypeModifierOperator { impl ESTree for TSTemplateLiteralType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTemplateLiteralType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("quasis", &self.quasis); state.serialize_field("types", &self.types); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3873,14 +3873,14 @@ impl ESTree for TSTemplateLiteralType<'_> { impl ESTree for TSAsExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSAsExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); state.serialize_field("typeAnnotation", &self.type_annotation); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3889,14 +3889,14 @@ impl ESTree for TSAsExpression<'_> { impl ESTree for TSSatisfiesExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSSatisfiesExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); state.serialize_field("typeAnnotation", &self.type_annotation); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3905,14 +3905,14 @@ impl ESTree for TSSatisfiesExpression<'_> { impl ESTree for TSTypeAssertion<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSTypeAssertion")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("expression", &self.expression); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3921,7 +3921,7 @@ impl ESTree for TSTypeAssertion<'_> { impl ESTree for TSImportEqualsDeclaration<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSImportEqualsDeclaration")); state.serialize_field("start", &self.span.start); @@ -3929,7 +3929,7 @@ impl ESTree for TSImportEqualsDeclaration<'_> { state.serialize_field("id", &self.id); state.serialize_field("moduleReference", &self.module_reference); state.serialize_field("importKind", &self.import_kind); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3950,13 +3950,13 @@ impl ESTree for TSModuleReference<'_> { impl ESTree for TSExternalModuleReference<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSExternalModuleReference")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3965,13 +3965,13 @@ impl ESTree for TSExternalModuleReference<'_> { impl ESTree for TSNonNullExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNonNullExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3980,13 +3980,13 @@ impl ESTree for TSNonNullExpression<'_> { impl ESTree for Decorator<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Decorator")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -3995,13 +3995,13 @@ impl ESTree for Decorator<'_> { impl ESTree for TSExportAssignment<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSExportAssignment")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -4010,13 +4010,13 @@ impl ESTree for TSExportAssignment<'_> { impl ESTree for TSNamespaceExportDeclaration<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSNamespaceExportDeclaration")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("id", &self.id); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -4025,14 +4025,14 @@ impl ESTree for TSNamespaceExportDeclaration<'_> { impl ESTree for TSInstantiationExpression<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSInstantiationExpression")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("expression", &self.expression); state.serialize_field("typeArguments", &self.type_arguments); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -4050,14 +4050,14 @@ impl ESTree for ImportOrExportKind { impl ESTree for JSDocNullableType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSJSDocNullableType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("postfix", &self.postfix); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -4066,14 +4066,14 @@ impl ESTree for JSDocNullableType<'_> { impl ESTree for JSDocNonNullableType<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSJSDocNonNullableType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("typeAnnotation", &self.type_annotation); state.serialize_field("postfix", &self.postfix); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -4082,12 +4082,12 @@ impl ESTree for JSDocNonNullableType<'_> { impl ESTree for JSDocUnknownType { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("TSJSDocUnknownType")); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -4105,13 +4105,13 @@ impl ESTree for CommentKind { impl ESTree for Comment { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &self.kind); state.serialize_field("value", &crate::serialize::CommentValue(self)); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index 5299115087c43..a762e4a3d7e11 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -168,7 +168,7 @@ impl ESTree for ProgramConverter<'_, '_> { let span_start = if S::INCLUDE_TS_FIELDS { get_ts_start_span(program) } else { program.span.start }; - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("type", &JsonSafeString("Program")); state.serialize_field("start", &span_start); @@ -176,7 +176,7 @@ impl ESTree for ProgramConverter<'_, '_> { state.serialize_field("body", &Concat2(&program.directives, &program.body)); state.serialize_field("sourceType", &program.source_type.module_kind()); state.serialize_field("hashbang", &program.hashbang); - if range { + if ranges { state.serialize_field("range", &[span_start, program.span.end]); } state.end(); diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index b7c076e43bf53..2440ce658af1e 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -45,7 +45,7 @@ pub trait Serializer: SerializerPrivate { /// Type of sequence serializer this serializer uses. type SequenceSerializer: SequenceSerializer; - fn range(&self) -> bool; + fn ranges(&self) -> bool; /// Serialize struct. fn serialize_struct(self) -> Self::StructSerializer; @@ -191,7 +191,7 @@ impl<'s, C: Config, F: Formatter> Serializer for &'s mut ESTreeSerializer type StructSerializer = ESTreeStructSerializer<'s, C, F>; type SequenceSerializer = ESTreeSequenceSerializer<'s, C, F>; - fn range(&self) -> bool { + fn ranges(&self) -> bool { self.config.ranges() } diff --git a/crates/oxc_estree/src/serialize/structs.rs b/crates/oxc_estree/src/serialize/structs.rs index 68fb082285c4e..6137c1061c942 100644 --- a/crates/oxc_estree/src/serialize/structs.rs +++ b/crates/oxc_estree/src/serialize/structs.rs @@ -41,7 +41,7 @@ pub trait StructSerializer { fn end(self); /// Whether to include range information in the serialized output - fn range(&self) -> bool; + fn ranges(&self) -> bool; } /// Serializer for structs. @@ -150,7 +150,7 @@ impl StructSerializer for ESTreeStructSerializer<'_, C, buffer.print_ascii_byte(b'}'); } - fn range(&self) -> bool { + fn ranges(&self) -> bool { self.serializer.config.ranges() } } @@ -223,8 +223,8 @@ impl<'p, P: StructSerializer> Serializer for FlatStructSerializer<'p, P> { } } - fn range(&self) -> bool { - self.0.range() + fn ranges(&self) -> bool { + self.0.ranges() } } @@ -292,8 +292,8 @@ impl StructSerializer for FlatStructSerializer<'_, P> { // No-op - there may be more fields to be added to the struct in the parent } - fn range(&self) -> bool { - self.0.range() + fn ranges(&self) -> bool { + self.0.ranges() } } diff --git a/crates/oxc_syntax/src/generated/derive_estree.rs b/crates/oxc_syntax/src/generated/derive_estree.rs index c48c875fd56fe..fd5fa527d171f 100644 --- a/crates/oxc_syntax/src/generated/derive_estree.rs +++ b/crates/oxc_syntax/src/generated/derive_estree.rs @@ -12,12 +12,12 @@ use crate::operator::*; impl ESTree for NameSpan<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("value", &self.name); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -50,7 +50,7 @@ impl ESTree for ImportImportName<'_> { impl ESTree for ExportEntry<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); @@ -59,7 +59,7 @@ impl ESTree for ExportEntry<'_> { state.serialize_field("exportName", &self.export_name); state.serialize_field("localName", &self.local_name); state.serialize_field("isType", &self.is_type); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -103,12 +103,12 @@ impl ESTree for ExportLocalName<'_> { impl ESTree for DynamicImport { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("moduleRequest", &self.module_request); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); diff --git a/napi/parser/src/generated/derive_estree.rs b/napi/parser/src/generated/derive_estree.rs index 6584034652178..87e5afe1d0110 100644 --- a/napi/parser/src/generated/derive_estree.rs +++ b/napi/parser/src/generated/derive_estree.rs @@ -44,12 +44,12 @@ impl ESTree for ErrorSeverity { impl ESTree for ErrorLabel<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("message", &self.message); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -70,13 +70,13 @@ impl ESTree for EcmaScriptModule<'_> { impl ESTree for StaticImport<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("moduleRequest", &self.module_request); state.serialize_field("entries", &self.entries); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); @@ -85,12 +85,12 @@ impl ESTree for StaticImport<'_> { impl ESTree for StaticExport<'_> { fn serialize(&self, serializer: S) { - let range = serializer.range(); + let ranges = serializer.ranges(); let mut state = serializer.serialize_struct(); state.serialize_field("start", &self.span.start); state.serialize_field("end", &self.span.end); state.serialize_field("entries", &self.entries); - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } state.end(); diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index deb43afc20d48..2cdfe557d61d2 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -379,9 +379,9 @@ fn generate_body_for_struct(struct_def: &StructDef, schema: &Schema) -> TokenStr let has_span_field = struct_def.fields.iter().any(|field| field.name() == "span"); let (range_declaration, range_field) = if has_span_field { ( - quote! { let range = serializer.range(); }, + quote! { let ranges = serializer.ranges(); }, quote! { - if range { + if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); } }, From fc46eb8177b8ccc0fd90311615a2411a32af18ad Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 24 Jun 2025 01:09:39 +0100 Subject: [PATCH 33/42] Reformat `quote!` macro usage --- tasks/ast_tools/src/derives/estree.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/ast_tools/src/derives/estree.rs b/tasks/ast_tools/src/derives/estree.rs index 2cdfe557d61d2..b15ce62fb76c0 100644 --- a/tasks/ast_tools/src/derives/estree.rs +++ b/tasks/ast_tools/src/derives/estree.rs @@ -379,7 +379,7 @@ fn generate_body_for_struct(struct_def: &StructDef, schema: &Schema) -> TokenStr let has_span_field = struct_def.fields.iter().any(|field| field.name() == "span"); let (range_declaration, range_field) = if has_span_field { ( - quote! { let ranges = serializer.ranges(); }, + quote!( let ranges = serializer.ranges(); ), quote! { if ranges { state.serialize_field("range", &[self.span.start, self.span.end]); From 461753cb19b5bdef549b3a6946f5c94ca5538da8 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 24 Jun 2025 01:15:00 +0100 Subject: [PATCH 34/42] Restore comment Restore comment 2 --- napi/parser/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/napi/parser/src/lib.rs b/napi/parser/src/lib.rs index c3149354e9ee5..8fdb6d044bccb 100644 --- a/napi/parser/src/lib.rs +++ b/napi/parser/src/lib.rs @@ -114,6 +114,8 @@ fn parse_with_return(filename: &str, source_text: String, options: &ParserOption } AstType::TypeScript => { // Note: `@typescript-eslint/parser` ignores hashbangs, + // despite appearances to the contrary in AST explorers. + // So we ignore them too. // See: https://github.com/typescript-eslint/typescript-eslint/issues/6500 let capacity = program.source_text.len() * 16; let serializer = CompactFixesTSSerializer::with_capacity_and_ranges(capacity, range); From 8e7fa9cec7e7dc340e3a4da65a7ae906481fbc8a Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 24 Jun 2025 01:17:20 +0100 Subject: [PATCH 35/42] `to_estree_js_json` etc take `ranges` param --- crates/oxc_ast/src/serialize/mod.rs | 32 ++++++++++++++-------------- crates/oxc_parser/examples/parser.rs | 4 ++-- napi/parser/src/lib.rs | 11 +++------- napi/playground/src/lib.rs | 4 ++-- tasks/benchmark/benches/parser.rs | 2 +- tasks/coverage/src/driver.rs | 2 +- tasks/coverage/src/tools/estree.rs | 6 +++--- 7 files changed, 28 insertions(+), 33 deletions(-) diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index a762e4a3d7e11..6b55c20682819 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -47,62 +47,62 @@ const JSON_CAPACITY_RATIO_PRETTY: usize = 80; impl Program<'_> { /// Serialize AST to ESTree JSON, including TypeScript fields. - pub fn to_estree_ts_json(&self) -> String { + pub fn to_estree_ts_json(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let mut serializer = CompactTSSerializer::with_capacity(capacity); + let mut serializer = CompactTSSerializer::with_capacity_and_ranges(capacity, ranges); self.serialize(&mut serializer); serializer.into_string() } /// Serialize AST to ESTree JSON, without TypeScript fields. - pub fn to_estree_js_json(&self) -> String { + pub fn to_estree_js_json(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let mut serializer = CompactJSSerializer::with_capacity(capacity); + let mut serializer = CompactJSSerializer::with_capacity_and_ranges(capacity, ranges); self.serialize(&mut serializer); serializer.into_string() } /// Serialize AST to pretty-printed ESTree JSON, including TypeScript fields. - pub fn to_pretty_estree_ts_json(&self) -> String { + pub fn to_pretty_estree_ts_json(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let mut serializer = PrettyTSSerializer::with_capacity(capacity); + let mut serializer = PrettyTSSerializer::with_capacity_and_ranges(capacity, ranges); self.serialize(&mut serializer); serializer.into_string() } /// Serialize AST to pretty-printed ESTree JSON, without TypeScript fields. - pub fn to_pretty_estree_js_json(&self) -> String { + pub fn to_pretty_estree_js_json(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let mut serializer = PrettyJSSerializer::with_capacity(capacity); + let mut serializer = PrettyJSSerializer::with_capacity_and_ranges(capacity, ranges); self.serialize(&mut serializer); serializer.into_string() } /// Serialize AST to ESTree JSON, including TypeScript fields, with list of fixes. - pub fn to_estree_ts_json_with_fixes(&self) -> String { + pub fn to_estree_ts_json_with_fixes(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let serializer = CompactFixesTSSerializer::with_capacity(capacity); + let serializer = CompactFixesTSSerializer::with_capacity_and_ranges(capacity, ranges); serializer.serialize_with_fixes(self) } /// Serialize AST to ESTree JSON, without TypeScript fields, with list of fixes. - pub fn to_estree_js_json_with_fixes(&self) -> String { + pub fn to_estree_js_json_with_fixes(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let serializer = CompactFixesJSSerializer::with_capacity(capacity); + let serializer = CompactFixesJSSerializer::with_capacity_and_ranges(capacity, ranges); serializer.serialize_with_fixes(self) } /// Serialize AST to pretty-printed ESTree JSON, including TypeScript fields, with list of fixes. - pub fn to_pretty_estree_ts_json_with_fixes(&self) -> String { + pub fn to_pretty_estree_ts_json_with_fixes(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let serializer = PrettyFixesTSSerializer::with_capacity(capacity); + let serializer = PrettyFixesTSSerializer::with_capacity_and_ranges(capacity, ranges); serializer.serialize_with_fixes(self) } /// Serialize AST to pretty-printed ESTree JSON, without TypeScript fields, with list of fixes. - pub fn to_pretty_estree_js_json_with_fixes(&self) -> String { + pub fn to_pretty_estree_js_json_with_fixes(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let serializer = PrettyFixesJSSerializer::with_capacity(capacity); + let serializer = PrettyFixesJSSerializer::with_capacity_and_ranges(capacity, ranges); serializer.serialize_with_fixes(self) } } diff --git a/crates/oxc_parser/examples/parser.rs b/crates/oxc_parser/examples/parser.rs index be13f0fe2dd8e..f696c612b8687 100644 --- a/crates/oxc_parser/examples/parser.rs +++ b/crates/oxc_parser/examples/parser.rs @@ -47,10 +47,10 @@ fn main() -> Result<(), String> { Utf8ToUtf16::new(&source_text).convert_program(&mut program); if source_type.is_javascript() { println!("ESTree AST:"); - println!("{}", program.to_pretty_estree_js_json()); + println!("{}", program.to_pretty_estree_js_json(false)); } else { println!("TS-ESTree AST:"); - println!("{}", program.to_pretty_estree_ts_json()); + println!("{}", program.to_pretty_estree_ts_json(false)); } } diff --git a/napi/parser/src/lib.rs b/napi/parser/src/lib.rs index 8fdb6d044bccb..a21595294635e 100644 --- a/napi/parser/src/lib.rs +++ b/napi/parser/src/lib.rs @@ -19,7 +19,6 @@ use oxc::{ semantic::SemanticBuilder, span::SourceType, }; -use oxc_estree::{CompactFixesJSSerializer, CompactFixesTSSerializer}; use oxc_napi::{Comment, OxcError, convert_utf8_to_utf16, get_source_type}; mod convert; @@ -76,7 +75,7 @@ fn parse_with_return(filename: &str, source_text: String, options: &ParserOption let source_type = get_source_type(filename, options.lang.as_deref(), options.source_type.as_deref()); let ast_type = get_ast_type(source_type, options); - let range = options.range.unwrap_or(false); + let ranges = options.range.unwrap_or(false); let ret = parse(&allocator, source_type, &source_text, options); let mut program = ret.program; @@ -108,18 +107,14 @@ fn parse_with_return(filename: &str, source_text: String, options: &ParserOption ); } - let capacity = program.source_text.len() * 16; - let serializer = CompactFixesJSSerializer::with_capacity_and_ranges(capacity, range); - serializer.serialize_with_fixes(&program) + program.to_estree_js_json_with_fixes(ranges) } AstType::TypeScript => { // Note: `@typescript-eslint/parser` ignores hashbangs, // despite appearances to the contrary in AST explorers. // So we ignore them too. // See: https://github.com/typescript-eslint/typescript-eslint/issues/6500 - let capacity = program.source_text.len() * 16; - let serializer = CompactFixesTSSerializer::with_capacity_and_ranges(capacity, range); - serializer.serialize_with_fixes(&program) + program.to_estree_ts_json_with_fixes(ranges) } }; diff --git a/napi/playground/src/lib.rs b/napi/playground/src/lib.rs index 553f96d98e670..e1a7b47923a90 100644 --- a/napi/playground/src/lib.rs +++ b/napi/playground/src/lib.rs @@ -265,9 +265,9 @@ impl Oxc { ); } - program.to_pretty_estree_js_json_with_fixes() + program.to_pretty_estree_js_json_with_fixes(false) } else { - program.to_pretty_estree_ts_json_with_fixes() + program.to_pretty_estree_ts_json_with_fixes(false) }; self.comments = comments; diff --git a/tasks/benchmark/benches/parser.rs b/tasks/benchmark/benches/parser.rs index b7f3d0710f3ad..09429d7e59b22 100644 --- a/tasks/benchmark/benches/parser.rs +++ b/tasks/benchmark/benches/parser.rs @@ -51,7 +51,7 @@ fn bench_estree(criterion: &mut Criterion) { span_converter.convert_program(&mut program); span_converter.convert_comments(&mut program.comments); - black_box(program.to_estree_ts_json_with_fixes()); + black_box(program.to_estree_ts_json_with_fixes(false)); program }); }); diff --git a/tasks/coverage/src/driver.rs b/tasks/coverage/src/driver.rs index de14bd0bb110b..341b965711ed4 100644 --- a/tasks/coverage/src/driver.rs +++ b/tasks/coverage/src/driver.rs @@ -86,7 +86,7 @@ impl CompilerInterface for Driver { self.errors.push(OxcDiagnostic::error("SourceType must not be unambiguous.")); } // Make sure serialization doesn't crash; also for code coverage. - program.to_estree_ts_json_with_fixes(); + program.to_estree_ts_json_with_fixes(false); ControlFlow::Continue(()) } diff --git a/tasks/coverage/src/tools/estree.rs b/tasks/coverage/src/tools/estree.rs index c23c34a5cbabd..a41b0d149130e 100644 --- a/tasks/coverage/src/tools/estree.rs +++ b/tasks/coverage/src/tools/estree.rs @@ -118,7 +118,7 @@ impl Case for EstreeTest262Case { } }; - let oxc_json = program.to_pretty_estree_js_json(); + let oxc_json = program.to_pretty_estree_js_json(false); if oxc_json == acorn_json { self.base.set_result(TestResult::Passed); @@ -228,7 +228,7 @@ impl Case for EstreeJsxCase { } }; - let oxc_json = program.to_pretty_estree_js_json(); + let oxc_json = program.to_pretty_estree_js_json(false); if oxc_json == acorn_json { self.result = TestResult::Passed; @@ -375,7 +375,7 @@ impl Case for EstreeTypescriptCase { let mut program = ret.program; Utf8ToUtf16::new(source_text).convert_program_with_ascending_order_checks(&mut program); - let oxc_json = program.to_pretty_estree_ts_json(); + let oxc_json = program.to_pretty_estree_ts_json(false); if oxc_json == estree_json { continue; } From 336b7cfb521ce7d76aa1d5409a420dab7cfbfd62 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 24 Jun 2025 01:24:58 +0100 Subject: [PATCH 36/42] `CompactJSSerializer` etc `new` and `with_capacity` take `ranges` option --- crates/oxc_allocator/src/boxed.rs | 2 +- crates/oxc_allocator/src/vec.rs | 2 +- crates/oxc_ast/src/serialize/mod.rs | 16 +++++++-------- crates/oxc_estree/src/serialize/blanket.rs | 8 ++++---- crates/oxc_estree/src/serialize/mod.rs | 20 +++++-------------- crates/oxc_estree/src/serialize/primitives.rs | 2 +- crates/oxc_estree/src/serialize/sequences.rs | 4 ++-- crates/oxc_estree/src/serialize/strings.rs | 8 ++++---- crates/oxc_estree/src/serialize/structs.rs | 16 +++++++-------- 9 files changed, 34 insertions(+), 44 deletions(-) diff --git a/crates/oxc_allocator/src/boxed.rs b/crates/oxc_allocator/src/boxed.rs index b5ab327dee419..3235239f2700d 100644 --- a/crates/oxc_allocator/src/boxed.rs +++ b/crates/oxc_allocator/src/boxed.rs @@ -243,7 +243,7 @@ mod test { let allocator = Allocator::default(); let b = Box::new_in("x", &allocator); - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); b.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(s, r#""x""#); diff --git a/crates/oxc_allocator/src/vec.rs b/crates/oxc_allocator/src/vec.rs index a7a77d26ecda6..70be7814c0ec3 100644 --- a/crates/oxc_allocator/src/vec.rs +++ b/crates/oxc_allocator/src/vec.rs @@ -311,7 +311,7 @@ mod test { let mut v = Vec::new_in(&allocator); v.push("x"); - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); v.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(s, r#"["x"]"#); diff --git a/crates/oxc_ast/src/serialize/mod.rs b/crates/oxc_ast/src/serialize/mod.rs index 6b55c20682819..cf43d2ed2eb5f 100644 --- a/crates/oxc_ast/src/serialize/mod.rs +++ b/crates/oxc_ast/src/serialize/mod.rs @@ -49,7 +49,7 @@ impl Program<'_> { /// Serialize AST to ESTree JSON, including TypeScript fields. pub fn to_estree_ts_json(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let mut serializer = CompactTSSerializer::with_capacity_and_ranges(capacity, ranges); + let mut serializer = CompactTSSerializer::with_capacity(capacity, ranges); self.serialize(&mut serializer); serializer.into_string() } @@ -57,7 +57,7 @@ impl Program<'_> { /// Serialize AST to ESTree JSON, without TypeScript fields. pub fn to_estree_js_json(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let mut serializer = CompactJSSerializer::with_capacity_and_ranges(capacity, ranges); + let mut serializer = CompactJSSerializer::with_capacity(capacity, ranges); self.serialize(&mut serializer); serializer.into_string() } @@ -65,7 +65,7 @@ impl Program<'_> { /// Serialize AST to pretty-printed ESTree JSON, including TypeScript fields. pub fn to_pretty_estree_ts_json(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let mut serializer = PrettyTSSerializer::with_capacity_and_ranges(capacity, ranges); + let mut serializer = PrettyTSSerializer::with_capacity(capacity, ranges); self.serialize(&mut serializer); serializer.into_string() } @@ -73,7 +73,7 @@ impl Program<'_> { /// Serialize AST to pretty-printed ESTree JSON, without TypeScript fields. pub fn to_pretty_estree_js_json(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let mut serializer = PrettyJSSerializer::with_capacity_and_ranges(capacity, ranges); + let mut serializer = PrettyJSSerializer::with_capacity(capacity, ranges); self.serialize(&mut serializer); serializer.into_string() } @@ -81,28 +81,28 @@ impl Program<'_> { /// Serialize AST to ESTree JSON, including TypeScript fields, with list of fixes. pub fn to_estree_ts_json_with_fixes(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let serializer = CompactFixesTSSerializer::with_capacity_and_ranges(capacity, ranges); + let serializer = CompactFixesTSSerializer::with_capacity(capacity, ranges); serializer.serialize_with_fixes(self) } /// Serialize AST to ESTree JSON, without TypeScript fields, with list of fixes. pub fn to_estree_js_json_with_fixes(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_COMPACT; - let serializer = CompactFixesJSSerializer::with_capacity_and_ranges(capacity, ranges); + let serializer = CompactFixesJSSerializer::with_capacity(capacity, ranges); serializer.serialize_with_fixes(self) } /// Serialize AST to pretty-printed ESTree JSON, including TypeScript fields, with list of fixes. pub fn to_pretty_estree_ts_json_with_fixes(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let serializer = PrettyFixesTSSerializer::with_capacity_and_ranges(capacity, ranges); + let serializer = PrettyFixesTSSerializer::with_capacity(capacity, ranges); serializer.serialize_with_fixes(self) } /// Serialize AST to pretty-printed ESTree JSON, without TypeScript fields, with list of fixes. pub fn to_pretty_estree_js_json_with_fixes(&self, ranges: bool) -> String { let capacity = self.source_text.len() * JSON_CAPACITY_RATIO_PRETTY; - let serializer = PrettyFixesJSSerializer::with_capacity_and_ranges(capacity, ranges); + let serializer = PrettyFixesJSSerializer::with_capacity(capacity, ranges); serializer.serialize_with_fixes(self) } } diff --git a/crates/oxc_estree/src/serialize/blanket.rs b/crates/oxc_estree/src/serialize/blanket.rs index 99bb174a3f1ec..486337d2e73b8 100644 --- a/crates/oxc_estree/src/serialize/blanket.rs +++ b/crates/oxc_estree/src/serialize/blanket.rs @@ -57,7 +57,7 @@ mod tests { let cases = [(&"foo", r#""foo""#), (&&"bar", r#""bar""#)]; for (input, output) in cases { - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); input.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, output); @@ -69,7 +69,7 @@ mod tests { let cases = [(&mut "foo", r#""foo""#), (&mut &mut "bar", r#""bar""#)]; for (input, output) in cases { - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); input.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, output); @@ -81,7 +81,7 @@ mod tests { let cases = [(None, "null"), (Some(123.0f64), "123")]; for (input, output) in cases { - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); input.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, output); @@ -94,7 +94,7 @@ mod tests { [(Cow::Borrowed("foo"), r#""foo""#), (Cow::Owned("bar".to_string()), r#""bar""#)]; for (input, output) in cases { - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); input.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, output); diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index 2440ce658af1e..6389bc5356a6c 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -107,13 +107,8 @@ pub struct ESTreeSerializer { } impl ESTreeSerializer { - /// Create new [`ESTreeSerializer`] with ranges disabled. - pub fn new() -> Self { - Self::new_with_ranges(false) - } - - /// Create new [`ESTreeSerializer`] with specified ranges setting. - pub fn new_with_ranges(ranges: bool) -> Self { + /// Create new [`ESTreeSerializer`]. + pub fn new(ranges: bool) -> Self { Self { buffer: CodeBuffer::new(), formatter: F::new(), @@ -123,13 +118,8 @@ impl ESTreeSerializer { } } - /// Create new [`ESTreeSerializer`] with specified buffer capacity and ranges disabled. - pub fn with_capacity(capacity: usize) -> Self { - Self::with_capacity_and_ranges(capacity, false) - } - - /// Create new [`ESTreeSerializer`] with specified buffer capacity and ranges setting. - pub fn with_capacity_and_ranges(capacity: usize, ranges: bool) -> Self { + /// Create new [`ESTreeSerializer`] with specified buffer capacity. + pub fn with_capacity(capacity: usize, ranges: bool) -> Self { Self { buffer: CodeBuffer::with_capacity(capacity), formatter: F::new(), @@ -180,7 +170,7 @@ impl ESTreeSerializer { impl Default for ESTreeSerializer { #[inline(always)] fn default() -> Self { - Self::new() + Self::new(false) } } diff --git a/crates/oxc_estree/src/serialize/primitives.rs b/crates/oxc_estree/src/serialize/primitives.rs index 9b2ecec1cfca6..59ae3cc20401f 100644 --- a/crates/oxc_estree/src/serialize/primitives.rs +++ b/crates/oxc_estree/src/serialize/primitives.rs @@ -78,7 +78,7 @@ mod tests { fn run_test(cases: &[(T, &str)]) { for (input, output) in cases { - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); input.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, output); diff --git a/crates/oxc_estree/src/serialize/sequences.rs b/crates/oxc_estree/src/serialize/sequences.rs index 445411842ed9a..d2c2689d16bac 100644 --- a/crates/oxc_estree/src/serialize/sequences.rs +++ b/crates/oxc_estree/src/serialize/sequences.rs @@ -121,12 +121,12 @@ mod tests { let foo = Foo { none: &[], one: &["one"], two: ["two one", "two two"] }; - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, r#"{"none":[],"one":["one"],"two":["two one","two two"]}"#); - let mut serializer = PrettyTSSerializer::new(); + let mut serializer = PrettyTSSerializer::new(false); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( diff --git a/crates/oxc_estree/src/serialize/strings.rs b/crates/oxc_estree/src/serialize/strings.rs index ed879e4280125..a79b522c2d992 100644 --- a/crates/oxc_estree/src/serialize/strings.rs +++ b/crates/oxc_estree/src/serialize/strings.rs @@ -483,7 +483,7 @@ mod tests { ]; for (input, output) in cases { - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); input.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, output); @@ -495,7 +495,7 @@ mod tests { let cases = [(String::new(), r#""""#), ("foobar".to_string(), r#""foobar""#)]; for (input, output) in cases { - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); input.to_string().serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, output); @@ -507,7 +507,7 @@ mod tests { let cases = [("", r#""""#), ("a", r#""a""#), ("abc", r#""abc""#)]; for (input, output) in cases { - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); JsonSafeString(input).serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, output); @@ -530,7 +530,7 @@ mod tests { ]; for (input, output) in cases { - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); LoneSurrogatesString(input).serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, output); diff --git a/crates/oxc_estree/src/serialize/structs.rs b/crates/oxc_estree/src/serialize/structs.rs index 6137c1061c942..3ce536323a716 100644 --- a/crates/oxc_estree/src/serialize/structs.rs +++ b/crates/oxc_estree/src/serialize/structs.rs @@ -364,7 +364,7 @@ mod tests { maybe_not_bar: None, }; - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -372,7 +372,7 @@ mod tests { r#"{"n":123,"u":12345,"bar":{"yes":"yup","no":"nope"},"empty":{},"hello":"hi!","maybe_bar":{"yes":"hell yeah!","no":"not a chance in a million, mate"},"maybe_not_bar":null}"# ); - let mut serializer = PrettyTSSerializer::new(); + let mut serializer = PrettyTSSerializer::new(false); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -453,7 +453,7 @@ mod tests { outer2: "out2", }; - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); outer.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -461,7 +461,7 @@ mod tests { r#"{"outer1":"out1","inner1":"in1","innermost1":"inin1","innermost2":"inin2","inner2":"in2","outer2":"out2"}"# ); - let mut serializer = PrettyTSSerializer::new(); + let mut serializer = PrettyTSSerializer::new(false); outer.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -499,12 +499,12 @@ mod tests { let foo = Foo { js: 1, ts: 2, js_only: 3, more_js: 4 }; - let mut serializer = CompactTSSerializer::new(); + let mut serializer = CompactTSSerializer::new(false); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, r#"{"js":1,"ts":2,"moreJs":4}"#); - let mut serializer = PrettyTSSerializer::new(); + let mut serializer = PrettyTSSerializer::new(false); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( @@ -516,12 +516,12 @@ mod tests { }"# ); - let mut serializer = CompactJSSerializer::new(); + let mut serializer = CompactJSSerializer::new(false); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!(&s, r#"{"js":1,"jsOnly":3,"moreJs":4}"#); - let mut serializer = PrettyJSSerializer::new(); + let mut serializer = PrettyJSSerializer::new(false); foo.serialize(&mut serializer); let s = serializer.into_string(); assert_eq!( From c0a4687e449d9f550a6a8e3d151b05d46b24595e Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 24 Jun 2025 01:27:26 +0100 Subject: [PATCH 37/42] `oxc_estree` do not expose `Config` trait and types --- crates/oxc_estree/src/serialize/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/oxc_estree/src/serialize/mod.rs b/crates/oxc_estree/src/serialize/mod.rs index 6389bc5356a6c..6da692346ca8e 100644 --- a/crates/oxc_estree/src/serialize/mod.rs +++ b/crates/oxc_estree/src/serialize/mod.rs @@ -15,13 +15,12 @@ mod primitives; mod sequences; mod strings; mod structs; +use config::{Config, ConfigFixesJS, ConfigFixesTS, ConfigJS, ConfigTS}; use formatter::{CompactFormatter, Formatter, PrettyFormatter}; use sequences::ESTreeSequenceSerializer; use structs::ESTreeStructSerializer; pub use concat::{Concat2, Concat3, ConcatElement}; -pub use config::{Config, ConfigFixesJS, ConfigFixesTS, ConfigJS, ConfigTS}; - pub use sequences::SequenceSerializer; pub use strings::{JsonSafeString, LoneSurrogatesString}; pub use structs::{FlatStructSerializer, StructSerializer}; From 010c67ebfcf1608fa84423bdd97959aef8fb1a10 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 24 Jun 2025 01:29:11 +0100 Subject: [PATCH 38/42] Tweak comment --- napi/parser/src/types.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/napi/parser/src/types.rs b/napi/parser/src/types.rs index 6aef7ae725d09..222fcbba18143 100644 --- a/napi/parser/src/types.rs +++ b/napi/parser/src/types.rs @@ -24,7 +24,8 @@ pub struct ParserOptions { pub ast_type: Option, /// Controls whether the `range` property is included on AST nodes. - /// The `range` property is a [number, number] which indicates the start/end index of the node in the file contents. + /// The `range` property is a `[number, number]` which indicates the start/end offsets + /// of the node in the file contents. /// /// @default false #[napi(ts_type = "boolean")] From fb9be85c140cbb1fcb2004c09dc3fef3028d8924 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 24 Jun 2025 01:30:16 +0100 Subject: [PATCH 39/42] Regenerate NAPI parser types --- napi/parser/index.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/napi/parser/index.d.ts b/napi/parser/index.d.ts index a863e91ace313..347862ff4d621 100644 --- a/napi/parser/index.d.ts +++ b/napi/parser/index.d.ts @@ -189,6 +189,14 @@ export interface ParserOptions { * The type of the file is determined from `lang` option, or extension of provided `filename`. */ astType?: 'js' | 'ts' + /** + * Controls whether the `range` property is included on AST nodes. + * The `range` property is a `[number, number]` which indicates the start/end offsets + * of the node in the file contents. + * + * @default false + */ + range?: boolean /** * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST. * From 333b6fec9bcacdb2026b3823ba4914fabb509dec Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 24 Jun 2025 01:43:04 +0100 Subject: [PATCH 40/42] `ESTreeStructSerializer` call parent serializer `ranges` method --- crates/oxc_estree/src/serialize/structs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/oxc_estree/src/serialize/structs.rs b/crates/oxc_estree/src/serialize/structs.rs index 3ce536323a716..58a36464f7b0a 100644 --- a/crates/oxc_estree/src/serialize/structs.rs +++ b/crates/oxc_estree/src/serialize/structs.rs @@ -151,7 +151,7 @@ impl StructSerializer for ESTreeStructSerializer<'_, C, } fn ranges(&self) -> bool { - self.serializer.config.ranges() + self.serializer.ranges() } } From afcb64f57d0baf1f712f163b050b6cf72dacd9fd Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 24 Jun 2025 02:03:06 +0100 Subject: [PATCH 41/42] Ignore TS errors in tests --- napi/parser/test/parse.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/napi/parser/test/parse.test.ts b/napi/parser/test/parse.test.ts index 6ad2eeaff9173..043541dace0ae 100644 --- a/napi/parser/test/parse.test.ts +++ b/napi/parser/test/parse.test.ts @@ -687,16 +687,22 @@ describe('parse', () => { it('should include range when true', () => { const ret = parseSync('test.js', '(x)', { range: true }); expect(ret.program.body[0].start).toBe(0); + // TODO: Remove `@ts-ignore` comment once we've corrected TS type definitions + // @ts-ignore expect(ret.program.body[0].range).toEqual([0, 3]); }); it('should not include range when false', () => { const ret = parseSync('test.js', '(x)', { range: false }); + // TODO: Remove `@ts-ignore` comment once we've corrected TS type definitions + // @ts-ignore expect(ret.program.body[0].range).toBeUndefined(); }); it('should include range by default', () => { const ret = parseSync('test.js', '(x)'); + // TODO: Remove `@ts-ignore` comment once we've corrected TS type definitions + // @ts-ignore expect(ret.program.body[0].range).toBeUndefined(); }); }); From b02d5264e699226c18c48d5aa51828f4780eb10b Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 24 Jun 2025 02:13:57 +0100 Subject: [PATCH 42/42] Fix test name --- napi/parser/test/parse.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/napi/parser/test/parse.test.ts b/napi/parser/test/parse.test.ts index 043541dace0ae..7fb2636580a8b 100644 --- a/napi/parser/test/parse.test.ts +++ b/napi/parser/test/parse.test.ts @@ -699,7 +699,7 @@ describe('parse', () => { expect(ret.program.body[0].range).toBeUndefined(); }); - it('should include range by default', () => { + it('should not include range by default', () => { const ret = parseSync('test.js', '(x)'); // TODO: Remove `@ts-ignore` comment once we've corrected TS type definitions // @ts-ignore