From f2558c1eed03d3cc32e4ec74bb3212e7ae11ee57 Mon Sep 17 00:00:00 2001 From: Steve Cao Date: Fri, 5 Mar 2021 02:11:10 -0800 Subject: [PATCH] remove unused parser Summary: - remove legacy positioned parser ffi, since OCaml now uses arena based positioned parser, - remove ocaml positioned parser, it alloc heap directly in ocamlpool to save intermediate heap allocation. This parser is already replaced by arena base positioned parser. Differential Revision: D26705617 fbshipit-source-id: 19777cb4400692df8b997bcac9045e4a02f77bb5 --- hphp/hack/Cargo.lock | 12 - hphp/hack/src/generate_full_fidelity_data.ml | 62 - hphp/hack/src/parser/ffi/Cargo.toml | 1 - hphp/hack/src/parser/ffi/lib.rs | 1 - hphp/hack/src/parser/ocaml_context_state.rs | 47 - .../hack/src/parser/ocaml_positioned_parser_ffi.rs | 9 - hphp/hack/src/parser/ocaml_syntax.rs | 130 - hphp/hack/src/parser/ocaml_syntax_generated.rs | 3740 -------------------- hphp/hack/src/parser/positioned_parser_ffi.rs | 9 - hphp/hack/src/parser/rust_to_ocaml.rs | 141 - 10 files changed, 4152 deletions(-) delete mode 100644 hphp/hack/src/parser/ocaml_context_state.rs delete mode 100644 hphp/hack/src/parser/ocaml_positioned_parser_ffi.rs delete mode 100644 hphp/hack/src/parser/ocaml_syntax.rs delete mode 100644 hphp/hack/src/parser/ocaml_syntax_generated.rs delete mode 100644 hphp/hack/src/parser/positioned_parser_ffi.rs diff --git a/hphp/hack/Cargo.lock b/hphp/hack/Cargo.lock index d2363a90a7d..dc4dac42327 100644 --- a/hphp/hack/Cargo.lock +++ b/hphp/hack/Cargo.lock @@ -1249,7 +1249,6 @@ version = "3.49.0" dependencies = [ "aast_parser_ffi", "positioned_by_ref_parser_ffi", - "positioned_parser_ffi", "verify_parser_ffi", ] @@ -2274,17 +2273,6 @@ dependencies = [ ] [[package]] -name = "positioned_parser_ffi" -version = "0.0.0" -dependencies = [ - "ocamlrep", - "ocamlrep_ocamlpool", - "oxidized", - "positioned_parser", - "rust_parser_ffi", -] - -[[package]] name = "positioned_smart_constructors" version = "0.0.0" dependencies = [ diff --git a/hphp/hack/src/generate_full_fidelity_data.ml b/hphp/hack/src/generate_full_fidelity_data.ml index 686aec85130..30503e5f085 100644 --- a/hphp/hack/src/generate_full_fidelity_data.ml +++ b/hphp/hack/src/generate_full_fidelity_data.ml @@ -1684,67 +1684,6 @@ end (* GenerateFFRustSyntaxSmartConstructors *) -module GenerateOcamlSyntax = struct - let to_constructor_methods x = - let sep s = String.concat ~sep:s in - let comma_sep = sep ", " in - let newline_sep spaces = sep (", \n" ^ spaces) in - let args = List.mapi x.fields ~f:(fun i _ -> sprintf "arg%d: Self" i) in - let args = comma_sep args in - let params f = List.mapi x.fields ~f:(fun i _ -> f (sprintf "arg%d" i)) in - let param_values = newline_sep " " (params (sprintf "%s.value")) in - let param_nodes = - newline_sep " " (params (sprintf "%s.syntax")) - in - sprintf - " fn make_%s(ctx: &C, %s) -> Self { - let children = &[ - %s - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::%s, - &value, - &[ - %s - ], - ); - Self { syntax, value } - }\n\n" - x.type_name - args - param_values - x.kind_name - param_nodes - - let template : string = - make_header CStyle "" - ^ " -use crate::{OcamlSyntax, Context}; -use rust_to_ocaml::*; - -use parser_core_types::syntax_kind::SyntaxKind; -use parser_core_types::syntax::{SyntaxType, SyntaxValueType}; -use parser_core_types::positioned_token::PositionedToken; - -impl SyntaxType for OcamlSyntax -where - C: Context, - V: SyntaxValueType + ToOcaml, -{ -CONSTRUCTOR_METHODS} - " - - let ocaml_syntax = - Full_fidelity_schema.make_template_file - ~transformations: - [{ pattern = "CONSTRUCTOR_METHODS"; func = to_constructor_methods }] - ~filename:(full_fidelity_path_prefix ^ "ocaml_syntax_generated.rs") - ~template - () -end - module GenerateFFRustDeclModeSmartConstructors = struct let to_constructor_methods x = let args = List.mapi x.fields ~f:(fun i _ -> sprintf "arg%d: Self::R" i) in @@ -3269,7 +3208,6 @@ let templates = .full_fidelity_smart_constructors_wrappers; GenerateFFRustSmartConstructorsWrappers .full_fidelity_smart_constructors_wrappers; - GenerateOcamlSyntax.ocaml_syntax; GenerateFFRustSyntaxVariantByRef.full_fidelity_syntax; GenerateSyntaxTypeImpl.full_fidelity_syntax; GenerateSyntaxChildrenIterator.full_fidelity_syntax; diff --git a/hphp/hack/src/parser/ffi/Cargo.toml b/hphp/hack/src/parser/ffi/Cargo.toml index fd42100f266..4194b26b5e3 100644 --- a/hphp/hack/src/parser/ffi/Cargo.toml +++ b/hphp/hack/src/parser/ffi/Cargo.toml @@ -5,7 +5,6 @@ edition = "2018" [dependencies] verify_parser_ffi = { path = "../cargo/verify_parser_ffi", package = "verify_parser_ffi" } -positioned_parser_ffi = { path = "../cargo/positioned_parser_ffi", package = "positioned_parser_ffi" } aast_parser_ffi = { path = "../cargo/aast_parser_ffi", package = "aast_parser_ffi" } positioned_by_ref_parser_ffi = { path = "../cargo/positioned_by_ref_parser_ffi", package = "positioned_by_ref_parser_ffi" } diff --git a/hphp/hack/src/parser/ffi/lib.rs b/hphp/hack/src/parser/ffi/lib.rs index 63f18054e3a..a31130c2bbf 100644 --- a/hphp/hack/src/parser/ffi/lib.rs +++ b/hphp/hack/src/parser/ffi/lib.rs @@ -5,5 +5,4 @@ pub use aast_parser_ffi::*; pub use positioned_by_ref_parser_ffi::*; -pub use positioned_parser_ffi::*; pub use verify_parser_ffi::*; diff --git a/hphp/hack/src/parser/ocaml_context_state.rs b/hphp/hack/src/parser/ocaml_context_state.rs deleted file mode 100644 index 7e2ad71f75a..00000000000 --- a/hphp/hack/src/parser/ocaml_context_state.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2019, Facebook, Inc. -// All rights reserved. -// -// This source code is licensed under the MIT license found in the -// LICENSE file in the "hack" directory of this source tree. - -use std::rc::Rc; - -use crate::Context; -use ocaml::core::mlvalues::Value; -use parser_core_types::source_text::SourceText; -use rust_to_ocaml::{SerializationContext, ToOcaml}; -use smart_constructors::NoState; -use syntax_smart_constructors::StateType; - -#[derive(Clone)] -pub struct OcamlContextState<'src> { - source: SourceText<'src>, - context: Rc, -} - -impl<'src> OcamlContextState<'src> { - pub fn initial(src: &SourceText<'src>) -> Self { - Self { - source: src.clone(), - context: Rc::new(SerializationContext::new( - src.ocaml_source_text().unwrap().as_usize(), - )), - } - } -} - -impl Context for OcamlContextState<'_> { - fn serialization_context(&self) -> &SerializationContext { - self.context.as_ref() - } -} - -impl StateType for OcamlContextState<'_> { - fn next(&mut self, _inputs: &[&S]) {} -} - -impl ToOcaml for OcamlContextState<'_> { - unsafe fn to_ocaml(&self, context: &SerializationContext) -> Value { - NoState.to_ocaml(context) - } -} diff --git a/hphp/hack/src/parser/ocaml_positioned_parser_ffi.rs b/hphp/hack/src/parser/ocaml_positioned_parser_ffi.rs deleted file mode 100644 index cdc8a716c58..00000000000 --- a/hphp/hack/src/parser/ocaml_positioned_parser_ffi.rs +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the -// LICENSE file in the "hack" directory of this source tree. - -rust_parser_ffi::parse!( - ocaml_parse_positioned, - ocaml_positioned_parser::parse_script -); diff --git a/hphp/hack/src/parser/ocaml_syntax.rs b/hphp/hack/src/parser/ocaml_syntax.rs deleted file mode 100644 index a0bd0cb9271..00000000000 --- a/hphp/hack/src/parser/ocaml_syntax.rs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2019, Facebook, Inc. -// All rights reserved. -// -// This source code is licensed under the MIT license found in the -// LICENSE file in the "hack" directory of this source tree. - -pub mod ocaml_context_state; -mod ocaml_syntax_generated; - -use ocaml::core::mlvalues::Value; -use ocaml::core::mlvalues::Value as OcamlValue; -use ocamlpool_rust::utils::*; -use ocamlrep::rc::RcOc; -use parser_core_types::{ - lexable_token::LexableToken, - positioned_token::PositionedToken, - syntax::{SyntaxTypeBase, SyntaxValueType}, - syntax_kind::SyntaxKind, -}; -use rust_to_ocaml::*; -use std::iter::empty; - -pub use crate::ocaml_context_state::*; -pub use crate::ocaml_syntax_generated::*; - -#[derive(Debug, Clone)] -pub struct OcamlSyntax { - pub syntax: OcamlValue, - pub value: V, -} - -pub trait Context { - fn serialization_context(&self) -> &SerializationContext; -} - -impl OcamlSyntax -where - V: SyntaxValueType + ToOcaml, -{ - pub fn make( - ctx: &C, - kind: SyntaxKind, - value: &V, - children: &[OcamlValue], - ) -> OcamlValue { - unsafe { - let ocaml_value = value.to_ocaml(ctx.serialization_context()); - let syntax = reserve_block(kind.ocaml_tag().into(), children.len()); - for (i, &child) in children.iter().enumerate() { - caml_set_field(syntax, i, child); - } - let node = reserve_block(0, 2); - caml_set_field(node, 0, syntax); - caml_set_field(node, 1, ocaml_value); - node - } - } -} - -impl SyntaxTypeBase for OcamlSyntax -where - C: Context, - V: SyntaxValueType + ToOcaml, -{ - type Token = PositionedToken; - type Value = V; - - fn make_missing(ctx: &C, offset: usize) -> Self { - unsafe { - let value = V::from_children(SyntaxKind::Missing, offset, empty()); - let ocaml_value = value.to_ocaml(ctx.serialization_context()); - let kind = u8_to_ocaml(SyntaxKind::Missing.ocaml_tag()); - let node = reserve_block(0, 2); - caml_set_field(node, 0, kind); - caml_set_field(node, 1, ocaml_value); - Self { - syntax: node, - value, - } - } - } - - fn make_token(ctx: &C, arg: Self::Token) -> Self { - unsafe { - let value = V::from_token(RcOc::clone(&arg)); - let ocaml_value = value.to_ocaml(ctx.serialization_context()); - let syntax = reserve_block(SyntaxKind::Token(arg.kind()).ocaml_tag().into(), 1); - caml_set_field(syntax, 0, arg.to_ocaml(ctx.serialization_context())); - let node = reserve_block(0.into(), 2); - caml_set_field(node, 0, syntax); - caml_set_field(node, 1, ocaml_value); - Self { - syntax: node, - value, - } - } - } - - fn make_list(ctx: &C, args: Vec, offset: usize) -> Self { - unsafe { - if args.is_empty() { - Self::make_missing(ctx, offset) - } else { - // TODO: avoid creating Vec - let lst_slice = args.iter().map(|x| &x.value); - let value = V::from_children(SyntaxKind::SyntaxList, offset, lst_slice); - let ocaml_value = value.to_ocaml(ctx.serialization_context()); - let syntax = reserve_block(SyntaxKind::SyntaxList.ocaml_tag().into(), 1); - caml_set_field(syntax, 0, to_list(&args, ctx.serialization_context())); - let node = reserve_block(0.into(), 2); - caml_set_field(node, 0, syntax); - caml_set_field(node, 1, ocaml_value); - Self { - syntax: node, - value, - } - } - } - } - - fn value(&self) -> &Self::Value { - &self.value - } -} - -impl ToOcaml for OcamlSyntax { - unsafe fn to_ocaml(&self, _context: &SerializationContext) -> Value { - self.syntax - } -} diff --git a/hphp/hack/src/parser/ocaml_syntax_generated.rs b/hphp/hack/src/parser/ocaml_syntax_generated.rs deleted file mode 100644 index 9084a4ca367..00000000000 --- a/hphp/hack/src/parser/ocaml_syntax_generated.rs +++ /dev/null @@ -1,3740 +0,0 @@ -/** - * Copyright (c) 2016, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the "hack" directory of this source tree. An additional - * directory. - * - ** - * - * THIS FILE IS @generated; DO NOT EDIT IT - * To regenerate this file, run - * - * buck run //hphp/hack/src:generate_full_fidelity - * - ** - * - */ -use crate::{OcamlSyntax, Context}; -use rust_to_ocaml::*; - -use parser_core_types::syntax_kind::SyntaxKind; -use parser_core_types::syntax::{SyntaxType, SyntaxValueType}; -use parser_core_types::positioned_token::PositionedToken; - -impl SyntaxType for OcamlSyntax -where - C: Context, - V: SyntaxValueType + ToOcaml, -{ - fn make_end_of_file(ctx: &C, arg0: Self) -> Self { - let children = &[ - arg0.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::EndOfFile, - &value, - &[ - arg0.syntax - ], - ); - Self { syntax, value } - } - - fn make_script(ctx: &C, arg0: Self) -> Self { - let children = &[ - arg0.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::Script, - &value, - &[ - arg0.syntax - ], - ); - Self { syntax, value } - } - - fn make_qualified_name(ctx: &C, arg0: Self) -> Self { - let children = &[ - arg0.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::QualifiedName, - &value, - &[ - arg0.syntax - ], - ); - Self { syntax, value } - } - - fn make_simple_type_specifier(ctx: &C, arg0: Self) -> Self { - let children = &[ - arg0.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::SimpleTypeSpecifier, - &value, - &[ - arg0.syntax - ], - ); - Self { syntax, value } - } - - fn make_literal_expression(ctx: &C, arg0: Self) -> Self { - let children = &[ - arg0.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::LiteralExpression, - &value, - &[ - arg0.syntax - ], - ); - Self { syntax, value } - } - - fn make_prefixed_string_expression(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::PrefixedStringExpression, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_prefixed_code_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::PrefixedCodeExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_variable_expression(ctx: &C, arg0: Self) -> Self { - let children = &[ - arg0.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::VariableExpression, - &value, - &[ - arg0.syntax - ], - ); - Self { syntax, value } - } - - fn make_pipe_variable_expression(ctx: &C, arg0: Self) -> Self { - let children = &[ - arg0.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::PipeVariableExpression, - &value, - &[ - arg0.syntax - ], - ); - Self { syntax, value } - } - - fn make_file_attribute_specification(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::FileAttributeSpecification, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_enum_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self, arg7: Self, arg8: Self, arg9: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value, - arg7.value, - arg8.value, - arg9.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::EnumDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax, - arg7.syntax, - arg8.syntax, - arg9.syntax - ], - ); - Self { syntax, value } - } - - fn make_enum_use(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::EnumUse, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_enumerator(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::Enumerator, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_enum_class_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self, arg7: Self, arg8: Self, arg9: Self, arg10: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value, - arg7.value, - arg8.value, - arg9.value, - arg10.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::EnumClassDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax, - arg7.syntax, - arg8.syntax, - arg9.syntax, - arg10.syntax - ], - ); - Self { syntax, value } - } - - fn make_enum_class_enumerator(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::EnumClassEnumerator, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_record_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self, arg7: Self, arg8: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value, - arg7.value, - arg8.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::RecordDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax, - arg7.syntax, - arg8.syntax - ], - ); - Self { syntax, value } - } - - fn make_record_field(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::RecordField, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_alias_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self, arg7: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value, - arg7.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::AliasDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax, - arg7.syntax - ], - ); - Self { syntax, value } - } - - fn make_property_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::PropertyDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_property_declarator(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::PropertyDeclarator, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_namespace_declaration(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::NamespaceDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_namespace_declaration_header(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::NamespaceDeclarationHeader, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_namespace_body(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::NamespaceBody, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_namespace_empty_body(ctx: &C, arg0: Self) -> Self { - let children = &[ - arg0.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::NamespaceEmptyBody, - &value, - &[ - arg0.syntax - ], - ); - Self { syntax, value } - } - - fn make_namespace_use_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::NamespaceUseDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_namespace_group_use_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::NamespaceGroupUseDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax - ], - ); - Self { syntax, value } - } - - fn make_namespace_use_clause(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::NamespaceUseClause, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_function_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::FunctionDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_function_declaration_header(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self, arg7: Self, arg8: Self, arg9: Self, arg10: Self, arg11: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value, - arg7.value, - arg8.value, - arg9.value, - arg10.value, - arg11.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::FunctionDeclarationHeader, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax, - arg7.syntax, - arg8.syntax, - arg9.syntax, - arg10.syntax, - arg11.syntax - ], - ); - Self { syntax, value } - } - - fn make_contexts(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::Contexts, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_where_clause(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::WhereClause, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_where_constraint(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::WhereConstraint, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_methodish_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::MethodishDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_methodish_trait_resolution(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::MethodishTraitResolution, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_classish_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self, arg7: Self, arg8: Self, arg9: Self, arg10: Self, arg11: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value, - arg7.value, - arg8.value, - arg9.value, - arg10.value, - arg11.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ClassishDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax, - arg7.syntax, - arg8.syntax, - arg9.syntax, - arg10.syntax, - arg11.syntax - ], - ); - Self { syntax, value } - } - - fn make_classish_body(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ClassishBody, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_trait_use_precedence_item(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::TraitUsePrecedenceItem, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_trait_use_alias_item(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::TraitUseAliasItem, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_trait_use_conflict_resolution(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::TraitUseConflictResolution, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_trait_use(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::TraitUse, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_require_clause(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::RequireClause, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_const_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ConstDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_constant_declarator(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ConstantDeclarator, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_type_const_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self, arg7: Self, arg8: Self, arg9: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value, - arg7.value, - arg8.value, - arg9.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::TypeConstDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax, - arg7.syntax, - arg8.syntax, - arg9.syntax - ], - ); - Self { syntax, value } - } - - fn make_context_const_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self, arg7: Self, arg8: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value, - arg7.value, - arg8.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ContextConstDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax, - arg7.syntax, - arg8.syntax - ], - ); - Self { syntax, value } - } - - fn make_decorated_expression(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::DecoratedExpression, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_parameter_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ParameterDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax - ], - ); - Self { syntax, value } - } - - fn make_variadic_parameter(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::VariadicParameter, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_old_attribute_specification(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::OldAttributeSpecification, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_attribute_specification(ctx: &C, arg0: Self) -> Self { - let children = &[ - arg0.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::AttributeSpecification, - &value, - &[ - arg0.syntax - ], - ); - Self { syntax, value } - } - - fn make_attribute(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::Attribute, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_inclusion_expression(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::InclusionExpression, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_inclusion_directive(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::InclusionDirective, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_compound_statement(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::CompoundStatement, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_expression_statement(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ExpressionStatement, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_markup_section(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::MarkupSection, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_markup_suffix(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::MarkupSuffix, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_unset_statement(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::UnsetStatement, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_using_statement_block_scoped(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::UsingStatementBlockScoped, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax - ], - ); - Self { syntax, value } - } - - fn make_using_statement_function_scoped(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::UsingStatementFunctionScoped, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_while_statement(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::WhileStatement, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_if_statement(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::IfStatement, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax - ], - ); - Self { syntax, value } - } - - fn make_elseif_clause(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ElseifClause, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_else_clause(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ElseClause, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_try_statement(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::TryStatement, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_catch_clause(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::CatchClause, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax - ], - ); - Self { syntax, value } - } - - fn make_finally_clause(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::FinallyClause, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_do_statement(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::DoStatement, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax - ], - ); - Self { syntax, value } - } - - fn make_for_statement(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self, arg7: Self, arg8: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value, - arg7.value, - arg8.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ForStatement, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax, - arg7.syntax, - arg8.syntax - ], - ); - Self { syntax, value } - } - - fn make_foreach_statement(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self, arg7: Self, arg8: Self, arg9: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value, - arg7.value, - arg8.value, - arg9.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ForeachStatement, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax, - arg7.syntax, - arg8.syntax, - arg9.syntax - ], - ); - Self { syntax, value } - } - - fn make_switch_statement(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::SwitchStatement, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax - ], - ); - Self { syntax, value } - } - - fn make_switch_section(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::SwitchSection, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_switch_fallthrough(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::SwitchFallthrough, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_case_label(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::CaseLabel, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_default_label(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::DefaultLabel, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_return_statement(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ReturnStatement, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_yield_break_statement(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::YieldBreakStatement, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_throw_statement(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ThrowStatement, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_break_statement(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::BreakStatement, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_continue_statement(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ContinueStatement, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_echo_statement(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::EchoStatement, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_concurrent_statement(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ConcurrentStatement, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_simple_initializer(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::SimpleInitializer, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_anonymous_class(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self, arg7: Self, arg8: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value, - arg7.value, - arg8.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::AnonymousClass, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax, - arg7.syntax, - arg8.syntax - ], - ); - Self { syntax, value } - } - - fn make_anonymous_function(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self, arg7: Self, arg8: Self, arg9: Self, arg10: Self, arg11: Self, arg12: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value, - arg7.value, - arg8.value, - arg9.value, - arg10.value, - arg11.value, - arg12.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::AnonymousFunction, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax, - arg7.syntax, - arg8.syntax, - arg9.syntax, - arg10.syntax, - arg11.syntax, - arg12.syntax - ], - ); - Self { syntax, value } - } - - fn make_anonymous_function_use_clause(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::AnonymousFunctionUseClause, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_lambda_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::LambdaExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_lambda_signature(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::LambdaSignature, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax - ], - ); - Self { syntax, value } - } - - fn make_cast_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::CastExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_scope_resolution_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ScopeResolutionExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_member_selection_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::MemberSelectionExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_safe_member_selection_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::SafeMemberSelectionExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_embedded_member_selection_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::EmbeddedMemberSelectionExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_yield_expression(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::YieldExpression, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_prefix_unary_expression(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::PrefixUnaryExpression, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_postfix_unary_expression(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::PostfixUnaryExpression, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_binary_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::BinaryExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_is_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::IsExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_as_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::AsExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_nullable_as_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::NullableAsExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_conditional_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ConditionalExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_eval_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::EvalExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_define_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::DefineExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_isset_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::IssetExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_function_call_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::FunctionCallExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_function_pointer_expression(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::FunctionPointerExpression, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_parenthesized_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ParenthesizedExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_braced_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::BracedExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_et_splice_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ETSpliceExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_embedded_braced_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::EmbeddedBracedExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_list_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ListExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_collection_literal_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::CollectionLiteralExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_object_creation_expression(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ObjectCreationExpression, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_constructor_call(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ConstructorCall, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_record_creation_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::RecordCreationExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_darray_intrinsic_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::DarrayIntrinsicExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_dictionary_intrinsic_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::DictionaryIntrinsicExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_keyset_intrinsic_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::KeysetIntrinsicExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_varray_intrinsic_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::VarrayIntrinsicExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_vector_intrinsic_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::VectorIntrinsicExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_element_initializer(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ElementInitializer, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_subscript_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::SubscriptExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_embedded_subscript_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::EmbeddedSubscriptExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_awaitable_creation_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::AwaitableCreationExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_xhp_children_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::XHPChildrenDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_xhp_children_parenthesized_list(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::XHPChildrenParenthesizedList, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_xhp_category_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::XHPCategoryDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_xhp_enum_type(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::XHPEnumType, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_xhp_lateinit(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::XHPLateinit, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_xhp_required(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::XHPRequired, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_xhp_class_attribute_declaration(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::XHPClassAttributeDeclaration, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_xhp_class_attribute(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::XHPClassAttribute, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_xhp_simple_class_attribute(ctx: &C, arg0: Self) -> Self { - let children = &[ - arg0.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::XHPSimpleClassAttribute, - &value, - &[ - arg0.syntax - ], - ); - Self { syntax, value } - } - - fn make_xhp_simple_attribute(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::XHPSimpleAttribute, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_xhp_spread_attribute(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::XHPSpreadAttribute, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_xhp_open(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::XHPOpen, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_xhp_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::XHPExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_xhp_close(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::XHPClose, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_type_constant(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::TypeConstant, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_vector_type_specifier(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::VectorTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_keyset_type_specifier(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::KeysetTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_tuple_type_explicit_specifier(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::TupleTypeExplicitSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_varray_type_specifier(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::VarrayTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_function_ctx_type_specifier(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::FunctionCtxTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_type_parameter(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::TypeParameter, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax - ], - ); - Self { syntax, value } - } - - fn make_type_constraint(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::TypeConstraint, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_context_constraint(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ContextConstraint, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_darray_type_specifier(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::DarrayTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax - ], - ); - Self { syntax, value } - } - - fn make_dictionary_type_specifier(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::DictionaryTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_closure_type_specifier(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self, arg5: Self, arg6: Self, arg7: Self, arg8: Self, arg9: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value, - arg5.value, - arg6.value, - arg7.value, - arg8.value, - arg9.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ClosureTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax, - arg5.syntax, - arg6.syntax, - arg7.syntax, - arg8.syntax, - arg9.syntax - ], - ); - Self { syntax, value } - } - - fn make_closure_parameter_type_specifier(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ClosureParameterTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_classname_type_specifier(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ClassnameTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_field_specifier(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::FieldSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_field_initializer(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::FieldInitializer, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_shape_type_specifier(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self, arg4: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value, - arg4.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ShapeTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax, - arg4.syntax - ], - ); - Self { syntax, value } - } - - fn make_shape_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ShapeExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_tuple_expression(ctx: &C, arg0: Self, arg1: Self, arg2: Self, arg3: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value, - arg3.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::TupleExpression, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax, - arg3.syntax - ], - ); - Self { syntax, value } - } - - fn make_generic_type_specifier(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::GenericTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_nullable_type_specifier(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::NullableTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_like_type_specifier(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::LikeTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_soft_type_specifier(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::SoftTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_attributized_specifier(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::AttributizedSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_reified_type_argument(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ReifiedTypeArgument, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_type_arguments(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::TypeArguments, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_type_parameters(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::TypeParameters, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_tuple_type_specifier(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::TupleTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_union_type_specifier(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::UnionTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_intersection_type_specifier(ctx: &C, arg0: Self, arg1: Self, arg2: Self) -> Self { - let children = &[ - arg0.value, - arg1.value, - arg2.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::IntersectionTypeSpecifier, - &value, - &[ - arg0.syntax, - arg1.syntax, - arg2.syntax - ], - ); - Self { syntax, value } - } - - fn make_error(ctx: &C, arg0: Self) -> Self { - let children = &[ - arg0.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ErrorSyntax, - &value, - &[ - arg0.syntax - ], - ); - Self { syntax, value } - } - - fn make_list_item(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::ListItem, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - - fn make_enum_atom_expression(ctx: &C, arg0: Self, arg1: Self) -> Self { - let children = &[ - arg0.value, - arg1.value - ]; - let value = V::from_values(children.iter()); - let syntax = Self::make( - ctx, - SyntaxKind::EnumAtomExpression, - &value, - &[ - arg0.syntax, - arg1.syntax - ], - ); - Self { syntax, value } - } - -} - \ No newline at end of file diff --git a/hphp/hack/src/parser/positioned_parser_ffi.rs b/hphp/hack/src/parser/positioned_parser_ffi.rs deleted file mode 100644 index 36472143825..00000000000 --- a/hphp/hack/src/parser/positioned_parser_ffi.rs +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. -// -// This source code is licensed under the MIT license found in the -// LICENSE file in the "hack" directory of this source tree. - -// This is OCaml FFI entry point. -rust_parser_ffi::parse!(parse_positioned, positioned_parser::parse_script); -// The function generated is `parse_positioned` and its implementation -// calls into `positioned_parser::parse_script`. diff --git a/hphp/hack/src/parser/rust_to_ocaml.rs b/hphp/hack/src/parser/rust_to_ocaml.rs index 6418a7cf8d8..5417f58bca0 100644 --- a/hphp/hack/src/parser/rust_to_ocaml.rs +++ b/hphp/hack/src/parser/rust_to_ocaml.rs @@ -13,8 +13,6 @@ use ocamlrep_ocamlpool::add_to_ambient_pool; use parser_core_types::{ lexable_token::LexableToken, minimal_trivia::MinimalTrivia, - positioned_syntax::PositionedValue, - positioned_token::PositionedToken, positioned_trivia::PositionedTrivium, source_text::SourceText, syntax::*, @@ -90,52 +88,6 @@ impl ToOcaml for MinimalTrivia { } } -impl ToOcaml for Syntax -where - Token: LexableToken + ToOcaml, - SyntaxValue: SyntaxValueType + ToOcaml, -{ - unsafe fn to_ocaml(&self, context: &SerializationContext) -> Value { - let value = self.value.to_ocaml(context); - - let syntax = match &self.syntax { - SyntaxVariant::Missing => u8_to_ocaml(SyntaxKind::Missing.ocaml_tag()), - SyntaxVariant::Token(token) => { - let token_kind = token.kind(); - let token = token.to_ocaml(context); - let block = reserve_block(SyntaxKind::Token(token_kind).ocaml_tag().into(), 1); - caml_set_field(block, 0, token); - block - } - SyntaxVariant::SyntaxList(l) => { - let l = to_list(l, context); - let block = reserve_block(SyntaxKind::SyntaxList.ocaml_tag().into(), 1); - caml_set_field(block, 0, l); - block - } - _ => { - let tag = self.kind().ocaml_tag() as u8; - // This could be much more readable by constructing a vector of children and - // passing it to to_list, but the cost of this intermediate vector allocation is - // too big - let n = self.iter_children().count(); - let result = reserve_block(tag, n); - // Similarly, fold() avoids intermediate allocation done by children() - self.iter_children().fold(0, |i, field| { - let field = field.to_ocaml(context); - caml_set_field(result, i, field); - i + 1 - }); - result - } - }; - let block = reserve_block(0.into(), 2); - caml_set_field(block, 0, syntax); - caml_set_field(block, 1, value); - block - } -} - impl ToOcaml for SyntaxByRef<'_, Token, SyntaxValue> where Token: LexableToken + ToOcaml, @@ -216,16 +168,6 @@ fn build_lazy_trivia(trivia_list: &[PositionedTrivium], acc: Option) -> O }) } -fn get_forward_pointer(token: &PositionedToken) -> Value { - token - .get_cached_value_in_generation(get_ocamlpool_generation()) - .unwrap_or(ocaml::core::mlvalues::UNIT) -} - -fn set_forward_pointer(token: &PositionedToken, value: Value) { - token.set_cached_value(value, get_ocamlpool_generation()); -} - impl ToOcaml for PositionedTokenByRef<'_> { unsafe fn to_ocaml(&self, context: &SerializationContext) -> Value { let kind = self.kind().to_ocaml(context); @@ -258,93 +200,10 @@ impl ToOcaml for PositionedTokenByRef<'_> { } } -impl ToOcaml for PositionedToken { - unsafe fn to_ocaml(&self, context: &SerializationContext) -> Value { - let res = get_forward_pointer(self); - if res != ocaml::core::mlvalues::UNIT { - return res; - } - - let kind = self.kind().to_ocaml(context); - let offset = usize_to_ocaml(self.offset()); - let leading_width = usize_to_ocaml(self.leading_width()); - let width = usize_to_ocaml(self.width()); - let trailing_width = usize_to_ocaml(self.trailing_width()); - - let lazy_trivia_mask = Some(0); - let lazy_trivia_mask = build_lazy_trivia(&self.leading, lazy_trivia_mask); - let lazy_trivia_mask = build_lazy_trivia(&self.trailing, lazy_trivia_mask); - - let trivia = match lazy_trivia_mask { - Some(mask) => usize_to_ocaml(mask), - None => { - //( Trivia.t list * Trivia.t list) - let leading = to_list(&self.leading, context); - let trailing = to_list(&self.trailing, context); - let block = reserve_block(0.into(), 2); - caml_set_field(block, 0, leading); - caml_set_field(block, 1, trailing); - block - } - }; - // From full_fidelity_positioned_token.ml: - // type t = { - // kind: TokenKind.t; - // source_text: SourceText.t; - // offset: int; (* Beginning of first trivia *) - // leading_width: int; - // width: int; (* Width of actual token, not counting trivia *) - // trailing_width: int; - // trivia: LazyTrivia.t; - // } - let res = reserve_block(0.into(), 7); - caml_set_field(res, 0, kind); - caml_set_field(res, 1, context.source_text); - caml_set_field(res, 2, offset); - caml_set_field(res, 3, leading_width); - caml_set_field(res, 4, width); - caml_set_field(res, 5, trailing_width); - caml_set_field(res, 6, trivia); - set_forward_pointer(self, res); - res - } -} - const TOKEN_VALUE_VARIANT: u8 = 0; const TOKEN_SPAN_VARIANT: u8 = 1; const MISSING_VALUE_VARIANT: u8 = 2; -impl ToOcaml for PositionedValue { - unsafe fn to_ocaml(&self, context: &SerializationContext) -> Value { - match self { - PositionedValue::TokenValue(t) => { - let token = t.to_ocaml(context); - // TokenValue of ... - let block = reserve_block(TOKEN_VALUE_VARIANT.into(), 1); - caml_set_field(block, 0, token); - block - } - PositionedValue::TokenSpan(x) => { - let left = x.left.to_ocaml(context); - let right = x.right.to_ocaml(context); - // TokenSpan { left: Token.t; right: Token.t } - let block = reserve_block(TOKEN_SPAN_VARIANT.into(), 2); - caml_set_field(block, 0, left); - caml_set_field(block, 1, right); - block - } - PositionedValue::Missing { offset } => { - let offset = usize_to_ocaml(*offset); - // Missing of {...} - let block = reserve_block(MISSING_VALUE_VARIANT.into(), 2); - caml_set_field(block, 0, context.source_text); - caml_set_field(block, 1, offset); - block - } - } - } -} - impl ToOcaml for PositionedValueByRef<'_> { unsafe fn to_ocaml(&self, context: &SerializationContext) -> Value { match self { -- 2.11.4.GIT