/* * Field-name metadata derived from @ast-grep/napi 0.45.2 * (tree-sitter-javascript 0.25.0, tree-sitter-typescript/tsx 0.23.2) * and @ast-grep/lang-go 0.0.6 (tree-sitter-go 0.25.0). * * MIT License * Copyright (c) 2020 N-API for Rust * Copyright (c) 2025 ast-grep * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ export const JAVASCRIPT_FIELDS: Readonly> = { arrow_function: ["body", "parameter", "parameters", "return_type", "type_parameters"], assignment_expression: ["left", "right"], assignment_pattern: ["left", "right"], augmented_assignment_expression: ["left", "operator", "right"], binary_expression: ["left", "operator", "right"], break_statement: ["label"], call_expression: ["arguments", "function", "optional_chain", "type_arguments"], catch_clause: ["body", "parameter", "type"], class: ["body", "decorator", "name", "type_parameters"], class_body: ["decorator", "member"], class_declaration: ["body", "decorator", "name", "type_parameters"], class_static_block: ["body"], continue_statement: ["label"], do_statement: ["body", "condition"], export_specifier: ["alias", "name"], export_statement: ["declaration", "decorator", "source", "value"], field_definition: ["decorator", "property", "value"], finally_clause: ["body"], for_in_statement: ["body", "kind", "left", "operator", "right", "value"], for_statement: ["body", "condition", "increment", "initializer"], function_declaration: ["body", "name", "parameters", "return_type", "type_parameters"], function_expression: ["body", "name", "parameters", "return_type", "type_parameters"], generator_function: ["body", "name", "parameters", "return_type", "type_parameters"], generator_function_declaration: ["body", "name", "parameters", "return_type", "type_parameters"], if_statement: ["alternative", "condition", "consequence"], import_specifier: ["alias", "name"], import_statement: ["source"], jsx_closing_element: ["name"], jsx_element: ["close_tag", "open_tag"], jsx_opening_element: ["attribute", "name", "type_arguments"], jsx_self_closing_element: ["attribute", "name", "type_arguments"], labeled_statement: ["body", "label"], lexical_declaration: ["kind"], member_expression: ["object", "optional_chain", "property"], method_definition: ["body", "decorator", "name", "parameters", "return_type", "type_parameters"], new_expression: ["arguments", "constructor", "type_arguments"], object_assignment_pattern: ["left", "right"], pair: ["key", "value"], pair_pattern: ["key", "value"], regex: ["flags", "pattern"], subscript_expression: ["index", "object", "optional_chain"], switch_case: ["body", "value"], switch_default: ["body"], switch_statement: ["body", "value"], ternary_expression: ["alternative", "condition", "consequence"], try_statement: ["body", "finalizer", "handler"], unary_expression: ["argument", "operator"], update_expression: ["argument", "operator"], using_declaration: ["kind"], variable_declarator: ["name", "type", "value"], while_statement: ["body", "condition"], with_statement: ["body", "object"], abstract_class_declaration: ["body", "decorator", "name", "type_parameters"], abstract_method_signature: ["name", "parameters", "return_type", "type_parameters"], call_signature: ["parameters", "return_type", "type_parameters"], conditional_type: ["alternative", "consequence", "left", "right"], construct_signature: ["parameters", "type", "type_parameters"], constructor_type: ["parameters", "type", "type_parameters"], enum_assignment: ["name", "value"], enum_body: ["name"], enum_declaration: ["body", "name"], extends_clause: ["type_arguments", "value"], extends_type_clause: ["type"], function_signature: ["name", "parameters", "return_type", "type_parameters"], function_type: ["parameters", "return_type", "type_parameters"], generic_type: ["name", "type_arguments"], import_require_clause: ["source"], index_signature: ["index_type", "name", "sign", "type"], instantiation_expression: ["function", "type_arguments"], interface_declaration: ["body", "name", "type_parameters"], internal_module: ["body", "name"], mapped_type_clause: ["alias", "name", "type"], method_signature: ["name", "parameters", "return_type", "type_parameters"], module: ["body", "name"], nested_identifier: ["object", "property"], nested_type_identifier: ["module", "name"], optional_parameter: ["decorator", "name", "pattern", "type", "value"], parenthesized_expression: ["type"], property_signature: ["name", "type"], public_field_definition: ["decorator", "name", "type", "value"], required_parameter: ["decorator", "name", "pattern", "type", "value"], type_alias_declaration: ["name", "type_parameters", "value"], type_parameter: ["constraint", "name", "value"], type_predicate: ["name", "type"], }; export const GO_FIELDS: Readonly> = { array_type: ["element", "length"], assignment_statement: ["left", "operator", "right"], binary_expression: ["left", "operator", "right"], call_expression: ["arguments", "function", "type_arguments"], channel_type: ["value"], communication_case: ["communication"], composite_literal: ["body", "type"], const_spec: ["name", "type", "value"], expression_case: ["value"], expression_switch_statement: ["initializer", "value"], field_declaration: ["name", "tag", "type"], for_clause: ["condition", "initializer", "update"], for_statement: ["body"], func_literal: ["body", "parameters", "result"], function_declaration: ["body", "name", "parameters", "result", "type_parameters"], function_type: ["parameters", "result"], generic_type: ["type", "type_arguments"], if_statement: ["alternative", "condition", "consequence", "initializer"], implicit_length_array_type: ["element"], import_spec: ["name", "path"], index_expression: ["index", "operand"], keyed_element: ["key", "value"], labeled_statement: ["label"], map_type: ["key", "value"], method_declaration: ["body", "name", "parameters", "receiver", "result"], method_elem: ["name", "parameters", "result"], parameter_declaration: ["name", "type"], qualified_type: ["name", "package"], range_clause: ["left", "right"], receive_statement: ["left", "right"], selector_expression: ["field", "operand"], send_statement: ["channel", "value"], short_var_declaration: ["left", "right"], slice_expression: ["capacity", "end", "operand", "start"], slice_type: ["element"], type_alias: ["name", "type", "type_parameters"], type_assertion_expression: ["operand", "type"], type_case: ["type"], type_conversion_expression: ["operand", "type"], type_instantiation_expression: ["type"], type_parameter_declaration: ["name", "type"], type_spec: ["name", "type", "type_parameters"], type_switch_statement: ["alias", "initializer", "value"], unary_expression: ["operand", "operator"], var_spec: ["name", "type", "value"], variadic_parameter_declaration: ["name", "type"], };