-Avoid deserialization of untrusted data if at all possible. If the
+Avoid deserialization of untrusted data if at all possible. If the
architecture permits it then use other formats instead of serialized objects,
for example JSON.
diff --git a/ruby/ql/src/queries/security/cwe-502/UnsafeDeserialization.qhelp b/ruby/ql/src/queries/security/cwe-502/UnsafeDeserialization.qhelp
index b84c7dce0677..001f7ef1448c 100644
--- a/ruby/ql/src/queries/security/cwe-502/UnsafeDeserialization.qhelp
+++ b/ruby/ql/src/queries/security/cwe-502/UnsafeDeserialization.qhelp
@@ -7,6 +7,16 @@ Deserializing untrusted data using any method that allows the construction of
arbitrary objects is easily exploitable and, in many cases, allows an attacker
to execute arbitrary code.
+
+Note that a deserialization method is only dangerous if it can instantiate
+arbitrary classes or objects. Serialization frameworks that use a schema to instantiate
+only expected, predefined types are generally not tracked by this query. Such
+frameworks are generally safe with respect to arbitrary-class-instantiation and
+gadget-chain attacks when the schema is trusted and does not permit
+user-controlled type resolution. However, care must be taken to ensure the schema
+strictly limits the allowed types. Permitting common standard library classes
+can still leave the application vulnerable to gadget-chain attacks.
+
@@ -31,7 +41,7 @@ safely be used.
If deserializing an untrusted XML document using the ox gem,
do not use parse_obj and load using the non-default :object mode.
Instead use the load method in the default mode or better explicitly set a safe
-mode such as :hash.
+mode such as :hash.
diff --git a/swift/downgrades/1bb163e31d206f30146738adcd93def10fdabefa/old.dbscheme b/swift/downgrades/1bb163e31d206f30146738adcd93def10fdabefa/old.dbscheme
new file mode 100644
index 000000000000..1bb163e31d20
--- /dev/null
+++ b/swift/downgrades/1bb163e31d206f30146738adcd93def10fdabefa/old.dbscheme
@@ -0,0 +1,2892 @@
+// generated by codegen/codegen.py, do not edit
+
+// from prefix.dbscheme
+/**
+ * The source location of the snapshot.
+ */
+sourceLocationPrefix(
+ string prefix: string ref
+);
+
+
+// from schema.py
+
+@element =
+ @file
+| @generic_context
+| @locatable
+| @location
+| @type
+;
+
+#keyset[id]
+element_is_unknown(
+ int id: @element ref
+);
+
+@file =
+ @db_file
+;
+
+#keyset[id]
+files(
+ int id: @file ref,
+ string name: string ref
+);
+
+#keyset[id]
+file_is_successfully_extracted(
+ int id: @file ref
+);
+
+@locatable =
+ @argument
+| @ast_node
+| @comment
+| @diagnostics
+| @error_element
+;
+
+#keyset[id]
+locatable_locations(
+ int id: @locatable ref,
+ int location: @location_or_none ref
+);
+
+@location =
+ @db_location
+;
+
+#keyset[id]
+locations(
+ int id: @location ref,
+ int file: @file_or_none ref,
+ int start_line: int ref,
+ int start_column: int ref,
+ int end_line: int ref,
+ int end_column: int ref
+);
+
+@ast_node =
+ @availability_info
+| @availability_spec
+| @callable
+| @case_label_item
+| @condition_element
+| @decl
+| @expr
+| @key_path_component
+| @macro_role
+| @pattern
+| @stmt
+| @stmt_condition
+| @type_repr
+;
+
+comments(
+ unique int id: @comment,
+ string text: string ref
+);
+
+db_files(
+ unique int id: @db_file
+);
+
+db_locations(
+ unique int id: @db_location
+);
+
+diagnostics(
+ unique int id: @diagnostics,
+ string text: string ref,
+ int kind: int ref
+);
+
+@error_element =
+ @error_expr
+| @error_type
+| @overloaded_decl_ref_expr
+| @unresolved_decl_ref_expr
+| @unresolved_dot_expr
+| @unresolved_member_chain_result_expr
+| @unresolved_member_expr
+| @unresolved_pattern_expr
+| @unresolved_specialize_expr
+| @unresolved_type
+| @unresolved_type_conversion_expr
+| @unspecified_element
+;
+
+availability_infos(
+ unique int id: @availability_info
+);
+
+#keyset[id]
+availability_info_is_unavailable(
+ int id: @availability_info ref
+);
+
+#keyset[id, index]
+availability_info_specs(
+ int id: @availability_info ref,
+ int index: int ref,
+ int spec: @availability_spec_or_none ref
+);
+
+availability_specs(
+ unique int id: @availability_spec
+);
+
+#keyset[id]
+availability_spec_platforms(
+ int id: @availability_spec ref,
+ string platform: string ref
+);
+
+#keyset[id]
+availability_spec_versions(
+ int id: @availability_spec ref,
+ string version: string ref
+);
+
+#keyset[id]
+availability_spec_is_wildcard(
+ int id: @availability_spec ref
+);
+
+@callable =
+ @closure_expr
+| @function
+;
+
+#keyset[id]
+callable_names(
+ int id: @callable ref,
+ string name: string ref
+);
+
+#keyset[id]
+callable_self_params(
+ int id: @callable ref,
+ int self_param: @param_decl_or_none ref
+);
+
+#keyset[id, index]
+callable_params(
+ int id: @callable ref,
+ int index: int ref,
+ int param: @param_decl_or_none ref
+);
+
+#keyset[id]
+callable_bodies(
+ int id: @callable ref,
+ int body: @brace_stmt_or_none ref
+);
+
+#keyset[id, index]
+callable_captures(
+ int id: @callable ref,
+ int index: int ref,
+ int capture: @captured_decl_or_none ref
+);
+
+key_path_components(
+ unique int id: @key_path_component,
+ int kind: int ref,
+ int component_type: @type_or_none ref
+);
+
+#keyset[id, index]
+key_path_component_subscript_arguments(
+ int id: @key_path_component ref,
+ int index: int ref,
+ int subscript_argument: @argument_or_none ref
+);
+
+#keyset[id]
+key_path_component_tuple_indices(
+ int id: @key_path_component ref,
+ int tuple_index: int ref
+);
+
+#keyset[id]
+key_path_component_decl_refs(
+ int id: @key_path_component ref,
+ int decl_ref: @value_decl_or_none ref
+);
+
+macro_roles(
+ unique int id: @macro_role,
+ int kind: int ref,
+ int macro_syntax: int ref
+);
+
+#keyset[id, index]
+macro_role_conformances(
+ int id: @macro_role ref,
+ int index: int ref,
+ int conformance: @expr_or_none ref
+);
+
+#keyset[id, index]
+macro_role_names(
+ int id: @macro_role ref,
+ int index: int ref,
+ string name: string ref
+);
+
+unspecified_elements(
+ unique int id: @unspecified_element,
+ string property: string ref,
+ string error: string ref
+);
+
+#keyset[id]
+unspecified_element_parents(
+ int id: @unspecified_element ref,
+ int parent: @element ref
+);
+
+#keyset[id]
+unspecified_element_indices(
+ int id: @unspecified_element ref,
+ int index: int ref
+);
+
+#keyset[id, index]
+unspecified_element_children(
+ int id: @unspecified_element ref,
+ int index: int ref,
+ int child: @ast_node_or_none ref
+);
+
+@decl =
+ @captured_decl
+| @enum_case_decl
+| @extension_decl
+| @if_config_decl
+| @import_decl
+| @missing_member_decl
+| @operator_decl
+| @pattern_binding_decl
+| @pound_diagnostic_decl
+| @precedence_group_decl
+| @top_level_code_decl
+| @using_decl
+| @value_decl
+;
+
+#keyset[id]
+decls( //dir=decl
+ int id: @decl ref,
+ int module: @module_decl_or_none ref
+);
+
+#keyset[id, index]
+decl_members( //dir=decl
+ int id: @decl ref,
+ int index: int ref,
+ int member: @decl_or_none ref
+);
+
+@generic_context =
+ @extension_decl
+| @function
+| @generic_type_decl
+| @macro_decl
+| @subscript_decl
+;
+
+#keyset[id, index]
+generic_context_generic_type_params( //dir=decl
+ int id: @generic_context ref,
+ int index: int ref,
+ int generic_type_param: @generic_type_param_decl_or_none ref
+);
+
+captured_decls( //dir=decl
+ unique int id: @captured_decl,
+ int decl: @value_decl_or_none ref
+);
+
+#keyset[id]
+captured_decl_is_direct( //dir=decl
+ int id: @captured_decl ref
+);
+
+#keyset[id]
+captured_decl_is_escaping( //dir=decl
+ int id: @captured_decl ref
+);
+
+enum_case_decls( //dir=decl
+ unique int id: @enum_case_decl
+);
+
+#keyset[id, index]
+enum_case_decl_elements( //dir=decl
+ int id: @enum_case_decl ref,
+ int index: int ref,
+ int element: @enum_element_decl_or_none ref
+);
+
+extension_decls( //dir=decl
+ unique int id: @extension_decl,
+ int extended_type_decl: @nominal_type_decl_or_none ref
+);
+
+#keyset[id, index]
+extension_decl_protocols( //dir=decl
+ int id: @extension_decl ref,
+ int index: int ref,
+ int protocol: @protocol_decl_or_none ref
+);
+
+if_config_decls( //dir=decl
+ unique int id: @if_config_decl
+);
+
+#keyset[id, index]
+if_config_decl_active_elements( //dir=decl
+ int id: @if_config_decl ref,
+ int index: int ref,
+ int active_element: @ast_node_or_none ref
+);
+
+import_decls( //dir=decl
+ unique int id: @import_decl
+);
+
+#keyset[id]
+import_decl_is_exported( //dir=decl
+ int id: @import_decl ref
+);
+
+#keyset[id]
+import_decl_imported_modules( //dir=decl
+ int id: @import_decl ref,
+ int imported_module: @module_decl_or_none ref
+);
+
+#keyset[id, index]
+import_decl_declarations( //dir=decl
+ int id: @import_decl ref,
+ int index: int ref,
+ int declaration: @value_decl_or_none ref
+);
+
+missing_member_decls( //dir=decl
+ unique int id: @missing_member_decl,
+ string name: string ref
+);
+
+@operator_decl =
+ @infix_operator_decl
+| @postfix_operator_decl
+| @prefix_operator_decl
+;
+
+#keyset[id]
+operator_decls( //dir=decl
+ int id: @operator_decl ref,
+ string name: string ref
+);
+
+pattern_binding_decls( //dir=decl
+ unique int id: @pattern_binding_decl
+);
+
+#keyset[id, index]
+pattern_binding_decl_inits( //dir=decl
+ int id: @pattern_binding_decl ref,
+ int index: int ref,
+ int init: @expr_or_none ref
+);
+
+#keyset[id, index]
+pattern_binding_decl_patterns( //dir=decl
+ int id: @pattern_binding_decl ref,
+ int index: int ref,
+ int pattern: @pattern_or_none ref
+);
+
+pound_diagnostic_decls( //dir=decl
+ unique int id: @pound_diagnostic_decl,
+ int kind: int ref,
+ int message: @string_literal_expr_or_none ref
+);
+
+precedence_group_decls( //dir=decl
+ unique int id: @precedence_group_decl
+);
+
+top_level_code_decls( //dir=decl
+ unique int id: @top_level_code_decl,
+ int body: @brace_stmt_or_none ref
+);
+
+using_decls( //dir=decl
+ unique int id: @using_decl
+);
+
+#keyset[id]
+using_decl_is_main_actor( //dir=decl
+ int id: @using_decl ref
+);
+
+#keyset[id]
+using_decl_is_nonisolated( //dir=decl
+ int id: @using_decl ref
+);
+
+@value_decl =
+ @abstract_storage_decl
+| @enum_element_decl
+| @function
+| @macro_decl
+| @type_decl
+;
+
+#keyset[id]
+value_decls( //dir=decl
+ int id: @value_decl ref,
+ int interface_type: @type_or_none ref
+);
+
+@abstract_storage_decl =
+ @subscript_decl
+| @var_decl
+;
+
+#keyset[id, index]
+abstract_storage_decl_accessors( //dir=decl
+ int id: @abstract_storage_decl ref,
+ int index: int ref,
+ int accessor: @accessor_or_none ref
+);
+
+enum_element_decls( //dir=decl
+ unique int id: @enum_element_decl,
+ string name: string ref
+);
+
+#keyset[id, index]
+enum_element_decl_params( //dir=decl
+ int id: @enum_element_decl ref,
+ int index: int ref,
+ int param: @param_decl_or_none ref
+);
+
+@function =
+ @accessor_or_named_function
+| @deinitializer
+| @initializer
+;
+
+infix_operator_decls( //dir=decl
+ unique int id: @infix_operator_decl
+);
+
+#keyset[id]
+infix_operator_decl_precedence_groups( //dir=decl
+ int id: @infix_operator_decl ref,
+ int precedence_group: @precedence_group_decl_or_none ref
+);
+
+macro_decls( //dir=decl
+ unique int id: @macro_decl,
+ string name: string ref
+);
+
+#keyset[id, index]
+macro_decl_parameters( //dir=decl
+ int id: @macro_decl ref,
+ int index: int ref,
+ int parameter: @param_decl_or_none ref
+);
+
+#keyset[id, index]
+macro_decl_roles( //dir=decl
+ int id: @macro_decl ref,
+ int index: int ref,
+ int role: @macro_role_or_none ref
+);
+
+postfix_operator_decls( //dir=decl
+ unique int id: @postfix_operator_decl
+);
+
+prefix_operator_decls( //dir=decl
+ unique int id: @prefix_operator_decl
+);
+
+@type_decl =
+ @abstract_type_param_decl
+| @generic_type_decl
+| @module_decl
+;
+
+#keyset[id]
+type_decls( //dir=decl
+ int id: @type_decl ref,
+ string name: string ref,
+ int declared_interface_type: @type_or_none ref
+);
+
+#keyset[id, index]
+type_decl_inherited_types( //dir=decl
+ int id: @type_decl ref,
+ int index: int ref,
+ int inherited_type: @type_or_none ref
+);
+
+@abstract_type_param_decl =
+ @associated_type_decl
+| @generic_type_param_decl
+;
+
+@accessor_or_named_function =
+ @accessor
+| @named_function
+;
+
+deinitializers( //dir=decl
+ unique int id: @deinitializer
+);
+
+@generic_type_decl =
+ @nominal_type_decl
+| @opaque_type_decl
+| @type_alias_decl
+;
+
+initializers( //dir=decl
+ unique int id: @initializer
+);
+
+module_decls( //dir=decl
+ unique int id: @module_decl
+);
+
+#keyset[id]
+module_decl_is_builtin_module( //dir=decl
+ int id: @module_decl ref
+);
+
+#keyset[id]
+module_decl_is_system_module( //dir=decl
+ int id: @module_decl ref
+);
+
+module_decl_imported_modules( //dir=decl
+ int id: @module_decl ref,
+ int imported_module: @module_decl_or_none ref
+);
+
+module_decl_exported_modules( //dir=decl
+ int id: @module_decl ref,
+ int exported_module: @module_decl_or_none ref
+);
+
+subscript_decls( //dir=decl
+ unique int id: @subscript_decl,
+ int element_type: @type_or_none ref
+);
+
+#keyset[id, index]
+subscript_decl_params( //dir=decl
+ int id: @subscript_decl ref,
+ int index: int ref,
+ int param: @param_decl_or_none ref
+);
+
+@var_decl =
+ @concrete_var_decl
+| @param_decl
+;
+
+#keyset[id]
+var_decls( //dir=decl
+ int id: @var_decl ref,
+ string name: string ref,
+ int type_: @type_or_none ref
+);
+
+#keyset[id]
+var_decl_attached_property_wrapper_types( //dir=decl
+ int id: @var_decl ref,
+ int attached_property_wrapper_type: @type_or_none ref
+);
+
+#keyset[id]
+var_decl_parent_patterns( //dir=decl
+ int id: @var_decl ref,
+ int parent_pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+var_decl_parent_initializers( //dir=decl
+ int id: @var_decl ref,
+ int parent_initializer: @expr_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_backing_var_bindings( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_backing_var_binding: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_backing_vars( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_backing_var: @var_decl_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_projection_var_bindings( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_projection_var_binding: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_projection_vars( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_projection_var: @var_decl_or_none ref
+);
+
+accessors( //dir=decl
+ unique int id: @accessor
+);
+
+#keyset[id]
+accessor_is_getter( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_setter( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_will_set( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_did_set( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_read( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_modify( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_unsafe_address( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_unsafe_mutable_address( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_distributed_get( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_read2( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_modify2( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_init( //dir=decl
+ int id: @accessor ref
+);
+
+associated_type_decls( //dir=decl
+ unique int id: @associated_type_decl
+);
+
+concrete_var_decls( //dir=decl
+ unique int id: @concrete_var_decl,
+ int introducer_int: int ref
+);
+
+generic_type_param_decls( //dir=decl
+ unique int id: @generic_type_param_decl
+);
+
+named_functions( //dir=decl
+ unique int id: @named_function
+);
+
+@nominal_type_decl =
+ @class_decl
+| @enum_decl
+| @protocol_decl
+| @struct_decl
+;
+
+#keyset[id]
+nominal_type_decls( //dir=decl
+ int id: @nominal_type_decl ref,
+ int type_: @type_or_none ref
+);
+
+opaque_type_decls( //dir=decl
+ unique int id: @opaque_type_decl,
+ int naming_declaration: @value_decl_or_none ref
+);
+
+#keyset[id, index]
+opaque_type_decl_opaque_generic_params( //dir=decl
+ int id: @opaque_type_decl ref,
+ int index: int ref,
+ int opaque_generic_param: @generic_type_param_type_or_none ref
+);
+
+param_decls( //dir=decl
+ unique int id: @param_decl
+);
+
+#keyset[id]
+param_decl_is_inout( //dir=decl
+ int id: @param_decl ref
+);
+
+#keyset[id]
+param_decl_property_wrapper_local_wrapped_var_bindings( //dir=decl
+ int id: @param_decl ref,
+ int property_wrapper_local_wrapped_var_binding: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+param_decl_property_wrapper_local_wrapped_vars( //dir=decl
+ int id: @param_decl ref,
+ int property_wrapper_local_wrapped_var: @var_decl_or_none ref
+);
+
+type_alias_decls( //dir=decl
+ unique int id: @type_alias_decl,
+ int aliased_type: @type_or_none ref
+);
+
+class_decls( //dir=decl
+ unique int id: @class_decl
+);
+
+enum_decls( //dir=decl
+ unique int id: @enum_decl
+);
+
+protocol_decls( //dir=decl
+ unique int id: @protocol_decl
+);
+
+struct_decls( //dir=decl
+ unique int id: @struct_decl
+);
+
+arguments( //dir=expr
+ unique int id: @argument,
+ string label: string ref,
+ int expr: @expr_or_none ref
+);
+
+@expr =
+ @any_try_expr
+| @applied_property_wrapper_expr
+| @apply_expr
+| @assign_expr
+| @bind_optional_expr
+| @capture_list_expr
+| @closure_expr
+| @collection_expr
+| @consume_expr
+| @copy_expr
+| @current_context_isolation_expr
+| @decl_ref_expr
+| @default_argument_expr
+| @discard_assignment_expr
+| @dot_syntax_base_ignored_expr
+| @dynamic_type_expr
+| @enum_is_case_expr
+| @error_expr
+| @explicit_cast_expr
+| @extract_function_isolation_expr
+| @force_value_expr
+| @identity_expr
+| @if_expr
+| @implicit_conversion_expr
+| @in_out_expr
+| @key_path_application_expr
+| @key_path_dot_expr
+| @key_path_expr
+| @lazy_initialization_expr
+| @literal_expr
+| @lookup_expr
+| @make_temporarily_escapable_expr
+| @materialize_pack_expr
+| @obj_c_selector_expr
+| @one_way_expr
+| @opaque_value_expr
+| @open_existential_expr
+| @optional_evaluation_expr
+| @other_initializer_ref_expr
+| @overloaded_decl_ref_expr
+| @pack_element_expr
+| @pack_expansion_expr
+| @property_wrapper_value_placeholder_expr
+| @rebind_self_in_initializer_expr
+| @sequence_expr
+| @single_value_stmt_expr
+| @super_ref_expr
+| @tap_expr
+| @tuple_element_expr
+| @tuple_expr
+| @type_expr
+| @type_value_expr
+| @unresolved_decl_ref_expr
+| @unresolved_dot_expr
+| @unresolved_member_expr
+| @unresolved_pattern_expr
+| @unresolved_specialize_expr
+| @vararg_expansion_expr
+;
+
+#keyset[id]
+expr_types( //dir=expr
+ int id: @expr ref,
+ int type_: @type_or_none ref
+);
+
+@any_try_expr =
+ @force_try_expr
+| @optional_try_expr
+| @try_expr
+;
+
+#keyset[id]
+any_try_exprs( //dir=expr
+ int id: @any_try_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+applied_property_wrapper_exprs( //dir=expr
+ unique int id: @applied_property_wrapper_expr,
+ int kind: int ref,
+ int value: @expr_or_none ref,
+ int param: @param_decl_or_none ref
+);
+
+@apply_expr =
+ @binary_expr
+| @call_expr
+| @postfix_unary_expr
+| @prefix_unary_expr
+| @self_apply_expr
+;
+
+#keyset[id]
+apply_exprs( //dir=expr
+ int id: @apply_expr ref,
+ int function: @expr_or_none ref
+);
+
+#keyset[id, index]
+apply_expr_arguments( //dir=expr
+ int id: @apply_expr ref,
+ int index: int ref,
+ int argument: @argument_or_none ref
+);
+
+assign_exprs( //dir=expr
+ unique int id: @assign_expr,
+ int dest: @expr_or_none ref,
+ int source: @expr_or_none ref
+);
+
+bind_optional_exprs( //dir=expr
+ unique int id: @bind_optional_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+capture_list_exprs( //dir=expr
+ unique int id: @capture_list_expr,
+ int closure_body: @closure_expr_or_none ref
+);
+
+#keyset[id, index]
+capture_list_expr_binding_decls( //dir=expr
+ int id: @capture_list_expr ref,
+ int index: int ref,
+ int binding_decl: @pattern_binding_decl_or_none ref
+);
+
+@closure_expr =
+ @auto_closure_expr
+| @explicit_closure_expr
+;
+
+@collection_expr =
+ @array_expr
+| @dictionary_expr
+;
+
+consume_exprs( //dir=expr
+ unique int id: @consume_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+copy_exprs( //dir=expr
+ unique int id: @copy_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+current_context_isolation_exprs( //dir=expr
+ unique int id: @current_context_isolation_expr,
+ int actor: @expr_or_none ref
+);
+
+decl_ref_exprs( //dir=expr
+ unique int id: @decl_ref_expr,
+ int decl: @decl_or_none ref
+);
+
+#keyset[id, index]
+decl_ref_expr_replacement_types( //dir=expr
+ int id: @decl_ref_expr ref,
+ int index: int ref,
+ int replacement_type: @type_or_none ref
+);
+
+#keyset[id]
+decl_ref_expr_has_direct_to_storage_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+#keyset[id]
+decl_ref_expr_has_direct_to_implementation_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+#keyset[id]
+decl_ref_expr_has_ordinary_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+#keyset[id]
+decl_ref_expr_has_distributed_thunk_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+default_argument_exprs( //dir=expr
+ unique int id: @default_argument_expr,
+ int param_decl: @param_decl_or_none ref,
+ int param_index: int ref
+);
+
+#keyset[id]
+default_argument_expr_caller_side_defaults( //dir=expr
+ int id: @default_argument_expr ref,
+ int caller_side_default: @expr_or_none ref
+);
+
+discard_assignment_exprs( //dir=expr
+ unique int id: @discard_assignment_expr
+);
+
+dot_syntax_base_ignored_exprs( //dir=expr
+ unique int id: @dot_syntax_base_ignored_expr,
+ int qualifier: @expr_or_none ref,
+ int sub_expr: @expr_or_none ref
+);
+
+dynamic_type_exprs( //dir=expr
+ unique int id: @dynamic_type_expr,
+ int base: @expr_or_none ref
+);
+
+enum_is_case_exprs( //dir=expr
+ unique int id: @enum_is_case_expr,
+ int sub_expr: @expr_or_none ref,
+ int element: @enum_element_decl_or_none ref
+);
+
+error_exprs( //dir=expr
+ unique int id: @error_expr
+);
+
+@explicit_cast_expr =
+ @checked_cast_expr
+| @coerce_expr
+;
+
+#keyset[id]
+explicit_cast_exprs( //dir=expr
+ int id: @explicit_cast_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+extract_function_isolation_exprs( //dir=expr
+ unique int id: @extract_function_isolation_expr,
+ int function_expr: @expr_or_none ref
+);
+
+force_value_exprs( //dir=expr
+ unique int id: @force_value_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+@identity_expr =
+ @await_expr
+| @borrow_expr
+| @dot_self_expr
+| @paren_expr
+| @unresolved_member_chain_result_expr
+| @unsafe_expr
+;
+
+#keyset[id]
+identity_exprs( //dir=expr
+ int id: @identity_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+if_exprs( //dir=expr
+ unique int id: @if_expr,
+ int condition: @expr_or_none ref,
+ int then_expr: @expr_or_none ref,
+ int else_expr: @expr_or_none ref
+);
+
+@implicit_conversion_expr =
+ @abi_safe_conversion_expr
+| @actor_isolation_erasure_expr
+| @any_hashable_erasure_expr
+| @archetype_to_super_expr
+| @array_to_pointer_expr
+| @bridge_from_obj_c_expr
+| @bridge_to_obj_c_expr
+| @class_metatype_to_object_expr
+| @collection_upcast_conversion_expr
+| @conditional_bridge_from_obj_c_expr
+| @covariant_function_conversion_expr
+| @covariant_return_conversion_expr
+| @derived_to_base_expr
+| @destructure_tuple_expr
+| @differentiable_function_expr
+| @differentiable_function_extract_original_expr
+| @erasure_expr
+| @existential_metatype_to_object_expr
+| @foreign_object_conversion_expr
+| @function_conversion_expr
+| @in_out_to_pointer_expr
+| @inject_into_optional_expr
+| @linear_function_expr
+| @linear_function_extract_original_expr
+| @linear_to_differentiable_function_expr
+| @load_expr
+| @metatype_conversion_expr
+| @pointer_to_pointer_expr
+| @protocol_metatype_to_object_expr
+| @string_to_pointer_expr
+| @underlying_to_opaque_expr
+| @unevaluated_instance_expr
+| @unreachable_expr
+| @unresolved_type_conversion_expr
+| @unsafe_cast_expr
+;
+
+#keyset[id]
+implicit_conversion_exprs( //dir=expr
+ int id: @implicit_conversion_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+in_out_exprs( //dir=expr
+ unique int id: @in_out_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+key_path_application_exprs( //dir=expr
+ unique int id: @key_path_application_expr,
+ int base: @expr_or_none ref,
+ int key_path: @expr_or_none ref
+);
+
+key_path_dot_exprs( //dir=expr
+ unique int id: @key_path_dot_expr
+);
+
+key_path_exprs( //dir=expr
+ unique int id: @key_path_expr
+);
+
+#keyset[id]
+key_path_expr_roots( //dir=expr
+ int id: @key_path_expr ref,
+ int root: @type_repr_or_none ref
+);
+
+#keyset[id, index]
+key_path_expr_components( //dir=expr
+ int id: @key_path_expr ref,
+ int index: int ref,
+ int component: @key_path_component_or_none ref
+);
+
+lazy_initialization_exprs( //dir=expr
+ unique int id: @lazy_initialization_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+@literal_expr =
+ @builtin_literal_expr
+| @interpolated_string_literal_expr
+| @nil_literal_expr
+| @object_literal_expr
+| @regex_literal_expr
+;
+
+@lookup_expr =
+ @dynamic_lookup_expr
+| @member_ref_expr
+| @subscript_expr
+;
+
+#keyset[id]
+lookup_exprs( //dir=expr
+ int id: @lookup_expr ref,
+ int base: @expr_or_none ref
+);
+
+#keyset[id]
+lookup_expr_members( //dir=expr
+ int id: @lookup_expr ref,
+ int member: @decl_or_none ref
+);
+
+make_temporarily_escapable_exprs( //dir=expr
+ unique int id: @make_temporarily_escapable_expr,
+ int escaping_closure: @opaque_value_expr_or_none ref,
+ int nonescaping_closure: @expr_or_none ref,
+ int sub_expr: @expr_or_none ref
+);
+
+materialize_pack_exprs( //dir=expr
+ unique int id: @materialize_pack_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+obj_c_selector_exprs( //dir=expr
+ unique int id: @obj_c_selector_expr,
+ int sub_expr: @expr_or_none ref,
+ int method: @function_or_none ref
+);
+
+one_way_exprs( //dir=expr
+ unique int id: @one_way_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+opaque_value_exprs( //dir=expr
+ unique int id: @opaque_value_expr
+);
+
+open_existential_exprs( //dir=expr
+ unique int id: @open_existential_expr,
+ int sub_expr: @expr_or_none ref,
+ int existential: @expr_or_none ref,
+ int opaque_expr: @opaque_value_expr_or_none ref
+);
+
+optional_evaluation_exprs( //dir=expr
+ unique int id: @optional_evaluation_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+other_initializer_ref_exprs( //dir=expr
+ unique int id: @other_initializer_ref_expr,
+ int initializer: @initializer_or_none ref
+);
+
+overloaded_decl_ref_exprs( //dir=expr
+ unique int id: @overloaded_decl_ref_expr
+);
+
+#keyset[id, index]
+overloaded_decl_ref_expr_possible_declarations( //dir=expr
+ int id: @overloaded_decl_ref_expr ref,
+ int index: int ref,
+ int possible_declaration: @value_decl_or_none ref
+);
+
+pack_element_exprs( //dir=expr
+ unique int id: @pack_element_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+pack_expansion_exprs( //dir=expr
+ unique int id: @pack_expansion_expr,
+ int pattern_expr: @expr_or_none ref
+);
+
+property_wrapper_value_placeholder_exprs( //dir=expr
+ unique int id: @property_wrapper_value_placeholder_expr,
+ int placeholder: @opaque_value_expr_or_none ref
+);
+
+#keyset[id]
+property_wrapper_value_placeholder_expr_wrapped_values( //dir=expr
+ int id: @property_wrapper_value_placeholder_expr ref,
+ int wrapped_value: @expr_or_none ref
+);
+
+rebind_self_in_initializer_exprs( //dir=expr
+ unique int id: @rebind_self_in_initializer_expr,
+ int sub_expr: @expr_or_none ref,
+ int self: @var_decl_or_none ref
+);
+
+sequence_exprs( //dir=expr
+ unique int id: @sequence_expr
+);
+
+#keyset[id, index]
+sequence_expr_elements( //dir=expr
+ int id: @sequence_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+single_value_stmt_exprs( //dir=expr
+ unique int id: @single_value_stmt_expr,
+ int stmt: @stmt_or_none ref
+);
+
+super_ref_exprs( //dir=expr
+ unique int id: @super_ref_expr,
+ int self: @var_decl_or_none ref
+);
+
+tap_exprs( //dir=expr
+ unique int id: @tap_expr,
+ int body: @brace_stmt_or_none ref,
+ int var: @var_decl_or_none ref
+);
+
+#keyset[id]
+tap_expr_sub_exprs( //dir=expr
+ int id: @tap_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+tuple_element_exprs( //dir=expr
+ unique int id: @tuple_element_expr,
+ int sub_expr: @expr_or_none ref,
+ int index: int ref
+);
+
+tuple_exprs( //dir=expr
+ unique int id: @tuple_expr
+);
+
+#keyset[id, index]
+tuple_expr_elements( //dir=expr
+ int id: @tuple_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+type_exprs( //dir=expr
+ unique int id: @type_expr
+);
+
+#keyset[id]
+type_expr_type_reprs( //dir=expr
+ int id: @type_expr ref,
+ int type_repr: @type_repr_or_none ref
+);
+
+type_value_exprs( //dir=expr
+ unique int id: @type_value_expr,
+ int type_repr: @type_repr_or_none ref
+);
+
+unresolved_decl_ref_exprs( //dir=expr
+ unique int id: @unresolved_decl_ref_expr
+);
+
+#keyset[id]
+unresolved_decl_ref_expr_names( //dir=expr
+ int id: @unresolved_decl_ref_expr ref,
+ string name: string ref
+);
+
+unresolved_dot_exprs( //dir=expr
+ unique int id: @unresolved_dot_expr,
+ int base: @expr_or_none ref,
+ string name: string ref
+);
+
+unresolved_member_exprs( //dir=expr
+ unique int id: @unresolved_member_expr,
+ string name: string ref
+);
+
+unresolved_pattern_exprs( //dir=expr
+ unique int id: @unresolved_pattern_expr,
+ int sub_pattern: @pattern_or_none ref
+);
+
+unresolved_specialize_exprs( //dir=expr
+ unique int id: @unresolved_specialize_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+vararg_expansion_exprs( //dir=expr
+ unique int id: @vararg_expansion_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+abi_safe_conversion_exprs( //dir=expr
+ unique int id: @abi_safe_conversion_expr
+);
+
+actor_isolation_erasure_exprs( //dir=expr
+ unique int id: @actor_isolation_erasure_expr
+);
+
+any_hashable_erasure_exprs( //dir=expr
+ unique int id: @any_hashable_erasure_expr
+);
+
+archetype_to_super_exprs( //dir=expr
+ unique int id: @archetype_to_super_expr
+);
+
+array_exprs( //dir=expr
+ unique int id: @array_expr
+);
+
+#keyset[id, index]
+array_expr_elements( //dir=expr
+ int id: @array_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+array_to_pointer_exprs( //dir=expr
+ unique int id: @array_to_pointer_expr
+);
+
+auto_closure_exprs( //dir=expr
+ unique int id: @auto_closure_expr
+);
+
+await_exprs( //dir=expr
+ unique int id: @await_expr
+);
+
+binary_exprs( //dir=expr
+ unique int id: @binary_expr
+);
+
+borrow_exprs( //dir=expr
+ unique int id: @borrow_expr
+);
+
+bridge_from_obj_c_exprs( //dir=expr
+ unique int id: @bridge_from_obj_c_expr
+);
+
+bridge_to_obj_c_exprs( //dir=expr
+ unique int id: @bridge_to_obj_c_expr
+);
+
+@builtin_literal_expr =
+ @boolean_literal_expr
+| @magic_identifier_literal_expr
+| @number_literal_expr
+| @string_literal_expr
+;
+
+call_exprs( //dir=expr
+ unique int id: @call_expr
+);
+
+@checked_cast_expr =
+ @conditional_checked_cast_expr
+| @forced_checked_cast_expr
+| @is_expr
+;
+
+class_metatype_to_object_exprs( //dir=expr
+ unique int id: @class_metatype_to_object_expr
+);
+
+coerce_exprs( //dir=expr
+ unique int id: @coerce_expr
+);
+
+collection_upcast_conversion_exprs( //dir=expr
+ unique int id: @collection_upcast_conversion_expr
+);
+
+conditional_bridge_from_obj_c_exprs( //dir=expr
+ unique int id: @conditional_bridge_from_obj_c_expr
+);
+
+covariant_function_conversion_exprs( //dir=expr
+ unique int id: @covariant_function_conversion_expr
+);
+
+covariant_return_conversion_exprs( //dir=expr
+ unique int id: @covariant_return_conversion_expr
+);
+
+derived_to_base_exprs( //dir=expr
+ unique int id: @derived_to_base_expr
+);
+
+destructure_tuple_exprs( //dir=expr
+ unique int id: @destructure_tuple_expr
+);
+
+dictionary_exprs( //dir=expr
+ unique int id: @dictionary_expr
+);
+
+#keyset[id, index]
+dictionary_expr_elements( //dir=expr
+ int id: @dictionary_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+differentiable_function_exprs( //dir=expr
+ unique int id: @differentiable_function_expr
+);
+
+differentiable_function_extract_original_exprs( //dir=expr
+ unique int id: @differentiable_function_extract_original_expr
+);
+
+dot_self_exprs( //dir=expr
+ unique int id: @dot_self_expr
+);
+
+@dynamic_lookup_expr =
+ @dynamic_member_ref_expr
+| @dynamic_subscript_expr
+;
+
+erasure_exprs( //dir=expr
+ unique int id: @erasure_expr
+);
+
+existential_metatype_to_object_exprs( //dir=expr
+ unique int id: @existential_metatype_to_object_expr
+);
+
+explicit_closure_exprs( //dir=expr
+ unique int id: @explicit_closure_expr
+);
+
+force_try_exprs( //dir=expr
+ unique int id: @force_try_expr
+);
+
+foreign_object_conversion_exprs( //dir=expr
+ unique int id: @foreign_object_conversion_expr
+);
+
+function_conversion_exprs( //dir=expr
+ unique int id: @function_conversion_expr
+);
+
+in_out_to_pointer_exprs( //dir=expr
+ unique int id: @in_out_to_pointer_expr
+);
+
+inject_into_optional_exprs( //dir=expr
+ unique int id: @inject_into_optional_expr
+);
+
+interpolated_string_literal_exprs( //dir=expr
+ unique int id: @interpolated_string_literal_expr
+);
+
+#keyset[id]
+interpolated_string_literal_expr_interpolation_exprs( //dir=expr
+ int id: @interpolated_string_literal_expr ref,
+ int interpolation_expr: @opaque_value_expr_or_none ref
+);
+
+#keyset[id]
+interpolated_string_literal_expr_appending_exprs( //dir=expr
+ int id: @interpolated_string_literal_expr ref,
+ int appending_expr: @tap_expr_or_none ref
+);
+
+linear_function_exprs( //dir=expr
+ unique int id: @linear_function_expr
+);
+
+linear_function_extract_original_exprs( //dir=expr
+ unique int id: @linear_function_extract_original_expr
+);
+
+linear_to_differentiable_function_exprs( //dir=expr
+ unique int id: @linear_to_differentiable_function_expr
+);
+
+load_exprs( //dir=expr
+ unique int id: @load_expr
+);
+
+member_ref_exprs( //dir=expr
+ unique int id: @member_ref_expr
+);
+
+#keyset[id]
+member_ref_expr_has_direct_to_storage_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+#keyset[id]
+member_ref_expr_has_direct_to_implementation_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+#keyset[id]
+member_ref_expr_has_ordinary_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+#keyset[id]
+member_ref_expr_has_distributed_thunk_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+metatype_conversion_exprs( //dir=expr
+ unique int id: @metatype_conversion_expr
+);
+
+nil_literal_exprs( //dir=expr
+ unique int id: @nil_literal_expr
+);
+
+object_literal_exprs( //dir=expr
+ unique int id: @object_literal_expr,
+ int kind: int ref
+);
+
+#keyset[id, index]
+object_literal_expr_arguments( //dir=expr
+ int id: @object_literal_expr ref,
+ int index: int ref,
+ int argument: @argument_or_none ref
+);
+
+optional_try_exprs( //dir=expr
+ unique int id: @optional_try_expr
+);
+
+paren_exprs( //dir=expr
+ unique int id: @paren_expr
+);
+
+pointer_to_pointer_exprs( //dir=expr
+ unique int id: @pointer_to_pointer_expr
+);
+
+postfix_unary_exprs( //dir=expr
+ unique int id: @postfix_unary_expr
+);
+
+prefix_unary_exprs( //dir=expr
+ unique int id: @prefix_unary_expr
+);
+
+protocol_metatype_to_object_exprs( //dir=expr
+ unique int id: @protocol_metatype_to_object_expr
+);
+
+regex_literal_exprs( //dir=expr
+ unique int id: @regex_literal_expr,
+ string pattern: string ref,
+ int version: int ref
+);
+
+@self_apply_expr =
+ @dot_syntax_call_expr
+| @initializer_ref_call_expr
+;
+
+#keyset[id]
+self_apply_exprs( //dir=expr
+ int id: @self_apply_expr ref,
+ int base: @expr_or_none ref
+);
+
+string_to_pointer_exprs( //dir=expr
+ unique int id: @string_to_pointer_expr
+);
+
+subscript_exprs( //dir=expr
+ unique int id: @subscript_expr
+);
+
+#keyset[id, index]
+subscript_expr_arguments( //dir=expr
+ int id: @subscript_expr ref,
+ int index: int ref,
+ int argument: @argument_or_none ref
+);
+
+#keyset[id]
+subscript_expr_has_direct_to_storage_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+#keyset[id]
+subscript_expr_has_direct_to_implementation_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+#keyset[id]
+subscript_expr_has_ordinary_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+#keyset[id]
+subscript_expr_has_distributed_thunk_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+try_exprs( //dir=expr
+ unique int id: @try_expr
+);
+
+underlying_to_opaque_exprs( //dir=expr
+ unique int id: @underlying_to_opaque_expr
+);
+
+unevaluated_instance_exprs( //dir=expr
+ unique int id: @unevaluated_instance_expr
+);
+
+unreachable_exprs( //dir=expr
+ unique int id: @unreachable_expr
+);
+
+unresolved_member_chain_result_exprs( //dir=expr
+ unique int id: @unresolved_member_chain_result_expr
+);
+
+unresolved_type_conversion_exprs( //dir=expr
+ unique int id: @unresolved_type_conversion_expr
+);
+
+unsafe_cast_exprs( //dir=expr
+ unique int id: @unsafe_cast_expr
+);
+
+unsafe_exprs( //dir=expr
+ unique int id: @unsafe_expr
+);
+
+boolean_literal_exprs( //dir=expr
+ unique int id: @boolean_literal_expr,
+ boolean value: boolean ref
+);
+
+conditional_checked_cast_exprs( //dir=expr
+ unique int id: @conditional_checked_cast_expr
+);
+
+dot_syntax_call_exprs( //dir=expr
+ unique int id: @dot_syntax_call_expr
+);
+
+dynamic_member_ref_exprs( //dir=expr
+ unique int id: @dynamic_member_ref_expr
+);
+
+dynamic_subscript_exprs( //dir=expr
+ unique int id: @dynamic_subscript_expr
+);
+
+forced_checked_cast_exprs( //dir=expr
+ unique int id: @forced_checked_cast_expr
+);
+
+initializer_ref_call_exprs( //dir=expr
+ unique int id: @initializer_ref_call_expr
+);
+
+is_exprs( //dir=expr
+ unique int id: @is_expr
+);
+
+magic_identifier_literal_exprs( //dir=expr
+ unique int id: @magic_identifier_literal_expr,
+ string kind: string ref
+);
+
+@number_literal_expr =
+ @float_literal_expr
+| @integer_literal_expr
+;
+
+string_literal_exprs( //dir=expr
+ unique int id: @string_literal_expr,
+ string value: string ref
+);
+
+float_literal_exprs( //dir=expr
+ unique int id: @float_literal_expr,
+ string string_value: string ref
+);
+
+integer_literal_exprs( //dir=expr
+ unique int id: @integer_literal_expr,
+ string string_value: string ref
+);
+
+@pattern =
+ @any_pattern
+| @binding_pattern
+| @bool_pattern
+| @enum_element_pattern
+| @expr_pattern
+| @is_pattern
+| @named_pattern
+| @optional_some_pattern
+| @paren_pattern
+| @tuple_pattern
+| @typed_pattern
+;
+
+#keyset[id]
+pattern_types( //dir=pattern
+ int id: @pattern ref,
+ int type_: @type_or_none ref
+);
+
+any_patterns( //dir=pattern
+ unique int id: @any_pattern
+);
+
+binding_patterns( //dir=pattern
+ unique int id: @binding_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+bool_patterns( //dir=pattern
+ unique int id: @bool_pattern,
+ boolean value: boolean ref
+);
+
+enum_element_patterns( //dir=pattern
+ unique int id: @enum_element_pattern,
+ int element: @enum_element_decl_or_none ref
+);
+
+#keyset[id]
+enum_element_pattern_sub_patterns( //dir=pattern
+ int id: @enum_element_pattern ref,
+ int sub_pattern: @pattern_or_none ref
+);
+
+expr_patterns( //dir=pattern
+ unique int id: @expr_pattern,
+ int sub_expr: @expr_or_none ref
+);
+
+is_patterns( //dir=pattern
+ unique int id: @is_pattern
+);
+
+#keyset[id]
+is_pattern_cast_type_reprs( //dir=pattern
+ int id: @is_pattern ref,
+ int cast_type_repr: @type_repr_or_none ref
+);
+
+#keyset[id]
+is_pattern_sub_patterns( //dir=pattern
+ int id: @is_pattern ref,
+ int sub_pattern: @pattern_or_none ref
+);
+
+named_patterns( //dir=pattern
+ unique int id: @named_pattern,
+ int var_decl: @var_decl_or_none ref
+);
+
+optional_some_patterns( //dir=pattern
+ unique int id: @optional_some_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+paren_patterns( //dir=pattern
+ unique int id: @paren_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+tuple_patterns( //dir=pattern
+ unique int id: @tuple_pattern
+);
+
+#keyset[id, index]
+tuple_pattern_elements( //dir=pattern
+ int id: @tuple_pattern ref,
+ int index: int ref,
+ int element: @pattern_or_none ref
+);
+
+typed_patterns( //dir=pattern
+ unique int id: @typed_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+typed_pattern_type_reprs( //dir=pattern
+ int id: @typed_pattern ref,
+ int type_repr: @type_repr_or_none ref
+);
+
+case_label_items( //dir=stmt
+ unique int id: @case_label_item,
+ int pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+case_label_item_guards( //dir=stmt
+ int id: @case_label_item ref,
+ int guard: @expr_or_none ref
+);
+
+condition_elements( //dir=stmt
+ unique int id: @condition_element
+);
+
+#keyset[id]
+condition_element_booleans( //dir=stmt
+ int id: @condition_element ref,
+ int boolean_: @expr_or_none ref
+);
+
+#keyset[id]
+condition_element_patterns( //dir=stmt
+ int id: @condition_element ref,
+ int pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+condition_element_initializers( //dir=stmt
+ int id: @condition_element ref,
+ int initializer: @expr_or_none ref
+);
+
+#keyset[id]
+condition_element_availabilities( //dir=stmt
+ int id: @condition_element ref,
+ int availability: @availability_info_or_none ref
+);
+
+@stmt =
+ @brace_stmt
+| @break_stmt
+| @case_stmt
+| @continue_stmt
+| @defer_stmt
+| @discard_stmt
+| @fail_stmt
+| @fallthrough_stmt
+| @labeled_stmt
+| @pound_assert_stmt
+| @return_stmt
+| @then_stmt
+| @throw_stmt
+| @yield_stmt
+;
+
+stmt_conditions( //dir=stmt
+ unique int id: @stmt_condition
+);
+
+#keyset[id, index]
+stmt_condition_elements( //dir=stmt
+ int id: @stmt_condition ref,
+ int index: int ref,
+ int element: @condition_element_or_none ref
+);
+
+brace_stmts( //dir=stmt
+ unique int id: @brace_stmt
+);
+
+#keyset[id, index]
+brace_stmt_elements( //dir=stmt
+ int id: @brace_stmt ref,
+ int index: int ref,
+ int element: @ast_node_or_none ref
+);
+
+break_stmts( //dir=stmt
+ unique int id: @break_stmt
+);
+
+#keyset[id]
+break_stmt_target_names( //dir=stmt
+ int id: @break_stmt ref,
+ string target_name: string ref
+);
+
+#keyset[id]
+break_stmt_targets( //dir=stmt
+ int id: @break_stmt ref,
+ int target: @stmt_or_none ref
+);
+
+case_stmts( //dir=stmt
+ unique int id: @case_stmt,
+ int body: @stmt_or_none ref
+);
+
+#keyset[id, index]
+case_stmt_labels( //dir=stmt
+ int id: @case_stmt ref,
+ int index: int ref,
+ int label: @case_label_item_or_none ref
+);
+
+#keyset[id, index]
+case_stmt_variables( //dir=stmt
+ int id: @case_stmt ref,
+ int index: int ref,
+ int variable: @var_decl_or_none ref
+);
+
+continue_stmts( //dir=stmt
+ unique int id: @continue_stmt
+);
+
+#keyset[id]
+continue_stmt_target_names( //dir=stmt
+ int id: @continue_stmt ref,
+ string target_name: string ref
+);
+
+#keyset[id]
+continue_stmt_targets( //dir=stmt
+ int id: @continue_stmt ref,
+ int target: @stmt_or_none ref
+);
+
+defer_stmts( //dir=stmt
+ unique int id: @defer_stmt,
+ int body: @brace_stmt_or_none ref
+);
+
+discard_stmts( //dir=stmt
+ unique int id: @discard_stmt,
+ int sub_expr: @expr_or_none ref
+);
+
+fail_stmts( //dir=stmt
+ unique int id: @fail_stmt
+);
+
+fallthrough_stmts( //dir=stmt
+ unique int id: @fallthrough_stmt,
+ int fallthrough_source: @case_stmt_or_none ref,
+ int fallthrough_dest: @case_stmt_or_none ref
+);
+
+@labeled_stmt =
+ @do_catch_stmt
+| @do_stmt
+| @for_each_stmt
+| @labeled_conditional_stmt
+| @repeat_while_stmt
+| @switch_stmt
+;
+
+#keyset[id]
+labeled_stmt_labels( //dir=stmt
+ int id: @labeled_stmt ref,
+ string label: string ref
+);
+
+pound_assert_stmts( //dir=stmt
+ unique int id: @pound_assert_stmt,
+ int condition: @expr_or_none ref,
+ string message: string ref
+);
+
+return_stmts( //dir=stmt
+ unique int id: @return_stmt
+);
+
+#keyset[id]
+return_stmt_results( //dir=stmt
+ int id: @return_stmt ref,
+ int result: @expr_or_none ref
+);
+
+then_stmts( //dir=stmt
+ unique int id: @then_stmt,
+ int result: @expr_or_none ref
+);
+
+throw_stmts( //dir=stmt
+ unique int id: @throw_stmt,
+ int sub_expr: @expr_or_none ref
+);
+
+yield_stmts( //dir=stmt
+ unique int id: @yield_stmt
+);
+
+#keyset[id, index]
+yield_stmt_results( //dir=stmt
+ int id: @yield_stmt ref,
+ int index: int ref,
+ int result: @expr_or_none ref
+);
+
+do_catch_stmts( //dir=stmt
+ unique int id: @do_catch_stmt,
+ int body: @stmt_or_none ref
+);
+
+#keyset[id, index]
+do_catch_stmt_catches( //dir=stmt
+ int id: @do_catch_stmt ref,
+ int index: int ref,
+ int catch: @case_stmt_or_none ref
+);
+
+do_stmts( //dir=stmt
+ unique int id: @do_stmt,
+ int body: @brace_stmt_or_none ref
+);
+
+for_each_stmts( //dir=stmt
+ unique int id: @for_each_stmt,
+ int pattern: @pattern_or_none ref,
+ int body: @brace_stmt_or_none ref
+);
+
+#keyset[id, index]
+for_each_stmt_variables( //dir=stmt
+ int id: @for_each_stmt ref,
+ int index: int ref,
+ int variable: @var_decl_or_none ref
+);
+
+#keyset[id]
+for_each_stmt_wheres( //dir=stmt
+ int id: @for_each_stmt ref,
+ int where: @expr_or_none ref
+);
+
+#keyset[id]
+for_each_stmt_iterator_vars( //dir=stmt
+ int id: @for_each_stmt ref,
+ int iteratorVar: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+for_each_stmt_next_calls( //dir=stmt
+ int id: @for_each_stmt ref,
+ int nextCall: @expr_or_none ref
+);
+
+@labeled_conditional_stmt =
+ @guard_stmt
+| @if_stmt
+| @while_stmt
+;
+
+#keyset[id]
+labeled_conditional_stmts( //dir=stmt
+ int id: @labeled_conditional_stmt ref,
+ int condition: @stmt_condition_or_none ref
+);
+
+repeat_while_stmts( //dir=stmt
+ unique int id: @repeat_while_stmt,
+ int condition: @expr_or_none ref,
+ int body: @stmt_or_none ref
+);
+
+switch_stmts( //dir=stmt
+ unique int id: @switch_stmt,
+ int expr: @expr_or_none ref
+);
+
+#keyset[id, index]
+switch_stmt_cases( //dir=stmt
+ int id: @switch_stmt ref,
+ int index: int ref,
+ int case_: @case_stmt_or_none ref
+);
+
+guard_stmts( //dir=stmt
+ unique int id: @guard_stmt,
+ int body: @brace_stmt_or_none ref
+);
+
+if_stmts( //dir=stmt
+ unique int id: @if_stmt,
+ int then: @stmt_or_none ref
+);
+
+#keyset[id]
+if_stmt_elses( //dir=stmt
+ int id: @if_stmt ref,
+ int else: @stmt_or_none ref
+);
+
+while_stmts( //dir=stmt
+ unique int id: @while_stmt,
+ int body: @stmt_or_none ref
+);
+
+@type =
+ @any_function_type
+| @any_generic_type
+| @any_metatype_type
+| @builtin_type
+| @dependent_member_type
+| @dynamic_self_type
+| @error_type
+| @existential_type
+| @in_out_type
+| @integer_type
+| @l_value_type
+| @module_type
+| @pack_element_type
+| @pack_expansion_type
+| @pack_type
+| @parameterized_protocol_type
+| @protocol_composition_type
+| @reference_storage_type
+| @substitutable_type
+| @sugar_type
+| @tuple_type
+| @unresolved_type
+;
+
+#keyset[id]
+types( //dir=type
+ int id: @type ref,
+ string name: string ref,
+ int canonical_type: @type_or_none ref
+);
+
+type_reprs( //dir=type
+ unique int id: @type_repr,
+ int type_: @type_or_none ref
+);
+
+@any_function_type =
+ @function_type
+| @generic_function_type
+;
+
+#keyset[id]
+any_function_types( //dir=type
+ int id: @any_function_type ref,
+ int result: @type_or_none ref
+);
+
+#keyset[id, index]
+any_function_type_param_types( //dir=type
+ int id: @any_function_type ref,
+ int index: int ref,
+ int param_type: @type_or_none ref
+);
+
+#keyset[id]
+any_function_type_is_throwing( //dir=type
+ int id: @any_function_type ref
+);
+
+#keyset[id]
+any_function_type_is_async( //dir=type
+ int id: @any_function_type ref
+);
+
+@any_generic_type =
+ @nominal_or_bound_generic_nominal_type
+| @unbound_generic_type
+;
+
+#keyset[id]
+any_generic_types( //dir=type
+ int id: @any_generic_type ref,
+ int declaration: @generic_type_decl_or_none ref
+);
+
+#keyset[id]
+any_generic_type_parents( //dir=type
+ int id: @any_generic_type ref,
+ int parent: @type_or_none ref
+);
+
+@any_metatype_type =
+ @existential_metatype_type
+| @metatype_type
+;
+
+@builtin_type =
+ @any_builtin_integer_type
+| @builtin_bridge_object_type
+| @builtin_default_actor_storage_type
+| @builtin_executor_type
+| @builtin_float_type
+| @builtin_generic_type
+| @builtin_job_type
+| @builtin_native_object_type
+| @builtin_raw_pointer_type
+| @builtin_raw_unsafe_continuation_type
+| @builtin_unsafe_value_buffer_type
+| @builtin_vector_type
+;
+
+dependent_member_types( //dir=type
+ unique int id: @dependent_member_type,
+ int base_type: @type_or_none ref,
+ int associated_type_decl: @associated_type_decl_or_none ref
+);
+
+dynamic_self_types( //dir=type
+ unique int id: @dynamic_self_type,
+ int static_self_type: @type_or_none ref
+);
+
+error_types( //dir=type
+ unique int id: @error_type
+);
+
+existential_types( //dir=type
+ unique int id: @existential_type,
+ int constraint: @type_or_none ref
+);
+
+in_out_types( //dir=type
+ unique int id: @in_out_type,
+ int object_type: @type_or_none ref
+);
+
+integer_types( //dir=type
+ unique int id: @integer_type,
+ string value: string ref
+);
+
+l_value_types( //dir=type
+ unique int id: @l_value_type,
+ int object_type: @type_or_none ref
+);
+
+module_types( //dir=type
+ unique int id: @module_type,
+ int module: @module_decl_or_none ref
+);
+
+pack_element_types( //dir=type
+ unique int id: @pack_element_type,
+ int pack_type: @type_or_none ref
+);
+
+pack_expansion_types( //dir=type
+ unique int id: @pack_expansion_type,
+ int pattern_type: @type_or_none ref,
+ int count_type: @type_or_none ref
+);
+
+pack_types( //dir=type
+ unique int id: @pack_type
+);
+
+#keyset[id, index]
+pack_type_elements( //dir=type
+ int id: @pack_type ref,
+ int index: int ref,
+ int element: @type_or_none ref
+);
+
+parameterized_protocol_types( //dir=type
+ unique int id: @parameterized_protocol_type,
+ int base: @protocol_type_or_none ref
+);
+
+#keyset[id, index]
+parameterized_protocol_type_args( //dir=type
+ int id: @parameterized_protocol_type ref,
+ int index: int ref,
+ int arg: @type_or_none ref
+);
+
+protocol_composition_types( //dir=type
+ unique int id: @protocol_composition_type
+);
+
+#keyset[id, index]
+protocol_composition_type_members( //dir=type
+ int id: @protocol_composition_type ref,
+ int index: int ref,
+ int member: @type_or_none ref
+);
+
+@reference_storage_type =
+ @unmanaged_storage_type
+| @unowned_storage_type
+| @weak_storage_type
+;
+
+#keyset[id]
+reference_storage_types( //dir=type
+ int id: @reference_storage_type ref,
+ int referent_type: @type_or_none ref
+);
+
+@substitutable_type =
+ @archetype_type
+| @generic_type_param_type
+;
+
+@sugar_type =
+ @paren_type
+| @syntax_sugar_type
+| @type_alias_type
+;
+
+tuple_types( //dir=type
+ unique int id: @tuple_type
+);
+
+#keyset[id, index]
+tuple_type_types( //dir=type
+ int id: @tuple_type ref,
+ int index: int ref,
+ int type_: @type_or_none ref
+);
+
+#keyset[id, index]
+tuple_type_names( //dir=type
+ int id: @tuple_type ref,
+ int index: int ref,
+ string name: string ref
+);
+
+unresolved_types( //dir=type
+ unique int id: @unresolved_type
+);
+
+@any_builtin_integer_type =
+ @builtin_integer_literal_type
+| @builtin_integer_type
+;
+
+@archetype_type =
+ @local_archetype_type
+| @opaque_type_archetype_type
+| @pack_archetype_type
+| @primary_archetype_type
+;
+
+#keyset[id]
+archetype_types( //dir=type
+ int id: @archetype_type ref,
+ int interface_type: @type_or_none ref
+);
+
+#keyset[id]
+archetype_type_superclasses( //dir=type
+ int id: @archetype_type ref,
+ int superclass: @type_or_none ref
+);
+
+#keyset[id, index]
+archetype_type_protocols( //dir=type
+ int id: @archetype_type ref,
+ int index: int ref,
+ int protocol: @protocol_decl_or_none ref
+);
+
+builtin_bridge_object_types( //dir=type
+ unique int id: @builtin_bridge_object_type
+);
+
+builtin_default_actor_storage_types( //dir=type
+ unique int id: @builtin_default_actor_storage_type
+);
+
+builtin_executor_types( //dir=type
+ unique int id: @builtin_executor_type
+);
+
+builtin_float_types( //dir=type
+ unique int id: @builtin_float_type
+);
+
+@builtin_generic_type =
+ @builtin_fixed_array_type
+;
+
+builtin_job_types( //dir=type
+ unique int id: @builtin_job_type
+);
+
+builtin_native_object_types( //dir=type
+ unique int id: @builtin_native_object_type
+);
+
+builtin_raw_pointer_types( //dir=type
+ unique int id: @builtin_raw_pointer_type
+);
+
+builtin_raw_unsafe_continuation_types( //dir=type
+ unique int id: @builtin_raw_unsafe_continuation_type
+);
+
+builtin_unsafe_value_buffer_types( //dir=type
+ unique int id: @builtin_unsafe_value_buffer_type
+);
+
+builtin_vector_types( //dir=type
+ unique int id: @builtin_vector_type
+);
+
+existential_metatype_types( //dir=type
+ unique int id: @existential_metatype_type
+);
+
+function_types( //dir=type
+ unique int id: @function_type
+);
+
+generic_function_types( //dir=type
+ unique int id: @generic_function_type
+);
+
+#keyset[id, index]
+generic_function_type_generic_params( //dir=type
+ int id: @generic_function_type ref,
+ int index: int ref,
+ int generic_param: @generic_type_param_type_or_none ref
+);
+
+generic_type_param_types( //dir=type
+ unique int id: @generic_type_param_type
+);
+
+metatype_types( //dir=type
+ unique int id: @metatype_type
+);
+
+@nominal_or_bound_generic_nominal_type =
+ @bound_generic_type
+| @nominal_type
+;
+
+paren_types( //dir=type
+ unique int id: @paren_type,
+ int type_: @type_or_none ref
+);
+
+@syntax_sugar_type =
+ @dictionary_type
+| @inline_array_type
+| @unary_syntax_sugar_type
+;
+
+type_alias_types( //dir=type
+ unique int id: @type_alias_type,
+ int decl: @type_alias_decl_or_none ref
+);
+
+unbound_generic_types( //dir=type
+ unique int id: @unbound_generic_type
+);
+
+unmanaged_storage_types( //dir=type
+ unique int id: @unmanaged_storage_type
+);
+
+unowned_storage_types( //dir=type
+ unique int id: @unowned_storage_type
+);
+
+weak_storage_types( //dir=type
+ unique int id: @weak_storage_type
+);
+
+@bound_generic_type =
+ @bound_generic_class_type
+| @bound_generic_enum_type
+| @bound_generic_struct_type
+;
+
+#keyset[id, index]
+bound_generic_type_arg_types( //dir=type
+ int id: @bound_generic_type ref,
+ int index: int ref,
+ int arg_type: @type_or_none ref
+);
+
+builtin_fixed_array_types( //dir=type
+ unique int id: @builtin_fixed_array_type,
+ int size: @type_or_none ref,
+ int element_type: @type_or_none ref
+);
+
+builtin_integer_literal_types( //dir=type
+ unique int id: @builtin_integer_literal_type
+);
+
+builtin_integer_types( //dir=type
+ unique int id: @builtin_integer_type
+);
+
+#keyset[id]
+builtin_integer_type_widths( //dir=type
+ int id: @builtin_integer_type ref,
+ int width: int ref
+);
+
+dictionary_types( //dir=type
+ unique int id: @dictionary_type,
+ int key_type: @type_or_none ref,
+ int value_type: @type_or_none ref
+);
+
+inline_array_types( //dir=type
+ unique int id: @inline_array_type,
+ int count_type: @type_or_none ref,
+ int element_type: @type_or_none ref
+);
+
+@local_archetype_type =
+ @element_archetype_type
+| @existential_archetype_type
+;
+
+@nominal_type =
+ @class_type
+| @enum_type
+| @protocol_type
+| @struct_type
+;
+
+opaque_type_archetype_types( //dir=type
+ unique int id: @opaque_type_archetype_type,
+ int declaration: @opaque_type_decl_or_none ref
+);
+
+pack_archetype_types( //dir=type
+ unique int id: @pack_archetype_type
+);
+
+primary_archetype_types( //dir=type
+ unique int id: @primary_archetype_type
+);
+
+@unary_syntax_sugar_type =
+ @array_slice_type
+| @optional_type
+| @variadic_sequence_type
+;
+
+#keyset[id]
+unary_syntax_sugar_types( //dir=type
+ int id: @unary_syntax_sugar_type ref,
+ int base_type: @type_or_none ref
+);
+
+array_slice_types( //dir=type
+ unique int id: @array_slice_type
+);
+
+bound_generic_class_types( //dir=type
+ unique int id: @bound_generic_class_type
+);
+
+bound_generic_enum_types( //dir=type
+ unique int id: @bound_generic_enum_type
+);
+
+bound_generic_struct_types( //dir=type
+ unique int id: @bound_generic_struct_type
+);
+
+class_types( //dir=type
+ unique int id: @class_type
+);
+
+element_archetype_types( //dir=type
+ unique int id: @element_archetype_type
+);
+
+enum_types( //dir=type
+ unique int id: @enum_type
+);
+
+existential_archetype_types( //dir=type
+ unique int id: @existential_archetype_type
+);
+
+optional_types( //dir=type
+ unique int id: @optional_type
+);
+
+protocol_types( //dir=type
+ unique int id: @protocol_type
+);
+
+struct_types( //dir=type
+ unique int id: @struct_type
+);
+
+variadic_sequence_types( //dir=type
+ unique int id: @variadic_sequence_type
+);
+
+@accessor_or_none =
+ @accessor
+| @unspecified_element
+;
+
+@argument_or_none =
+ @argument
+| @unspecified_element
+;
+
+@associated_type_decl_or_none =
+ @associated_type_decl
+| @unspecified_element
+;
+
+@ast_node_or_none =
+ @ast_node
+| @unspecified_element
+;
+
+@availability_info_or_none =
+ @availability_info
+| @unspecified_element
+;
+
+@availability_spec_or_none =
+ @availability_spec
+| @unspecified_element
+;
+
+@brace_stmt_or_none =
+ @brace_stmt
+| @unspecified_element
+;
+
+@captured_decl_or_none =
+ @captured_decl
+| @unspecified_element
+;
+
+@case_label_item_or_none =
+ @case_label_item
+| @unspecified_element
+;
+
+@case_stmt_or_none =
+ @case_stmt
+| @unspecified_element
+;
+
+@closure_expr_or_none =
+ @closure_expr
+| @unspecified_element
+;
+
+@condition_element_or_none =
+ @condition_element
+| @unspecified_element
+;
+
+@decl_or_none =
+ @decl
+| @unspecified_element
+;
+
+@enum_element_decl_or_none =
+ @enum_element_decl
+| @unspecified_element
+;
+
+@expr_or_none =
+ @expr
+| @unspecified_element
+;
+
+@file_or_none =
+ @file
+| @unspecified_element
+;
+
+@function_or_none =
+ @function
+| @unspecified_element
+;
+
+@generic_type_decl_or_none =
+ @generic_type_decl
+| @unspecified_element
+;
+
+@generic_type_param_decl_or_none =
+ @generic_type_param_decl
+| @unspecified_element
+;
+
+@generic_type_param_type_or_none =
+ @generic_type_param_type
+| @unspecified_element
+;
+
+@initializer_or_none =
+ @initializer
+| @unspecified_element
+;
+
+@key_path_component_or_none =
+ @key_path_component
+| @unspecified_element
+;
+
+@location_or_none =
+ @location
+| @unspecified_element
+;
+
+@macro_role_or_none =
+ @macro_role
+| @unspecified_element
+;
+
+@module_decl_or_none =
+ @module_decl
+| @unspecified_element
+;
+
+@nominal_type_decl_or_none =
+ @nominal_type_decl
+| @unspecified_element
+;
+
+@opaque_type_decl_or_none =
+ @opaque_type_decl
+| @unspecified_element
+;
+
+@opaque_value_expr_or_none =
+ @opaque_value_expr
+| @unspecified_element
+;
+
+@param_decl_or_none =
+ @param_decl
+| @unspecified_element
+;
+
+@pattern_or_none =
+ @pattern
+| @unspecified_element
+;
+
+@pattern_binding_decl_or_none =
+ @pattern_binding_decl
+| @unspecified_element
+;
+
+@precedence_group_decl_or_none =
+ @precedence_group_decl
+| @unspecified_element
+;
+
+@protocol_decl_or_none =
+ @protocol_decl
+| @unspecified_element
+;
+
+@protocol_type_or_none =
+ @protocol_type
+| @unspecified_element
+;
+
+@stmt_or_none =
+ @stmt
+| @unspecified_element
+;
+
+@stmt_condition_or_none =
+ @stmt_condition
+| @unspecified_element
+;
+
+@string_literal_expr_or_none =
+ @string_literal_expr
+| @unspecified_element
+;
+
+@tap_expr_or_none =
+ @tap_expr
+| @unspecified_element
+;
+
+@type_or_none =
+ @type
+| @unspecified_element
+;
+
+@type_alias_decl_or_none =
+ @type_alias_decl
+| @unspecified_element
+;
+
+@type_repr_or_none =
+ @type_repr
+| @unspecified_element
+;
+
+@value_decl_or_none =
+ @unspecified_element
+| @value_decl
+;
+
+@var_decl_or_none =
+ @unspecified_element
+| @var_decl
+;
diff --git a/swift/downgrades/1bb163e31d206f30146738adcd93def10fdabefa/swift.dbscheme b/swift/downgrades/1bb163e31d206f30146738adcd93def10fdabefa/swift.dbscheme
new file mode 100644
index 000000000000..5738be6bb047
--- /dev/null
+++ b/swift/downgrades/1bb163e31d206f30146738adcd93def10fdabefa/swift.dbscheme
@@ -0,0 +1,2891 @@
+// generated by codegen/codegen.py, do not edit
+
+// from prefix.dbscheme
+/**
+ * The source location of the snapshot.
+ */
+sourceLocationPrefix(
+ string prefix: string ref
+);
+
+
+// from schema.py
+
+@element =
+ @file
+| @generic_context
+| @locatable
+| @location
+| @type
+;
+
+#keyset[id]
+element_is_unknown(
+ int id: @element ref
+);
+
+@file =
+ @db_file
+;
+
+#keyset[id]
+files(
+ int id: @file ref,
+ string name: string ref
+);
+
+#keyset[id]
+file_is_successfully_extracted(
+ int id: @file ref
+);
+
+@locatable =
+ @argument
+| @ast_node
+| @comment
+| @diagnostics
+| @error_element
+;
+
+#keyset[id]
+locatable_locations(
+ int id: @locatable ref,
+ int location: @location_or_none ref
+);
+
+@location =
+ @db_location
+;
+
+#keyset[id]
+locations(
+ int id: @location ref,
+ int file: @file_or_none ref,
+ int start_line: int ref,
+ int start_column: int ref,
+ int end_line: int ref,
+ int end_column: int ref
+);
+
+@ast_node =
+ @availability_info
+| @availability_spec
+| @callable
+| @case_label_item
+| @condition_element
+| @decl
+| @expr
+| @key_path_component
+| @macro_role
+| @pattern
+| @stmt
+| @stmt_condition
+| @type_repr
+;
+
+comments(
+ unique int id: @comment,
+ string text: string ref
+);
+
+db_files(
+ unique int id: @db_file
+);
+
+db_locations(
+ unique int id: @db_location
+);
+
+diagnostics(
+ unique int id: @diagnostics,
+ string text: string ref,
+ int kind: int ref
+);
+
+@error_element =
+ @error_expr
+| @error_type
+| @overloaded_decl_ref_expr
+| @unresolved_decl_ref_expr
+| @unresolved_dot_expr
+| @unresolved_member_chain_result_expr
+| @unresolved_member_expr
+| @unresolved_pattern_expr
+| @unresolved_specialize_expr
+| @unresolved_type
+| @unresolved_type_conversion_expr
+| @unspecified_element
+;
+
+availability_infos(
+ unique int id: @availability_info
+);
+
+#keyset[id]
+availability_info_is_unavailable(
+ int id: @availability_info ref
+);
+
+#keyset[id, index]
+availability_info_specs(
+ int id: @availability_info ref,
+ int index: int ref,
+ int spec: @availability_spec_or_none ref
+);
+
+availability_specs(
+ unique int id: @availability_spec
+);
+
+#keyset[id]
+availability_spec_platforms(
+ int id: @availability_spec ref,
+ string platform: string ref
+);
+
+#keyset[id]
+availability_spec_versions(
+ int id: @availability_spec ref,
+ string version: string ref
+);
+
+#keyset[id]
+availability_spec_is_wildcard(
+ int id: @availability_spec ref
+);
+
+@callable =
+ @closure_expr
+| @function
+;
+
+#keyset[id]
+callable_names(
+ int id: @callable ref,
+ string name: string ref
+);
+
+#keyset[id]
+callable_self_params(
+ int id: @callable ref,
+ int self_param: @param_decl_or_none ref
+);
+
+#keyset[id, index]
+callable_params(
+ int id: @callable ref,
+ int index: int ref,
+ int param: @param_decl_or_none ref
+);
+
+#keyset[id]
+callable_bodies(
+ int id: @callable ref,
+ int body: @brace_stmt_or_none ref
+);
+
+#keyset[id, index]
+callable_captures(
+ int id: @callable ref,
+ int index: int ref,
+ int capture: @captured_decl_or_none ref
+);
+
+key_path_components(
+ unique int id: @key_path_component,
+ int kind: int ref,
+ int component_type: @type_or_none ref
+);
+
+#keyset[id, index]
+key_path_component_subscript_arguments(
+ int id: @key_path_component ref,
+ int index: int ref,
+ int subscript_argument: @argument_or_none ref
+);
+
+#keyset[id]
+key_path_component_tuple_indices(
+ int id: @key_path_component ref,
+ int tuple_index: int ref
+);
+
+#keyset[id]
+key_path_component_decl_refs(
+ int id: @key_path_component ref,
+ int decl_ref: @value_decl_or_none ref
+);
+
+macro_roles(
+ unique int id: @macro_role,
+ int kind: int ref,
+ int macro_syntax: int ref
+);
+
+#keyset[id, index]
+macro_role_conformances(
+ int id: @macro_role ref,
+ int index: int ref,
+ int conformance: @expr_or_none ref
+);
+
+#keyset[id, index]
+macro_role_names(
+ int id: @macro_role ref,
+ int index: int ref,
+ string name: string ref
+);
+
+unspecified_elements(
+ unique int id: @unspecified_element,
+ string property: string ref,
+ string error: string ref
+);
+
+#keyset[id]
+unspecified_element_parents(
+ int id: @unspecified_element ref,
+ int parent: @element ref
+);
+
+#keyset[id]
+unspecified_element_indices(
+ int id: @unspecified_element ref,
+ int index: int ref
+);
+
+#keyset[id, index]
+unspecified_element_children(
+ int id: @unspecified_element ref,
+ int index: int ref,
+ int child: @ast_node_or_none ref
+);
+
+@decl =
+ @captured_decl
+| @enum_case_decl
+| @extension_decl
+| @if_config_decl
+| @import_decl
+| @missing_member_decl
+| @operator_decl
+| @pattern_binding_decl
+| @pound_diagnostic_decl
+| @precedence_group_decl
+| @top_level_code_decl
+| @using_decl
+| @value_decl
+;
+
+#keyset[id]
+decls( //dir=decl
+ int id: @decl ref,
+ int module: @module_decl_or_none ref
+);
+
+#keyset[id, index]
+decl_members( //dir=decl
+ int id: @decl ref,
+ int index: int ref,
+ int member: @decl_or_none ref
+);
+
+@generic_context =
+ @extension_decl
+| @function
+| @generic_type_decl
+| @macro_decl
+| @subscript_decl
+;
+
+#keyset[id, index]
+generic_context_generic_type_params( //dir=decl
+ int id: @generic_context ref,
+ int index: int ref,
+ int generic_type_param: @generic_type_param_decl_or_none ref
+);
+
+captured_decls( //dir=decl
+ unique int id: @captured_decl,
+ int decl: @value_decl_or_none ref
+);
+
+#keyset[id]
+captured_decl_is_direct( //dir=decl
+ int id: @captured_decl ref
+);
+
+#keyset[id]
+captured_decl_is_escaping( //dir=decl
+ int id: @captured_decl ref
+);
+
+enum_case_decls( //dir=decl
+ unique int id: @enum_case_decl
+);
+
+#keyset[id, index]
+enum_case_decl_elements( //dir=decl
+ int id: @enum_case_decl ref,
+ int index: int ref,
+ int element: @enum_element_decl_or_none ref
+);
+
+extension_decls( //dir=decl
+ unique int id: @extension_decl,
+ int extended_type_decl: @nominal_type_decl_or_none ref
+);
+
+#keyset[id, index]
+extension_decl_protocols( //dir=decl
+ int id: @extension_decl ref,
+ int index: int ref,
+ int protocol: @protocol_decl_or_none ref
+);
+
+if_config_decls( //dir=decl
+ unique int id: @if_config_decl
+);
+
+#keyset[id, index]
+if_config_decl_active_elements( //dir=decl
+ int id: @if_config_decl ref,
+ int index: int ref,
+ int active_element: @ast_node_or_none ref
+);
+
+import_decls( //dir=decl
+ unique int id: @import_decl
+);
+
+#keyset[id]
+import_decl_is_exported( //dir=decl
+ int id: @import_decl ref
+);
+
+#keyset[id]
+import_decl_imported_modules( //dir=decl
+ int id: @import_decl ref,
+ int imported_module: @module_decl_or_none ref
+);
+
+#keyset[id, index]
+import_decl_declarations( //dir=decl
+ int id: @import_decl ref,
+ int index: int ref,
+ int declaration: @value_decl_or_none ref
+);
+
+missing_member_decls( //dir=decl
+ unique int id: @missing_member_decl,
+ string name: string ref
+);
+
+@operator_decl =
+ @infix_operator_decl
+| @postfix_operator_decl
+| @prefix_operator_decl
+;
+
+#keyset[id]
+operator_decls( //dir=decl
+ int id: @operator_decl ref,
+ string name: string ref
+);
+
+pattern_binding_decls( //dir=decl
+ unique int id: @pattern_binding_decl
+);
+
+#keyset[id, index]
+pattern_binding_decl_inits( //dir=decl
+ int id: @pattern_binding_decl ref,
+ int index: int ref,
+ int init: @expr_or_none ref
+);
+
+#keyset[id, index]
+pattern_binding_decl_patterns( //dir=decl
+ int id: @pattern_binding_decl ref,
+ int index: int ref,
+ int pattern: @pattern_or_none ref
+);
+
+pound_diagnostic_decls( //dir=decl
+ unique int id: @pound_diagnostic_decl,
+ int kind: int ref,
+ int message: @string_literal_expr_or_none ref
+);
+
+precedence_group_decls( //dir=decl
+ unique int id: @precedence_group_decl
+);
+
+top_level_code_decls( //dir=decl
+ unique int id: @top_level_code_decl,
+ int body: @brace_stmt_or_none ref
+);
+
+using_decls( //dir=decl
+ unique int id: @using_decl
+);
+
+#keyset[id]
+using_decl_is_main_actor( //dir=decl
+ int id: @using_decl ref
+);
+
+#keyset[id]
+using_decl_is_nonisolated( //dir=decl
+ int id: @using_decl ref
+);
+
+@value_decl =
+ @abstract_storage_decl
+| @enum_element_decl
+| @function
+| @macro_decl
+| @type_decl
+;
+
+#keyset[id]
+value_decls( //dir=decl
+ int id: @value_decl ref,
+ int interface_type: @type_or_none ref
+);
+
+@abstract_storage_decl =
+ @subscript_decl
+| @var_decl
+;
+
+#keyset[id, index]
+abstract_storage_decl_accessors( //dir=decl
+ int id: @abstract_storage_decl ref,
+ int index: int ref,
+ int accessor: @accessor_or_none ref
+);
+
+enum_element_decls( //dir=decl
+ unique int id: @enum_element_decl,
+ string name: string ref
+);
+
+#keyset[id, index]
+enum_element_decl_params( //dir=decl
+ int id: @enum_element_decl ref,
+ int index: int ref,
+ int param: @param_decl_or_none ref
+);
+
+@function =
+ @accessor_or_named_function
+| @deinitializer
+| @initializer
+;
+
+infix_operator_decls( //dir=decl
+ unique int id: @infix_operator_decl
+);
+
+#keyset[id]
+infix_operator_decl_precedence_groups( //dir=decl
+ int id: @infix_operator_decl ref,
+ int precedence_group: @precedence_group_decl_or_none ref
+);
+
+macro_decls( //dir=decl
+ unique int id: @macro_decl,
+ string name: string ref
+);
+
+#keyset[id, index]
+macro_decl_parameters( //dir=decl
+ int id: @macro_decl ref,
+ int index: int ref,
+ int parameter: @param_decl_or_none ref
+);
+
+#keyset[id, index]
+macro_decl_roles( //dir=decl
+ int id: @macro_decl ref,
+ int index: int ref,
+ int role: @macro_role_or_none ref
+);
+
+postfix_operator_decls( //dir=decl
+ unique int id: @postfix_operator_decl
+);
+
+prefix_operator_decls( //dir=decl
+ unique int id: @prefix_operator_decl
+);
+
+@type_decl =
+ @abstract_type_param_decl
+| @generic_type_decl
+| @module_decl
+;
+
+#keyset[id]
+type_decls( //dir=decl
+ int id: @type_decl ref,
+ string name: string ref
+);
+
+#keyset[id, index]
+type_decl_inherited_types( //dir=decl
+ int id: @type_decl ref,
+ int index: int ref,
+ int inherited_type: @type_or_none ref
+);
+
+@abstract_type_param_decl =
+ @associated_type_decl
+| @generic_type_param_decl
+;
+
+@accessor_or_named_function =
+ @accessor
+| @named_function
+;
+
+deinitializers( //dir=decl
+ unique int id: @deinitializer
+);
+
+@generic_type_decl =
+ @nominal_type_decl
+| @opaque_type_decl
+| @type_alias_decl
+;
+
+initializers( //dir=decl
+ unique int id: @initializer
+);
+
+module_decls( //dir=decl
+ unique int id: @module_decl
+);
+
+#keyset[id]
+module_decl_is_builtin_module( //dir=decl
+ int id: @module_decl ref
+);
+
+#keyset[id]
+module_decl_is_system_module( //dir=decl
+ int id: @module_decl ref
+);
+
+module_decl_imported_modules( //dir=decl
+ int id: @module_decl ref,
+ int imported_module: @module_decl_or_none ref
+);
+
+module_decl_exported_modules( //dir=decl
+ int id: @module_decl ref,
+ int exported_module: @module_decl_or_none ref
+);
+
+subscript_decls( //dir=decl
+ unique int id: @subscript_decl,
+ int element_type: @type_or_none ref
+);
+
+#keyset[id, index]
+subscript_decl_params( //dir=decl
+ int id: @subscript_decl ref,
+ int index: int ref,
+ int param: @param_decl_or_none ref
+);
+
+@var_decl =
+ @concrete_var_decl
+| @param_decl
+;
+
+#keyset[id]
+var_decls( //dir=decl
+ int id: @var_decl ref,
+ string name: string ref,
+ int type_: @type_or_none ref
+);
+
+#keyset[id]
+var_decl_attached_property_wrapper_types( //dir=decl
+ int id: @var_decl ref,
+ int attached_property_wrapper_type: @type_or_none ref
+);
+
+#keyset[id]
+var_decl_parent_patterns( //dir=decl
+ int id: @var_decl ref,
+ int parent_pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+var_decl_parent_initializers( //dir=decl
+ int id: @var_decl ref,
+ int parent_initializer: @expr_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_backing_var_bindings( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_backing_var_binding: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_backing_vars( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_backing_var: @var_decl_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_projection_var_bindings( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_projection_var_binding: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_projection_vars( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_projection_var: @var_decl_or_none ref
+);
+
+accessors( //dir=decl
+ unique int id: @accessor
+);
+
+#keyset[id]
+accessor_is_getter( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_setter( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_will_set( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_did_set( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_read( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_modify( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_unsafe_address( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_unsafe_mutable_address( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_distributed_get( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_read2( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_modify2( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_init( //dir=decl
+ int id: @accessor ref
+);
+
+associated_type_decls( //dir=decl
+ unique int id: @associated_type_decl
+);
+
+concrete_var_decls( //dir=decl
+ unique int id: @concrete_var_decl,
+ int introducer_int: int ref
+);
+
+generic_type_param_decls( //dir=decl
+ unique int id: @generic_type_param_decl
+);
+
+named_functions( //dir=decl
+ unique int id: @named_function
+);
+
+@nominal_type_decl =
+ @class_decl
+| @enum_decl
+| @protocol_decl
+| @struct_decl
+;
+
+#keyset[id]
+nominal_type_decls( //dir=decl
+ int id: @nominal_type_decl ref,
+ int type_: @type_or_none ref
+);
+
+opaque_type_decls( //dir=decl
+ unique int id: @opaque_type_decl,
+ int naming_declaration: @value_decl_or_none ref
+);
+
+#keyset[id, index]
+opaque_type_decl_opaque_generic_params( //dir=decl
+ int id: @opaque_type_decl ref,
+ int index: int ref,
+ int opaque_generic_param: @generic_type_param_type_or_none ref
+);
+
+param_decls( //dir=decl
+ unique int id: @param_decl
+);
+
+#keyset[id]
+param_decl_is_inout( //dir=decl
+ int id: @param_decl ref
+);
+
+#keyset[id]
+param_decl_property_wrapper_local_wrapped_var_bindings( //dir=decl
+ int id: @param_decl ref,
+ int property_wrapper_local_wrapped_var_binding: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+param_decl_property_wrapper_local_wrapped_vars( //dir=decl
+ int id: @param_decl ref,
+ int property_wrapper_local_wrapped_var: @var_decl_or_none ref
+);
+
+type_alias_decls( //dir=decl
+ unique int id: @type_alias_decl,
+ int aliased_type: @type_or_none ref
+);
+
+class_decls( //dir=decl
+ unique int id: @class_decl
+);
+
+enum_decls( //dir=decl
+ unique int id: @enum_decl
+);
+
+protocol_decls( //dir=decl
+ unique int id: @protocol_decl
+);
+
+struct_decls( //dir=decl
+ unique int id: @struct_decl
+);
+
+arguments( //dir=expr
+ unique int id: @argument,
+ string label: string ref,
+ int expr: @expr_or_none ref
+);
+
+@expr =
+ @any_try_expr
+| @applied_property_wrapper_expr
+| @apply_expr
+| @assign_expr
+| @bind_optional_expr
+| @capture_list_expr
+| @closure_expr
+| @collection_expr
+| @consume_expr
+| @copy_expr
+| @current_context_isolation_expr
+| @decl_ref_expr
+| @default_argument_expr
+| @discard_assignment_expr
+| @dot_syntax_base_ignored_expr
+| @dynamic_type_expr
+| @enum_is_case_expr
+| @error_expr
+| @explicit_cast_expr
+| @extract_function_isolation_expr
+| @force_value_expr
+| @identity_expr
+| @if_expr
+| @implicit_conversion_expr
+| @in_out_expr
+| @key_path_application_expr
+| @key_path_dot_expr
+| @key_path_expr
+| @lazy_initialization_expr
+| @literal_expr
+| @lookup_expr
+| @make_temporarily_escapable_expr
+| @materialize_pack_expr
+| @obj_c_selector_expr
+| @one_way_expr
+| @opaque_value_expr
+| @open_existential_expr
+| @optional_evaluation_expr
+| @other_initializer_ref_expr
+| @overloaded_decl_ref_expr
+| @pack_element_expr
+| @pack_expansion_expr
+| @property_wrapper_value_placeholder_expr
+| @rebind_self_in_initializer_expr
+| @sequence_expr
+| @single_value_stmt_expr
+| @super_ref_expr
+| @tap_expr
+| @tuple_element_expr
+| @tuple_expr
+| @type_expr
+| @type_value_expr
+| @unresolved_decl_ref_expr
+| @unresolved_dot_expr
+| @unresolved_member_expr
+| @unresolved_pattern_expr
+| @unresolved_specialize_expr
+| @vararg_expansion_expr
+;
+
+#keyset[id]
+expr_types( //dir=expr
+ int id: @expr ref,
+ int type_: @type_or_none ref
+);
+
+@any_try_expr =
+ @force_try_expr
+| @optional_try_expr
+| @try_expr
+;
+
+#keyset[id]
+any_try_exprs( //dir=expr
+ int id: @any_try_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+applied_property_wrapper_exprs( //dir=expr
+ unique int id: @applied_property_wrapper_expr,
+ int kind: int ref,
+ int value: @expr_or_none ref,
+ int param: @param_decl_or_none ref
+);
+
+@apply_expr =
+ @binary_expr
+| @call_expr
+| @postfix_unary_expr
+| @prefix_unary_expr
+| @self_apply_expr
+;
+
+#keyset[id]
+apply_exprs( //dir=expr
+ int id: @apply_expr ref,
+ int function: @expr_or_none ref
+);
+
+#keyset[id, index]
+apply_expr_arguments( //dir=expr
+ int id: @apply_expr ref,
+ int index: int ref,
+ int argument: @argument_or_none ref
+);
+
+assign_exprs( //dir=expr
+ unique int id: @assign_expr,
+ int dest: @expr_or_none ref,
+ int source: @expr_or_none ref
+);
+
+bind_optional_exprs( //dir=expr
+ unique int id: @bind_optional_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+capture_list_exprs( //dir=expr
+ unique int id: @capture_list_expr,
+ int closure_body: @closure_expr_or_none ref
+);
+
+#keyset[id, index]
+capture_list_expr_binding_decls( //dir=expr
+ int id: @capture_list_expr ref,
+ int index: int ref,
+ int binding_decl: @pattern_binding_decl_or_none ref
+);
+
+@closure_expr =
+ @auto_closure_expr
+| @explicit_closure_expr
+;
+
+@collection_expr =
+ @array_expr
+| @dictionary_expr
+;
+
+consume_exprs( //dir=expr
+ unique int id: @consume_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+copy_exprs( //dir=expr
+ unique int id: @copy_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+current_context_isolation_exprs( //dir=expr
+ unique int id: @current_context_isolation_expr,
+ int actor: @expr_or_none ref
+);
+
+decl_ref_exprs( //dir=expr
+ unique int id: @decl_ref_expr,
+ int decl: @decl_or_none ref
+);
+
+#keyset[id, index]
+decl_ref_expr_replacement_types( //dir=expr
+ int id: @decl_ref_expr ref,
+ int index: int ref,
+ int replacement_type: @type_or_none ref
+);
+
+#keyset[id]
+decl_ref_expr_has_direct_to_storage_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+#keyset[id]
+decl_ref_expr_has_direct_to_implementation_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+#keyset[id]
+decl_ref_expr_has_ordinary_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+#keyset[id]
+decl_ref_expr_has_distributed_thunk_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+default_argument_exprs( //dir=expr
+ unique int id: @default_argument_expr,
+ int param_decl: @param_decl_or_none ref,
+ int param_index: int ref
+);
+
+#keyset[id]
+default_argument_expr_caller_side_defaults( //dir=expr
+ int id: @default_argument_expr ref,
+ int caller_side_default: @expr_or_none ref
+);
+
+discard_assignment_exprs( //dir=expr
+ unique int id: @discard_assignment_expr
+);
+
+dot_syntax_base_ignored_exprs( //dir=expr
+ unique int id: @dot_syntax_base_ignored_expr,
+ int qualifier: @expr_or_none ref,
+ int sub_expr: @expr_or_none ref
+);
+
+dynamic_type_exprs( //dir=expr
+ unique int id: @dynamic_type_expr,
+ int base: @expr_or_none ref
+);
+
+enum_is_case_exprs( //dir=expr
+ unique int id: @enum_is_case_expr,
+ int sub_expr: @expr_or_none ref,
+ int element: @enum_element_decl_or_none ref
+);
+
+error_exprs( //dir=expr
+ unique int id: @error_expr
+);
+
+@explicit_cast_expr =
+ @checked_cast_expr
+| @coerce_expr
+;
+
+#keyset[id]
+explicit_cast_exprs( //dir=expr
+ int id: @explicit_cast_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+extract_function_isolation_exprs( //dir=expr
+ unique int id: @extract_function_isolation_expr,
+ int function_expr: @expr_or_none ref
+);
+
+force_value_exprs( //dir=expr
+ unique int id: @force_value_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+@identity_expr =
+ @await_expr
+| @borrow_expr
+| @dot_self_expr
+| @paren_expr
+| @unresolved_member_chain_result_expr
+| @unsafe_expr
+;
+
+#keyset[id]
+identity_exprs( //dir=expr
+ int id: @identity_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+if_exprs( //dir=expr
+ unique int id: @if_expr,
+ int condition: @expr_or_none ref,
+ int then_expr: @expr_or_none ref,
+ int else_expr: @expr_or_none ref
+);
+
+@implicit_conversion_expr =
+ @abi_safe_conversion_expr
+| @actor_isolation_erasure_expr
+| @any_hashable_erasure_expr
+| @archetype_to_super_expr
+| @array_to_pointer_expr
+| @bridge_from_obj_c_expr
+| @bridge_to_obj_c_expr
+| @class_metatype_to_object_expr
+| @collection_upcast_conversion_expr
+| @conditional_bridge_from_obj_c_expr
+| @covariant_function_conversion_expr
+| @covariant_return_conversion_expr
+| @derived_to_base_expr
+| @destructure_tuple_expr
+| @differentiable_function_expr
+| @differentiable_function_extract_original_expr
+| @erasure_expr
+| @existential_metatype_to_object_expr
+| @foreign_object_conversion_expr
+| @function_conversion_expr
+| @in_out_to_pointer_expr
+| @inject_into_optional_expr
+| @linear_function_expr
+| @linear_function_extract_original_expr
+| @linear_to_differentiable_function_expr
+| @load_expr
+| @metatype_conversion_expr
+| @pointer_to_pointer_expr
+| @protocol_metatype_to_object_expr
+| @string_to_pointer_expr
+| @underlying_to_opaque_expr
+| @unevaluated_instance_expr
+| @unreachable_expr
+| @unresolved_type_conversion_expr
+| @unsafe_cast_expr
+;
+
+#keyset[id]
+implicit_conversion_exprs( //dir=expr
+ int id: @implicit_conversion_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+in_out_exprs( //dir=expr
+ unique int id: @in_out_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+key_path_application_exprs( //dir=expr
+ unique int id: @key_path_application_expr,
+ int base: @expr_or_none ref,
+ int key_path: @expr_or_none ref
+);
+
+key_path_dot_exprs( //dir=expr
+ unique int id: @key_path_dot_expr
+);
+
+key_path_exprs( //dir=expr
+ unique int id: @key_path_expr
+);
+
+#keyset[id]
+key_path_expr_roots( //dir=expr
+ int id: @key_path_expr ref,
+ int root: @type_repr_or_none ref
+);
+
+#keyset[id, index]
+key_path_expr_components( //dir=expr
+ int id: @key_path_expr ref,
+ int index: int ref,
+ int component: @key_path_component_or_none ref
+);
+
+lazy_initialization_exprs( //dir=expr
+ unique int id: @lazy_initialization_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+@literal_expr =
+ @builtin_literal_expr
+| @interpolated_string_literal_expr
+| @nil_literal_expr
+| @object_literal_expr
+| @regex_literal_expr
+;
+
+@lookup_expr =
+ @dynamic_lookup_expr
+| @member_ref_expr
+| @subscript_expr
+;
+
+#keyset[id]
+lookup_exprs( //dir=expr
+ int id: @lookup_expr ref,
+ int base: @expr_or_none ref
+);
+
+#keyset[id]
+lookup_expr_members( //dir=expr
+ int id: @lookup_expr ref,
+ int member: @decl_or_none ref
+);
+
+make_temporarily_escapable_exprs( //dir=expr
+ unique int id: @make_temporarily_escapable_expr,
+ int escaping_closure: @opaque_value_expr_or_none ref,
+ int nonescaping_closure: @expr_or_none ref,
+ int sub_expr: @expr_or_none ref
+);
+
+materialize_pack_exprs( //dir=expr
+ unique int id: @materialize_pack_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+obj_c_selector_exprs( //dir=expr
+ unique int id: @obj_c_selector_expr,
+ int sub_expr: @expr_or_none ref,
+ int method: @function_or_none ref
+);
+
+one_way_exprs( //dir=expr
+ unique int id: @one_way_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+opaque_value_exprs( //dir=expr
+ unique int id: @opaque_value_expr
+);
+
+open_existential_exprs( //dir=expr
+ unique int id: @open_existential_expr,
+ int sub_expr: @expr_or_none ref,
+ int existential: @expr_or_none ref,
+ int opaque_expr: @opaque_value_expr_or_none ref
+);
+
+optional_evaluation_exprs( //dir=expr
+ unique int id: @optional_evaluation_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+other_initializer_ref_exprs( //dir=expr
+ unique int id: @other_initializer_ref_expr,
+ int initializer: @initializer_or_none ref
+);
+
+overloaded_decl_ref_exprs( //dir=expr
+ unique int id: @overloaded_decl_ref_expr
+);
+
+#keyset[id, index]
+overloaded_decl_ref_expr_possible_declarations( //dir=expr
+ int id: @overloaded_decl_ref_expr ref,
+ int index: int ref,
+ int possible_declaration: @value_decl_or_none ref
+);
+
+pack_element_exprs( //dir=expr
+ unique int id: @pack_element_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+pack_expansion_exprs( //dir=expr
+ unique int id: @pack_expansion_expr,
+ int pattern_expr: @expr_or_none ref
+);
+
+property_wrapper_value_placeholder_exprs( //dir=expr
+ unique int id: @property_wrapper_value_placeholder_expr,
+ int placeholder: @opaque_value_expr_or_none ref
+);
+
+#keyset[id]
+property_wrapper_value_placeholder_expr_wrapped_values( //dir=expr
+ int id: @property_wrapper_value_placeholder_expr ref,
+ int wrapped_value: @expr_or_none ref
+);
+
+rebind_self_in_initializer_exprs( //dir=expr
+ unique int id: @rebind_self_in_initializer_expr,
+ int sub_expr: @expr_or_none ref,
+ int self: @var_decl_or_none ref
+);
+
+sequence_exprs( //dir=expr
+ unique int id: @sequence_expr
+);
+
+#keyset[id, index]
+sequence_expr_elements( //dir=expr
+ int id: @sequence_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+single_value_stmt_exprs( //dir=expr
+ unique int id: @single_value_stmt_expr,
+ int stmt: @stmt_or_none ref
+);
+
+super_ref_exprs( //dir=expr
+ unique int id: @super_ref_expr,
+ int self: @var_decl_or_none ref
+);
+
+tap_exprs( //dir=expr
+ unique int id: @tap_expr,
+ int body: @brace_stmt_or_none ref,
+ int var: @var_decl_or_none ref
+);
+
+#keyset[id]
+tap_expr_sub_exprs( //dir=expr
+ int id: @tap_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+tuple_element_exprs( //dir=expr
+ unique int id: @tuple_element_expr,
+ int sub_expr: @expr_or_none ref,
+ int index: int ref
+);
+
+tuple_exprs( //dir=expr
+ unique int id: @tuple_expr
+);
+
+#keyset[id, index]
+tuple_expr_elements( //dir=expr
+ int id: @tuple_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+type_exprs( //dir=expr
+ unique int id: @type_expr
+);
+
+#keyset[id]
+type_expr_type_reprs( //dir=expr
+ int id: @type_expr ref,
+ int type_repr: @type_repr_or_none ref
+);
+
+type_value_exprs( //dir=expr
+ unique int id: @type_value_expr,
+ int type_repr: @type_repr_or_none ref
+);
+
+unresolved_decl_ref_exprs( //dir=expr
+ unique int id: @unresolved_decl_ref_expr
+);
+
+#keyset[id]
+unresolved_decl_ref_expr_names( //dir=expr
+ int id: @unresolved_decl_ref_expr ref,
+ string name: string ref
+);
+
+unresolved_dot_exprs( //dir=expr
+ unique int id: @unresolved_dot_expr,
+ int base: @expr_or_none ref,
+ string name: string ref
+);
+
+unresolved_member_exprs( //dir=expr
+ unique int id: @unresolved_member_expr,
+ string name: string ref
+);
+
+unresolved_pattern_exprs( //dir=expr
+ unique int id: @unresolved_pattern_expr,
+ int sub_pattern: @pattern_or_none ref
+);
+
+unresolved_specialize_exprs( //dir=expr
+ unique int id: @unresolved_specialize_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+vararg_expansion_exprs( //dir=expr
+ unique int id: @vararg_expansion_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+abi_safe_conversion_exprs( //dir=expr
+ unique int id: @abi_safe_conversion_expr
+);
+
+actor_isolation_erasure_exprs( //dir=expr
+ unique int id: @actor_isolation_erasure_expr
+);
+
+any_hashable_erasure_exprs( //dir=expr
+ unique int id: @any_hashable_erasure_expr
+);
+
+archetype_to_super_exprs( //dir=expr
+ unique int id: @archetype_to_super_expr
+);
+
+array_exprs( //dir=expr
+ unique int id: @array_expr
+);
+
+#keyset[id, index]
+array_expr_elements( //dir=expr
+ int id: @array_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+array_to_pointer_exprs( //dir=expr
+ unique int id: @array_to_pointer_expr
+);
+
+auto_closure_exprs( //dir=expr
+ unique int id: @auto_closure_expr
+);
+
+await_exprs( //dir=expr
+ unique int id: @await_expr
+);
+
+binary_exprs( //dir=expr
+ unique int id: @binary_expr
+);
+
+borrow_exprs( //dir=expr
+ unique int id: @borrow_expr
+);
+
+bridge_from_obj_c_exprs( //dir=expr
+ unique int id: @bridge_from_obj_c_expr
+);
+
+bridge_to_obj_c_exprs( //dir=expr
+ unique int id: @bridge_to_obj_c_expr
+);
+
+@builtin_literal_expr =
+ @boolean_literal_expr
+| @magic_identifier_literal_expr
+| @number_literal_expr
+| @string_literal_expr
+;
+
+call_exprs( //dir=expr
+ unique int id: @call_expr
+);
+
+@checked_cast_expr =
+ @conditional_checked_cast_expr
+| @forced_checked_cast_expr
+| @is_expr
+;
+
+class_metatype_to_object_exprs( //dir=expr
+ unique int id: @class_metatype_to_object_expr
+);
+
+coerce_exprs( //dir=expr
+ unique int id: @coerce_expr
+);
+
+collection_upcast_conversion_exprs( //dir=expr
+ unique int id: @collection_upcast_conversion_expr
+);
+
+conditional_bridge_from_obj_c_exprs( //dir=expr
+ unique int id: @conditional_bridge_from_obj_c_expr
+);
+
+covariant_function_conversion_exprs( //dir=expr
+ unique int id: @covariant_function_conversion_expr
+);
+
+covariant_return_conversion_exprs( //dir=expr
+ unique int id: @covariant_return_conversion_expr
+);
+
+derived_to_base_exprs( //dir=expr
+ unique int id: @derived_to_base_expr
+);
+
+destructure_tuple_exprs( //dir=expr
+ unique int id: @destructure_tuple_expr
+);
+
+dictionary_exprs( //dir=expr
+ unique int id: @dictionary_expr
+);
+
+#keyset[id, index]
+dictionary_expr_elements( //dir=expr
+ int id: @dictionary_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+differentiable_function_exprs( //dir=expr
+ unique int id: @differentiable_function_expr
+);
+
+differentiable_function_extract_original_exprs( //dir=expr
+ unique int id: @differentiable_function_extract_original_expr
+);
+
+dot_self_exprs( //dir=expr
+ unique int id: @dot_self_expr
+);
+
+@dynamic_lookup_expr =
+ @dynamic_member_ref_expr
+| @dynamic_subscript_expr
+;
+
+erasure_exprs( //dir=expr
+ unique int id: @erasure_expr
+);
+
+existential_metatype_to_object_exprs( //dir=expr
+ unique int id: @existential_metatype_to_object_expr
+);
+
+explicit_closure_exprs( //dir=expr
+ unique int id: @explicit_closure_expr
+);
+
+force_try_exprs( //dir=expr
+ unique int id: @force_try_expr
+);
+
+foreign_object_conversion_exprs( //dir=expr
+ unique int id: @foreign_object_conversion_expr
+);
+
+function_conversion_exprs( //dir=expr
+ unique int id: @function_conversion_expr
+);
+
+in_out_to_pointer_exprs( //dir=expr
+ unique int id: @in_out_to_pointer_expr
+);
+
+inject_into_optional_exprs( //dir=expr
+ unique int id: @inject_into_optional_expr
+);
+
+interpolated_string_literal_exprs( //dir=expr
+ unique int id: @interpolated_string_literal_expr
+);
+
+#keyset[id]
+interpolated_string_literal_expr_interpolation_exprs( //dir=expr
+ int id: @interpolated_string_literal_expr ref,
+ int interpolation_expr: @opaque_value_expr_or_none ref
+);
+
+#keyset[id]
+interpolated_string_literal_expr_appending_exprs( //dir=expr
+ int id: @interpolated_string_literal_expr ref,
+ int appending_expr: @tap_expr_or_none ref
+);
+
+linear_function_exprs( //dir=expr
+ unique int id: @linear_function_expr
+);
+
+linear_function_extract_original_exprs( //dir=expr
+ unique int id: @linear_function_extract_original_expr
+);
+
+linear_to_differentiable_function_exprs( //dir=expr
+ unique int id: @linear_to_differentiable_function_expr
+);
+
+load_exprs( //dir=expr
+ unique int id: @load_expr
+);
+
+member_ref_exprs( //dir=expr
+ unique int id: @member_ref_expr
+);
+
+#keyset[id]
+member_ref_expr_has_direct_to_storage_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+#keyset[id]
+member_ref_expr_has_direct_to_implementation_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+#keyset[id]
+member_ref_expr_has_ordinary_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+#keyset[id]
+member_ref_expr_has_distributed_thunk_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+metatype_conversion_exprs( //dir=expr
+ unique int id: @metatype_conversion_expr
+);
+
+nil_literal_exprs( //dir=expr
+ unique int id: @nil_literal_expr
+);
+
+object_literal_exprs( //dir=expr
+ unique int id: @object_literal_expr,
+ int kind: int ref
+);
+
+#keyset[id, index]
+object_literal_expr_arguments( //dir=expr
+ int id: @object_literal_expr ref,
+ int index: int ref,
+ int argument: @argument_or_none ref
+);
+
+optional_try_exprs( //dir=expr
+ unique int id: @optional_try_expr
+);
+
+paren_exprs( //dir=expr
+ unique int id: @paren_expr
+);
+
+pointer_to_pointer_exprs( //dir=expr
+ unique int id: @pointer_to_pointer_expr
+);
+
+postfix_unary_exprs( //dir=expr
+ unique int id: @postfix_unary_expr
+);
+
+prefix_unary_exprs( //dir=expr
+ unique int id: @prefix_unary_expr
+);
+
+protocol_metatype_to_object_exprs( //dir=expr
+ unique int id: @protocol_metatype_to_object_expr
+);
+
+regex_literal_exprs( //dir=expr
+ unique int id: @regex_literal_expr,
+ string pattern: string ref,
+ int version: int ref
+);
+
+@self_apply_expr =
+ @dot_syntax_call_expr
+| @initializer_ref_call_expr
+;
+
+#keyset[id]
+self_apply_exprs( //dir=expr
+ int id: @self_apply_expr ref,
+ int base: @expr_or_none ref
+);
+
+string_to_pointer_exprs( //dir=expr
+ unique int id: @string_to_pointer_expr
+);
+
+subscript_exprs( //dir=expr
+ unique int id: @subscript_expr
+);
+
+#keyset[id, index]
+subscript_expr_arguments( //dir=expr
+ int id: @subscript_expr ref,
+ int index: int ref,
+ int argument: @argument_or_none ref
+);
+
+#keyset[id]
+subscript_expr_has_direct_to_storage_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+#keyset[id]
+subscript_expr_has_direct_to_implementation_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+#keyset[id]
+subscript_expr_has_ordinary_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+#keyset[id]
+subscript_expr_has_distributed_thunk_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+try_exprs( //dir=expr
+ unique int id: @try_expr
+);
+
+underlying_to_opaque_exprs( //dir=expr
+ unique int id: @underlying_to_opaque_expr
+);
+
+unevaluated_instance_exprs( //dir=expr
+ unique int id: @unevaluated_instance_expr
+);
+
+unreachable_exprs( //dir=expr
+ unique int id: @unreachable_expr
+);
+
+unresolved_member_chain_result_exprs( //dir=expr
+ unique int id: @unresolved_member_chain_result_expr
+);
+
+unresolved_type_conversion_exprs( //dir=expr
+ unique int id: @unresolved_type_conversion_expr
+);
+
+unsafe_cast_exprs( //dir=expr
+ unique int id: @unsafe_cast_expr
+);
+
+unsafe_exprs( //dir=expr
+ unique int id: @unsafe_expr
+);
+
+boolean_literal_exprs( //dir=expr
+ unique int id: @boolean_literal_expr,
+ boolean value: boolean ref
+);
+
+conditional_checked_cast_exprs( //dir=expr
+ unique int id: @conditional_checked_cast_expr
+);
+
+dot_syntax_call_exprs( //dir=expr
+ unique int id: @dot_syntax_call_expr
+);
+
+dynamic_member_ref_exprs( //dir=expr
+ unique int id: @dynamic_member_ref_expr
+);
+
+dynamic_subscript_exprs( //dir=expr
+ unique int id: @dynamic_subscript_expr
+);
+
+forced_checked_cast_exprs( //dir=expr
+ unique int id: @forced_checked_cast_expr
+);
+
+initializer_ref_call_exprs( //dir=expr
+ unique int id: @initializer_ref_call_expr
+);
+
+is_exprs( //dir=expr
+ unique int id: @is_expr
+);
+
+magic_identifier_literal_exprs( //dir=expr
+ unique int id: @magic_identifier_literal_expr,
+ string kind: string ref
+);
+
+@number_literal_expr =
+ @float_literal_expr
+| @integer_literal_expr
+;
+
+string_literal_exprs( //dir=expr
+ unique int id: @string_literal_expr,
+ string value: string ref
+);
+
+float_literal_exprs( //dir=expr
+ unique int id: @float_literal_expr,
+ string string_value: string ref
+);
+
+integer_literal_exprs( //dir=expr
+ unique int id: @integer_literal_expr,
+ string string_value: string ref
+);
+
+@pattern =
+ @any_pattern
+| @binding_pattern
+| @bool_pattern
+| @enum_element_pattern
+| @expr_pattern
+| @is_pattern
+| @named_pattern
+| @optional_some_pattern
+| @paren_pattern
+| @tuple_pattern
+| @typed_pattern
+;
+
+#keyset[id]
+pattern_types( //dir=pattern
+ int id: @pattern ref,
+ int type_: @type_or_none ref
+);
+
+any_patterns( //dir=pattern
+ unique int id: @any_pattern
+);
+
+binding_patterns( //dir=pattern
+ unique int id: @binding_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+bool_patterns( //dir=pattern
+ unique int id: @bool_pattern,
+ boolean value: boolean ref
+);
+
+enum_element_patterns( //dir=pattern
+ unique int id: @enum_element_pattern,
+ int element: @enum_element_decl_or_none ref
+);
+
+#keyset[id]
+enum_element_pattern_sub_patterns( //dir=pattern
+ int id: @enum_element_pattern ref,
+ int sub_pattern: @pattern_or_none ref
+);
+
+expr_patterns( //dir=pattern
+ unique int id: @expr_pattern,
+ int sub_expr: @expr_or_none ref
+);
+
+is_patterns( //dir=pattern
+ unique int id: @is_pattern
+);
+
+#keyset[id]
+is_pattern_cast_type_reprs( //dir=pattern
+ int id: @is_pattern ref,
+ int cast_type_repr: @type_repr_or_none ref
+);
+
+#keyset[id]
+is_pattern_sub_patterns( //dir=pattern
+ int id: @is_pattern ref,
+ int sub_pattern: @pattern_or_none ref
+);
+
+named_patterns( //dir=pattern
+ unique int id: @named_pattern,
+ int var_decl: @var_decl_or_none ref
+);
+
+optional_some_patterns( //dir=pattern
+ unique int id: @optional_some_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+paren_patterns( //dir=pattern
+ unique int id: @paren_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+tuple_patterns( //dir=pattern
+ unique int id: @tuple_pattern
+);
+
+#keyset[id, index]
+tuple_pattern_elements( //dir=pattern
+ int id: @tuple_pattern ref,
+ int index: int ref,
+ int element: @pattern_or_none ref
+);
+
+typed_patterns( //dir=pattern
+ unique int id: @typed_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+typed_pattern_type_reprs( //dir=pattern
+ int id: @typed_pattern ref,
+ int type_repr: @type_repr_or_none ref
+);
+
+case_label_items( //dir=stmt
+ unique int id: @case_label_item,
+ int pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+case_label_item_guards( //dir=stmt
+ int id: @case_label_item ref,
+ int guard: @expr_or_none ref
+);
+
+condition_elements( //dir=stmt
+ unique int id: @condition_element
+);
+
+#keyset[id]
+condition_element_booleans( //dir=stmt
+ int id: @condition_element ref,
+ int boolean_: @expr_or_none ref
+);
+
+#keyset[id]
+condition_element_patterns( //dir=stmt
+ int id: @condition_element ref,
+ int pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+condition_element_initializers( //dir=stmt
+ int id: @condition_element ref,
+ int initializer: @expr_or_none ref
+);
+
+#keyset[id]
+condition_element_availabilities( //dir=stmt
+ int id: @condition_element ref,
+ int availability: @availability_info_or_none ref
+);
+
+@stmt =
+ @brace_stmt
+| @break_stmt
+| @case_stmt
+| @continue_stmt
+| @defer_stmt
+| @discard_stmt
+| @fail_stmt
+| @fallthrough_stmt
+| @labeled_stmt
+| @pound_assert_stmt
+| @return_stmt
+| @then_stmt
+| @throw_stmt
+| @yield_stmt
+;
+
+stmt_conditions( //dir=stmt
+ unique int id: @stmt_condition
+);
+
+#keyset[id, index]
+stmt_condition_elements( //dir=stmt
+ int id: @stmt_condition ref,
+ int index: int ref,
+ int element: @condition_element_or_none ref
+);
+
+brace_stmts( //dir=stmt
+ unique int id: @brace_stmt
+);
+
+#keyset[id, index]
+brace_stmt_elements( //dir=stmt
+ int id: @brace_stmt ref,
+ int index: int ref,
+ int element: @ast_node_or_none ref
+);
+
+break_stmts( //dir=stmt
+ unique int id: @break_stmt
+);
+
+#keyset[id]
+break_stmt_target_names( //dir=stmt
+ int id: @break_stmt ref,
+ string target_name: string ref
+);
+
+#keyset[id]
+break_stmt_targets( //dir=stmt
+ int id: @break_stmt ref,
+ int target: @stmt_or_none ref
+);
+
+case_stmts( //dir=stmt
+ unique int id: @case_stmt,
+ int body: @stmt_or_none ref
+);
+
+#keyset[id, index]
+case_stmt_labels( //dir=stmt
+ int id: @case_stmt ref,
+ int index: int ref,
+ int label: @case_label_item_or_none ref
+);
+
+#keyset[id, index]
+case_stmt_variables( //dir=stmt
+ int id: @case_stmt ref,
+ int index: int ref,
+ int variable: @var_decl_or_none ref
+);
+
+continue_stmts( //dir=stmt
+ unique int id: @continue_stmt
+);
+
+#keyset[id]
+continue_stmt_target_names( //dir=stmt
+ int id: @continue_stmt ref,
+ string target_name: string ref
+);
+
+#keyset[id]
+continue_stmt_targets( //dir=stmt
+ int id: @continue_stmt ref,
+ int target: @stmt_or_none ref
+);
+
+defer_stmts( //dir=stmt
+ unique int id: @defer_stmt,
+ int body: @brace_stmt_or_none ref
+);
+
+discard_stmts( //dir=stmt
+ unique int id: @discard_stmt,
+ int sub_expr: @expr_or_none ref
+);
+
+fail_stmts( //dir=stmt
+ unique int id: @fail_stmt
+);
+
+fallthrough_stmts( //dir=stmt
+ unique int id: @fallthrough_stmt,
+ int fallthrough_source: @case_stmt_or_none ref,
+ int fallthrough_dest: @case_stmt_or_none ref
+);
+
+@labeled_stmt =
+ @do_catch_stmt
+| @do_stmt
+| @for_each_stmt
+| @labeled_conditional_stmt
+| @repeat_while_stmt
+| @switch_stmt
+;
+
+#keyset[id]
+labeled_stmt_labels( //dir=stmt
+ int id: @labeled_stmt ref,
+ string label: string ref
+);
+
+pound_assert_stmts( //dir=stmt
+ unique int id: @pound_assert_stmt,
+ int condition: @expr_or_none ref,
+ string message: string ref
+);
+
+return_stmts( //dir=stmt
+ unique int id: @return_stmt
+);
+
+#keyset[id]
+return_stmt_results( //dir=stmt
+ int id: @return_stmt ref,
+ int result: @expr_or_none ref
+);
+
+then_stmts( //dir=stmt
+ unique int id: @then_stmt,
+ int result: @expr_or_none ref
+);
+
+throw_stmts( //dir=stmt
+ unique int id: @throw_stmt,
+ int sub_expr: @expr_or_none ref
+);
+
+yield_stmts( //dir=stmt
+ unique int id: @yield_stmt
+);
+
+#keyset[id, index]
+yield_stmt_results( //dir=stmt
+ int id: @yield_stmt ref,
+ int index: int ref,
+ int result: @expr_or_none ref
+);
+
+do_catch_stmts( //dir=stmt
+ unique int id: @do_catch_stmt,
+ int body: @stmt_or_none ref
+);
+
+#keyset[id, index]
+do_catch_stmt_catches( //dir=stmt
+ int id: @do_catch_stmt ref,
+ int index: int ref,
+ int catch: @case_stmt_or_none ref
+);
+
+do_stmts( //dir=stmt
+ unique int id: @do_stmt,
+ int body: @brace_stmt_or_none ref
+);
+
+for_each_stmts( //dir=stmt
+ unique int id: @for_each_stmt,
+ int pattern: @pattern_or_none ref,
+ int body: @brace_stmt_or_none ref
+);
+
+#keyset[id, index]
+for_each_stmt_variables( //dir=stmt
+ int id: @for_each_stmt ref,
+ int index: int ref,
+ int variable: @var_decl_or_none ref
+);
+
+#keyset[id]
+for_each_stmt_wheres( //dir=stmt
+ int id: @for_each_stmt ref,
+ int where: @expr_or_none ref
+);
+
+#keyset[id]
+for_each_stmt_iterator_vars( //dir=stmt
+ int id: @for_each_stmt ref,
+ int iteratorVar: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+for_each_stmt_next_calls( //dir=stmt
+ int id: @for_each_stmt ref,
+ int nextCall: @expr_or_none ref
+);
+
+@labeled_conditional_stmt =
+ @guard_stmt
+| @if_stmt
+| @while_stmt
+;
+
+#keyset[id]
+labeled_conditional_stmts( //dir=stmt
+ int id: @labeled_conditional_stmt ref,
+ int condition: @stmt_condition_or_none ref
+);
+
+repeat_while_stmts( //dir=stmt
+ unique int id: @repeat_while_stmt,
+ int condition: @expr_or_none ref,
+ int body: @stmt_or_none ref
+);
+
+switch_stmts( //dir=stmt
+ unique int id: @switch_stmt,
+ int expr: @expr_or_none ref
+);
+
+#keyset[id, index]
+switch_stmt_cases( //dir=stmt
+ int id: @switch_stmt ref,
+ int index: int ref,
+ int case_: @case_stmt_or_none ref
+);
+
+guard_stmts( //dir=stmt
+ unique int id: @guard_stmt,
+ int body: @brace_stmt_or_none ref
+);
+
+if_stmts( //dir=stmt
+ unique int id: @if_stmt,
+ int then: @stmt_or_none ref
+);
+
+#keyset[id]
+if_stmt_elses( //dir=stmt
+ int id: @if_stmt ref,
+ int else: @stmt_or_none ref
+);
+
+while_stmts( //dir=stmt
+ unique int id: @while_stmt,
+ int body: @stmt_or_none ref
+);
+
+@type =
+ @any_function_type
+| @any_generic_type
+| @any_metatype_type
+| @builtin_type
+| @dependent_member_type
+| @dynamic_self_type
+| @error_type
+| @existential_type
+| @in_out_type
+| @integer_type
+| @l_value_type
+| @module_type
+| @pack_element_type
+| @pack_expansion_type
+| @pack_type
+| @parameterized_protocol_type
+| @protocol_composition_type
+| @reference_storage_type
+| @substitutable_type
+| @sugar_type
+| @tuple_type
+| @unresolved_type
+;
+
+#keyset[id]
+types( //dir=type
+ int id: @type ref,
+ string name: string ref,
+ int canonical_type: @type_or_none ref
+);
+
+type_reprs( //dir=type
+ unique int id: @type_repr,
+ int type_: @type_or_none ref
+);
+
+@any_function_type =
+ @function_type
+| @generic_function_type
+;
+
+#keyset[id]
+any_function_types( //dir=type
+ int id: @any_function_type ref,
+ int result: @type_or_none ref
+);
+
+#keyset[id, index]
+any_function_type_param_types( //dir=type
+ int id: @any_function_type ref,
+ int index: int ref,
+ int param_type: @type_or_none ref
+);
+
+#keyset[id]
+any_function_type_is_throwing( //dir=type
+ int id: @any_function_type ref
+);
+
+#keyset[id]
+any_function_type_is_async( //dir=type
+ int id: @any_function_type ref
+);
+
+@any_generic_type =
+ @nominal_or_bound_generic_nominal_type
+| @unbound_generic_type
+;
+
+#keyset[id]
+any_generic_types( //dir=type
+ int id: @any_generic_type ref,
+ int declaration: @generic_type_decl_or_none ref
+);
+
+#keyset[id]
+any_generic_type_parents( //dir=type
+ int id: @any_generic_type ref,
+ int parent: @type_or_none ref
+);
+
+@any_metatype_type =
+ @existential_metatype_type
+| @metatype_type
+;
+
+@builtin_type =
+ @any_builtin_integer_type
+| @builtin_bridge_object_type
+| @builtin_default_actor_storage_type
+| @builtin_executor_type
+| @builtin_float_type
+| @builtin_generic_type
+| @builtin_job_type
+| @builtin_native_object_type
+| @builtin_raw_pointer_type
+| @builtin_raw_unsafe_continuation_type
+| @builtin_unsafe_value_buffer_type
+| @builtin_vector_type
+;
+
+dependent_member_types( //dir=type
+ unique int id: @dependent_member_type,
+ int base_type: @type_or_none ref,
+ int associated_type_decl: @associated_type_decl_or_none ref
+);
+
+dynamic_self_types( //dir=type
+ unique int id: @dynamic_self_type,
+ int static_self_type: @type_or_none ref
+);
+
+error_types( //dir=type
+ unique int id: @error_type
+);
+
+existential_types( //dir=type
+ unique int id: @existential_type,
+ int constraint: @type_or_none ref
+);
+
+in_out_types( //dir=type
+ unique int id: @in_out_type,
+ int object_type: @type_or_none ref
+);
+
+integer_types( //dir=type
+ unique int id: @integer_type,
+ string value: string ref
+);
+
+l_value_types( //dir=type
+ unique int id: @l_value_type,
+ int object_type: @type_or_none ref
+);
+
+module_types( //dir=type
+ unique int id: @module_type,
+ int module: @module_decl_or_none ref
+);
+
+pack_element_types( //dir=type
+ unique int id: @pack_element_type,
+ int pack_type: @type_or_none ref
+);
+
+pack_expansion_types( //dir=type
+ unique int id: @pack_expansion_type,
+ int pattern_type: @type_or_none ref,
+ int count_type: @type_or_none ref
+);
+
+pack_types( //dir=type
+ unique int id: @pack_type
+);
+
+#keyset[id, index]
+pack_type_elements( //dir=type
+ int id: @pack_type ref,
+ int index: int ref,
+ int element: @type_or_none ref
+);
+
+parameterized_protocol_types( //dir=type
+ unique int id: @parameterized_protocol_type,
+ int base: @protocol_type_or_none ref
+);
+
+#keyset[id, index]
+parameterized_protocol_type_args( //dir=type
+ int id: @parameterized_protocol_type ref,
+ int index: int ref,
+ int arg: @type_or_none ref
+);
+
+protocol_composition_types( //dir=type
+ unique int id: @protocol_composition_type
+);
+
+#keyset[id, index]
+protocol_composition_type_members( //dir=type
+ int id: @protocol_composition_type ref,
+ int index: int ref,
+ int member: @type_or_none ref
+);
+
+@reference_storage_type =
+ @unmanaged_storage_type
+| @unowned_storage_type
+| @weak_storage_type
+;
+
+#keyset[id]
+reference_storage_types( //dir=type
+ int id: @reference_storage_type ref,
+ int referent_type: @type_or_none ref
+);
+
+@substitutable_type =
+ @archetype_type
+| @generic_type_param_type
+;
+
+@sugar_type =
+ @paren_type
+| @syntax_sugar_type
+| @type_alias_type
+;
+
+tuple_types( //dir=type
+ unique int id: @tuple_type
+);
+
+#keyset[id, index]
+tuple_type_types( //dir=type
+ int id: @tuple_type ref,
+ int index: int ref,
+ int type_: @type_or_none ref
+);
+
+#keyset[id, index]
+tuple_type_names( //dir=type
+ int id: @tuple_type ref,
+ int index: int ref,
+ string name: string ref
+);
+
+unresolved_types( //dir=type
+ unique int id: @unresolved_type
+);
+
+@any_builtin_integer_type =
+ @builtin_integer_literal_type
+| @builtin_integer_type
+;
+
+@archetype_type =
+ @local_archetype_type
+| @opaque_type_archetype_type
+| @pack_archetype_type
+| @primary_archetype_type
+;
+
+#keyset[id]
+archetype_types( //dir=type
+ int id: @archetype_type ref,
+ int interface_type: @type_or_none ref
+);
+
+#keyset[id]
+archetype_type_superclasses( //dir=type
+ int id: @archetype_type ref,
+ int superclass: @type_or_none ref
+);
+
+#keyset[id, index]
+archetype_type_protocols( //dir=type
+ int id: @archetype_type ref,
+ int index: int ref,
+ int protocol: @protocol_decl_or_none ref
+);
+
+builtin_bridge_object_types( //dir=type
+ unique int id: @builtin_bridge_object_type
+);
+
+builtin_default_actor_storage_types( //dir=type
+ unique int id: @builtin_default_actor_storage_type
+);
+
+builtin_executor_types( //dir=type
+ unique int id: @builtin_executor_type
+);
+
+builtin_float_types( //dir=type
+ unique int id: @builtin_float_type
+);
+
+@builtin_generic_type =
+ @builtin_fixed_array_type
+;
+
+builtin_job_types( //dir=type
+ unique int id: @builtin_job_type
+);
+
+builtin_native_object_types( //dir=type
+ unique int id: @builtin_native_object_type
+);
+
+builtin_raw_pointer_types( //dir=type
+ unique int id: @builtin_raw_pointer_type
+);
+
+builtin_raw_unsafe_continuation_types( //dir=type
+ unique int id: @builtin_raw_unsafe_continuation_type
+);
+
+builtin_unsafe_value_buffer_types( //dir=type
+ unique int id: @builtin_unsafe_value_buffer_type
+);
+
+builtin_vector_types( //dir=type
+ unique int id: @builtin_vector_type
+);
+
+existential_metatype_types( //dir=type
+ unique int id: @existential_metatype_type
+);
+
+function_types( //dir=type
+ unique int id: @function_type
+);
+
+generic_function_types( //dir=type
+ unique int id: @generic_function_type
+);
+
+#keyset[id, index]
+generic_function_type_generic_params( //dir=type
+ int id: @generic_function_type ref,
+ int index: int ref,
+ int generic_param: @generic_type_param_type_or_none ref
+);
+
+generic_type_param_types( //dir=type
+ unique int id: @generic_type_param_type
+);
+
+metatype_types( //dir=type
+ unique int id: @metatype_type
+);
+
+@nominal_or_bound_generic_nominal_type =
+ @bound_generic_type
+| @nominal_type
+;
+
+paren_types( //dir=type
+ unique int id: @paren_type,
+ int type_: @type_or_none ref
+);
+
+@syntax_sugar_type =
+ @dictionary_type
+| @inline_array_type
+| @unary_syntax_sugar_type
+;
+
+type_alias_types( //dir=type
+ unique int id: @type_alias_type,
+ int decl: @type_alias_decl_or_none ref
+);
+
+unbound_generic_types( //dir=type
+ unique int id: @unbound_generic_type
+);
+
+unmanaged_storage_types( //dir=type
+ unique int id: @unmanaged_storage_type
+);
+
+unowned_storage_types( //dir=type
+ unique int id: @unowned_storage_type
+);
+
+weak_storage_types( //dir=type
+ unique int id: @weak_storage_type
+);
+
+@bound_generic_type =
+ @bound_generic_class_type
+| @bound_generic_enum_type
+| @bound_generic_struct_type
+;
+
+#keyset[id, index]
+bound_generic_type_arg_types( //dir=type
+ int id: @bound_generic_type ref,
+ int index: int ref,
+ int arg_type: @type_or_none ref
+);
+
+builtin_fixed_array_types( //dir=type
+ unique int id: @builtin_fixed_array_type,
+ int size: @type_or_none ref,
+ int element_type: @type_or_none ref
+);
+
+builtin_integer_literal_types( //dir=type
+ unique int id: @builtin_integer_literal_type
+);
+
+builtin_integer_types( //dir=type
+ unique int id: @builtin_integer_type
+);
+
+#keyset[id]
+builtin_integer_type_widths( //dir=type
+ int id: @builtin_integer_type ref,
+ int width: int ref
+);
+
+dictionary_types( //dir=type
+ unique int id: @dictionary_type,
+ int key_type: @type_or_none ref,
+ int value_type: @type_or_none ref
+);
+
+inline_array_types( //dir=type
+ unique int id: @inline_array_type,
+ int count_type: @type_or_none ref,
+ int element_type: @type_or_none ref
+);
+
+@local_archetype_type =
+ @element_archetype_type
+| @existential_archetype_type
+;
+
+@nominal_type =
+ @class_type
+| @enum_type
+| @protocol_type
+| @struct_type
+;
+
+opaque_type_archetype_types( //dir=type
+ unique int id: @opaque_type_archetype_type,
+ int declaration: @opaque_type_decl_or_none ref
+);
+
+pack_archetype_types( //dir=type
+ unique int id: @pack_archetype_type
+);
+
+primary_archetype_types( //dir=type
+ unique int id: @primary_archetype_type
+);
+
+@unary_syntax_sugar_type =
+ @array_slice_type
+| @optional_type
+| @variadic_sequence_type
+;
+
+#keyset[id]
+unary_syntax_sugar_types( //dir=type
+ int id: @unary_syntax_sugar_type ref,
+ int base_type: @type_or_none ref
+);
+
+array_slice_types( //dir=type
+ unique int id: @array_slice_type
+);
+
+bound_generic_class_types( //dir=type
+ unique int id: @bound_generic_class_type
+);
+
+bound_generic_enum_types( //dir=type
+ unique int id: @bound_generic_enum_type
+);
+
+bound_generic_struct_types( //dir=type
+ unique int id: @bound_generic_struct_type
+);
+
+class_types( //dir=type
+ unique int id: @class_type
+);
+
+element_archetype_types( //dir=type
+ unique int id: @element_archetype_type
+);
+
+enum_types( //dir=type
+ unique int id: @enum_type
+);
+
+existential_archetype_types( //dir=type
+ unique int id: @existential_archetype_type
+);
+
+optional_types( //dir=type
+ unique int id: @optional_type
+);
+
+protocol_types( //dir=type
+ unique int id: @protocol_type
+);
+
+struct_types( //dir=type
+ unique int id: @struct_type
+);
+
+variadic_sequence_types( //dir=type
+ unique int id: @variadic_sequence_type
+);
+
+@accessor_or_none =
+ @accessor
+| @unspecified_element
+;
+
+@argument_or_none =
+ @argument
+| @unspecified_element
+;
+
+@associated_type_decl_or_none =
+ @associated_type_decl
+| @unspecified_element
+;
+
+@ast_node_or_none =
+ @ast_node
+| @unspecified_element
+;
+
+@availability_info_or_none =
+ @availability_info
+| @unspecified_element
+;
+
+@availability_spec_or_none =
+ @availability_spec
+| @unspecified_element
+;
+
+@brace_stmt_or_none =
+ @brace_stmt
+| @unspecified_element
+;
+
+@captured_decl_or_none =
+ @captured_decl
+| @unspecified_element
+;
+
+@case_label_item_or_none =
+ @case_label_item
+| @unspecified_element
+;
+
+@case_stmt_or_none =
+ @case_stmt
+| @unspecified_element
+;
+
+@closure_expr_or_none =
+ @closure_expr
+| @unspecified_element
+;
+
+@condition_element_or_none =
+ @condition_element
+| @unspecified_element
+;
+
+@decl_or_none =
+ @decl
+| @unspecified_element
+;
+
+@enum_element_decl_or_none =
+ @enum_element_decl
+| @unspecified_element
+;
+
+@expr_or_none =
+ @expr
+| @unspecified_element
+;
+
+@file_or_none =
+ @file
+| @unspecified_element
+;
+
+@function_or_none =
+ @function
+| @unspecified_element
+;
+
+@generic_type_decl_or_none =
+ @generic_type_decl
+| @unspecified_element
+;
+
+@generic_type_param_decl_or_none =
+ @generic_type_param_decl
+| @unspecified_element
+;
+
+@generic_type_param_type_or_none =
+ @generic_type_param_type
+| @unspecified_element
+;
+
+@initializer_or_none =
+ @initializer
+| @unspecified_element
+;
+
+@key_path_component_or_none =
+ @key_path_component
+| @unspecified_element
+;
+
+@location_or_none =
+ @location
+| @unspecified_element
+;
+
+@macro_role_or_none =
+ @macro_role
+| @unspecified_element
+;
+
+@module_decl_or_none =
+ @module_decl
+| @unspecified_element
+;
+
+@nominal_type_decl_or_none =
+ @nominal_type_decl
+| @unspecified_element
+;
+
+@opaque_type_decl_or_none =
+ @opaque_type_decl
+| @unspecified_element
+;
+
+@opaque_value_expr_or_none =
+ @opaque_value_expr
+| @unspecified_element
+;
+
+@param_decl_or_none =
+ @param_decl
+| @unspecified_element
+;
+
+@pattern_or_none =
+ @pattern
+| @unspecified_element
+;
+
+@pattern_binding_decl_or_none =
+ @pattern_binding_decl
+| @unspecified_element
+;
+
+@precedence_group_decl_or_none =
+ @precedence_group_decl
+| @unspecified_element
+;
+
+@protocol_decl_or_none =
+ @protocol_decl
+| @unspecified_element
+;
+
+@protocol_type_or_none =
+ @protocol_type
+| @unspecified_element
+;
+
+@stmt_or_none =
+ @stmt
+| @unspecified_element
+;
+
+@stmt_condition_or_none =
+ @stmt_condition
+| @unspecified_element
+;
+
+@string_literal_expr_or_none =
+ @string_literal_expr
+| @unspecified_element
+;
+
+@tap_expr_or_none =
+ @tap_expr
+| @unspecified_element
+;
+
+@type_or_none =
+ @type
+| @unspecified_element
+;
+
+@type_alias_decl_or_none =
+ @type_alias_decl
+| @unspecified_element
+;
+
+@type_repr_or_none =
+ @type_repr
+| @unspecified_element
+;
+
+@value_decl_or_none =
+ @unspecified_element
+| @value_decl
+;
+
+@var_decl_or_none =
+ @unspecified_element
+| @var_decl
+;
diff --git a/swift/downgrades/1bb163e31d206f30146738adcd93def10fdabefa/upgrade.properties b/swift/downgrades/1bb163e31d206f30146738adcd93def10fdabefa/upgrade.properties
new file mode 100644
index 000000000000..1dd157e51bec
--- /dev/null
+++ b/swift/downgrades/1bb163e31d206f30146738adcd93def10fdabefa/upgrade.properties
@@ -0,0 +1,3 @@
+description: Expose declared interface types
+compatibility: full
+type_decls.rel: reorder type_decls.rel (@type_decl id, string name, @type_or_none declared_interface_type) id name
diff --git a/swift/extractor/translators/DeclTranslator.cpp b/swift/extractor/translators/DeclTranslator.cpp
index 4a89d571c41d..f7ea94e36648 100644
--- a/swift/extractor/translators/DeclTranslator.cpp
+++ b/swift/extractor/translators/DeclTranslator.cpp
@@ -299,6 +299,7 @@ void DeclTranslator::fillTypeDecl(const swift::TypeDecl& decl, codeql::TypeDecl&
entry.inherited_types.push_back(dispatcher.fetchLabel(type));
}
}
+ entry.declared_interface_type = dispatcher.fetchLabel(decl.getDeclaredInterfaceType());
fillValueDecl(decl, entry);
}
diff --git a/swift/ql/.generated.list b/swift/ql/.generated.list
index ea1cb6f571b2..f178f2bc4b3f 100644
--- a/swift/ql/.generated.list
+++ b/swift/ql/.generated.list
@@ -741,7 +741,7 @@ lib/codeql/swift/generated/Location.qll 5e20316c3e480ddfe632b7e88e016c19f10a67df
lib/codeql/swift/generated/MacroRole.qll facf907e75490d69cd401c491215e4719324d751f40ea46c86ccf24cf3663c1f 969d8d4b44e3f1a9c193a152a4d83a303e56d2dbb871fc920c47a33f699cf018
lib/codeql/swift/generated/ParentChild.qll 669d39245f2cb735cfd4bcebdb551ef8f334fef5297c5834a8b09ebfa655856e 59b283c8a30b6b364c853302ab919ea713e0289e7b793b08b46fc87178d14a6a
lib/codeql/swift/generated/PureSynthConstructors.qll bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4 bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4
-lib/codeql/swift/generated/Raw.qll 0090c6509cb3fa5a67c996a2fc22e6338caef19701ca19463965b55b3c63096f 578329fa3abbabbadbff5e364e9c8d7ad76b41d4c17ad76e0660d41f48746659
+lib/codeql/swift/generated/Raw.qll a21e4f931d2bfcd9d964a7b930a81e7c169dc7ed7611f195087ea664745f90ea 3594391128bf4f3fb387ce386ab0f1ef070b7fa046425b6b4152f13b21d0a754
lib/codeql/swift/generated/Synth.qll e30b50d2645d9c36719d81f1be70712c7c6e89a3f5b4a5ae894411e045d05bff 9bd0c9c90532db97cde9553dde4089b7cf12c462c690d853fa40cb36ea112c21
lib/codeql/swift/generated/SynthConstructors.qll c40f01e1331bdbe238620a41d17409cefe34a6b23066708ef5d74f8631b54f48 c40f01e1331bdbe238620a41d17409cefe34a6b23066708ef5d74f8631b54f48
lib/codeql/swift/generated/UnknownFile.qll 247ddf2ebb49ce5ed4bf7bf91a969ddff37de6c78d43d8affccaf7eb586e06f2 452b29f0465ef45e978ef8b647b75e5a2a1e53f2a568fc003bc8f52f73b3fa4d
@@ -787,7 +787,7 @@ lib/codeql/swift/generated/decl/StructDecl.qll baa06ebff9619339b461342828f952693
lib/codeql/swift/generated/decl/SubscriptDecl.qll 18d84b4ef27ecb732ac4350b8b01cb8c48db5182680f6893d392d5994919ca97 fcb5fe713326957a5bdf9bb9098f979c77778c02252dcb9c6d915a8d15eb65cf
lib/codeql/swift/generated/decl/TopLevelCodeDecl.qll b327da6de5b1e40f5eea5893f4fcb01803cfdd78bd757ec93daadedb7169bf8d 2d316fff198707fae5a43e6b24d2a547ee9502fd278468846495d1b2f4ea62b1
lib/codeql/swift/generated/decl/TypeAliasDecl.qll 041c098c276bc7369049e9a11540e99b061d50977338cceca47488f82b21694e 06deed614cbe77031fdbf3f9591780e80b9f545adec8b7831a2b5329ee49bc5f
-lib/codeql/swift/generated/decl/TypeDecl.qll 92f74709cce7e9f0f713598d3b20b730475c312957c518b8096206f8744419a2 305bda46c8bef48b7e30392698e724093ab2984ffed74cae3361f818cbf8c77a
+lib/codeql/swift/generated/decl/TypeDecl.qll f8382cfd5800b1165b11fe927b35b2406826f0d1239114376656352039249b56 0247872a700e15c9243dd36e564e93c8b2aeec9cdd26ee675eaaf01525787111
lib/codeql/swift/generated/decl/UsingDecl.qll 3bb697961f5699ec9ed1b87511714eac4ee69f5d82e1fd8c6598f121e23a2f7b 4e72b98a84f796d3e0e556ae6b84bf7b7f08adc225dcdc00fd120461e287b472
lib/codeql/swift/generated/decl/ValueDecl.qll d3b9c241fd6cb1ce8274435c0242775c28c08f6a47caae01ad1ecd38897b2cd5 bc81291b1394b47972d7b75b6a767ed847f881932a7d9345d28d161a55b66bd1
lib/codeql/swift/generated/decl/VarDecl.qll 8978a73fa2d7a9f952b68a2638788eda857e62502311a33fa6de1dad49a6cb1c b8b6c8cf6773056c3a90494754b0a257dcae494c03d933f138ece7f531fb9158
@@ -1048,13 +1048,13 @@ test/extractor-tests/generated/Diagnostics/Diagnostics.ql c1f8be2c283e13c1a4dada
test/extractor-tests/generated/File/File.ql a1385ef2080e04e8757f61b8e1d0129df9f955edf03fbb3b83cc9cb5498b4e95 0364d8c7f108d01b2641f996efedab7084956307e875e6bc078ea677d04267e0
test/extractor-tests/generated/KeyPathComponent/KeyPathComponent.ql 3fa617f8ed1b308d0c56f429ee8abe6d33ef60bf57d87f6dc89fdc8fe969a102 c2fa3153077dbe9e0fc608524dc03c82ff4ed460364d341ee6a817b0d75291c3
test/extractor-tests/generated/decl/Accessor/Accessor.ql 3d4301ec9ec6284b547f8cccf94c3077f0baf70778f458bc21bebc5de55c86e5 2f263e79ecd1ac8da56c17caff400fd3c40d83b6aa3d501830f1d2eeb48a57cd
-test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.ql 55a78a6b96a17532178a39bd39aa4df23295f98019bb00de041ba15dfd4f84d9 51dbcd86203d5d031d748f77943a81c2c50de4ff559af20a4a1a682a19978d4f
+test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.ql b7ad6073733906adbffae03a0a227beea7b5ddeb46e31c81fa9c98d6688abd5c b9b9b01e358d37a154bd3e4d7e59765c5c0ef36cc1a3110718ec9d35946d1ab6
test/extractor-tests/generated/decl/CapturedDecl/CapturedDecl.ql fd62be6c38d39f371c20e8c2f233e37a9da5aa234588920634f5db67e8beb3bd d51d35d4fd6a21cd596e064e0221d0c86e36312412a9bd4e64f431c123f3019a
-test/extractor-tests/generated/decl/ClassDecl/ClassDecl.ql d5fa7f68307e2e3e7ad060a125bda148e4a28f6acbef08a1a975bbf9ba947641 46d1e4f801414f1c869601dc706e41393e5fcd399e51da593c1e58737f6ff427
+test/extractor-tests/generated/decl/ClassDecl/ClassDecl.ql 28e453c11069b0266d950da1f32361863d10d870de0f6d11512a0bb686af2ec1 2524ee149a48902346b81bfac6f50c832f83680aed4a850e8ea15504253865be
test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.ql 936ac4aa52a55bd5bb4c75c117fffcc00208b9f502ff7ee05acbaad7d48a52fb d80346fe34d40910f5ecdb33d7266b6e4d1ec79f8d767c7da5e2ab780f201457
test/extractor-tests/generated/decl/Deinitializer/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
test/extractor-tests/generated/decl/EnumDecl/EnumCaseDecl.ql 7436bb7dfaa471f5a21ea2e3faba97d61bf53f930720999abdcc6745a65f0a1a 0241b2bb07c17136f6099185f65ea1266cd912296dfe481dce30eb9e3d1dd23f
-test/extractor-tests/generated/decl/EnumDecl/EnumDecl.ql 47f20279f49388a4850df4f5ee61634e30beed58567eff891688c09942862ec2 8e11af1ceb07cab9738ffb25ac877ced712d1883a6514de5e8895cd1809a7bd8
+test/extractor-tests/generated/decl/EnumDecl/EnumDecl.ql 329c3f6255ef3ed5441110291d40c4e409ad520d92504d8778aadf21e1359a27 ebda0c8f81c6c8383c8ecb68be66a14cc351a9b5f21d44f9a815ff8e149d74b8
test/extractor-tests/generated/decl/EnumDecl/EnumElementDecl.ql 16caf5b014dea42a36b23eee6932c0818d94b1416e151ce46ba06a1fd2fb73ba cac704575b50613c8f8f297ce37c6d09ef943c94df4289643a4496103ac8388e
test/extractor-tests/generated/decl/ExtensionDecl/ExtensionDecl.ql 04529ad447b7b0c529a54b0e0d009183c00cb1dcd7eb16378a7c4c7bc86bca4d 86379270a15fa014dc127607b720bb4d39b24b70d1c0f72ef8563c4144423ced
test/extractor-tests/generated/decl/GenericTypeParamDecl/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
@@ -1064,9 +1064,9 @@ test/extractor-tests/generated/decl/InfixOperatorDecl/MISSING_SOURCE.txt 35fb32e
test/extractor-tests/generated/decl/Initializer/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
test/extractor-tests/generated/decl/MacroDecl/MacroDecl.ql 61f092d4ed5972283b3eb0eeec81c8f299496dc548a98dca56a1aadaf8248d1d b9cd637cb0f6f34d8d0a4473f2c212a0534d49891d55593758bb03f8d225f32a
test/extractor-tests/generated/decl/MacroDecl/MacroRole.ql 7ab0dc211663c1b09a54ccbee7d6be94ffa45f420b383d2e2f22b7ccfb8d7a48 92296b89fccf6aebe877e67796885bedd809ebb470f23f48f98b27c2922c4ba2
-test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.ql 63a41a3b393b29d19752379fe29f26fe649dad2927836e24832e07c503d092a6 927fa4056a5d7c65803f7baa1216e6bef9b3b6a223c4a2bb50f2a6a31580db6a
+test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.ql 814ec8b4d9947ff8a49e1c4726015d8a0a35b22851dd50eb516f7c91994481e8 d01548746991d765b8c508c88cfe5ff2e39b499dd177abafcd94e226e0efa016
test/extractor-tests/generated/decl/NamedFunction/NamedFunction.ql c6be4c1314ffed2a8a91af2e08ea14ce721195ec993d18ebd4d7b90f4a60dac3 767fc36b64291ab7ecccd63bf74856983830267c992d1347236da314fca73d57
-test/extractor-tests/generated/decl/OpaqueTypeDecl/OpaqueTypeDecl.ql 85b041e1f791b40ff3d3c58c79e017cebf9ef535ea3d576984b7c093f25aa95b 9fcf314b02ac95fbd2c0e5fc95dc48c16522c74def57f5647dd5ad7e80f7c2c1
+test/extractor-tests/generated/decl/OpaqueTypeDecl/OpaqueTypeDecl.ql d764ddd50ee6faff51bee3a00349d660c32fd5548c7bda3a19866925688e96b0 e6534ba21371aef4d99a6206187d69cda77cd613606d7cb297192f21532fdcab
test/extractor-tests/generated/decl/ParamDecl/ParamDecl.ql cc9d89731f7a5ecc2267923268e2d8046aa3f0eb9556c6a12e53b541347f45a4 6d06279172ff2c04be0f39293a2e9a9de5e41ff1efffd41a67d5a921e1afe9ea
test/extractor-tests/generated/decl/PatternBindingDecl/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
test/extractor-tests/generated/decl/PostfixOperatorDecl/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
diff --git a/swift/ql/lib/change-notes/2026-05-11-declared-interface-type.md b/swift/ql/lib/change-notes/2026-05-11-declared-interface-type.md
new file mode 100644
index 000000000000..c62130ee099a
--- /dev/null
+++ b/swift/ql/lib/change-notes/2026-05-11-declared-interface-type.md
@@ -0,0 +1,4 @@
+---
+category: feature
+---
+* The `TypeDecl` class now defines a `getDeclaredInterfaceType` predicate, which yields the declared interface type of the type declaration.
diff --git a/swift/ql/lib/codeql/swift/generated/Raw.qll b/swift/ql/lib/codeql/swift/generated/Raw.qll
index 3e0fa95a327a..71858b8854cd 100644
--- a/swift/ql/lib/codeql/swift/generated/Raw.qll
+++ b/swift/ql/lib/codeql/swift/generated/Raw.qll
@@ -1008,7 +1008,7 @@ module Raw {
/**
* Gets the name of this type declaration.
*/
- string getName() { type_decls(this, result) }
+ string getName() { type_decls(this, result, _) }
/**
* Gets the `index`th inherited type of this type declaration (0-based).
@@ -1024,6 +1024,11 @@ module Raw {
int getNumberOfInheritedTypes() {
result = count(int i | type_decl_inherited_types(this, i, _))
}
+
+ /**
+ * Gets the declared interface type of this type declaration.
+ */
+ Type getDeclaredInterfaceType() { type_decls(this, _, result) }
}
/**
diff --git a/swift/ql/lib/codeql/swift/generated/decl/TypeDecl.qll b/swift/ql/lib/codeql/swift/generated/decl/TypeDecl.qll
index c1cb0c15f73c..f77355da6323 100644
--- a/swift/ql/lib/codeql/swift/generated/decl/TypeDecl.qll
+++ b/swift/ql/lib/codeql/swift/generated/decl/TypeDecl.qll
@@ -61,5 +61,28 @@ module Generated {
final int getNumberOfInheritedTypes() {
result = count(int i | exists(this.getInheritedType(i)))
}
+
+ /**
+ * Gets the declared interface type of this type declaration.
+ *
+ * This includes nodes from the "hidden" AST. It can be overridden in subclasses to change the
+ * behavior of both the `Immediate` and non-`Immediate` versions.
+ */
+ Type getImmediateDeclaredInterfaceType() {
+ result =
+ Synth::convertTypeFromRaw(Synth::convertTypeDeclToRaw(this)
+ .(Raw::TypeDecl)
+ .getDeclaredInterfaceType())
+ }
+
+ /**
+ * Gets the declared interface type of this type declaration.
+ */
+ final Type getDeclaredInterfaceType() {
+ exists(Type immediate |
+ immediate = this.getImmediateDeclaredInterfaceType() and
+ result = immediate.resolve()
+ )
+ }
}
}
diff --git a/swift/ql/lib/swift.dbscheme b/swift/ql/lib/swift.dbscheme
index 5738be6bb047..1bb163e31d20 100644
--- a/swift/ql/lib/swift.dbscheme
+++ b/swift/ql/lib/swift.dbscheme
@@ -530,7 +530,8 @@ prefix_operator_decls( //dir=decl
#keyset[id]
type_decls( //dir=decl
int id: @type_decl ref,
- string name: string ref
+ string name: string ref,
+ int declared_interface_type: @type_or_none ref
);
#keyset[id, index]
diff --git a/swift/ql/lib/upgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/old.dbscheme b/swift/ql/lib/upgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/old.dbscheme
new file mode 100644
index 000000000000..5738be6bb047
--- /dev/null
+++ b/swift/ql/lib/upgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/old.dbscheme
@@ -0,0 +1,2891 @@
+// generated by codegen/codegen.py, do not edit
+
+// from prefix.dbscheme
+/**
+ * The source location of the snapshot.
+ */
+sourceLocationPrefix(
+ string prefix: string ref
+);
+
+
+// from schema.py
+
+@element =
+ @file
+| @generic_context
+| @locatable
+| @location
+| @type
+;
+
+#keyset[id]
+element_is_unknown(
+ int id: @element ref
+);
+
+@file =
+ @db_file
+;
+
+#keyset[id]
+files(
+ int id: @file ref,
+ string name: string ref
+);
+
+#keyset[id]
+file_is_successfully_extracted(
+ int id: @file ref
+);
+
+@locatable =
+ @argument
+| @ast_node
+| @comment
+| @diagnostics
+| @error_element
+;
+
+#keyset[id]
+locatable_locations(
+ int id: @locatable ref,
+ int location: @location_or_none ref
+);
+
+@location =
+ @db_location
+;
+
+#keyset[id]
+locations(
+ int id: @location ref,
+ int file: @file_or_none ref,
+ int start_line: int ref,
+ int start_column: int ref,
+ int end_line: int ref,
+ int end_column: int ref
+);
+
+@ast_node =
+ @availability_info
+| @availability_spec
+| @callable
+| @case_label_item
+| @condition_element
+| @decl
+| @expr
+| @key_path_component
+| @macro_role
+| @pattern
+| @stmt
+| @stmt_condition
+| @type_repr
+;
+
+comments(
+ unique int id: @comment,
+ string text: string ref
+);
+
+db_files(
+ unique int id: @db_file
+);
+
+db_locations(
+ unique int id: @db_location
+);
+
+diagnostics(
+ unique int id: @diagnostics,
+ string text: string ref,
+ int kind: int ref
+);
+
+@error_element =
+ @error_expr
+| @error_type
+| @overloaded_decl_ref_expr
+| @unresolved_decl_ref_expr
+| @unresolved_dot_expr
+| @unresolved_member_chain_result_expr
+| @unresolved_member_expr
+| @unresolved_pattern_expr
+| @unresolved_specialize_expr
+| @unresolved_type
+| @unresolved_type_conversion_expr
+| @unspecified_element
+;
+
+availability_infos(
+ unique int id: @availability_info
+);
+
+#keyset[id]
+availability_info_is_unavailable(
+ int id: @availability_info ref
+);
+
+#keyset[id, index]
+availability_info_specs(
+ int id: @availability_info ref,
+ int index: int ref,
+ int spec: @availability_spec_or_none ref
+);
+
+availability_specs(
+ unique int id: @availability_spec
+);
+
+#keyset[id]
+availability_spec_platforms(
+ int id: @availability_spec ref,
+ string platform: string ref
+);
+
+#keyset[id]
+availability_spec_versions(
+ int id: @availability_spec ref,
+ string version: string ref
+);
+
+#keyset[id]
+availability_spec_is_wildcard(
+ int id: @availability_spec ref
+);
+
+@callable =
+ @closure_expr
+| @function
+;
+
+#keyset[id]
+callable_names(
+ int id: @callable ref,
+ string name: string ref
+);
+
+#keyset[id]
+callable_self_params(
+ int id: @callable ref,
+ int self_param: @param_decl_or_none ref
+);
+
+#keyset[id, index]
+callable_params(
+ int id: @callable ref,
+ int index: int ref,
+ int param: @param_decl_or_none ref
+);
+
+#keyset[id]
+callable_bodies(
+ int id: @callable ref,
+ int body: @brace_stmt_or_none ref
+);
+
+#keyset[id, index]
+callable_captures(
+ int id: @callable ref,
+ int index: int ref,
+ int capture: @captured_decl_or_none ref
+);
+
+key_path_components(
+ unique int id: @key_path_component,
+ int kind: int ref,
+ int component_type: @type_or_none ref
+);
+
+#keyset[id, index]
+key_path_component_subscript_arguments(
+ int id: @key_path_component ref,
+ int index: int ref,
+ int subscript_argument: @argument_or_none ref
+);
+
+#keyset[id]
+key_path_component_tuple_indices(
+ int id: @key_path_component ref,
+ int tuple_index: int ref
+);
+
+#keyset[id]
+key_path_component_decl_refs(
+ int id: @key_path_component ref,
+ int decl_ref: @value_decl_or_none ref
+);
+
+macro_roles(
+ unique int id: @macro_role,
+ int kind: int ref,
+ int macro_syntax: int ref
+);
+
+#keyset[id, index]
+macro_role_conformances(
+ int id: @macro_role ref,
+ int index: int ref,
+ int conformance: @expr_or_none ref
+);
+
+#keyset[id, index]
+macro_role_names(
+ int id: @macro_role ref,
+ int index: int ref,
+ string name: string ref
+);
+
+unspecified_elements(
+ unique int id: @unspecified_element,
+ string property: string ref,
+ string error: string ref
+);
+
+#keyset[id]
+unspecified_element_parents(
+ int id: @unspecified_element ref,
+ int parent: @element ref
+);
+
+#keyset[id]
+unspecified_element_indices(
+ int id: @unspecified_element ref,
+ int index: int ref
+);
+
+#keyset[id, index]
+unspecified_element_children(
+ int id: @unspecified_element ref,
+ int index: int ref,
+ int child: @ast_node_or_none ref
+);
+
+@decl =
+ @captured_decl
+| @enum_case_decl
+| @extension_decl
+| @if_config_decl
+| @import_decl
+| @missing_member_decl
+| @operator_decl
+| @pattern_binding_decl
+| @pound_diagnostic_decl
+| @precedence_group_decl
+| @top_level_code_decl
+| @using_decl
+| @value_decl
+;
+
+#keyset[id]
+decls( //dir=decl
+ int id: @decl ref,
+ int module: @module_decl_or_none ref
+);
+
+#keyset[id, index]
+decl_members( //dir=decl
+ int id: @decl ref,
+ int index: int ref,
+ int member: @decl_or_none ref
+);
+
+@generic_context =
+ @extension_decl
+| @function
+| @generic_type_decl
+| @macro_decl
+| @subscript_decl
+;
+
+#keyset[id, index]
+generic_context_generic_type_params( //dir=decl
+ int id: @generic_context ref,
+ int index: int ref,
+ int generic_type_param: @generic_type_param_decl_or_none ref
+);
+
+captured_decls( //dir=decl
+ unique int id: @captured_decl,
+ int decl: @value_decl_or_none ref
+);
+
+#keyset[id]
+captured_decl_is_direct( //dir=decl
+ int id: @captured_decl ref
+);
+
+#keyset[id]
+captured_decl_is_escaping( //dir=decl
+ int id: @captured_decl ref
+);
+
+enum_case_decls( //dir=decl
+ unique int id: @enum_case_decl
+);
+
+#keyset[id, index]
+enum_case_decl_elements( //dir=decl
+ int id: @enum_case_decl ref,
+ int index: int ref,
+ int element: @enum_element_decl_or_none ref
+);
+
+extension_decls( //dir=decl
+ unique int id: @extension_decl,
+ int extended_type_decl: @nominal_type_decl_or_none ref
+);
+
+#keyset[id, index]
+extension_decl_protocols( //dir=decl
+ int id: @extension_decl ref,
+ int index: int ref,
+ int protocol: @protocol_decl_or_none ref
+);
+
+if_config_decls( //dir=decl
+ unique int id: @if_config_decl
+);
+
+#keyset[id, index]
+if_config_decl_active_elements( //dir=decl
+ int id: @if_config_decl ref,
+ int index: int ref,
+ int active_element: @ast_node_or_none ref
+);
+
+import_decls( //dir=decl
+ unique int id: @import_decl
+);
+
+#keyset[id]
+import_decl_is_exported( //dir=decl
+ int id: @import_decl ref
+);
+
+#keyset[id]
+import_decl_imported_modules( //dir=decl
+ int id: @import_decl ref,
+ int imported_module: @module_decl_or_none ref
+);
+
+#keyset[id, index]
+import_decl_declarations( //dir=decl
+ int id: @import_decl ref,
+ int index: int ref,
+ int declaration: @value_decl_or_none ref
+);
+
+missing_member_decls( //dir=decl
+ unique int id: @missing_member_decl,
+ string name: string ref
+);
+
+@operator_decl =
+ @infix_operator_decl
+| @postfix_operator_decl
+| @prefix_operator_decl
+;
+
+#keyset[id]
+operator_decls( //dir=decl
+ int id: @operator_decl ref,
+ string name: string ref
+);
+
+pattern_binding_decls( //dir=decl
+ unique int id: @pattern_binding_decl
+);
+
+#keyset[id, index]
+pattern_binding_decl_inits( //dir=decl
+ int id: @pattern_binding_decl ref,
+ int index: int ref,
+ int init: @expr_or_none ref
+);
+
+#keyset[id, index]
+pattern_binding_decl_patterns( //dir=decl
+ int id: @pattern_binding_decl ref,
+ int index: int ref,
+ int pattern: @pattern_or_none ref
+);
+
+pound_diagnostic_decls( //dir=decl
+ unique int id: @pound_diagnostic_decl,
+ int kind: int ref,
+ int message: @string_literal_expr_or_none ref
+);
+
+precedence_group_decls( //dir=decl
+ unique int id: @precedence_group_decl
+);
+
+top_level_code_decls( //dir=decl
+ unique int id: @top_level_code_decl,
+ int body: @brace_stmt_or_none ref
+);
+
+using_decls( //dir=decl
+ unique int id: @using_decl
+);
+
+#keyset[id]
+using_decl_is_main_actor( //dir=decl
+ int id: @using_decl ref
+);
+
+#keyset[id]
+using_decl_is_nonisolated( //dir=decl
+ int id: @using_decl ref
+);
+
+@value_decl =
+ @abstract_storage_decl
+| @enum_element_decl
+| @function
+| @macro_decl
+| @type_decl
+;
+
+#keyset[id]
+value_decls( //dir=decl
+ int id: @value_decl ref,
+ int interface_type: @type_or_none ref
+);
+
+@abstract_storage_decl =
+ @subscript_decl
+| @var_decl
+;
+
+#keyset[id, index]
+abstract_storage_decl_accessors( //dir=decl
+ int id: @abstract_storage_decl ref,
+ int index: int ref,
+ int accessor: @accessor_or_none ref
+);
+
+enum_element_decls( //dir=decl
+ unique int id: @enum_element_decl,
+ string name: string ref
+);
+
+#keyset[id, index]
+enum_element_decl_params( //dir=decl
+ int id: @enum_element_decl ref,
+ int index: int ref,
+ int param: @param_decl_or_none ref
+);
+
+@function =
+ @accessor_or_named_function
+| @deinitializer
+| @initializer
+;
+
+infix_operator_decls( //dir=decl
+ unique int id: @infix_operator_decl
+);
+
+#keyset[id]
+infix_operator_decl_precedence_groups( //dir=decl
+ int id: @infix_operator_decl ref,
+ int precedence_group: @precedence_group_decl_or_none ref
+);
+
+macro_decls( //dir=decl
+ unique int id: @macro_decl,
+ string name: string ref
+);
+
+#keyset[id, index]
+macro_decl_parameters( //dir=decl
+ int id: @macro_decl ref,
+ int index: int ref,
+ int parameter: @param_decl_or_none ref
+);
+
+#keyset[id, index]
+macro_decl_roles( //dir=decl
+ int id: @macro_decl ref,
+ int index: int ref,
+ int role: @macro_role_or_none ref
+);
+
+postfix_operator_decls( //dir=decl
+ unique int id: @postfix_operator_decl
+);
+
+prefix_operator_decls( //dir=decl
+ unique int id: @prefix_operator_decl
+);
+
+@type_decl =
+ @abstract_type_param_decl
+| @generic_type_decl
+| @module_decl
+;
+
+#keyset[id]
+type_decls( //dir=decl
+ int id: @type_decl ref,
+ string name: string ref
+);
+
+#keyset[id, index]
+type_decl_inherited_types( //dir=decl
+ int id: @type_decl ref,
+ int index: int ref,
+ int inherited_type: @type_or_none ref
+);
+
+@abstract_type_param_decl =
+ @associated_type_decl
+| @generic_type_param_decl
+;
+
+@accessor_or_named_function =
+ @accessor
+| @named_function
+;
+
+deinitializers( //dir=decl
+ unique int id: @deinitializer
+);
+
+@generic_type_decl =
+ @nominal_type_decl
+| @opaque_type_decl
+| @type_alias_decl
+;
+
+initializers( //dir=decl
+ unique int id: @initializer
+);
+
+module_decls( //dir=decl
+ unique int id: @module_decl
+);
+
+#keyset[id]
+module_decl_is_builtin_module( //dir=decl
+ int id: @module_decl ref
+);
+
+#keyset[id]
+module_decl_is_system_module( //dir=decl
+ int id: @module_decl ref
+);
+
+module_decl_imported_modules( //dir=decl
+ int id: @module_decl ref,
+ int imported_module: @module_decl_or_none ref
+);
+
+module_decl_exported_modules( //dir=decl
+ int id: @module_decl ref,
+ int exported_module: @module_decl_or_none ref
+);
+
+subscript_decls( //dir=decl
+ unique int id: @subscript_decl,
+ int element_type: @type_or_none ref
+);
+
+#keyset[id, index]
+subscript_decl_params( //dir=decl
+ int id: @subscript_decl ref,
+ int index: int ref,
+ int param: @param_decl_or_none ref
+);
+
+@var_decl =
+ @concrete_var_decl
+| @param_decl
+;
+
+#keyset[id]
+var_decls( //dir=decl
+ int id: @var_decl ref,
+ string name: string ref,
+ int type_: @type_or_none ref
+);
+
+#keyset[id]
+var_decl_attached_property_wrapper_types( //dir=decl
+ int id: @var_decl ref,
+ int attached_property_wrapper_type: @type_or_none ref
+);
+
+#keyset[id]
+var_decl_parent_patterns( //dir=decl
+ int id: @var_decl ref,
+ int parent_pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+var_decl_parent_initializers( //dir=decl
+ int id: @var_decl ref,
+ int parent_initializer: @expr_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_backing_var_bindings( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_backing_var_binding: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_backing_vars( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_backing_var: @var_decl_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_projection_var_bindings( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_projection_var_binding: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_projection_vars( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_projection_var: @var_decl_or_none ref
+);
+
+accessors( //dir=decl
+ unique int id: @accessor
+);
+
+#keyset[id]
+accessor_is_getter( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_setter( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_will_set( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_did_set( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_read( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_modify( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_unsafe_address( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_unsafe_mutable_address( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_distributed_get( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_read2( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_modify2( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_init( //dir=decl
+ int id: @accessor ref
+);
+
+associated_type_decls( //dir=decl
+ unique int id: @associated_type_decl
+);
+
+concrete_var_decls( //dir=decl
+ unique int id: @concrete_var_decl,
+ int introducer_int: int ref
+);
+
+generic_type_param_decls( //dir=decl
+ unique int id: @generic_type_param_decl
+);
+
+named_functions( //dir=decl
+ unique int id: @named_function
+);
+
+@nominal_type_decl =
+ @class_decl
+| @enum_decl
+| @protocol_decl
+| @struct_decl
+;
+
+#keyset[id]
+nominal_type_decls( //dir=decl
+ int id: @nominal_type_decl ref,
+ int type_: @type_or_none ref
+);
+
+opaque_type_decls( //dir=decl
+ unique int id: @opaque_type_decl,
+ int naming_declaration: @value_decl_or_none ref
+);
+
+#keyset[id, index]
+opaque_type_decl_opaque_generic_params( //dir=decl
+ int id: @opaque_type_decl ref,
+ int index: int ref,
+ int opaque_generic_param: @generic_type_param_type_or_none ref
+);
+
+param_decls( //dir=decl
+ unique int id: @param_decl
+);
+
+#keyset[id]
+param_decl_is_inout( //dir=decl
+ int id: @param_decl ref
+);
+
+#keyset[id]
+param_decl_property_wrapper_local_wrapped_var_bindings( //dir=decl
+ int id: @param_decl ref,
+ int property_wrapper_local_wrapped_var_binding: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+param_decl_property_wrapper_local_wrapped_vars( //dir=decl
+ int id: @param_decl ref,
+ int property_wrapper_local_wrapped_var: @var_decl_or_none ref
+);
+
+type_alias_decls( //dir=decl
+ unique int id: @type_alias_decl,
+ int aliased_type: @type_or_none ref
+);
+
+class_decls( //dir=decl
+ unique int id: @class_decl
+);
+
+enum_decls( //dir=decl
+ unique int id: @enum_decl
+);
+
+protocol_decls( //dir=decl
+ unique int id: @protocol_decl
+);
+
+struct_decls( //dir=decl
+ unique int id: @struct_decl
+);
+
+arguments( //dir=expr
+ unique int id: @argument,
+ string label: string ref,
+ int expr: @expr_or_none ref
+);
+
+@expr =
+ @any_try_expr
+| @applied_property_wrapper_expr
+| @apply_expr
+| @assign_expr
+| @bind_optional_expr
+| @capture_list_expr
+| @closure_expr
+| @collection_expr
+| @consume_expr
+| @copy_expr
+| @current_context_isolation_expr
+| @decl_ref_expr
+| @default_argument_expr
+| @discard_assignment_expr
+| @dot_syntax_base_ignored_expr
+| @dynamic_type_expr
+| @enum_is_case_expr
+| @error_expr
+| @explicit_cast_expr
+| @extract_function_isolation_expr
+| @force_value_expr
+| @identity_expr
+| @if_expr
+| @implicit_conversion_expr
+| @in_out_expr
+| @key_path_application_expr
+| @key_path_dot_expr
+| @key_path_expr
+| @lazy_initialization_expr
+| @literal_expr
+| @lookup_expr
+| @make_temporarily_escapable_expr
+| @materialize_pack_expr
+| @obj_c_selector_expr
+| @one_way_expr
+| @opaque_value_expr
+| @open_existential_expr
+| @optional_evaluation_expr
+| @other_initializer_ref_expr
+| @overloaded_decl_ref_expr
+| @pack_element_expr
+| @pack_expansion_expr
+| @property_wrapper_value_placeholder_expr
+| @rebind_self_in_initializer_expr
+| @sequence_expr
+| @single_value_stmt_expr
+| @super_ref_expr
+| @tap_expr
+| @tuple_element_expr
+| @tuple_expr
+| @type_expr
+| @type_value_expr
+| @unresolved_decl_ref_expr
+| @unresolved_dot_expr
+| @unresolved_member_expr
+| @unresolved_pattern_expr
+| @unresolved_specialize_expr
+| @vararg_expansion_expr
+;
+
+#keyset[id]
+expr_types( //dir=expr
+ int id: @expr ref,
+ int type_: @type_or_none ref
+);
+
+@any_try_expr =
+ @force_try_expr
+| @optional_try_expr
+| @try_expr
+;
+
+#keyset[id]
+any_try_exprs( //dir=expr
+ int id: @any_try_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+applied_property_wrapper_exprs( //dir=expr
+ unique int id: @applied_property_wrapper_expr,
+ int kind: int ref,
+ int value: @expr_or_none ref,
+ int param: @param_decl_or_none ref
+);
+
+@apply_expr =
+ @binary_expr
+| @call_expr
+| @postfix_unary_expr
+| @prefix_unary_expr
+| @self_apply_expr
+;
+
+#keyset[id]
+apply_exprs( //dir=expr
+ int id: @apply_expr ref,
+ int function: @expr_or_none ref
+);
+
+#keyset[id, index]
+apply_expr_arguments( //dir=expr
+ int id: @apply_expr ref,
+ int index: int ref,
+ int argument: @argument_or_none ref
+);
+
+assign_exprs( //dir=expr
+ unique int id: @assign_expr,
+ int dest: @expr_or_none ref,
+ int source: @expr_or_none ref
+);
+
+bind_optional_exprs( //dir=expr
+ unique int id: @bind_optional_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+capture_list_exprs( //dir=expr
+ unique int id: @capture_list_expr,
+ int closure_body: @closure_expr_or_none ref
+);
+
+#keyset[id, index]
+capture_list_expr_binding_decls( //dir=expr
+ int id: @capture_list_expr ref,
+ int index: int ref,
+ int binding_decl: @pattern_binding_decl_or_none ref
+);
+
+@closure_expr =
+ @auto_closure_expr
+| @explicit_closure_expr
+;
+
+@collection_expr =
+ @array_expr
+| @dictionary_expr
+;
+
+consume_exprs( //dir=expr
+ unique int id: @consume_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+copy_exprs( //dir=expr
+ unique int id: @copy_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+current_context_isolation_exprs( //dir=expr
+ unique int id: @current_context_isolation_expr,
+ int actor: @expr_or_none ref
+);
+
+decl_ref_exprs( //dir=expr
+ unique int id: @decl_ref_expr,
+ int decl: @decl_or_none ref
+);
+
+#keyset[id, index]
+decl_ref_expr_replacement_types( //dir=expr
+ int id: @decl_ref_expr ref,
+ int index: int ref,
+ int replacement_type: @type_or_none ref
+);
+
+#keyset[id]
+decl_ref_expr_has_direct_to_storage_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+#keyset[id]
+decl_ref_expr_has_direct_to_implementation_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+#keyset[id]
+decl_ref_expr_has_ordinary_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+#keyset[id]
+decl_ref_expr_has_distributed_thunk_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+default_argument_exprs( //dir=expr
+ unique int id: @default_argument_expr,
+ int param_decl: @param_decl_or_none ref,
+ int param_index: int ref
+);
+
+#keyset[id]
+default_argument_expr_caller_side_defaults( //dir=expr
+ int id: @default_argument_expr ref,
+ int caller_side_default: @expr_or_none ref
+);
+
+discard_assignment_exprs( //dir=expr
+ unique int id: @discard_assignment_expr
+);
+
+dot_syntax_base_ignored_exprs( //dir=expr
+ unique int id: @dot_syntax_base_ignored_expr,
+ int qualifier: @expr_or_none ref,
+ int sub_expr: @expr_or_none ref
+);
+
+dynamic_type_exprs( //dir=expr
+ unique int id: @dynamic_type_expr,
+ int base: @expr_or_none ref
+);
+
+enum_is_case_exprs( //dir=expr
+ unique int id: @enum_is_case_expr,
+ int sub_expr: @expr_or_none ref,
+ int element: @enum_element_decl_or_none ref
+);
+
+error_exprs( //dir=expr
+ unique int id: @error_expr
+);
+
+@explicit_cast_expr =
+ @checked_cast_expr
+| @coerce_expr
+;
+
+#keyset[id]
+explicit_cast_exprs( //dir=expr
+ int id: @explicit_cast_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+extract_function_isolation_exprs( //dir=expr
+ unique int id: @extract_function_isolation_expr,
+ int function_expr: @expr_or_none ref
+);
+
+force_value_exprs( //dir=expr
+ unique int id: @force_value_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+@identity_expr =
+ @await_expr
+| @borrow_expr
+| @dot_self_expr
+| @paren_expr
+| @unresolved_member_chain_result_expr
+| @unsafe_expr
+;
+
+#keyset[id]
+identity_exprs( //dir=expr
+ int id: @identity_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+if_exprs( //dir=expr
+ unique int id: @if_expr,
+ int condition: @expr_or_none ref,
+ int then_expr: @expr_or_none ref,
+ int else_expr: @expr_or_none ref
+);
+
+@implicit_conversion_expr =
+ @abi_safe_conversion_expr
+| @actor_isolation_erasure_expr
+| @any_hashable_erasure_expr
+| @archetype_to_super_expr
+| @array_to_pointer_expr
+| @bridge_from_obj_c_expr
+| @bridge_to_obj_c_expr
+| @class_metatype_to_object_expr
+| @collection_upcast_conversion_expr
+| @conditional_bridge_from_obj_c_expr
+| @covariant_function_conversion_expr
+| @covariant_return_conversion_expr
+| @derived_to_base_expr
+| @destructure_tuple_expr
+| @differentiable_function_expr
+| @differentiable_function_extract_original_expr
+| @erasure_expr
+| @existential_metatype_to_object_expr
+| @foreign_object_conversion_expr
+| @function_conversion_expr
+| @in_out_to_pointer_expr
+| @inject_into_optional_expr
+| @linear_function_expr
+| @linear_function_extract_original_expr
+| @linear_to_differentiable_function_expr
+| @load_expr
+| @metatype_conversion_expr
+| @pointer_to_pointer_expr
+| @protocol_metatype_to_object_expr
+| @string_to_pointer_expr
+| @underlying_to_opaque_expr
+| @unevaluated_instance_expr
+| @unreachable_expr
+| @unresolved_type_conversion_expr
+| @unsafe_cast_expr
+;
+
+#keyset[id]
+implicit_conversion_exprs( //dir=expr
+ int id: @implicit_conversion_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+in_out_exprs( //dir=expr
+ unique int id: @in_out_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+key_path_application_exprs( //dir=expr
+ unique int id: @key_path_application_expr,
+ int base: @expr_or_none ref,
+ int key_path: @expr_or_none ref
+);
+
+key_path_dot_exprs( //dir=expr
+ unique int id: @key_path_dot_expr
+);
+
+key_path_exprs( //dir=expr
+ unique int id: @key_path_expr
+);
+
+#keyset[id]
+key_path_expr_roots( //dir=expr
+ int id: @key_path_expr ref,
+ int root: @type_repr_or_none ref
+);
+
+#keyset[id, index]
+key_path_expr_components( //dir=expr
+ int id: @key_path_expr ref,
+ int index: int ref,
+ int component: @key_path_component_or_none ref
+);
+
+lazy_initialization_exprs( //dir=expr
+ unique int id: @lazy_initialization_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+@literal_expr =
+ @builtin_literal_expr
+| @interpolated_string_literal_expr
+| @nil_literal_expr
+| @object_literal_expr
+| @regex_literal_expr
+;
+
+@lookup_expr =
+ @dynamic_lookup_expr
+| @member_ref_expr
+| @subscript_expr
+;
+
+#keyset[id]
+lookup_exprs( //dir=expr
+ int id: @lookup_expr ref,
+ int base: @expr_or_none ref
+);
+
+#keyset[id]
+lookup_expr_members( //dir=expr
+ int id: @lookup_expr ref,
+ int member: @decl_or_none ref
+);
+
+make_temporarily_escapable_exprs( //dir=expr
+ unique int id: @make_temporarily_escapable_expr,
+ int escaping_closure: @opaque_value_expr_or_none ref,
+ int nonescaping_closure: @expr_or_none ref,
+ int sub_expr: @expr_or_none ref
+);
+
+materialize_pack_exprs( //dir=expr
+ unique int id: @materialize_pack_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+obj_c_selector_exprs( //dir=expr
+ unique int id: @obj_c_selector_expr,
+ int sub_expr: @expr_or_none ref,
+ int method: @function_or_none ref
+);
+
+one_way_exprs( //dir=expr
+ unique int id: @one_way_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+opaque_value_exprs( //dir=expr
+ unique int id: @opaque_value_expr
+);
+
+open_existential_exprs( //dir=expr
+ unique int id: @open_existential_expr,
+ int sub_expr: @expr_or_none ref,
+ int existential: @expr_or_none ref,
+ int opaque_expr: @opaque_value_expr_or_none ref
+);
+
+optional_evaluation_exprs( //dir=expr
+ unique int id: @optional_evaluation_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+other_initializer_ref_exprs( //dir=expr
+ unique int id: @other_initializer_ref_expr,
+ int initializer: @initializer_or_none ref
+);
+
+overloaded_decl_ref_exprs( //dir=expr
+ unique int id: @overloaded_decl_ref_expr
+);
+
+#keyset[id, index]
+overloaded_decl_ref_expr_possible_declarations( //dir=expr
+ int id: @overloaded_decl_ref_expr ref,
+ int index: int ref,
+ int possible_declaration: @value_decl_or_none ref
+);
+
+pack_element_exprs( //dir=expr
+ unique int id: @pack_element_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+pack_expansion_exprs( //dir=expr
+ unique int id: @pack_expansion_expr,
+ int pattern_expr: @expr_or_none ref
+);
+
+property_wrapper_value_placeholder_exprs( //dir=expr
+ unique int id: @property_wrapper_value_placeholder_expr,
+ int placeholder: @opaque_value_expr_or_none ref
+);
+
+#keyset[id]
+property_wrapper_value_placeholder_expr_wrapped_values( //dir=expr
+ int id: @property_wrapper_value_placeholder_expr ref,
+ int wrapped_value: @expr_or_none ref
+);
+
+rebind_self_in_initializer_exprs( //dir=expr
+ unique int id: @rebind_self_in_initializer_expr,
+ int sub_expr: @expr_or_none ref,
+ int self: @var_decl_or_none ref
+);
+
+sequence_exprs( //dir=expr
+ unique int id: @sequence_expr
+);
+
+#keyset[id, index]
+sequence_expr_elements( //dir=expr
+ int id: @sequence_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+single_value_stmt_exprs( //dir=expr
+ unique int id: @single_value_stmt_expr,
+ int stmt: @stmt_or_none ref
+);
+
+super_ref_exprs( //dir=expr
+ unique int id: @super_ref_expr,
+ int self: @var_decl_or_none ref
+);
+
+tap_exprs( //dir=expr
+ unique int id: @tap_expr,
+ int body: @brace_stmt_or_none ref,
+ int var: @var_decl_or_none ref
+);
+
+#keyset[id]
+tap_expr_sub_exprs( //dir=expr
+ int id: @tap_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+tuple_element_exprs( //dir=expr
+ unique int id: @tuple_element_expr,
+ int sub_expr: @expr_or_none ref,
+ int index: int ref
+);
+
+tuple_exprs( //dir=expr
+ unique int id: @tuple_expr
+);
+
+#keyset[id, index]
+tuple_expr_elements( //dir=expr
+ int id: @tuple_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+type_exprs( //dir=expr
+ unique int id: @type_expr
+);
+
+#keyset[id]
+type_expr_type_reprs( //dir=expr
+ int id: @type_expr ref,
+ int type_repr: @type_repr_or_none ref
+);
+
+type_value_exprs( //dir=expr
+ unique int id: @type_value_expr,
+ int type_repr: @type_repr_or_none ref
+);
+
+unresolved_decl_ref_exprs( //dir=expr
+ unique int id: @unresolved_decl_ref_expr
+);
+
+#keyset[id]
+unresolved_decl_ref_expr_names( //dir=expr
+ int id: @unresolved_decl_ref_expr ref,
+ string name: string ref
+);
+
+unresolved_dot_exprs( //dir=expr
+ unique int id: @unresolved_dot_expr,
+ int base: @expr_or_none ref,
+ string name: string ref
+);
+
+unresolved_member_exprs( //dir=expr
+ unique int id: @unresolved_member_expr,
+ string name: string ref
+);
+
+unresolved_pattern_exprs( //dir=expr
+ unique int id: @unresolved_pattern_expr,
+ int sub_pattern: @pattern_or_none ref
+);
+
+unresolved_specialize_exprs( //dir=expr
+ unique int id: @unresolved_specialize_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+vararg_expansion_exprs( //dir=expr
+ unique int id: @vararg_expansion_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+abi_safe_conversion_exprs( //dir=expr
+ unique int id: @abi_safe_conversion_expr
+);
+
+actor_isolation_erasure_exprs( //dir=expr
+ unique int id: @actor_isolation_erasure_expr
+);
+
+any_hashable_erasure_exprs( //dir=expr
+ unique int id: @any_hashable_erasure_expr
+);
+
+archetype_to_super_exprs( //dir=expr
+ unique int id: @archetype_to_super_expr
+);
+
+array_exprs( //dir=expr
+ unique int id: @array_expr
+);
+
+#keyset[id, index]
+array_expr_elements( //dir=expr
+ int id: @array_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+array_to_pointer_exprs( //dir=expr
+ unique int id: @array_to_pointer_expr
+);
+
+auto_closure_exprs( //dir=expr
+ unique int id: @auto_closure_expr
+);
+
+await_exprs( //dir=expr
+ unique int id: @await_expr
+);
+
+binary_exprs( //dir=expr
+ unique int id: @binary_expr
+);
+
+borrow_exprs( //dir=expr
+ unique int id: @borrow_expr
+);
+
+bridge_from_obj_c_exprs( //dir=expr
+ unique int id: @bridge_from_obj_c_expr
+);
+
+bridge_to_obj_c_exprs( //dir=expr
+ unique int id: @bridge_to_obj_c_expr
+);
+
+@builtin_literal_expr =
+ @boolean_literal_expr
+| @magic_identifier_literal_expr
+| @number_literal_expr
+| @string_literal_expr
+;
+
+call_exprs( //dir=expr
+ unique int id: @call_expr
+);
+
+@checked_cast_expr =
+ @conditional_checked_cast_expr
+| @forced_checked_cast_expr
+| @is_expr
+;
+
+class_metatype_to_object_exprs( //dir=expr
+ unique int id: @class_metatype_to_object_expr
+);
+
+coerce_exprs( //dir=expr
+ unique int id: @coerce_expr
+);
+
+collection_upcast_conversion_exprs( //dir=expr
+ unique int id: @collection_upcast_conversion_expr
+);
+
+conditional_bridge_from_obj_c_exprs( //dir=expr
+ unique int id: @conditional_bridge_from_obj_c_expr
+);
+
+covariant_function_conversion_exprs( //dir=expr
+ unique int id: @covariant_function_conversion_expr
+);
+
+covariant_return_conversion_exprs( //dir=expr
+ unique int id: @covariant_return_conversion_expr
+);
+
+derived_to_base_exprs( //dir=expr
+ unique int id: @derived_to_base_expr
+);
+
+destructure_tuple_exprs( //dir=expr
+ unique int id: @destructure_tuple_expr
+);
+
+dictionary_exprs( //dir=expr
+ unique int id: @dictionary_expr
+);
+
+#keyset[id, index]
+dictionary_expr_elements( //dir=expr
+ int id: @dictionary_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+differentiable_function_exprs( //dir=expr
+ unique int id: @differentiable_function_expr
+);
+
+differentiable_function_extract_original_exprs( //dir=expr
+ unique int id: @differentiable_function_extract_original_expr
+);
+
+dot_self_exprs( //dir=expr
+ unique int id: @dot_self_expr
+);
+
+@dynamic_lookup_expr =
+ @dynamic_member_ref_expr
+| @dynamic_subscript_expr
+;
+
+erasure_exprs( //dir=expr
+ unique int id: @erasure_expr
+);
+
+existential_metatype_to_object_exprs( //dir=expr
+ unique int id: @existential_metatype_to_object_expr
+);
+
+explicit_closure_exprs( //dir=expr
+ unique int id: @explicit_closure_expr
+);
+
+force_try_exprs( //dir=expr
+ unique int id: @force_try_expr
+);
+
+foreign_object_conversion_exprs( //dir=expr
+ unique int id: @foreign_object_conversion_expr
+);
+
+function_conversion_exprs( //dir=expr
+ unique int id: @function_conversion_expr
+);
+
+in_out_to_pointer_exprs( //dir=expr
+ unique int id: @in_out_to_pointer_expr
+);
+
+inject_into_optional_exprs( //dir=expr
+ unique int id: @inject_into_optional_expr
+);
+
+interpolated_string_literal_exprs( //dir=expr
+ unique int id: @interpolated_string_literal_expr
+);
+
+#keyset[id]
+interpolated_string_literal_expr_interpolation_exprs( //dir=expr
+ int id: @interpolated_string_literal_expr ref,
+ int interpolation_expr: @opaque_value_expr_or_none ref
+);
+
+#keyset[id]
+interpolated_string_literal_expr_appending_exprs( //dir=expr
+ int id: @interpolated_string_literal_expr ref,
+ int appending_expr: @tap_expr_or_none ref
+);
+
+linear_function_exprs( //dir=expr
+ unique int id: @linear_function_expr
+);
+
+linear_function_extract_original_exprs( //dir=expr
+ unique int id: @linear_function_extract_original_expr
+);
+
+linear_to_differentiable_function_exprs( //dir=expr
+ unique int id: @linear_to_differentiable_function_expr
+);
+
+load_exprs( //dir=expr
+ unique int id: @load_expr
+);
+
+member_ref_exprs( //dir=expr
+ unique int id: @member_ref_expr
+);
+
+#keyset[id]
+member_ref_expr_has_direct_to_storage_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+#keyset[id]
+member_ref_expr_has_direct_to_implementation_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+#keyset[id]
+member_ref_expr_has_ordinary_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+#keyset[id]
+member_ref_expr_has_distributed_thunk_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+metatype_conversion_exprs( //dir=expr
+ unique int id: @metatype_conversion_expr
+);
+
+nil_literal_exprs( //dir=expr
+ unique int id: @nil_literal_expr
+);
+
+object_literal_exprs( //dir=expr
+ unique int id: @object_literal_expr,
+ int kind: int ref
+);
+
+#keyset[id, index]
+object_literal_expr_arguments( //dir=expr
+ int id: @object_literal_expr ref,
+ int index: int ref,
+ int argument: @argument_or_none ref
+);
+
+optional_try_exprs( //dir=expr
+ unique int id: @optional_try_expr
+);
+
+paren_exprs( //dir=expr
+ unique int id: @paren_expr
+);
+
+pointer_to_pointer_exprs( //dir=expr
+ unique int id: @pointer_to_pointer_expr
+);
+
+postfix_unary_exprs( //dir=expr
+ unique int id: @postfix_unary_expr
+);
+
+prefix_unary_exprs( //dir=expr
+ unique int id: @prefix_unary_expr
+);
+
+protocol_metatype_to_object_exprs( //dir=expr
+ unique int id: @protocol_metatype_to_object_expr
+);
+
+regex_literal_exprs( //dir=expr
+ unique int id: @regex_literal_expr,
+ string pattern: string ref,
+ int version: int ref
+);
+
+@self_apply_expr =
+ @dot_syntax_call_expr
+| @initializer_ref_call_expr
+;
+
+#keyset[id]
+self_apply_exprs( //dir=expr
+ int id: @self_apply_expr ref,
+ int base: @expr_or_none ref
+);
+
+string_to_pointer_exprs( //dir=expr
+ unique int id: @string_to_pointer_expr
+);
+
+subscript_exprs( //dir=expr
+ unique int id: @subscript_expr
+);
+
+#keyset[id, index]
+subscript_expr_arguments( //dir=expr
+ int id: @subscript_expr ref,
+ int index: int ref,
+ int argument: @argument_or_none ref
+);
+
+#keyset[id]
+subscript_expr_has_direct_to_storage_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+#keyset[id]
+subscript_expr_has_direct_to_implementation_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+#keyset[id]
+subscript_expr_has_ordinary_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+#keyset[id]
+subscript_expr_has_distributed_thunk_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+try_exprs( //dir=expr
+ unique int id: @try_expr
+);
+
+underlying_to_opaque_exprs( //dir=expr
+ unique int id: @underlying_to_opaque_expr
+);
+
+unevaluated_instance_exprs( //dir=expr
+ unique int id: @unevaluated_instance_expr
+);
+
+unreachable_exprs( //dir=expr
+ unique int id: @unreachable_expr
+);
+
+unresolved_member_chain_result_exprs( //dir=expr
+ unique int id: @unresolved_member_chain_result_expr
+);
+
+unresolved_type_conversion_exprs( //dir=expr
+ unique int id: @unresolved_type_conversion_expr
+);
+
+unsafe_cast_exprs( //dir=expr
+ unique int id: @unsafe_cast_expr
+);
+
+unsafe_exprs( //dir=expr
+ unique int id: @unsafe_expr
+);
+
+boolean_literal_exprs( //dir=expr
+ unique int id: @boolean_literal_expr,
+ boolean value: boolean ref
+);
+
+conditional_checked_cast_exprs( //dir=expr
+ unique int id: @conditional_checked_cast_expr
+);
+
+dot_syntax_call_exprs( //dir=expr
+ unique int id: @dot_syntax_call_expr
+);
+
+dynamic_member_ref_exprs( //dir=expr
+ unique int id: @dynamic_member_ref_expr
+);
+
+dynamic_subscript_exprs( //dir=expr
+ unique int id: @dynamic_subscript_expr
+);
+
+forced_checked_cast_exprs( //dir=expr
+ unique int id: @forced_checked_cast_expr
+);
+
+initializer_ref_call_exprs( //dir=expr
+ unique int id: @initializer_ref_call_expr
+);
+
+is_exprs( //dir=expr
+ unique int id: @is_expr
+);
+
+magic_identifier_literal_exprs( //dir=expr
+ unique int id: @magic_identifier_literal_expr,
+ string kind: string ref
+);
+
+@number_literal_expr =
+ @float_literal_expr
+| @integer_literal_expr
+;
+
+string_literal_exprs( //dir=expr
+ unique int id: @string_literal_expr,
+ string value: string ref
+);
+
+float_literal_exprs( //dir=expr
+ unique int id: @float_literal_expr,
+ string string_value: string ref
+);
+
+integer_literal_exprs( //dir=expr
+ unique int id: @integer_literal_expr,
+ string string_value: string ref
+);
+
+@pattern =
+ @any_pattern
+| @binding_pattern
+| @bool_pattern
+| @enum_element_pattern
+| @expr_pattern
+| @is_pattern
+| @named_pattern
+| @optional_some_pattern
+| @paren_pattern
+| @tuple_pattern
+| @typed_pattern
+;
+
+#keyset[id]
+pattern_types( //dir=pattern
+ int id: @pattern ref,
+ int type_: @type_or_none ref
+);
+
+any_patterns( //dir=pattern
+ unique int id: @any_pattern
+);
+
+binding_patterns( //dir=pattern
+ unique int id: @binding_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+bool_patterns( //dir=pattern
+ unique int id: @bool_pattern,
+ boolean value: boolean ref
+);
+
+enum_element_patterns( //dir=pattern
+ unique int id: @enum_element_pattern,
+ int element: @enum_element_decl_or_none ref
+);
+
+#keyset[id]
+enum_element_pattern_sub_patterns( //dir=pattern
+ int id: @enum_element_pattern ref,
+ int sub_pattern: @pattern_or_none ref
+);
+
+expr_patterns( //dir=pattern
+ unique int id: @expr_pattern,
+ int sub_expr: @expr_or_none ref
+);
+
+is_patterns( //dir=pattern
+ unique int id: @is_pattern
+);
+
+#keyset[id]
+is_pattern_cast_type_reprs( //dir=pattern
+ int id: @is_pattern ref,
+ int cast_type_repr: @type_repr_or_none ref
+);
+
+#keyset[id]
+is_pattern_sub_patterns( //dir=pattern
+ int id: @is_pattern ref,
+ int sub_pattern: @pattern_or_none ref
+);
+
+named_patterns( //dir=pattern
+ unique int id: @named_pattern,
+ int var_decl: @var_decl_or_none ref
+);
+
+optional_some_patterns( //dir=pattern
+ unique int id: @optional_some_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+paren_patterns( //dir=pattern
+ unique int id: @paren_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+tuple_patterns( //dir=pattern
+ unique int id: @tuple_pattern
+);
+
+#keyset[id, index]
+tuple_pattern_elements( //dir=pattern
+ int id: @tuple_pattern ref,
+ int index: int ref,
+ int element: @pattern_or_none ref
+);
+
+typed_patterns( //dir=pattern
+ unique int id: @typed_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+typed_pattern_type_reprs( //dir=pattern
+ int id: @typed_pattern ref,
+ int type_repr: @type_repr_or_none ref
+);
+
+case_label_items( //dir=stmt
+ unique int id: @case_label_item,
+ int pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+case_label_item_guards( //dir=stmt
+ int id: @case_label_item ref,
+ int guard: @expr_or_none ref
+);
+
+condition_elements( //dir=stmt
+ unique int id: @condition_element
+);
+
+#keyset[id]
+condition_element_booleans( //dir=stmt
+ int id: @condition_element ref,
+ int boolean_: @expr_or_none ref
+);
+
+#keyset[id]
+condition_element_patterns( //dir=stmt
+ int id: @condition_element ref,
+ int pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+condition_element_initializers( //dir=stmt
+ int id: @condition_element ref,
+ int initializer: @expr_or_none ref
+);
+
+#keyset[id]
+condition_element_availabilities( //dir=stmt
+ int id: @condition_element ref,
+ int availability: @availability_info_or_none ref
+);
+
+@stmt =
+ @brace_stmt
+| @break_stmt
+| @case_stmt
+| @continue_stmt
+| @defer_stmt
+| @discard_stmt
+| @fail_stmt
+| @fallthrough_stmt
+| @labeled_stmt
+| @pound_assert_stmt
+| @return_stmt
+| @then_stmt
+| @throw_stmt
+| @yield_stmt
+;
+
+stmt_conditions( //dir=stmt
+ unique int id: @stmt_condition
+);
+
+#keyset[id, index]
+stmt_condition_elements( //dir=stmt
+ int id: @stmt_condition ref,
+ int index: int ref,
+ int element: @condition_element_or_none ref
+);
+
+brace_stmts( //dir=stmt
+ unique int id: @brace_stmt
+);
+
+#keyset[id, index]
+brace_stmt_elements( //dir=stmt
+ int id: @brace_stmt ref,
+ int index: int ref,
+ int element: @ast_node_or_none ref
+);
+
+break_stmts( //dir=stmt
+ unique int id: @break_stmt
+);
+
+#keyset[id]
+break_stmt_target_names( //dir=stmt
+ int id: @break_stmt ref,
+ string target_name: string ref
+);
+
+#keyset[id]
+break_stmt_targets( //dir=stmt
+ int id: @break_stmt ref,
+ int target: @stmt_or_none ref
+);
+
+case_stmts( //dir=stmt
+ unique int id: @case_stmt,
+ int body: @stmt_or_none ref
+);
+
+#keyset[id, index]
+case_stmt_labels( //dir=stmt
+ int id: @case_stmt ref,
+ int index: int ref,
+ int label: @case_label_item_or_none ref
+);
+
+#keyset[id, index]
+case_stmt_variables( //dir=stmt
+ int id: @case_stmt ref,
+ int index: int ref,
+ int variable: @var_decl_or_none ref
+);
+
+continue_stmts( //dir=stmt
+ unique int id: @continue_stmt
+);
+
+#keyset[id]
+continue_stmt_target_names( //dir=stmt
+ int id: @continue_stmt ref,
+ string target_name: string ref
+);
+
+#keyset[id]
+continue_stmt_targets( //dir=stmt
+ int id: @continue_stmt ref,
+ int target: @stmt_or_none ref
+);
+
+defer_stmts( //dir=stmt
+ unique int id: @defer_stmt,
+ int body: @brace_stmt_or_none ref
+);
+
+discard_stmts( //dir=stmt
+ unique int id: @discard_stmt,
+ int sub_expr: @expr_or_none ref
+);
+
+fail_stmts( //dir=stmt
+ unique int id: @fail_stmt
+);
+
+fallthrough_stmts( //dir=stmt
+ unique int id: @fallthrough_stmt,
+ int fallthrough_source: @case_stmt_or_none ref,
+ int fallthrough_dest: @case_stmt_or_none ref
+);
+
+@labeled_stmt =
+ @do_catch_stmt
+| @do_stmt
+| @for_each_stmt
+| @labeled_conditional_stmt
+| @repeat_while_stmt
+| @switch_stmt
+;
+
+#keyset[id]
+labeled_stmt_labels( //dir=stmt
+ int id: @labeled_stmt ref,
+ string label: string ref
+);
+
+pound_assert_stmts( //dir=stmt
+ unique int id: @pound_assert_stmt,
+ int condition: @expr_or_none ref,
+ string message: string ref
+);
+
+return_stmts( //dir=stmt
+ unique int id: @return_stmt
+);
+
+#keyset[id]
+return_stmt_results( //dir=stmt
+ int id: @return_stmt ref,
+ int result: @expr_or_none ref
+);
+
+then_stmts( //dir=stmt
+ unique int id: @then_stmt,
+ int result: @expr_or_none ref
+);
+
+throw_stmts( //dir=stmt
+ unique int id: @throw_stmt,
+ int sub_expr: @expr_or_none ref
+);
+
+yield_stmts( //dir=stmt
+ unique int id: @yield_stmt
+);
+
+#keyset[id, index]
+yield_stmt_results( //dir=stmt
+ int id: @yield_stmt ref,
+ int index: int ref,
+ int result: @expr_or_none ref
+);
+
+do_catch_stmts( //dir=stmt
+ unique int id: @do_catch_stmt,
+ int body: @stmt_or_none ref
+);
+
+#keyset[id, index]
+do_catch_stmt_catches( //dir=stmt
+ int id: @do_catch_stmt ref,
+ int index: int ref,
+ int catch: @case_stmt_or_none ref
+);
+
+do_stmts( //dir=stmt
+ unique int id: @do_stmt,
+ int body: @brace_stmt_or_none ref
+);
+
+for_each_stmts( //dir=stmt
+ unique int id: @for_each_stmt,
+ int pattern: @pattern_or_none ref,
+ int body: @brace_stmt_or_none ref
+);
+
+#keyset[id, index]
+for_each_stmt_variables( //dir=stmt
+ int id: @for_each_stmt ref,
+ int index: int ref,
+ int variable: @var_decl_or_none ref
+);
+
+#keyset[id]
+for_each_stmt_wheres( //dir=stmt
+ int id: @for_each_stmt ref,
+ int where: @expr_or_none ref
+);
+
+#keyset[id]
+for_each_stmt_iterator_vars( //dir=stmt
+ int id: @for_each_stmt ref,
+ int iteratorVar: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+for_each_stmt_next_calls( //dir=stmt
+ int id: @for_each_stmt ref,
+ int nextCall: @expr_or_none ref
+);
+
+@labeled_conditional_stmt =
+ @guard_stmt
+| @if_stmt
+| @while_stmt
+;
+
+#keyset[id]
+labeled_conditional_stmts( //dir=stmt
+ int id: @labeled_conditional_stmt ref,
+ int condition: @stmt_condition_or_none ref
+);
+
+repeat_while_stmts( //dir=stmt
+ unique int id: @repeat_while_stmt,
+ int condition: @expr_or_none ref,
+ int body: @stmt_or_none ref
+);
+
+switch_stmts( //dir=stmt
+ unique int id: @switch_stmt,
+ int expr: @expr_or_none ref
+);
+
+#keyset[id, index]
+switch_stmt_cases( //dir=stmt
+ int id: @switch_stmt ref,
+ int index: int ref,
+ int case_: @case_stmt_or_none ref
+);
+
+guard_stmts( //dir=stmt
+ unique int id: @guard_stmt,
+ int body: @brace_stmt_or_none ref
+);
+
+if_stmts( //dir=stmt
+ unique int id: @if_stmt,
+ int then: @stmt_or_none ref
+);
+
+#keyset[id]
+if_stmt_elses( //dir=stmt
+ int id: @if_stmt ref,
+ int else: @stmt_or_none ref
+);
+
+while_stmts( //dir=stmt
+ unique int id: @while_stmt,
+ int body: @stmt_or_none ref
+);
+
+@type =
+ @any_function_type
+| @any_generic_type
+| @any_metatype_type
+| @builtin_type
+| @dependent_member_type
+| @dynamic_self_type
+| @error_type
+| @existential_type
+| @in_out_type
+| @integer_type
+| @l_value_type
+| @module_type
+| @pack_element_type
+| @pack_expansion_type
+| @pack_type
+| @parameterized_protocol_type
+| @protocol_composition_type
+| @reference_storage_type
+| @substitutable_type
+| @sugar_type
+| @tuple_type
+| @unresolved_type
+;
+
+#keyset[id]
+types( //dir=type
+ int id: @type ref,
+ string name: string ref,
+ int canonical_type: @type_or_none ref
+);
+
+type_reprs( //dir=type
+ unique int id: @type_repr,
+ int type_: @type_or_none ref
+);
+
+@any_function_type =
+ @function_type
+| @generic_function_type
+;
+
+#keyset[id]
+any_function_types( //dir=type
+ int id: @any_function_type ref,
+ int result: @type_or_none ref
+);
+
+#keyset[id, index]
+any_function_type_param_types( //dir=type
+ int id: @any_function_type ref,
+ int index: int ref,
+ int param_type: @type_or_none ref
+);
+
+#keyset[id]
+any_function_type_is_throwing( //dir=type
+ int id: @any_function_type ref
+);
+
+#keyset[id]
+any_function_type_is_async( //dir=type
+ int id: @any_function_type ref
+);
+
+@any_generic_type =
+ @nominal_or_bound_generic_nominal_type
+| @unbound_generic_type
+;
+
+#keyset[id]
+any_generic_types( //dir=type
+ int id: @any_generic_type ref,
+ int declaration: @generic_type_decl_or_none ref
+);
+
+#keyset[id]
+any_generic_type_parents( //dir=type
+ int id: @any_generic_type ref,
+ int parent: @type_or_none ref
+);
+
+@any_metatype_type =
+ @existential_metatype_type
+| @metatype_type
+;
+
+@builtin_type =
+ @any_builtin_integer_type
+| @builtin_bridge_object_type
+| @builtin_default_actor_storage_type
+| @builtin_executor_type
+| @builtin_float_type
+| @builtin_generic_type
+| @builtin_job_type
+| @builtin_native_object_type
+| @builtin_raw_pointer_type
+| @builtin_raw_unsafe_continuation_type
+| @builtin_unsafe_value_buffer_type
+| @builtin_vector_type
+;
+
+dependent_member_types( //dir=type
+ unique int id: @dependent_member_type,
+ int base_type: @type_or_none ref,
+ int associated_type_decl: @associated_type_decl_or_none ref
+);
+
+dynamic_self_types( //dir=type
+ unique int id: @dynamic_self_type,
+ int static_self_type: @type_or_none ref
+);
+
+error_types( //dir=type
+ unique int id: @error_type
+);
+
+existential_types( //dir=type
+ unique int id: @existential_type,
+ int constraint: @type_or_none ref
+);
+
+in_out_types( //dir=type
+ unique int id: @in_out_type,
+ int object_type: @type_or_none ref
+);
+
+integer_types( //dir=type
+ unique int id: @integer_type,
+ string value: string ref
+);
+
+l_value_types( //dir=type
+ unique int id: @l_value_type,
+ int object_type: @type_or_none ref
+);
+
+module_types( //dir=type
+ unique int id: @module_type,
+ int module: @module_decl_or_none ref
+);
+
+pack_element_types( //dir=type
+ unique int id: @pack_element_type,
+ int pack_type: @type_or_none ref
+);
+
+pack_expansion_types( //dir=type
+ unique int id: @pack_expansion_type,
+ int pattern_type: @type_or_none ref,
+ int count_type: @type_or_none ref
+);
+
+pack_types( //dir=type
+ unique int id: @pack_type
+);
+
+#keyset[id, index]
+pack_type_elements( //dir=type
+ int id: @pack_type ref,
+ int index: int ref,
+ int element: @type_or_none ref
+);
+
+parameterized_protocol_types( //dir=type
+ unique int id: @parameterized_protocol_type,
+ int base: @protocol_type_or_none ref
+);
+
+#keyset[id, index]
+parameterized_protocol_type_args( //dir=type
+ int id: @parameterized_protocol_type ref,
+ int index: int ref,
+ int arg: @type_or_none ref
+);
+
+protocol_composition_types( //dir=type
+ unique int id: @protocol_composition_type
+);
+
+#keyset[id, index]
+protocol_composition_type_members( //dir=type
+ int id: @protocol_composition_type ref,
+ int index: int ref,
+ int member: @type_or_none ref
+);
+
+@reference_storage_type =
+ @unmanaged_storage_type
+| @unowned_storage_type
+| @weak_storage_type
+;
+
+#keyset[id]
+reference_storage_types( //dir=type
+ int id: @reference_storage_type ref,
+ int referent_type: @type_or_none ref
+);
+
+@substitutable_type =
+ @archetype_type
+| @generic_type_param_type
+;
+
+@sugar_type =
+ @paren_type
+| @syntax_sugar_type
+| @type_alias_type
+;
+
+tuple_types( //dir=type
+ unique int id: @tuple_type
+);
+
+#keyset[id, index]
+tuple_type_types( //dir=type
+ int id: @tuple_type ref,
+ int index: int ref,
+ int type_: @type_or_none ref
+);
+
+#keyset[id, index]
+tuple_type_names( //dir=type
+ int id: @tuple_type ref,
+ int index: int ref,
+ string name: string ref
+);
+
+unresolved_types( //dir=type
+ unique int id: @unresolved_type
+);
+
+@any_builtin_integer_type =
+ @builtin_integer_literal_type
+| @builtin_integer_type
+;
+
+@archetype_type =
+ @local_archetype_type
+| @opaque_type_archetype_type
+| @pack_archetype_type
+| @primary_archetype_type
+;
+
+#keyset[id]
+archetype_types( //dir=type
+ int id: @archetype_type ref,
+ int interface_type: @type_or_none ref
+);
+
+#keyset[id]
+archetype_type_superclasses( //dir=type
+ int id: @archetype_type ref,
+ int superclass: @type_or_none ref
+);
+
+#keyset[id, index]
+archetype_type_protocols( //dir=type
+ int id: @archetype_type ref,
+ int index: int ref,
+ int protocol: @protocol_decl_or_none ref
+);
+
+builtin_bridge_object_types( //dir=type
+ unique int id: @builtin_bridge_object_type
+);
+
+builtin_default_actor_storage_types( //dir=type
+ unique int id: @builtin_default_actor_storage_type
+);
+
+builtin_executor_types( //dir=type
+ unique int id: @builtin_executor_type
+);
+
+builtin_float_types( //dir=type
+ unique int id: @builtin_float_type
+);
+
+@builtin_generic_type =
+ @builtin_fixed_array_type
+;
+
+builtin_job_types( //dir=type
+ unique int id: @builtin_job_type
+);
+
+builtin_native_object_types( //dir=type
+ unique int id: @builtin_native_object_type
+);
+
+builtin_raw_pointer_types( //dir=type
+ unique int id: @builtin_raw_pointer_type
+);
+
+builtin_raw_unsafe_continuation_types( //dir=type
+ unique int id: @builtin_raw_unsafe_continuation_type
+);
+
+builtin_unsafe_value_buffer_types( //dir=type
+ unique int id: @builtin_unsafe_value_buffer_type
+);
+
+builtin_vector_types( //dir=type
+ unique int id: @builtin_vector_type
+);
+
+existential_metatype_types( //dir=type
+ unique int id: @existential_metatype_type
+);
+
+function_types( //dir=type
+ unique int id: @function_type
+);
+
+generic_function_types( //dir=type
+ unique int id: @generic_function_type
+);
+
+#keyset[id, index]
+generic_function_type_generic_params( //dir=type
+ int id: @generic_function_type ref,
+ int index: int ref,
+ int generic_param: @generic_type_param_type_or_none ref
+);
+
+generic_type_param_types( //dir=type
+ unique int id: @generic_type_param_type
+);
+
+metatype_types( //dir=type
+ unique int id: @metatype_type
+);
+
+@nominal_or_bound_generic_nominal_type =
+ @bound_generic_type
+| @nominal_type
+;
+
+paren_types( //dir=type
+ unique int id: @paren_type,
+ int type_: @type_or_none ref
+);
+
+@syntax_sugar_type =
+ @dictionary_type
+| @inline_array_type
+| @unary_syntax_sugar_type
+;
+
+type_alias_types( //dir=type
+ unique int id: @type_alias_type,
+ int decl: @type_alias_decl_or_none ref
+);
+
+unbound_generic_types( //dir=type
+ unique int id: @unbound_generic_type
+);
+
+unmanaged_storage_types( //dir=type
+ unique int id: @unmanaged_storage_type
+);
+
+unowned_storage_types( //dir=type
+ unique int id: @unowned_storage_type
+);
+
+weak_storage_types( //dir=type
+ unique int id: @weak_storage_type
+);
+
+@bound_generic_type =
+ @bound_generic_class_type
+| @bound_generic_enum_type
+| @bound_generic_struct_type
+;
+
+#keyset[id, index]
+bound_generic_type_arg_types( //dir=type
+ int id: @bound_generic_type ref,
+ int index: int ref,
+ int arg_type: @type_or_none ref
+);
+
+builtin_fixed_array_types( //dir=type
+ unique int id: @builtin_fixed_array_type,
+ int size: @type_or_none ref,
+ int element_type: @type_or_none ref
+);
+
+builtin_integer_literal_types( //dir=type
+ unique int id: @builtin_integer_literal_type
+);
+
+builtin_integer_types( //dir=type
+ unique int id: @builtin_integer_type
+);
+
+#keyset[id]
+builtin_integer_type_widths( //dir=type
+ int id: @builtin_integer_type ref,
+ int width: int ref
+);
+
+dictionary_types( //dir=type
+ unique int id: @dictionary_type,
+ int key_type: @type_or_none ref,
+ int value_type: @type_or_none ref
+);
+
+inline_array_types( //dir=type
+ unique int id: @inline_array_type,
+ int count_type: @type_or_none ref,
+ int element_type: @type_or_none ref
+);
+
+@local_archetype_type =
+ @element_archetype_type
+| @existential_archetype_type
+;
+
+@nominal_type =
+ @class_type
+| @enum_type
+| @protocol_type
+| @struct_type
+;
+
+opaque_type_archetype_types( //dir=type
+ unique int id: @opaque_type_archetype_type,
+ int declaration: @opaque_type_decl_or_none ref
+);
+
+pack_archetype_types( //dir=type
+ unique int id: @pack_archetype_type
+);
+
+primary_archetype_types( //dir=type
+ unique int id: @primary_archetype_type
+);
+
+@unary_syntax_sugar_type =
+ @array_slice_type
+| @optional_type
+| @variadic_sequence_type
+;
+
+#keyset[id]
+unary_syntax_sugar_types( //dir=type
+ int id: @unary_syntax_sugar_type ref,
+ int base_type: @type_or_none ref
+);
+
+array_slice_types( //dir=type
+ unique int id: @array_slice_type
+);
+
+bound_generic_class_types( //dir=type
+ unique int id: @bound_generic_class_type
+);
+
+bound_generic_enum_types( //dir=type
+ unique int id: @bound_generic_enum_type
+);
+
+bound_generic_struct_types( //dir=type
+ unique int id: @bound_generic_struct_type
+);
+
+class_types( //dir=type
+ unique int id: @class_type
+);
+
+element_archetype_types( //dir=type
+ unique int id: @element_archetype_type
+);
+
+enum_types( //dir=type
+ unique int id: @enum_type
+);
+
+existential_archetype_types( //dir=type
+ unique int id: @existential_archetype_type
+);
+
+optional_types( //dir=type
+ unique int id: @optional_type
+);
+
+protocol_types( //dir=type
+ unique int id: @protocol_type
+);
+
+struct_types( //dir=type
+ unique int id: @struct_type
+);
+
+variadic_sequence_types( //dir=type
+ unique int id: @variadic_sequence_type
+);
+
+@accessor_or_none =
+ @accessor
+| @unspecified_element
+;
+
+@argument_or_none =
+ @argument
+| @unspecified_element
+;
+
+@associated_type_decl_or_none =
+ @associated_type_decl
+| @unspecified_element
+;
+
+@ast_node_or_none =
+ @ast_node
+| @unspecified_element
+;
+
+@availability_info_or_none =
+ @availability_info
+| @unspecified_element
+;
+
+@availability_spec_or_none =
+ @availability_spec
+| @unspecified_element
+;
+
+@brace_stmt_or_none =
+ @brace_stmt
+| @unspecified_element
+;
+
+@captured_decl_or_none =
+ @captured_decl
+| @unspecified_element
+;
+
+@case_label_item_or_none =
+ @case_label_item
+| @unspecified_element
+;
+
+@case_stmt_or_none =
+ @case_stmt
+| @unspecified_element
+;
+
+@closure_expr_or_none =
+ @closure_expr
+| @unspecified_element
+;
+
+@condition_element_or_none =
+ @condition_element
+| @unspecified_element
+;
+
+@decl_or_none =
+ @decl
+| @unspecified_element
+;
+
+@enum_element_decl_or_none =
+ @enum_element_decl
+| @unspecified_element
+;
+
+@expr_or_none =
+ @expr
+| @unspecified_element
+;
+
+@file_or_none =
+ @file
+| @unspecified_element
+;
+
+@function_or_none =
+ @function
+| @unspecified_element
+;
+
+@generic_type_decl_or_none =
+ @generic_type_decl
+| @unspecified_element
+;
+
+@generic_type_param_decl_or_none =
+ @generic_type_param_decl
+| @unspecified_element
+;
+
+@generic_type_param_type_or_none =
+ @generic_type_param_type
+| @unspecified_element
+;
+
+@initializer_or_none =
+ @initializer
+| @unspecified_element
+;
+
+@key_path_component_or_none =
+ @key_path_component
+| @unspecified_element
+;
+
+@location_or_none =
+ @location
+| @unspecified_element
+;
+
+@macro_role_or_none =
+ @macro_role
+| @unspecified_element
+;
+
+@module_decl_or_none =
+ @module_decl
+| @unspecified_element
+;
+
+@nominal_type_decl_or_none =
+ @nominal_type_decl
+| @unspecified_element
+;
+
+@opaque_type_decl_or_none =
+ @opaque_type_decl
+| @unspecified_element
+;
+
+@opaque_value_expr_or_none =
+ @opaque_value_expr
+| @unspecified_element
+;
+
+@param_decl_or_none =
+ @param_decl
+| @unspecified_element
+;
+
+@pattern_or_none =
+ @pattern
+| @unspecified_element
+;
+
+@pattern_binding_decl_or_none =
+ @pattern_binding_decl
+| @unspecified_element
+;
+
+@precedence_group_decl_or_none =
+ @precedence_group_decl
+| @unspecified_element
+;
+
+@protocol_decl_or_none =
+ @protocol_decl
+| @unspecified_element
+;
+
+@protocol_type_or_none =
+ @protocol_type
+| @unspecified_element
+;
+
+@stmt_or_none =
+ @stmt
+| @unspecified_element
+;
+
+@stmt_condition_or_none =
+ @stmt_condition
+| @unspecified_element
+;
+
+@string_literal_expr_or_none =
+ @string_literal_expr
+| @unspecified_element
+;
+
+@tap_expr_or_none =
+ @tap_expr
+| @unspecified_element
+;
+
+@type_or_none =
+ @type
+| @unspecified_element
+;
+
+@type_alias_decl_or_none =
+ @type_alias_decl
+| @unspecified_element
+;
+
+@type_repr_or_none =
+ @type_repr
+| @unspecified_element
+;
+
+@value_decl_or_none =
+ @unspecified_element
+| @value_decl
+;
+
+@var_decl_or_none =
+ @unspecified_element
+| @var_decl
+;
diff --git a/swift/ql/lib/upgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/swift.dbscheme b/swift/ql/lib/upgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/swift.dbscheme
new file mode 100644
index 000000000000..1bb163e31d20
--- /dev/null
+++ b/swift/ql/lib/upgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/swift.dbscheme
@@ -0,0 +1,2892 @@
+// generated by codegen/codegen.py, do not edit
+
+// from prefix.dbscheme
+/**
+ * The source location of the snapshot.
+ */
+sourceLocationPrefix(
+ string prefix: string ref
+);
+
+
+// from schema.py
+
+@element =
+ @file
+| @generic_context
+| @locatable
+| @location
+| @type
+;
+
+#keyset[id]
+element_is_unknown(
+ int id: @element ref
+);
+
+@file =
+ @db_file
+;
+
+#keyset[id]
+files(
+ int id: @file ref,
+ string name: string ref
+);
+
+#keyset[id]
+file_is_successfully_extracted(
+ int id: @file ref
+);
+
+@locatable =
+ @argument
+| @ast_node
+| @comment
+| @diagnostics
+| @error_element
+;
+
+#keyset[id]
+locatable_locations(
+ int id: @locatable ref,
+ int location: @location_or_none ref
+);
+
+@location =
+ @db_location
+;
+
+#keyset[id]
+locations(
+ int id: @location ref,
+ int file: @file_or_none ref,
+ int start_line: int ref,
+ int start_column: int ref,
+ int end_line: int ref,
+ int end_column: int ref
+);
+
+@ast_node =
+ @availability_info
+| @availability_spec
+| @callable
+| @case_label_item
+| @condition_element
+| @decl
+| @expr
+| @key_path_component
+| @macro_role
+| @pattern
+| @stmt
+| @stmt_condition
+| @type_repr
+;
+
+comments(
+ unique int id: @comment,
+ string text: string ref
+);
+
+db_files(
+ unique int id: @db_file
+);
+
+db_locations(
+ unique int id: @db_location
+);
+
+diagnostics(
+ unique int id: @diagnostics,
+ string text: string ref,
+ int kind: int ref
+);
+
+@error_element =
+ @error_expr
+| @error_type
+| @overloaded_decl_ref_expr
+| @unresolved_decl_ref_expr
+| @unresolved_dot_expr
+| @unresolved_member_chain_result_expr
+| @unresolved_member_expr
+| @unresolved_pattern_expr
+| @unresolved_specialize_expr
+| @unresolved_type
+| @unresolved_type_conversion_expr
+| @unspecified_element
+;
+
+availability_infos(
+ unique int id: @availability_info
+);
+
+#keyset[id]
+availability_info_is_unavailable(
+ int id: @availability_info ref
+);
+
+#keyset[id, index]
+availability_info_specs(
+ int id: @availability_info ref,
+ int index: int ref,
+ int spec: @availability_spec_or_none ref
+);
+
+availability_specs(
+ unique int id: @availability_spec
+);
+
+#keyset[id]
+availability_spec_platforms(
+ int id: @availability_spec ref,
+ string platform: string ref
+);
+
+#keyset[id]
+availability_spec_versions(
+ int id: @availability_spec ref,
+ string version: string ref
+);
+
+#keyset[id]
+availability_spec_is_wildcard(
+ int id: @availability_spec ref
+);
+
+@callable =
+ @closure_expr
+| @function
+;
+
+#keyset[id]
+callable_names(
+ int id: @callable ref,
+ string name: string ref
+);
+
+#keyset[id]
+callable_self_params(
+ int id: @callable ref,
+ int self_param: @param_decl_or_none ref
+);
+
+#keyset[id, index]
+callable_params(
+ int id: @callable ref,
+ int index: int ref,
+ int param: @param_decl_or_none ref
+);
+
+#keyset[id]
+callable_bodies(
+ int id: @callable ref,
+ int body: @brace_stmt_or_none ref
+);
+
+#keyset[id, index]
+callable_captures(
+ int id: @callable ref,
+ int index: int ref,
+ int capture: @captured_decl_or_none ref
+);
+
+key_path_components(
+ unique int id: @key_path_component,
+ int kind: int ref,
+ int component_type: @type_or_none ref
+);
+
+#keyset[id, index]
+key_path_component_subscript_arguments(
+ int id: @key_path_component ref,
+ int index: int ref,
+ int subscript_argument: @argument_or_none ref
+);
+
+#keyset[id]
+key_path_component_tuple_indices(
+ int id: @key_path_component ref,
+ int tuple_index: int ref
+);
+
+#keyset[id]
+key_path_component_decl_refs(
+ int id: @key_path_component ref,
+ int decl_ref: @value_decl_or_none ref
+);
+
+macro_roles(
+ unique int id: @macro_role,
+ int kind: int ref,
+ int macro_syntax: int ref
+);
+
+#keyset[id, index]
+macro_role_conformances(
+ int id: @macro_role ref,
+ int index: int ref,
+ int conformance: @expr_or_none ref
+);
+
+#keyset[id, index]
+macro_role_names(
+ int id: @macro_role ref,
+ int index: int ref,
+ string name: string ref
+);
+
+unspecified_elements(
+ unique int id: @unspecified_element,
+ string property: string ref,
+ string error: string ref
+);
+
+#keyset[id]
+unspecified_element_parents(
+ int id: @unspecified_element ref,
+ int parent: @element ref
+);
+
+#keyset[id]
+unspecified_element_indices(
+ int id: @unspecified_element ref,
+ int index: int ref
+);
+
+#keyset[id, index]
+unspecified_element_children(
+ int id: @unspecified_element ref,
+ int index: int ref,
+ int child: @ast_node_or_none ref
+);
+
+@decl =
+ @captured_decl
+| @enum_case_decl
+| @extension_decl
+| @if_config_decl
+| @import_decl
+| @missing_member_decl
+| @operator_decl
+| @pattern_binding_decl
+| @pound_diagnostic_decl
+| @precedence_group_decl
+| @top_level_code_decl
+| @using_decl
+| @value_decl
+;
+
+#keyset[id]
+decls( //dir=decl
+ int id: @decl ref,
+ int module: @module_decl_or_none ref
+);
+
+#keyset[id, index]
+decl_members( //dir=decl
+ int id: @decl ref,
+ int index: int ref,
+ int member: @decl_or_none ref
+);
+
+@generic_context =
+ @extension_decl
+| @function
+| @generic_type_decl
+| @macro_decl
+| @subscript_decl
+;
+
+#keyset[id, index]
+generic_context_generic_type_params( //dir=decl
+ int id: @generic_context ref,
+ int index: int ref,
+ int generic_type_param: @generic_type_param_decl_or_none ref
+);
+
+captured_decls( //dir=decl
+ unique int id: @captured_decl,
+ int decl: @value_decl_or_none ref
+);
+
+#keyset[id]
+captured_decl_is_direct( //dir=decl
+ int id: @captured_decl ref
+);
+
+#keyset[id]
+captured_decl_is_escaping( //dir=decl
+ int id: @captured_decl ref
+);
+
+enum_case_decls( //dir=decl
+ unique int id: @enum_case_decl
+);
+
+#keyset[id, index]
+enum_case_decl_elements( //dir=decl
+ int id: @enum_case_decl ref,
+ int index: int ref,
+ int element: @enum_element_decl_or_none ref
+);
+
+extension_decls( //dir=decl
+ unique int id: @extension_decl,
+ int extended_type_decl: @nominal_type_decl_or_none ref
+);
+
+#keyset[id, index]
+extension_decl_protocols( //dir=decl
+ int id: @extension_decl ref,
+ int index: int ref,
+ int protocol: @protocol_decl_or_none ref
+);
+
+if_config_decls( //dir=decl
+ unique int id: @if_config_decl
+);
+
+#keyset[id, index]
+if_config_decl_active_elements( //dir=decl
+ int id: @if_config_decl ref,
+ int index: int ref,
+ int active_element: @ast_node_or_none ref
+);
+
+import_decls( //dir=decl
+ unique int id: @import_decl
+);
+
+#keyset[id]
+import_decl_is_exported( //dir=decl
+ int id: @import_decl ref
+);
+
+#keyset[id]
+import_decl_imported_modules( //dir=decl
+ int id: @import_decl ref,
+ int imported_module: @module_decl_or_none ref
+);
+
+#keyset[id, index]
+import_decl_declarations( //dir=decl
+ int id: @import_decl ref,
+ int index: int ref,
+ int declaration: @value_decl_or_none ref
+);
+
+missing_member_decls( //dir=decl
+ unique int id: @missing_member_decl,
+ string name: string ref
+);
+
+@operator_decl =
+ @infix_operator_decl
+| @postfix_operator_decl
+| @prefix_operator_decl
+;
+
+#keyset[id]
+operator_decls( //dir=decl
+ int id: @operator_decl ref,
+ string name: string ref
+);
+
+pattern_binding_decls( //dir=decl
+ unique int id: @pattern_binding_decl
+);
+
+#keyset[id, index]
+pattern_binding_decl_inits( //dir=decl
+ int id: @pattern_binding_decl ref,
+ int index: int ref,
+ int init: @expr_or_none ref
+);
+
+#keyset[id, index]
+pattern_binding_decl_patterns( //dir=decl
+ int id: @pattern_binding_decl ref,
+ int index: int ref,
+ int pattern: @pattern_or_none ref
+);
+
+pound_diagnostic_decls( //dir=decl
+ unique int id: @pound_diagnostic_decl,
+ int kind: int ref,
+ int message: @string_literal_expr_or_none ref
+);
+
+precedence_group_decls( //dir=decl
+ unique int id: @precedence_group_decl
+);
+
+top_level_code_decls( //dir=decl
+ unique int id: @top_level_code_decl,
+ int body: @brace_stmt_or_none ref
+);
+
+using_decls( //dir=decl
+ unique int id: @using_decl
+);
+
+#keyset[id]
+using_decl_is_main_actor( //dir=decl
+ int id: @using_decl ref
+);
+
+#keyset[id]
+using_decl_is_nonisolated( //dir=decl
+ int id: @using_decl ref
+);
+
+@value_decl =
+ @abstract_storage_decl
+| @enum_element_decl
+| @function
+| @macro_decl
+| @type_decl
+;
+
+#keyset[id]
+value_decls( //dir=decl
+ int id: @value_decl ref,
+ int interface_type: @type_or_none ref
+);
+
+@abstract_storage_decl =
+ @subscript_decl
+| @var_decl
+;
+
+#keyset[id, index]
+abstract_storage_decl_accessors( //dir=decl
+ int id: @abstract_storage_decl ref,
+ int index: int ref,
+ int accessor: @accessor_or_none ref
+);
+
+enum_element_decls( //dir=decl
+ unique int id: @enum_element_decl,
+ string name: string ref
+);
+
+#keyset[id, index]
+enum_element_decl_params( //dir=decl
+ int id: @enum_element_decl ref,
+ int index: int ref,
+ int param: @param_decl_or_none ref
+);
+
+@function =
+ @accessor_or_named_function
+| @deinitializer
+| @initializer
+;
+
+infix_operator_decls( //dir=decl
+ unique int id: @infix_operator_decl
+);
+
+#keyset[id]
+infix_operator_decl_precedence_groups( //dir=decl
+ int id: @infix_operator_decl ref,
+ int precedence_group: @precedence_group_decl_or_none ref
+);
+
+macro_decls( //dir=decl
+ unique int id: @macro_decl,
+ string name: string ref
+);
+
+#keyset[id, index]
+macro_decl_parameters( //dir=decl
+ int id: @macro_decl ref,
+ int index: int ref,
+ int parameter: @param_decl_or_none ref
+);
+
+#keyset[id, index]
+macro_decl_roles( //dir=decl
+ int id: @macro_decl ref,
+ int index: int ref,
+ int role: @macro_role_or_none ref
+);
+
+postfix_operator_decls( //dir=decl
+ unique int id: @postfix_operator_decl
+);
+
+prefix_operator_decls( //dir=decl
+ unique int id: @prefix_operator_decl
+);
+
+@type_decl =
+ @abstract_type_param_decl
+| @generic_type_decl
+| @module_decl
+;
+
+#keyset[id]
+type_decls( //dir=decl
+ int id: @type_decl ref,
+ string name: string ref,
+ int declared_interface_type: @type_or_none ref
+);
+
+#keyset[id, index]
+type_decl_inherited_types( //dir=decl
+ int id: @type_decl ref,
+ int index: int ref,
+ int inherited_type: @type_or_none ref
+);
+
+@abstract_type_param_decl =
+ @associated_type_decl
+| @generic_type_param_decl
+;
+
+@accessor_or_named_function =
+ @accessor
+| @named_function
+;
+
+deinitializers( //dir=decl
+ unique int id: @deinitializer
+);
+
+@generic_type_decl =
+ @nominal_type_decl
+| @opaque_type_decl
+| @type_alias_decl
+;
+
+initializers( //dir=decl
+ unique int id: @initializer
+);
+
+module_decls( //dir=decl
+ unique int id: @module_decl
+);
+
+#keyset[id]
+module_decl_is_builtin_module( //dir=decl
+ int id: @module_decl ref
+);
+
+#keyset[id]
+module_decl_is_system_module( //dir=decl
+ int id: @module_decl ref
+);
+
+module_decl_imported_modules( //dir=decl
+ int id: @module_decl ref,
+ int imported_module: @module_decl_or_none ref
+);
+
+module_decl_exported_modules( //dir=decl
+ int id: @module_decl ref,
+ int exported_module: @module_decl_or_none ref
+);
+
+subscript_decls( //dir=decl
+ unique int id: @subscript_decl,
+ int element_type: @type_or_none ref
+);
+
+#keyset[id, index]
+subscript_decl_params( //dir=decl
+ int id: @subscript_decl ref,
+ int index: int ref,
+ int param: @param_decl_or_none ref
+);
+
+@var_decl =
+ @concrete_var_decl
+| @param_decl
+;
+
+#keyset[id]
+var_decls( //dir=decl
+ int id: @var_decl ref,
+ string name: string ref,
+ int type_: @type_or_none ref
+);
+
+#keyset[id]
+var_decl_attached_property_wrapper_types( //dir=decl
+ int id: @var_decl ref,
+ int attached_property_wrapper_type: @type_or_none ref
+);
+
+#keyset[id]
+var_decl_parent_patterns( //dir=decl
+ int id: @var_decl ref,
+ int parent_pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+var_decl_parent_initializers( //dir=decl
+ int id: @var_decl ref,
+ int parent_initializer: @expr_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_backing_var_bindings( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_backing_var_binding: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_backing_vars( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_backing_var: @var_decl_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_projection_var_bindings( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_projection_var_binding: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+var_decl_property_wrapper_projection_vars( //dir=decl
+ int id: @var_decl ref,
+ int property_wrapper_projection_var: @var_decl_or_none ref
+);
+
+accessors( //dir=decl
+ unique int id: @accessor
+);
+
+#keyset[id]
+accessor_is_getter( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_setter( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_will_set( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_did_set( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_read( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_modify( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_unsafe_address( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_unsafe_mutable_address( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_distributed_get( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_read2( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_modify2( //dir=decl
+ int id: @accessor ref
+);
+
+#keyset[id]
+accessor_is_init( //dir=decl
+ int id: @accessor ref
+);
+
+associated_type_decls( //dir=decl
+ unique int id: @associated_type_decl
+);
+
+concrete_var_decls( //dir=decl
+ unique int id: @concrete_var_decl,
+ int introducer_int: int ref
+);
+
+generic_type_param_decls( //dir=decl
+ unique int id: @generic_type_param_decl
+);
+
+named_functions( //dir=decl
+ unique int id: @named_function
+);
+
+@nominal_type_decl =
+ @class_decl
+| @enum_decl
+| @protocol_decl
+| @struct_decl
+;
+
+#keyset[id]
+nominal_type_decls( //dir=decl
+ int id: @nominal_type_decl ref,
+ int type_: @type_or_none ref
+);
+
+opaque_type_decls( //dir=decl
+ unique int id: @opaque_type_decl,
+ int naming_declaration: @value_decl_or_none ref
+);
+
+#keyset[id, index]
+opaque_type_decl_opaque_generic_params( //dir=decl
+ int id: @opaque_type_decl ref,
+ int index: int ref,
+ int opaque_generic_param: @generic_type_param_type_or_none ref
+);
+
+param_decls( //dir=decl
+ unique int id: @param_decl
+);
+
+#keyset[id]
+param_decl_is_inout( //dir=decl
+ int id: @param_decl ref
+);
+
+#keyset[id]
+param_decl_property_wrapper_local_wrapped_var_bindings( //dir=decl
+ int id: @param_decl ref,
+ int property_wrapper_local_wrapped_var_binding: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+param_decl_property_wrapper_local_wrapped_vars( //dir=decl
+ int id: @param_decl ref,
+ int property_wrapper_local_wrapped_var: @var_decl_or_none ref
+);
+
+type_alias_decls( //dir=decl
+ unique int id: @type_alias_decl,
+ int aliased_type: @type_or_none ref
+);
+
+class_decls( //dir=decl
+ unique int id: @class_decl
+);
+
+enum_decls( //dir=decl
+ unique int id: @enum_decl
+);
+
+protocol_decls( //dir=decl
+ unique int id: @protocol_decl
+);
+
+struct_decls( //dir=decl
+ unique int id: @struct_decl
+);
+
+arguments( //dir=expr
+ unique int id: @argument,
+ string label: string ref,
+ int expr: @expr_or_none ref
+);
+
+@expr =
+ @any_try_expr
+| @applied_property_wrapper_expr
+| @apply_expr
+| @assign_expr
+| @bind_optional_expr
+| @capture_list_expr
+| @closure_expr
+| @collection_expr
+| @consume_expr
+| @copy_expr
+| @current_context_isolation_expr
+| @decl_ref_expr
+| @default_argument_expr
+| @discard_assignment_expr
+| @dot_syntax_base_ignored_expr
+| @dynamic_type_expr
+| @enum_is_case_expr
+| @error_expr
+| @explicit_cast_expr
+| @extract_function_isolation_expr
+| @force_value_expr
+| @identity_expr
+| @if_expr
+| @implicit_conversion_expr
+| @in_out_expr
+| @key_path_application_expr
+| @key_path_dot_expr
+| @key_path_expr
+| @lazy_initialization_expr
+| @literal_expr
+| @lookup_expr
+| @make_temporarily_escapable_expr
+| @materialize_pack_expr
+| @obj_c_selector_expr
+| @one_way_expr
+| @opaque_value_expr
+| @open_existential_expr
+| @optional_evaluation_expr
+| @other_initializer_ref_expr
+| @overloaded_decl_ref_expr
+| @pack_element_expr
+| @pack_expansion_expr
+| @property_wrapper_value_placeholder_expr
+| @rebind_self_in_initializer_expr
+| @sequence_expr
+| @single_value_stmt_expr
+| @super_ref_expr
+| @tap_expr
+| @tuple_element_expr
+| @tuple_expr
+| @type_expr
+| @type_value_expr
+| @unresolved_decl_ref_expr
+| @unresolved_dot_expr
+| @unresolved_member_expr
+| @unresolved_pattern_expr
+| @unresolved_specialize_expr
+| @vararg_expansion_expr
+;
+
+#keyset[id]
+expr_types( //dir=expr
+ int id: @expr ref,
+ int type_: @type_or_none ref
+);
+
+@any_try_expr =
+ @force_try_expr
+| @optional_try_expr
+| @try_expr
+;
+
+#keyset[id]
+any_try_exprs( //dir=expr
+ int id: @any_try_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+applied_property_wrapper_exprs( //dir=expr
+ unique int id: @applied_property_wrapper_expr,
+ int kind: int ref,
+ int value: @expr_or_none ref,
+ int param: @param_decl_or_none ref
+);
+
+@apply_expr =
+ @binary_expr
+| @call_expr
+| @postfix_unary_expr
+| @prefix_unary_expr
+| @self_apply_expr
+;
+
+#keyset[id]
+apply_exprs( //dir=expr
+ int id: @apply_expr ref,
+ int function: @expr_or_none ref
+);
+
+#keyset[id, index]
+apply_expr_arguments( //dir=expr
+ int id: @apply_expr ref,
+ int index: int ref,
+ int argument: @argument_or_none ref
+);
+
+assign_exprs( //dir=expr
+ unique int id: @assign_expr,
+ int dest: @expr_or_none ref,
+ int source: @expr_or_none ref
+);
+
+bind_optional_exprs( //dir=expr
+ unique int id: @bind_optional_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+capture_list_exprs( //dir=expr
+ unique int id: @capture_list_expr,
+ int closure_body: @closure_expr_or_none ref
+);
+
+#keyset[id, index]
+capture_list_expr_binding_decls( //dir=expr
+ int id: @capture_list_expr ref,
+ int index: int ref,
+ int binding_decl: @pattern_binding_decl_or_none ref
+);
+
+@closure_expr =
+ @auto_closure_expr
+| @explicit_closure_expr
+;
+
+@collection_expr =
+ @array_expr
+| @dictionary_expr
+;
+
+consume_exprs( //dir=expr
+ unique int id: @consume_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+copy_exprs( //dir=expr
+ unique int id: @copy_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+current_context_isolation_exprs( //dir=expr
+ unique int id: @current_context_isolation_expr,
+ int actor: @expr_or_none ref
+);
+
+decl_ref_exprs( //dir=expr
+ unique int id: @decl_ref_expr,
+ int decl: @decl_or_none ref
+);
+
+#keyset[id, index]
+decl_ref_expr_replacement_types( //dir=expr
+ int id: @decl_ref_expr ref,
+ int index: int ref,
+ int replacement_type: @type_or_none ref
+);
+
+#keyset[id]
+decl_ref_expr_has_direct_to_storage_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+#keyset[id]
+decl_ref_expr_has_direct_to_implementation_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+#keyset[id]
+decl_ref_expr_has_ordinary_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+#keyset[id]
+decl_ref_expr_has_distributed_thunk_semantics( //dir=expr
+ int id: @decl_ref_expr ref
+);
+
+default_argument_exprs( //dir=expr
+ unique int id: @default_argument_expr,
+ int param_decl: @param_decl_or_none ref,
+ int param_index: int ref
+);
+
+#keyset[id]
+default_argument_expr_caller_side_defaults( //dir=expr
+ int id: @default_argument_expr ref,
+ int caller_side_default: @expr_or_none ref
+);
+
+discard_assignment_exprs( //dir=expr
+ unique int id: @discard_assignment_expr
+);
+
+dot_syntax_base_ignored_exprs( //dir=expr
+ unique int id: @dot_syntax_base_ignored_expr,
+ int qualifier: @expr_or_none ref,
+ int sub_expr: @expr_or_none ref
+);
+
+dynamic_type_exprs( //dir=expr
+ unique int id: @dynamic_type_expr,
+ int base: @expr_or_none ref
+);
+
+enum_is_case_exprs( //dir=expr
+ unique int id: @enum_is_case_expr,
+ int sub_expr: @expr_or_none ref,
+ int element: @enum_element_decl_or_none ref
+);
+
+error_exprs( //dir=expr
+ unique int id: @error_expr
+);
+
+@explicit_cast_expr =
+ @checked_cast_expr
+| @coerce_expr
+;
+
+#keyset[id]
+explicit_cast_exprs( //dir=expr
+ int id: @explicit_cast_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+extract_function_isolation_exprs( //dir=expr
+ unique int id: @extract_function_isolation_expr,
+ int function_expr: @expr_or_none ref
+);
+
+force_value_exprs( //dir=expr
+ unique int id: @force_value_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+@identity_expr =
+ @await_expr
+| @borrow_expr
+| @dot_self_expr
+| @paren_expr
+| @unresolved_member_chain_result_expr
+| @unsafe_expr
+;
+
+#keyset[id]
+identity_exprs( //dir=expr
+ int id: @identity_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+if_exprs( //dir=expr
+ unique int id: @if_expr,
+ int condition: @expr_or_none ref,
+ int then_expr: @expr_or_none ref,
+ int else_expr: @expr_or_none ref
+);
+
+@implicit_conversion_expr =
+ @abi_safe_conversion_expr
+| @actor_isolation_erasure_expr
+| @any_hashable_erasure_expr
+| @archetype_to_super_expr
+| @array_to_pointer_expr
+| @bridge_from_obj_c_expr
+| @bridge_to_obj_c_expr
+| @class_metatype_to_object_expr
+| @collection_upcast_conversion_expr
+| @conditional_bridge_from_obj_c_expr
+| @covariant_function_conversion_expr
+| @covariant_return_conversion_expr
+| @derived_to_base_expr
+| @destructure_tuple_expr
+| @differentiable_function_expr
+| @differentiable_function_extract_original_expr
+| @erasure_expr
+| @existential_metatype_to_object_expr
+| @foreign_object_conversion_expr
+| @function_conversion_expr
+| @in_out_to_pointer_expr
+| @inject_into_optional_expr
+| @linear_function_expr
+| @linear_function_extract_original_expr
+| @linear_to_differentiable_function_expr
+| @load_expr
+| @metatype_conversion_expr
+| @pointer_to_pointer_expr
+| @protocol_metatype_to_object_expr
+| @string_to_pointer_expr
+| @underlying_to_opaque_expr
+| @unevaluated_instance_expr
+| @unreachable_expr
+| @unresolved_type_conversion_expr
+| @unsafe_cast_expr
+;
+
+#keyset[id]
+implicit_conversion_exprs( //dir=expr
+ int id: @implicit_conversion_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+in_out_exprs( //dir=expr
+ unique int id: @in_out_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+key_path_application_exprs( //dir=expr
+ unique int id: @key_path_application_expr,
+ int base: @expr_or_none ref,
+ int key_path: @expr_or_none ref
+);
+
+key_path_dot_exprs( //dir=expr
+ unique int id: @key_path_dot_expr
+);
+
+key_path_exprs( //dir=expr
+ unique int id: @key_path_expr
+);
+
+#keyset[id]
+key_path_expr_roots( //dir=expr
+ int id: @key_path_expr ref,
+ int root: @type_repr_or_none ref
+);
+
+#keyset[id, index]
+key_path_expr_components( //dir=expr
+ int id: @key_path_expr ref,
+ int index: int ref,
+ int component: @key_path_component_or_none ref
+);
+
+lazy_initialization_exprs( //dir=expr
+ unique int id: @lazy_initialization_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+@literal_expr =
+ @builtin_literal_expr
+| @interpolated_string_literal_expr
+| @nil_literal_expr
+| @object_literal_expr
+| @regex_literal_expr
+;
+
+@lookup_expr =
+ @dynamic_lookup_expr
+| @member_ref_expr
+| @subscript_expr
+;
+
+#keyset[id]
+lookup_exprs( //dir=expr
+ int id: @lookup_expr ref,
+ int base: @expr_or_none ref
+);
+
+#keyset[id]
+lookup_expr_members( //dir=expr
+ int id: @lookup_expr ref,
+ int member: @decl_or_none ref
+);
+
+make_temporarily_escapable_exprs( //dir=expr
+ unique int id: @make_temporarily_escapable_expr,
+ int escaping_closure: @opaque_value_expr_or_none ref,
+ int nonescaping_closure: @expr_or_none ref,
+ int sub_expr: @expr_or_none ref
+);
+
+materialize_pack_exprs( //dir=expr
+ unique int id: @materialize_pack_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+obj_c_selector_exprs( //dir=expr
+ unique int id: @obj_c_selector_expr,
+ int sub_expr: @expr_or_none ref,
+ int method: @function_or_none ref
+);
+
+one_way_exprs( //dir=expr
+ unique int id: @one_way_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+opaque_value_exprs( //dir=expr
+ unique int id: @opaque_value_expr
+);
+
+open_existential_exprs( //dir=expr
+ unique int id: @open_existential_expr,
+ int sub_expr: @expr_or_none ref,
+ int existential: @expr_or_none ref,
+ int opaque_expr: @opaque_value_expr_or_none ref
+);
+
+optional_evaluation_exprs( //dir=expr
+ unique int id: @optional_evaluation_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+other_initializer_ref_exprs( //dir=expr
+ unique int id: @other_initializer_ref_expr,
+ int initializer: @initializer_or_none ref
+);
+
+overloaded_decl_ref_exprs( //dir=expr
+ unique int id: @overloaded_decl_ref_expr
+);
+
+#keyset[id, index]
+overloaded_decl_ref_expr_possible_declarations( //dir=expr
+ int id: @overloaded_decl_ref_expr ref,
+ int index: int ref,
+ int possible_declaration: @value_decl_or_none ref
+);
+
+pack_element_exprs( //dir=expr
+ unique int id: @pack_element_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+pack_expansion_exprs( //dir=expr
+ unique int id: @pack_expansion_expr,
+ int pattern_expr: @expr_or_none ref
+);
+
+property_wrapper_value_placeholder_exprs( //dir=expr
+ unique int id: @property_wrapper_value_placeholder_expr,
+ int placeholder: @opaque_value_expr_or_none ref
+);
+
+#keyset[id]
+property_wrapper_value_placeholder_expr_wrapped_values( //dir=expr
+ int id: @property_wrapper_value_placeholder_expr ref,
+ int wrapped_value: @expr_or_none ref
+);
+
+rebind_self_in_initializer_exprs( //dir=expr
+ unique int id: @rebind_self_in_initializer_expr,
+ int sub_expr: @expr_or_none ref,
+ int self: @var_decl_or_none ref
+);
+
+sequence_exprs( //dir=expr
+ unique int id: @sequence_expr
+);
+
+#keyset[id, index]
+sequence_expr_elements( //dir=expr
+ int id: @sequence_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+single_value_stmt_exprs( //dir=expr
+ unique int id: @single_value_stmt_expr,
+ int stmt: @stmt_or_none ref
+);
+
+super_ref_exprs( //dir=expr
+ unique int id: @super_ref_expr,
+ int self: @var_decl_or_none ref
+);
+
+tap_exprs( //dir=expr
+ unique int id: @tap_expr,
+ int body: @brace_stmt_or_none ref,
+ int var: @var_decl_or_none ref
+);
+
+#keyset[id]
+tap_expr_sub_exprs( //dir=expr
+ int id: @tap_expr ref,
+ int sub_expr: @expr_or_none ref
+);
+
+tuple_element_exprs( //dir=expr
+ unique int id: @tuple_element_expr,
+ int sub_expr: @expr_or_none ref,
+ int index: int ref
+);
+
+tuple_exprs( //dir=expr
+ unique int id: @tuple_expr
+);
+
+#keyset[id, index]
+tuple_expr_elements( //dir=expr
+ int id: @tuple_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+type_exprs( //dir=expr
+ unique int id: @type_expr
+);
+
+#keyset[id]
+type_expr_type_reprs( //dir=expr
+ int id: @type_expr ref,
+ int type_repr: @type_repr_or_none ref
+);
+
+type_value_exprs( //dir=expr
+ unique int id: @type_value_expr,
+ int type_repr: @type_repr_or_none ref
+);
+
+unresolved_decl_ref_exprs( //dir=expr
+ unique int id: @unresolved_decl_ref_expr
+);
+
+#keyset[id]
+unresolved_decl_ref_expr_names( //dir=expr
+ int id: @unresolved_decl_ref_expr ref,
+ string name: string ref
+);
+
+unresolved_dot_exprs( //dir=expr
+ unique int id: @unresolved_dot_expr,
+ int base: @expr_or_none ref,
+ string name: string ref
+);
+
+unresolved_member_exprs( //dir=expr
+ unique int id: @unresolved_member_expr,
+ string name: string ref
+);
+
+unresolved_pattern_exprs( //dir=expr
+ unique int id: @unresolved_pattern_expr,
+ int sub_pattern: @pattern_or_none ref
+);
+
+unresolved_specialize_exprs( //dir=expr
+ unique int id: @unresolved_specialize_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+vararg_expansion_exprs( //dir=expr
+ unique int id: @vararg_expansion_expr,
+ int sub_expr: @expr_or_none ref
+);
+
+abi_safe_conversion_exprs( //dir=expr
+ unique int id: @abi_safe_conversion_expr
+);
+
+actor_isolation_erasure_exprs( //dir=expr
+ unique int id: @actor_isolation_erasure_expr
+);
+
+any_hashable_erasure_exprs( //dir=expr
+ unique int id: @any_hashable_erasure_expr
+);
+
+archetype_to_super_exprs( //dir=expr
+ unique int id: @archetype_to_super_expr
+);
+
+array_exprs( //dir=expr
+ unique int id: @array_expr
+);
+
+#keyset[id, index]
+array_expr_elements( //dir=expr
+ int id: @array_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+array_to_pointer_exprs( //dir=expr
+ unique int id: @array_to_pointer_expr
+);
+
+auto_closure_exprs( //dir=expr
+ unique int id: @auto_closure_expr
+);
+
+await_exprs( //dir=expr
+ unique int id: @await_expr
+);
+
+binary_exprs( //dir=expr
+ unique int id: @binary_expr
+);
+
+borrow_exprs( //dir=expr
+ unique int id: @borrow_expr
+);
+
+bridge_from_obj_c_exprs( //dir=expr
+ unique int id: @bridge_from_obj_c_expr
+);
+
+bridge_to_obj_c_exprs( //dir=expr
+ unique int id: @bridge_to_obj_c_expr
+);
+
+@builtin_literal_expr =
+ @boolean_literal_expr
+| @magic_identifier_literal_expr
+| @number_literal_expr
+| @string_literal_expr
+;
+
+call_exprs( //dir=expr
+ unique int id: @call_expr
+);
+
+@checked_cast_expr =
+ @conditional_checked_cast_expr
+| @forced_checked_cast_expr
+| @is_expr
+;
+
+class_metatype_to_object_exprs( //dir=expr
+ unique int id: @class_metatype_to_object_expr
+);
+
+coerce_exprs( //dir=expr
+ unique int id: @coerce_expr
+);
+
+collection_upcast_conversion_exprs( //dir=expr
+ unique int id: @collection_upcast_conversion_expr
+);
+
+conditional_bridge_from_obj_c_exprs( //dir=expr
+ unique int id: @conditional_bridge_from_obj_c_expr
+);
+
+covariant_function_conversion_exprs( //dir=expr
+ unique int id: @covariant_function_conversion_expr
+);
+
+covariant_return_conversion_exprs( //dir=expr
+ unique int id: @covariant_return_conversion_expr
+);
+
+derived_to_base_exprs( //dir=expr
+ unique int id: @derived_to_base_expr
+);
+
+destructure_tuple_exprs( //dir=expr
+ unique int id: @destructure_tuple_expr
+);
+
+dictionary_exprs( //dir=expr
+ unique int id: @dictionary_expr
+);
+
+#keyset[id, index]
+dictionary_expr_elements( //dir=expr
+ int id: @dictionary_expr ref,
+ int index: int ref,
+ int element: @expr_or_none ref
+);
+
+differentiable_function_exprs( //dir=expr
+ unique int id: @differentiable_function_expr
+);
+
+differentiable_function_extract_original_exprs( //dir=expr
+ unique int id: @differentiable_function_extract_original_expr
+);
+
+dot_self_exprs( //dir=expr
+ unique int id: @dot_self_expr
+);
+
+@dynamic_lookup_expr =
+ @dynamic_member_ref_expr
+| @dynamic_subscript_expr
+;
+
+erasure_exprs( //dir=expr
+ unique int id: @erasure_expr
+);
+
+existential_metatype_to_object_exprs( //dir=expr
+ unique int id: @existential_metatype_to_object_expr
+);
+
+explicit_closure_exprs( //dir=expr
+ unique int id: @explicit_closure_expr
+);
+
+force_try_exprs( //dir=expr
+ unique int id: @force_try_expr
+);
+
+foreign_object_conversion_exprs( //dir=expr
+ unique int id: @foreign_object_conversion_expr
+);
+
+function_conversion_exprs( //dir=expr
+ unique int id: @function_conversion_expr
+);
+
+in_out_to_pointer_exprs( //dir=expr
+ unique int id: @in_out_to_pointer_expr
+);
+
+inject_into_optional_exprs( //dir=expr
+ unique int id: @inject_into_optional_expr
+);
+
+interpolated_string_literal_exprs( //dir=expr
+ unique int id: @interpolated_string_literal_expr
+);
+
+#keyset[id]
+interpolated_string_literal_expr_interpolation_exprs( //dir=expr
+ int id: @interpolated_string_literal_expr ref,
+ int interpolation_expr: @opaque_value_expr_or_none ref
+);
+
+#keyset[id]
+interpolated_string_literal_expr_appending_exprs( //dir=expr
+ int id: @interpolated_string_literal_expr ref,
+ int appending_expr: @tap_expr_or_none ref
+);
+
+linear_function_exprs( //dir=expr
+ unique int id: @linear_function_expr
+);
+
+linear_function_extract_original_exprs( //dir=expr
+ unique int id: @linear_function_extract_original_expr
+);
+
+linear_to_differentiable_function_exprs( //dir=expr
+ unique int id: @linear_to_differentiable_function_expr
+);
+
+load_exprs( //dir=expr
+ unique int id: @load_expr
+);
+
+member_ref_exprs( //dir=expr
+ unique int id: @member_ref_expr
+);
+
+#keyset[id]
+member_ref_expr_has_direct_to_storage_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+#keyset[id]
+member_ref_expr_has_direct_to_implementation_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+#keyset[id]
+member_ref_expr_has_ordinary_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+#keyset[id]
+member_ref_expr_has_distributed_thunk_semantics( //dir=expr
+ int id: @member_ref_expr ref
+);
+
+metatype_conversion_exprs( //dir=expr
+ unique int id: @metatype_conversion_expr
+);
+
+nil_literal_exprs( //dir=expr
+ unique int id: @nil_literal_expr
+);
+
+object_literal_exprs( //dir=expr
+ unique int id: @object_literal_expr,
+ int kind: int ref
+);
+
+#keyset[id, index]
+object_literal_expr_arguments( //dir=expr
+ int id: @object_literal_expr ref,
+ int index: int ref,
+ int argument: @argument_or_none ref
+);
+
+optional_try_exprs( //dir=expr
+ unique int id: @optional_try_expr
+);
+
+paren_exprs( //dir=expr
+ unique int id: @paren_expr
+);
+
+pointer_to_pointer_exprs( //dir=expr
+ unique int id: @pointer_to_pointer_expr
+);
+
+postfix_unary_exprs( //dir=expr
+ unique int id: @postfix_unary_expr
+);
+
+prefix_unary_exprs( //dir=expr
+ unique int id: @prefix_unary_expr
+);
+
+protocol_metatype_to_object_exprs( //dir=expr
+ unique int id: @protocol_metatype_to_object_expr
+);
+
+regex_literal_exprs( //dir=expr
+ unique int id: @regex_literal_expr,
+ string pattern: string ref,
+ int version: int ref
+);
+
+@self_apply_expr =
+ @dot_syntax_call_expr
+| @initializer_ref_call_expr
+;
+
+#keyset[id]
+self_apply_exprs( //dir=expr
+ int id: @self_apply_expr ref,
+ int base: @expr_or_none ref
+);
+
+string_to_pointer_exprs( //dir=expr
+ unique int id: @string_to_pointer_expr
+);
+
+subscript_exprs( //dir=expr
+ unique int id: @subscript_expr
+);
+
+#keyset[id, index]
+subscript_expr_arguments( //dir=expr
+ int id: @subscript_expr ref,
+ int index: int ref,
+ int argument: @argument_or_none ref
+);
+
+#keyset[id]
+subscript_expr_has_direct_to_storage_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+#keyset[id]
+subscript_expr_has_direct_to_implementation_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+#keyset[id]
+subscript_expr_has_ordinary_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+#keyset[id]
+subscript_expr_has_distributed_thunk_semantics( //dir=expr
+ int id: @subscript_expr ref
+);
+
+try_exprs( //dir=expr
+ unique int id: @try_expr
+);
+
+underlying_to_opaque_exprs( //dir=expr
+ unique int id: @underlying_to_opaque_expr
+);
+
+unevaluated_instance_exprs( //dir=expr
+ unique int id: @unevaluated_instance_expr
+);
+
+unreachable_exprs( //dir=expr
+ unique int id: @unreachable_expr
+);
+
+unresolved_member_chain_result_exprs( //dir=expr
+ unique int id: @unresolved_member_chain_result_expr
+);
+
+unresolved_type_conversion_exprs( //dir=expr
+ unique int id: @unresolved_type_conversion_expr
+);
+
+unsafe_cast_exprs( //dir=expr
+ unique int id: @unsafe_cast_expr
+);
+
+unsafe_exprs( //dir=expr
+ unique int id: @unsafe_expr
+);
+
+boolean_literal_exprs( //dir=expr
+ unique int id: @boolean_literal_expr,
+ boolean value: boolean ref
+);
+
+conditional_checked_cast_exprs( //dir=expr
+ unique int id: @conditional_checked_cast_expr
+);
+
+dot_syntax_call_exprs( //dir=expr
+ unique int id: @dot_syntax_call_expr
+);
+
+dynamic_member_ref_exprs( //dir=expr
+ unique int id: @dynamic_member_ref_expr
+);
+
+dynamic_subscript_exprs( //dir=expr
+ unique int id: @dynamic_subscript_expr
+);
+
+forced_checked_cast_exprs( //dir=expr
+ unique int id: @forced_checked_cast_expr
+);
+
+initializer_ref_call_exprs( //dir=expr
+ unique int id: @initializer_ref_call_expr
+);
+
+is_exprs( //dir=expr
+ unique int id: @is_expr
+);
+
+magic_identifier_literal_exprs( //dir=expr
+ unique int id: @magic_identifier_literal_expr,
+ string kind: string ref
+);
+
+@number_literal_expr =
+ @float_literal_expr
+| @integer_literal_expr
+;
+
+string_literal_exprs( //dir=expr
+ unique int id: @string_literal_expr,
+ string value: string ref
+);
+
+float_literal_exprs( //dir=expr
+ unique int id: @float_literal_expr,
+ string string_value: string ref
+);
+
+integer_literal_exprs( //dir=expr
+ unique int id: @integer_literal_expr,
+ string string_value: string ref
+);
+
+@pattern =
+ @any_pattern
+| @binding_pattern
+| @bool_pattern
+| @enum_element_pattern
+| @expr_pattern
+| @is_pattern
+| @named_pattern
+| @optional_some_pattern
+| @paren_pattern
+| @tuple_pattern
+| @typed_pattern
+;
+
+#keyset[id]
+pattern_types( //dir=pattern
+ int id: @pattern ref,
+ int type_: @type_or_none ref
+);
+
+any_patterns( //dir=pattern
+ unique int id: @any_pattern
+);
+
+binding_patterns( //dir=pattern
+ unique int id: @binding_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+bool_patterns( //dir=pattern
+ unique int id: @bool_pattern,
+ boolean value: boolean ref
+);
+
+enum_element_patterns( //dir=pattern
+ unique int id: @enum_element_pattern,
+ int element: @enum_element_decl_or_none ref
+);
+
+#keyset[id]
+enum_element_pattern_sub_patterns( //dir=pattern
+ int id: @enum_element_pattern ref,
+ int sub_pattern: @pattern_or_none ref
+);
+
+expr_patterns( //dir=pattern
+ unique int id: @expr_pattern,
+ int sub_expr: @expr_or_none ref
+);
+
+is_patterns( //dir=pattern
+ unique int id: @is_pattern
+);
+
+#keyset[id]
+is_pattern_cast_type_reprs( //dir=pattern
+ int id: @is_pattern ref,
+ int cast_type_repr: @type_repr_or_none ref
+);
+
+#keyset[id]
+is_pattern_sub_patterns( //dir=pattern
+ int id: @is_pattern ref,
+ int sub_pattern: @pattern_or_none ref
+);
+
+named_patterns( //dir=pattern
+ unique int id: @named_pattern,
+ int var_decl: @var_decl_or_none ref
+);
+
+optional_some_patterns( //dir=pattern
+ unique int id: @optional_some_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+paren_patterns( //dir=pattern
+ unique int id: @paren_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+tuple_patterns( //dir=pattern
+ unique int id: @tuple_pattern
+);
+
+#keyset[id, index]
+tuple_pattern_elements( //dir=pattern
+ int id: @tuple_pattern ref,
+ int index: int ref,
+ int element: @pattern_or_none ref
+);
+
+typed_patterns( //dir=pattern
+ unique int id: @typed_pattern,
+ int sub_pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+typed_pattern_type_reprs( //dir=pattern
+ int id: @typed_pattern ref,
+ int type_repr: @type_repr_or_none ref
+);
+
+case_label_items( //dir=stmt
+ unique int id: @case_label_item,
+ int pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+case_label_item_guards( //dir=stmt
+ int id: @case_label_item ref,
+ int guard: @expr_or_none ref
+);
+
+condition_elements( //dir=stmt
+ unique int id: @condition_element
+);
+
+#keyset[id]
+condition_element_booleans( //dir=stmt
+ int id: @condition_element ref,
+ int boolean_: @expr_or_none ref
+);
+
+#keyset[id]
+condition_element_patterns( //dir=stmt
+ int id: @condition_element ref,
+ int pattern: @pattern_or_none ref
+);
+
+#keyset[id]
+condition_element_initializers( //dir=stmt
+ int id: @condition_element ref,
+ int initializer: @expr_or_none ref
+);
+
+#keyset[id]
+condition_element_availabilities( //dir=stmt
+ int id: @condition_element ref,
+ int availability: @availability_info_or_none ref
+);
+
+@stmt =
+ @brace_stmt
+| @break_stmt
+| @case_stmt
+| @continue_stmt
+| @defer_stmt
+| @discard_stmt
+| @fail_stmt
+| @fallthrough_stmt
+| @labeled_stmt
+| @pound_assert_stmt
+| @return_stmt
+| @then_stmt
+| @throw_stmt
+| @yield_stmt
+;
+
+stmt_conditions( //dir=stmt
+ unique int id: @stmt_condition
+);
+
+#keyset[id, index]
+stmt_condition_elements( //dir=stmt
+ int id: @stmt_condition ref,
+ int index: int ref,
+ int element: @condition_element_or_none ref
+);
+
+brace_stmts( //dir=stmt
+ unique int id: @brace_stmt
+);
+
+#keyset[id, index]
+brace_stmt_elements( //dir=stmt
+ int id: @brace_stmt ref,
+ int index: int ref,
+ int element: @ast_node_or_none ref
+);
+
+break_stmts( //dir=stmt
+ unique int id: @break_stmt
+);
+
+#keyset[id]
+break_stmt_target_names( //dir=stmt
+ int id: @break_stmt ref,
+ string target_name: string ref
+);
+
+#keyset[id]
+break_stmt_targets( //dir=stmt
+ int id: @break_stmt ref,
+ int target: @stmt_or_none ref
+);
+
+case_stmts( //dir=stmt
+ unique int id: @case_stmt,
+ int body: @stmt_or_none ref
+);
+
+#keyset[id, index]
+case_stmt_labels( //dir=stmt
+ int id: @case_stmt ref,
+ int index: int ref,
+ int label: @case_label_item_or_none ref
+);
+
+#keyset[id, index]
+case_stmt_variables( //dir=stmt
+ int id: @case_stmt ref,
+ int index: int ref,
+ int variable: @var_decl_or_none ref
+);
+
+continue_stmts( //dir=stmt
+ unique int id: @continue_stmt
+);
+
+#keyset[id]
+continue_stmt_target_names( //dir=stmt
+ int id: @continue_stmt ref,
+ string target_name: string ref
+);
+
+#keyset[id]
+continue_stmt_targets( //dir=stmt
+ int id: @continue_stmt ref,
+ int target: @stmt_or_none ref
+);
+
+defer_stmts( //dir=stmt
+ unique int id: @defer_stmt,
+ int body: @brace_stmt_or_none ref
+);
+
+discard_stmts( //dir=stmt
+ unique int id: @discard_stmt,
+ int sub_expr: @expr_or_none ref
+);
+
+fail_stmts( //dir=stmt
+ unique int id: @fail_stmt
+);
+
+fallthrough_stmts( //dir=stmt
+ unique int id: @fallthrough_stmt,
+ int fallthrough_source: @case_stmt_or_none ref,
+ int fallthrough_dest: @case_stmt_or_none ref
+);
+
+@labeled_stmt =
+ @do_catch_stmt
+| @do_stmt
+| @for_each_stmt
+| @labeled_conditional_stmt
+| @repeat_while_stmt
+| @switch_stmt
+;
+
+#keyset[id]
+labeled_stmt_labels( //dir=stmt
+ int id: @labeled_stmt ref,
+ string label: string ref
+);
+
+pound_assert_stmts( //dir=stmt
+ unique int id: @pound_assert_stmt,
+ int condition: @expr_or_none ref,
+ string message: string ref
+);
+
+return_stmts( //dir=stmt
+ unique int id: @return_stmt
+);
+
+#keyset[id]
+return_stmt_results( //dir=stmt
+ int id: @return_stmt ref,
+ int result: @expr_or_none ref
+);
+
+then_stmts( //dir=stmt
+ unique int id: @then_stmt,
+ int result: @expr_or_none ref
+);
+
+throw_stmts( //dir=stmt
+ unique int id: @throw_stmt,
+ int sub_expr: @expr_or_none ref
+);
+
+yield_stmts( //dir=stmt
+ unique int id: @yield_stmt
+);
+
+#keyset[id, index]
+yield_stmt_results( //dir=stmt
+ int id: @yield_stmt ref,
+ int index: int ref,
+ int result: @expr_or_none ref
+);
+
+do_catch_stmts( //dir=stmt
+ unique int id: @do_catch_stmt,
+ int body: @stmt_or_none ref
+);
+
+#keyset[id, index]
+do_catch_stmt_catches( //dir=stmt
+ int id: @do_catch_stmt ref,
+ int index: int ref,
+ int catch: @case_stmt_or_none ref
+);
+
+do_stmts( //dir=stmt
+ unique int id: @do_stmt,
+ int body: @brace_stmt_or_none ref
+);
+
+for_each_stmts( //dir=stmt
+ unique int id: @for_each_stmt,
+ int pattern: @pattern_or_none ref,
+ int body: @brace_stmt_or_none ref
+);
+
+#keyset[id, index]
+for_each_stmt_variables( //dir=stmt
+ int id: @for_each_stmt ref,
+ int index: int ref,
+ int variable: @var_decl_or_none ref
+);
+
+#keyset[id]
+for_each_stmt_wheres( //dir=stmt
+ int id: @for_each_stmt ref,
+ int where: @expr_or_none ref
+);
+
+#keyset[id]
+for_each_stmt_iterator_vars( //dir=stmt
+ int id: @for_each_stmt ref,
+ int iteratorVar: @pattern_binding_decl_or_none ref
+);
+
+#keyset[id]
+for_each_stmt_next_calls( //dir=stmt
+ int id: @for_each_stmt ref,
+ int nextCall: @expr_or_none ref
+);
+
+@labeled_conditional_stmt =
+ @guard_stmt
+| @if_stmt
+| @while_stmt
+;
+
+#keyset[id]
+labeled_conditional_stmts( //dir=stmt
+ int id: @labeled_conditional_stmt ref,
+ int condition: @stmt_condition_or_none ref
+);
+
+repeat_while_stmts( //dir=stmt
+ unique int id: @repeat_while_stmt,
+ int condition: @expr_or_none ref,
+ int body: @stmt_or_none ref
+);
+
+switch_stmts( //dir=stmt
+ unique int id: @switch_stmt,
+ int expr: @expr_or_none ref
+);
+
+#keyset[id, index]
+switch_stmt_cases( //dir=stmt
+ int id: @switch_stmt ref,
+ int index: int ref,
+ int case_: @case_stmt_or_none ref
+);
+
+guard_stmts( //dir=stmt
+ unique int id: @guard_stmt,
+ int body: @brace_stmt_or_none ref
+);
+
+if_stmts( //dir=stmt
+ unique int id: @if_stmt,
+ int then: @stmt_or_none ref
+);
+
+#keyset[id]
+if_stmt_elses( //dir=stmt
+ int id: @if_stmt ref,
+ int else: @stmt_or_none ref
+);
+
+while_stmts( //dir=stmt
+ unique int id: @while_stmt,
+ int body: @stmt_or_none ref
+);
+
+@type =
+ @any_function_type
+| @any_generic_type
+| @any_metatype_type
+| @builtin_type
+| @dependent_member_type
+| @dynamic_self_type
+| @error_type
+| @existential_type
+| @in_out_type
+| @integer_type
+| @l_value_type
+| @module_type
+| @pack_element_type
+| @pack_expansion_type
+| @pack_type
+| @parameterized_protocol_type
+| @protocol_composition_type
+| @reference_storage_type
+| @substitutable_type
+| @sugar_type
+| @tuple_type
+| @unresolved_type
+;
+
+#keyset[id]
+types( //dir=type
+ int id: @type ref,
+ string name: string ref,
+ int canonical_type: @type_or_none ref
+);
+
+type_reprs( //dir=type
+ unique int id: @type_repr,
+ int type_: @type_or_none ref
+);
+
+@any_function_type =
+ @function_type
+| @generic_function_type
+;
+
+#keyset[id]
+any_function_types( //dir=type
+ int id: @any_function_type ref,
+ int result: @type_or_none ref
+);
+
+#keyset[id, index]
+any_function_type_param_types( //dir=type
+ int id: @any_function_type ref,
+ int index: int ref,
+ int param_type: @type_or_none ref
+);
+
+#keyset[id]
+any_function_type_is_throwing( //dir=type
+ int id: @any_function_type ref
+);
+
+#keyset[id]
+any_function_type_is_async( //dir=type
+ int id: @any_function_type ref
+);
+
+@any_generic_type =
+ @nominal_or_bound_generic_nominal_type
+| @unbound_generic_type
+;
+
+#keyset[id]
+any_generic_types( //dir=type
+ int id: @any_generic_type ref,
+ int declaration: @generic_type_decl_or_none ref
+);
+
+#keyset[id]
+any_generic_type_parents( //dir=type
+ int id: @any_generic_type ref,
+ int parent: @type_or_none ref
+);
+
+@any_metatype_type =
+ @existential_metatype_type
+| @metatype_type
+;
+
+@builtin_type =
+ @any_builtin_integer_type
+| @builtin_bridge_object_type
+| @builtin_default_actor_storage_type
+| @builtin_executor_type
+| @builtin_float_type
+| @builtin_generic_type
+| @builtin_job_type
+| @builtin_native_object_type
+| @builtin_raw_pointer_type
+| @builtin_raw_unsafe_continuation_type
+| @builtin_unsafe_value_buffer_type
+| @builtin_vector_type
+;
+
+dependent_member_types( //dir=type
+ unique int id: @dependent_member_type,
+ int base_type: @type_or_none ref,
+ int associated_type_decl: @associated_type_decl_or_none ref
+);
+
+dynamic_self_types( //dir=type
+ unique int id: @dynamic_self_type,
+ int static_self_type: @type_or_none ref
+);
+
+error_types( //dir=type
+ unique int id: @error_type
+);
+
+existential_types( //dir=type
+ unique int id: @existential_type,
+ int constraint: @type_or_none ref
+);
+
+in_out_types( //dir=type
+ unique int id: @in_out_type,
+ int object_type: @type_or_none ref
+);
+
+integer_types( //dir=type
+ unique int id: @integer_type,
+ string value: string ref
+);
+
+l_value_types( //dir=type
+ unique int id: @l_value_type,
+ int object_type: @type_or_none ref
+);
+
+module_types( //dir=type
+ unique int id: @module_type,
+ int module: @module_decl_or_none ref
+);
+
+pack_element_types( //dir=type
+ unique int id: @pack_element_type,
+ int pack_type: @type_or_none ref
+);
+
+pack_expansion_types( //dir=type
+ unique int id: @pack_expansion_type,
+ int pattern_type: @type_or_none ref,
+ int count_type: @type_or_none ref
+);
+
+pack_types( //dir=type
+ unique int id: @pack_type
+);
+
+#keyset[id, index]
+pack_type_elements( //dir=type
+ int id: @pack_type ref,
+ int index: int ref,
+ int element: @type_or_none ref
+);
+
+parameterized_protocol_types( //dir=type
+ unique int id: @parameterized_protocol_type,
+ int base: @protocol_type_or_none ref
+);
+
+#keyset[id, index]
+parameterized_protocol_type_args( //dir=type
+ int id: @parameterized_protocol_type ref,
+ int index: int ref,
+ int arg: @type_or_none ref
+);
+
+protocol_composition_types( //dir=type
+ unique int id: @protocol_composition_type
+);
+
+#keyset[id, index]
+protocol_composition_type_members( //dir=type
+ int id: @protocol_composition_type ref,
+ int index: int ref,
+ int member: @type_or_none ref
+);
+
+@reference_storage_type =
+ @unmanaged_storage_type
+| @unowned_storage_type
+| @weak_storage_type
+;
+
+#keyset[id]
+reference_storage_types( //dir=type
+ int id: @reference_storage_type ref,
+ int referent_type: @type_or_none ref
+);
+
+@substitutable_type =
+ @archetype_type
+| @generic_type_param_type
+;
+
+@sugar_type =
+ @paren_type
+| @syntax_sugar_type
+| @type_alias_type
+;
+
+tuple_types( //dir=type
+ unique int id: @tuple_type
+);
+
+#keyset[id, index]
+tuple_type_types( //dir=type
+ int id: @tuple_type ref,
+ int index: int ref,
+ int type_: @type_or_none ref
+);
+
+#keyset[id, index]
+tuple_type_names( //dir=type
+ int id: @tuple_type ref,
+ int index: int ref,
+ string name: string ref
+);
+
+unresolved_types( //dir=type
+ unique int id: @unresolved_type
+);
+
+@any_builtin_integer_type =
+ @builtin_integer_literal_type
+| @builtin_integer_type
+;
+
+@archetype_type =
+ @local_archetype_type
+| @opaque_type_archetype_type
+| @pack_archetype_type
+| @primary_archetype_type
+;
+
+#keyset[id]
+archetype_types( //dir=type
+ int id: @archetype_type ref,
+ int interface_type: @type_or_none ref
+);
+
+#keyset[id]
+archetype_type_superclasses( //dir=type
+ int id: @archetype_type ref,
+ int superclass: @type_or_none ref
+);
+
+#keyset[id, index]
+archetype_type_protocols( //dir=type
+ int id: @archetype_type ref,
+ int index: int ref,
+ int protocol: @protocol_decl_or_none ref
+);
+
+builtin_bridge_object_types( //dir=type
+ unique int id: @builtin_bridge_object_type
+);
+
+builtin_default_actor_storage_types( //dir=type
+ unique int id: @builtin_default_actor_storage_type
+);
+
+builtin_executor_types( //dir=type
+ unique int id: @builtin_executor_type
+);
+
+builtin_float_types( //dir=type
+ unique int id: @builtin_float_type
+);
+
+@builtin_generic_type =
+ @builtin_fixed_array_type
+;
+
+builtin_job_types( //dir=type
+ unique int id: @builtin_job_type
+);
+
+builtin_native_object_types( //dir=type
+ unique int id: @builtin_native_object_type
+);
+
+builtin_raw_pointer_types( //dir=type
+ unique int id: @builtin_raw_pointer_type
+);
+
+builtin_raw_unsafe_continuation_types( //dir=type
+ unique int id: @builtin_raw_unsafe_continuation_type
+);
+
+builtin_unsafe_value_buffer_types( //dir=type
+ unique int id: @builtin_unsafe_value_buffer_type
+);
+
+builtin_vector_types( //dir=type
+ unique int id: @builtin_vector_type
+);
+
+existential_metatype_types( //dir=type
+ unique int id: @existential_metatype_type
+);
+
+function_types( //dir=type
+ unique int id: @function_type
+);
+
+generic_function_types( //dir=type
+ unique int id: @generic_function_type
+);
+
+#keyset[id, index]
+generic_function_type_generic_params( //dir=type
+ int id: @generic_function_type ref,
+ int index: int ref,
+ int generic_param: @generic_type_param_type_or_none ref
+);
+
+generic_type_param_types( //dir=type
+ unique int id: @generic_type_param_type
+);
+
+metatype_types( //dir=type
+ unique int id: @metatype_type
+);
+
+@nominal_or_bound_generic_nominal_type =
+ @bound_generic_type
+| @nominal_type
+;
+
+paren_types( //dir=type
+ unique int id: @paren_type,
+ int type_: @type_or_none ref
+);
+
+@syntax_sugar_type =
+ @dictionary_type
+| @inline_array_type
+| @unary_syntax_sugar_type
+;
+
+type_alias_types( //dir=type
+ unique int id: @type_alias_type,
+ int decl: @type_alias_decl_or_none ref
+);
+
+unbound_generic_types( //dir=type
+ unique int id: @unbound_generic_type
+);
+
+unmanaged_storage_types( //dir=type
+ unique int id: @unmanaged_storage_type
+);
+
+unowned_storage_types( //dir=type
+ unique int id: @unowned_storage_type
+);
+
+weak_storage_types( //dir=type
+ unique int id: @weak_storage_type
+);
+
+@bound_generic_type =
+ @bound_generic_class_type
+| @bound_generic_enum_type
+| @bound_generic_struct_type
+;
+
+#keyset[id, index]
+bound_generic_type_arg_types( //dir=type
+ int id: @bound_generic_type ref,
+ int index: int ref,
+ int arg_type: @type_or_none ref
+);
+
+builtin_fixed_array_types( //dir=type
+ unique int id: @builtin_fixed_array_type,
+ int size: @type_or_none ref,
+ int element_type: @type_or_none ref
+);
+
+builtin_integer_literal_types( //dir=type
+ unique int id: @builtin_integer_literal_type
+);
+
+builtin_integer_types( //dir=type
+ unique int id: @builtin_integer_type
+);
+
+#keyset[id]
+builtin_integer_type_widths( //dir=type
+ int id: @builtin_integer_type ref,
+ int width: int ref
+);
+
+dictionary_types( //dir=type
+ unique int id: @dictionary_type,
+ int key_type: @type_or_none ref,
+ int value_type: @type_or_none ref
+);
+
+inline_array_types( //dir=type
+ unique int id: @inline_array_type,
+ int count_type: @type_or_none ref,
+ int element_type: @type_or_none ref
+);
+
+@local_archetype_type =
+ @element_archetype_type
+| @existential_archetype_type
+;
+
+@nominal_type =
+ @class_type
+| @enum_type
+| @protocol_type
+| @struct_type
+;
+
+opaque_type_archetype_types( //dir=type
+ unique int id: @opaque_type_archetype_type,
+ int declaration: @opaque_type_decl_or_none ref
+);
+
+pack_archetype_types( //dir=type
+ unique int id: @pack_archetype_type
+);
+
+primary_archetype_types( //dir=type
+ unique int id: @primary_archetype_type
+);
+
+@unary_syntax_sugar_type =
+ @array_slice_type
+| @optional_type
+| @variadic_sequence_type
+;
+
+#keyset[id]
+unary_syntax_sugar_types( //dir=type
+ int id: @unary_syntax_sugar_type ref,
+ int base_type: @type_or_none ref
+);
+
+array_slice_types( //dir=type
+ unique int id: @array_slice_type
+);
+
+bound_generic_class_types( //dir=type
+ unique int id: @bound_generic_class_type
+);
+
+bound_generic_enum_types( //dir=type
+ unique int id: @bound_generic_enum_type
+);
+
+bound_generic_struct_types( //dir=type
+ unique int id: @bound_generic_struct_type
+);
+
+class_types( //dir=type
+ unique int id: @class_type
+);
+
+element_archetype_types( //dir=type
+ unique int id: @element_archetype_type
+);
+
+enum_types( //dir=type
+ unique int id: @enum_type
+);
+
+existential_archetype_types( //dir=type
+ unique int id: @existential_archetype_type
+);
+
+optional_types( //dir=type
+ unique int id: @optional_type
+);
+
+protocol_types( //dir=type
+ unique int id: @protocol_type
+);
+
+struct_types( //dir=type
+ unique int id: @struct_type
+);
+
+variadic_sequence_types( //dir=type
+ unique int id: @variadic_sequence_type
+);
+
+@accessor_or_none =
+ @accessor
+| @unspecified_element
+;
+
+@argument_or_none =
+ @argument
+| @unspecified_element
+;
+
+@associated_type_decl_or_none =
+ @associated_type_decl
+| @unspecified_element
+;
+
+@ast_node_or_none =
+ @ast_node
+| @unspecified_element
+;
+
+@availability_info_or_none =
+ @availability_info
+| @unspecified_element
+;
+
+@availability_spec_or_none =
+ @availability_spec
+| @unspecified_element
+;
+
+@brace_stmt_or_none =
+ @brace_stmt
+| @unspecified_element
+;
+
+@captured_decl_or_none =
+ @captured_decl
+| @unspecified_element
+;
+
+@case_label_item_or_none =
+ @case_label_item
+| @unspecified_element
+;
+
+@case_stmt_or_none =
+ @case_stmt
+| @unspecified_element
+;
+
+@closure_expr_or_none =
+ @closure_expr
+| @unspecified_element
+;
+
+@condition_element_or_none =
+ @condition_element
+| @unspecified_element
+;
+
+@decl_or_none =
+ @decl
+| @unspecified_element
+;
+
+@enum_element_decl_or_none =
+ @enum_element_decl
+| @unspecified_element
+;
+
+@expr_or_none =
+ @expr
+| @unspecified_element
+;
+
+@file_or_none =
+ @file
+| @unspecified_element
+;
+
+@function_or_none =
+ @function
+| @unspecified_element
+;
+
+@generic_type_decl_or_none =
+ @generic_type_decl
+| @unspecified_element
+;
+
+@generic_type_param_decl_or_none =
+ @generic_type_param_decl
+| @unspecified_element
+;
+
+@generic_type_param_type_or_none =
+ @generic_type_param_type
+| @unspecified_element
+;
+
+@initializer_or_none =
+ @initializer
+| @unspecified_element
+;
+
+@key_path_component_or_none =
+ @key_path_component
+| @unspecified_element
+;
+
+@location_or_none =
+ @location
+| @unspecified_element
+;
+
+@macro_role_or_none =
+ @macro_role
+| @unspecified_element
+;
+
+@module_decl_or_none =
+ @module_decl
+| @unspecified_element
+;
+
+@nominal_type_decl_or_none =
+ @nominal_type_decl
+| @unspecified_element
+;
+
+@opaque_type_decl_or_none =
+ @opaque_type_decl
+| @unspecified_element
+;
+
+@opaque_value_expr_or_none =
+ @opaque_value_expr
+| @unspecified_element
+;
+
+@param_decl_or_none =
+ @param_decl
+| @unspecified_element
+;
+
+@pattern_or_none =
+ @pattern
+| @unspecified_element
+;
+
+@pattern_binding_decl_or_none =
+ @pattern_binding_decl
+| @unspecified_element
+;
+
+@precedence_group_decl_or_none =
+ @precedence_group_decl
+| @unspecified_element
+;
+
+@protocol_decl_or_none =
+ @protocol_decl
+| @unspecified_element
+;
+
+@protocol_type_or_none =
+ @protocol_type
+| @unspecified_element
+;
+
+@stmt_or_none =
+ @stmt
+| @unspecified_element
+;
+
+@stmt_condition_or_none =
+ @stmt_condition
+| @unspecified_element
+;
+
+@string_literal_expr_or_none =
+ @string_literal_expr
+| @unspecified_element
+;
+
+@tap_expr_or_none =
+ @tap_expr
+| @unspecified_element
+;
+
+@type_or_none =
+ @type
+| @unspecified_element
+;
+
+@type_alias_decl_or_none =
+ @type_alias_decl
+| @unspecified_element
+;
+
+@type_repr_or_none =
+ @type_repr
+| @unspecified_element
+;
+
+@value_decl_or_none =
+ @unspecified_element
+| @value_decl
+;
+
+@var_decl_or_none =
+ @unspecified_element
+| @var_decl
+;
diff --git a/swift/ql/lib/upgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/upgrade.properties b/swift/ql/lib/upgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/upgrade.properties
new file mode 100644
index 000000000000..270852cf8512
--- /dev/null
+++ b/swift/ql/lib/upgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/upgrade.properties
@@ -0,0 +1,4 @@
+description: Expose declared interface types
+compatibility: backwards
+type_decls.rel: run upgrade.ql new_type_decls
+unspecified_elements.rel: run upgrade.ql new_unspecified_elements
diff --git a/swift/ql/lib/upgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/upgrade.ql b/swift/ql/lib/upgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/upgrade.ql
new file mode 100644
index 000000000000..3ecfd00badbb
--- /dev/null
+++ b/swift/ql/lib/upgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/upgrade.ql
@@ -0,0 +1,29 @@
+class TypeDecl extends @type_decl {
+ string toString() { none() }
+}
+
+newtype TAddedElement = TType(TypeDecl t)
+
+module Fresh = QlBuiltins::NewEntity;
+
+class TNewElement = @element or Fresh::EntityId;
+
+class NewElement extends TNewElement {
+ string toString() { none() }
+}
+
+query predicate new_type_decls(TypeDecl typeDecl, string name, NewElement elementType) {
+ type_decls(typeDecl, name) and
+ Fresh::map(TType(typeDecl)) = elementType
+}
+
+query predicate new_unspecified_elements(NewElement id, string property, string error) {
+ unspecified_elements(id, property, error)
+ or
+ exists(TypeDecl typeDecl | type_decls(typeDecl, _) |
+ id = Fresh::map(TType(typeDecl)) and
+ error =
+ "TypeDecl declared interface type missing after upgrade. Please update your CodeQL code." and
+ property = ""
+ )
+}
diff --git a/swift/ql/test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.expected b/swift/ql/test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.expected
index 9daa87b09ccd..474fb0ab2e6f 100644
--- a/swift/ql/test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.expected
+++ b/swift/ql/test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.expected
@@ -1,6 +1,6 @@
instances
-| associated_type.swift:2:5:2:20 | Bar | getModule: | file://:0:0:0:0 | associated_type | getInterfaceType: | Self.Bar.Type | getName: | Bar |
-| associated_type.swift:3:5:3:25 | Baz | getModule: | file://:0:0:0:0 | associated_type | getInterfaceType: | Self.Baz.Type | getName: | Baz |
+| associated_type.swift:2:5:2:20 | Bar | getModule: | file://:0:0:0:0 | associated_type | getInterfaceType: | Self.Bar.Type | getName: | Bar | getDeclaredInterfaceType: | Self.Bar |
+| associated_type.swift:3:5:3:25 | Baz | getModule: | file://:0:0:0:0 | associated_type | getInterfaceType: | Self.Baz.Type | getName: | Baz | getDeclaredInterfaceType: | Self.Baz |
getMember
getInheritedType
| associated_type.swift:3:5:3:25 | Baz | 0 | Equatable |
diff --git a/swift/ql/test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.ql b/swift/ql/test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.ql
index 41cc9d349a43..8788784b044d 100644
--- a/swift/ql/test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.ql
+++ b/swift/ql/test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.ql
@@ -4,7 +4,8 @@ import TestUtils
query predicate instances(
AssociatedTypeDecl x, string getModule__label, ModuleDecl getModule,
- string getInterfaceType__label, Type getInterfaceType, string getName__label, string getName
+ string getInterfaceType__label, Type getInterfaceType, string getName__label, string getName,
+ string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType
) {
toBeTested(x) and
not x.isUnknown() and
@@ -13,7 +14,9 @@ query predicate instances(
getInterfaceType__label = "getInterfaceType:" and
getInterfaceType = x.getInterfaceType() and
getName__label = "getName:" and
- getName = x.getName()
+ getName = x.getName() and
+ getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
+ getDeclaredInterfaceType = x.getDeclaredInterfaceType()
}
query predicate getMember(AssociatedTypeDecl x, int index, Decl getMember) {
diff --git a/swift/ql/test/extractor-tests/generated/decl/ClassDecl/ClassDecl.expected b/swift/ql/test/extractor-tests/generated/decl/ClassDecl/ClassDecl.expected
index b15a1cc649df..a9054efb302b 100644
--- a/swift/ql/test/extractor-tests/generated/decl/ClassDecl/ClassDecl.expected
+++ b/swift/ql/test/extractor-tests/generated/decl/ClassDecl/ClassDecl.expected
@@ -1,7 +1,7 @@
instances
-| class.swift:1:1:7:1 | Foo | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Foo.Type | getName: | Foo | getType: | Foo |
-| class.swift:11:1:14:1 | Generic | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Generic.Type | getName: | Generic | getType: | Generic |
-| class.swift:16:1:17:1 | Baz | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Baz.Type | getName: | Baz | getType: | Baz |
+| class.swift:1:1:7:1 | Foo | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Foo.Type | getName: | Foo | getDeclaredInterfaceType: | Foo | getType: | Foo |
+| class.swift:11:1:14:1 | Generic | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Generic.Type | getName: | Generic | getDeclaredInterfaceType: | Generic | getType: | Generic |
+| class.swift:16:1:17:1 | Baz | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Baz.Type | getName: | Baz | getDeclaredInterfaceType: | Baz | getType: | Baz |
getGenericTypeParam
| class.swift:11:1:14:1 | Generic | 0 | class.swift:11:15:11:15 | X |
| class.swift:11:1:14:1 | Generic | 1 | class.swift:11:18:11:18 | Y |
diff --git a/swift/ql/test/extractor-tests/generated/decl/ClassDecl/ClassDecl.ql b/swift/ql/test/extractor-tests/generated/decl/ClassDecl/ClassDecl.ql
index e32a98ca2bc0..620a77295d9f 100644
--- a/swift/ql/test/extractor-tests/generated/decl/ClassDecl/ClassDecl.ql
+++ b/swift/ql/test/extractor-tests/generated/decl/ClassDecl/ClassDecl.ql
@@ -4,7 +4,9 @@ import TestUtils
query predicate instances(
ClassDecl x, string getModule__label, ModuleDecl getModule, string getInterfaceType__label,
- Type getInterfaceType, string getName__label, string getName, string getType__label, Type getType
+ Type getInterfaceType, string getName__label, string getName,
+ string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType, string getType__label,
+ Type getType
) {
toBeTested(x) and
not x.isUnknown() and
@@ -14,6 +16,8 @@ query predicate instances(
getInterfaceType = x.getInterfaceType() and
getName__label = "getName:" and
getName = x.getName() and
+ getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
+ getDeclaredInterfaceType = x.getDeclaredInterfaceType() and
getType__label = "getType:" and
getType = x.getType()
}
diff --git a/swift/ql/test/extractor-tests/generated/decl/EnumDecl/EnumDecl.expected b/swift/ql/test/extractor-tests/generated/decl/EnumDecl/EnumDecl.expected
index 06c1789b3bcc..2b71460a07c5 100644
--- a/swift/ql/test/extractor-tests/generated/decl/EnumDecl/EnumDecl.expected
+++ b/swift/ql/test/extractor-tests/generated/decl/EnumDecl/EnumDecl.expected
@@ -1,9 +1,9 @@
instances
-| enums.swift:1:1:4:1 | EnumValues | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumValues.Type | getName: | EnumValues | getType: | EnumValues |
-| enums.swift:7:1:10:1 | EnumValuesWithBase | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumValuesWithBase.Type | getName: | EnumValuesWithBase | getType: | EnumValuesWithBase |
-| enums.swift:12:1:16:1 | EnumWithParams | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumWithParams.Type | getName: | EnumWithParams | getType: | EnumWithParams |
-| enums.swift:18:1:21:1 | GenericEnum | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | GenericEnum.Type | getName: | GenericEnum | getType: | GenericEnum |
-| enums.swift:23:1:27:1 | EnumWithNamedParams | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumWithNamedParams.Type | getName: | EnumWithNamedParams | getType: | EnumWithNamedParams |
+| enums.swift:1:1:4:1 | EnumValues | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumValues.Type | getName: | EnumValues | getDeclaredInterfaceType: | EnumValues | getType: | EnumValues |
+| enums.swift:7:1:10:1 | EnumValuesWithBase | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumValuesWithBase.Type | getName: | EnumValuesWithBase | getDeclaredInterfaceType: | EnumValuesWithBase | getType: | EnumValuesWithBase |
+| enums.swift:12:1:16:1 | EnumWithParams | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumWithParams.Type | getName: | EnumWithParams | getDeclaredInterfaceType: | EnumWithParams | getType: | EnumWithParams |
+| enums.swift:18:1:21:1 | GenericEnum | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | GenericEnum.Type | getName: | GenericEnum | getDeclaredInterfaceType: | GenericEnum | getType: | GenericEnum |
+| enums.swift:23:1:27:1 | EnumWithNamedParams | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumWithNamedParams.Type | getName: | EnumWithNamedParams | getDeclaredInterfaceType: | EnumWithNamedParams | getType: | EnumWithNamedParams |
getGenericTypeParam
| enums.swift:18:1:21:1 | GenericEnum | 0 | enums.swift:18:18:18:18 | T |
getMember
diff --git a/swift/ql/test/extractor-tests/generated/decl/EnumDecl/EnumDecl.ql b/swift/ql/test/extractor-tests/generated/decl/EnumDecl/EnumDecl.ql
index dabf9078cea0..f5d9540c0f76 100644
--- a/swift/ql/test/extractor-tests/generated/decl/EnumDecl/EnumDecl.ql
+++ b/swift/ql/test/extractor-tests/generated/decl/EnumDecl/EnumDecl.ql
@@ -4,7 +4,9 @@ import TestUtils
query predicate instances(
EnumDecl x, string getModule__label, ModuleDecl getModule, string getInterfaceType__label,
- Type getInterfaceType, string getName__label, string getName, string getType__label, Type getType
+ Type getInterfaceType, string getName__label, string getName,
+ string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType, string getType__label,
+ Type getType
) {
toBeTested(x) and
not x.isUnknown() and
@@ -14,6 +16,8 @@ query predicate instances(
getInterfaceType = x.getInterfaceType() and
getName__label = "getName:" and
getName = x.getName() and
+ getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
+ getDeclaredInterfaceType = x.getDeclaredInterfaceType() and
getType__label = "getType:" and
getType = x.getType()
}
diff --git a/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.expected b/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.expected
index 42d051d0a4ff..3c06d59b026b 100644
--- a/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.expected
+++ b/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.expected
@@ -1,7 +1,7 @@
instances
-| file://:0:0:0:0 | Foo | getModule: | file://:0:0:0:0 | Foo | getInterfaceType: | module | getName: | Foo | isBuiltinModule: | no | isSystemModule: | no |
-| file://:0:0:0:0 | __ObjC | getModule: | file://:0:0:0:0 | __ObjC | getInterfaceType: | module<__ObjC> | getName: | __ObjC | isBuiltinModule: | no | isSystemModule: | no |
-| file://:0:0:0:0 | default_module_name | getModule: | file://:0:0:0:0 | default_module_name | getInterfaceType: | module | getName: | default_module_name | isBuiltinModule: | no | isSystemModule: | no |
+| file://:0:0:0:0 | Foo | getModule: | file://:0:0:0:0 | Foo | getInterfaceType: | module | getName: | Foo | getDeclaredInterfaceType: | module | isBuiltinModule: | no | isSystemModule: | no |
+| file://:0:0:0:0 | __ObjC | getModule: | file://:0:0:0:0 | __ObjC | getInterfaceType: | module<__ObjC> | getName: | __ObjC | getDeclaredInterfaceType: | module<__ObjC> | isBuiltinModule: | no | isSystemModule: | no |
+| file://:0:0:0:0 | default_module_name | getModule: | file://:0:0:0:0 | default_module_name | getInterfaceType: | module | getName: | default_module_name | getDeclaredInterfaceType: | module | isBuiltinModule: | no | isSystemModule: | no |
getMember
getInheritedType
getAnImportedModule
diff --git a/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.ql b/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.ql
index 911474839d40..89d5438e07cd 100644
--- a/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.ql
+++ b/swift/ql/test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.ql
@@ -4,8 +4,10 @@ import TestUtils
query predicate instances(
ModuleDecl x, string getModule__label, ModuleDecl getModule, string getInterfaceType__label,
- Type getInterfaceType, string getName__label, string getName, string isBuiltinModule__label,
- string isBuiltinModule, string isSystemModule__label, string isSystemModule
+ Type getInterfaceType, string getName__label, string getName,
+ string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType,
+ string isBuiltinModule__label, string isBuiltinModule, string isSystemModule__label,
+ string isSystemModule
) {
toBeTested(x) and
not x.isUnknown() and
@@ -15,6 +17,8 @@ query predicate instances(
getInterfaceType = x.getInterfaceType() and
getName__label = "getName:" and
getName = x.getName() and
+ getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
+ getDeclaredInterfaceType = x.getDeclaredInterfaceType() and
isBuiltinModule__label = "isBuiltinModule:" and
(if x.isBuiltinModule() then isBuiltinModule = "yes" else isBuiltinModule = "no") and
isSystemModule__label = "isSystemModule:" and
diff --git a/swift/ql/test/extractor-tests/generated/decl/OpaqueTypeDecl/OpaqueTypeDecl.expected b/swift/ql/test/extractor-tests/generated/decl/OpaqueTypeDecl/OpaqueTypeDecl.expected
index 8a5d39063f54..846aeea5bae7 100644
--- a/swift/ql/test/extractor-tests/generated/decl/OpaqueTypeDecl/OpaqueTypeDecl.expected
+++ b/swift/ql/test/extractor-tests/generated/decl/OpaqueTypeDecl/OpaqueTypeDecl.expected
@@ -1,8 +1,8 @@
instances
-| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some Base).Type | getName: | _ | getNamingDeclaration: | opaque_types.swift:9:1:9:51 | baz(_:) |
-| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some P).Type | getName: | _ | getNamingDeclaration: | opaque_types.swift:5:1:5:45 | bar(_:) |
-| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some P).Type | getName: | _ | getNamingDeclaration: | opaque_types.swift:13:1:13:59 | bazz() |
-| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some SignedInteger).Type | getName: | _ | getNamingDeclaration: | opaque_types.swift:1:1:1:45 | foo() |
+| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some Base).Type | getName: | _ | getDeclaredInterfaceType: | some Base | getNamingDeclaration: | opaque_types.swift:9:1:9:51 | baz(_:) |
+| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some P).Type | getName: | _ | getDeclaredInterfaceType: | some P | getNamingDeclaration: | opaque_types.swift:5:1:5:45 | bar(_:) |
+| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some P).Type | getName: | _ | getDeclaredInterfaceType: | some P | getNamingDeclaration: | opaque_types.swift:13:1:13:59 | bazz() |
+| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some SignedInteger).Type | getName: | _ | getDeclaredInterfaceType: | some SignedInteger | getNamingDeclaration: | opaque_types.swift:1:1:1:45 | foo() |
getGenericTypeParam
getMember
getInheritedType
diff --git a/swift/ql/test/extractor-tests/generated/decl/OpaqueTypeDecl/OpaqueTypeDecl.ql b/swift/ql/test/extractor-tests/generated/decl/OpaqueTypeDecl/OpaqueTypeDecl.ql
index 64b9149c1d00..aa34537f7ae8 100644
--- a/swift/ql/test/extractor-tests/generated/decl/OpaqueTypeDecl/OpaqueTypeDecl.ql
+++ b/swift/ql/test/extractor-tests/generated/decl/OpaqueTypeDecl/OpaqueTypeDecl.ql
@@ -4,8 +4,9 @@ import TestUtils
query predicate instances(
OpaqueTypeDecl x, string getModule__label, ModuleDecl getModule, string getInterfaceType__label,
- Type getInterfaceType, string getName__label, string getName, string getNamingDeclaration__label,
- ValueDecl getNamingDeclaration
+ Type getInterfaceType, string getName__label, string getName,
+ string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType,
+ string getNamingDeclaration__label, ValueDecl getNamingDeclaration
) {
toBeTested(x) and
not x.isUnknown() and
@@ -15,6 +16,8 @@ query predicate instances(
getInterfaceType = x.getInterfaceType() and
getName__label = "getName:" and
getName = x.getName() and
+ getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
+ getDeclaredInterfaceType = x.getDeclaredInterfaceType() and
getNamingDeclaration__label = "getNamingDeclaration:" and
getNamingDeclaration = x.getNamingDeclaration()
}
diff --git a/swift/schema.py b/swift/schema.py
index febbf1ae2f47..31be5ee7d24c 100644
--- a/swift/schema.py
+++ b/swift/schema.py
@@ -278,6 +278,7 @@ class TypeDecl(ValueDecl):
This only returns the types effectively appearing in the declaration. In particular it
will not resolve `TypeAliasDecl`s or consider base types added by extensions.
""")
+ declared_interface_type: Type
class AbstractTypeParamDecl(TypeDecl):
pass
diff --git a/unified/AGENTS.md b/unified/AGENTS.md
index 44cb74372883..488a94f44bd4 100644
--- a/unified/AGENTS.md
+++ b/unified/AGENTS.md
@@ -5,6 +5,21 @@ This is a CodeQL extractor based on tree-sitter.
## Building
To build the extractor, run `scripts/create-extractor-pack.sh`
+## Editing the Swift grammar
+The vendored tree-sitter-swift grammar lives at
+`extractor/tree-sitter-swift/`. After editing `grammar.js` (or any other
+grammar source), run `scripts/regenerate-grammar.sh` to:
+- regenerate `extractor/tree-sitter-swift/src/{parser.c, grammar.json,
+ node-types.json}` (and the `src/tree_sitter/*.h` headers) via
+ `tree-sitter generate`; and
+- refresh `extractor/tree-sitter-swift/node-types.yml`, the
+ human-readable companion to `src/node-types.json` produced by yeast's
+ `node_types_yaml` binary.
+
+`node-types.yml` is the recommended review surface for grammar changes —
+it shows the impact of a grammar tweak on the named node kinds, fields,
+and child types in a form much easier to read than the raw JSON.
+
## Testing
- If you changed the extractor code, always rebuild it before running tests.
diff --git a/unified/extractor/BUILD.bazel b/unified/extractor/BUILD.bazel
index 5a53d7cc3e07..80ca1c0057b3 100644
--- a/unified/extractor/BUILD.bazel
+++ b/unified/extractor/BUILD.bazel
@@ -16,5 +16,6 @@ codeql_rust_binary(
) + [
"//shared/tree-sitter-extractor",
"//shared/yeast",
+ "//unified/extractor/tree-sitter-swift",
],
)
diff --git a/unified/extractor/Cargo.toml b/unified/extractor/Cargo.toml
index 3877ec2e106f..39c20598b1ff 100644
--- a/unified/extractor/Cargo.toml
+++ b/unified/extractor/Cargo.toml
@@ -9,7 +9,7 @@ edition = "2024"
[dependencies]
tree-sitter = ">= 0.23.0"
tree-sitter-embedded-template = "0.25.0"
-tree-sitter-swift = "0.7.2"
+tree-sitter-swift = { path = "tree-sitter-swift" }
clap = { version = "4.5", features = ["derive"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
diff --git a/unified/extractor/tree-sitter-swift/.gitignore b/unified/extractor/tree-sitter-swift/.gitignore
new file mode 100644
index 000000000000..53796875297e
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/.gitignore
@@ -0,0 +1,9 @@
+# Generated by tree-sitter from grammar.js. The Cargo build script
+# (bindings/rust/build.rs) and Bazel's cargo_build_script regenerate them into
+# OUT_DIR. The tree-sitter CLI (parse, test, playground, etc.) expects them in
+# src/, so contributors can run `tree-sitter generate` locally to populate
+# these — they are intentionally untracked.
+src/parser.c
+src/grammar.json
+src/node-types.json
+src/tree_sitter/
diff --git a/unified/extractor/tree-sitter-swift/BUILD.bazel b/unified/extractor/tree-sitter-swift/BUILD.bazel
new file mode 100644
index 000000000000..f865f22a1420
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/BUILD.bazel
@@ -0,0 +1,42 @@
+load("@rules_rust//cargo:defs.bzl", "cargo_build_script")
+load("@rules_rust//rust:defs.bzl", "rust_library")
+load("//misc/bazel/3rdparty/tree_sitter_extractors_deps:defs.bzl", "aliases", "all_crate_deps")
+
+package(default_visibility = ["//visibility:public"])
+
+# This will run the build script from the root of the workspace, and
+# collect the outputs.
+cargo_build_script(
+ name = "tree-sitter-swift-build",
+ srcs = ["bindings/rust/build.rs"],
+ data = glob([
+ "src/scanner.c",
+ ]) + [
+ "grammar.js",
+ ],
+ deps = all_crate_deps(
+ build = True,
+ ),
+)
+
+rust_library(
+ name = "tree-sitter-swift",
+ srcs = [
+ "bindings/rust/lib.rs",
+ ],
+ aliases = aliases(),
+ compile_data = glob([
+ "src/**",
+ "queries/**",
+ ]) + [
+ "grammar.js",
+ ],
+ proc_macro_deps = all_crate_deps(
+ proc_macro = True,
+ ),
+ deps = [":tree-sitter-swift-build"] + all_crate_deps(
+ normal = True,
+ ),
+)
+
+exports_files(["Cargo.toml"])
diff --git a/unified/extractor/tree-sitter-swift/Cargo.toml b/unified/extractor/tree-sitter-swift/Cargo.toml
new file mode 100644
index 000000000000..8cec03889a83
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/Cargo.toml
@@ -0,0 +1,22 @@
+[package]
+name = "tree-sitter-swift"
+description = "Swift grammar for the tree-sitter parsing library (vendored copy for the unified extractor)"
+version = "0.7.2"
+keywords = ["incremental", "parsing", "swift"]
+categories = ["parsing", "text-editors"]
+repository = "https://github.com/alex-pinkus/tree-sitter-swift"
+edition = "2024"
+license = "MIT"
+
+build = "bindings/rust/build.rs"
+
+[lib]
+path = "bindings/rust/lib.rs"
+
+# When updating these dependencies, run `misc/bazel/3rdparty/update_cargo_deps.sh`
+[dependencies]
+tree-sitter-language = "0.1"
+
+[build-dependencies]
+cc = "1.2"
+tree-sitter-generate = "0.26.8"
diff --git a/unified/extractor/tree-sitter-swift/LICENSE b/unified/extractor/tree-sitter-swift/LICENSE
new file mode 100644
index 000000000000..f158d7005311
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021 alex-pinkus
+
+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.
diff --git a/unified/extractor/tree-sitter-swift/README.md b/unified/extractor/tree-sitter-swift/README.md
new file mode 100644
index 000000000000..5b54f4b617f6
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/README.md
@@ -0,0 +1,127 @@
+
+[](https://crates.io/crates/tree-sitter-swift)
+[](https://www.npmjs.com/package/tree-sitter-swift)
+[](https://github.com/alex-pinkus/tree-sitter-swift/actions/workflows/top-repos.yml)
+
+# tree-sitter-swift
+
+This contains a [`tree-sitter`](https://tree-sitter.github.io/tree-sitter) grammar for the Swift programming language.
+
+## Getting started
+
+To use this parser to parse Swift code, you'll want to depend on either the Rust crate or the NPM package.
+
+### Rust
+
+To use the Rust crate, you'll add this to your `Cargo.toml`:
+
+```
+tree-sitter = "0.23.0"
+tree-sitter-swift = "=0.7.0"
+```
+
+Then you can use a `tree-sitter` parser with the language declared here:
+
+```
+let mut parser = tree_sitter::Parser::new();
+parser.set_language(tree_sitter_swift::language())?;
+
+// ...
+
+let tree = parser.parse(&my_source_code, None)
+ .ok_or_else(|| /* error handling code */)?;
+```
+
+### Javascript
+
+To use this from NPM, you'll add similar dependencies to `package.json`:
+
+```
+"dependencies: {
+ "tree-sitter-swift": "0.7.0",
+ "tree-sitter": "^0.22.1"
+}
+```
+
+Your usage of the parser will look like:
+
+```
+const Parser = require("tree-sitter");
+const Swift = require("tree-sitter-swift");
+
+const parser = new Parser();
+parser.setLanguage(Swift);
+
+// ...
+
+const tree = parser.parse(mySourceCode);
+```
+
+### Editing the grammar
+
+With this package checked out, a common workflow for editing the grammar will look something like:
+
+1. Make a change to `grammar.ts`.
+2. Run `npm install && npm test` to see whether the change has had impact on existing parsing behavior. The default
+ `npm test` target requires `valgrind` to be installed; if you do not have it installed, and do not wish to, you can
+ substitute `tree-sitter test` directly.
+3. Run `tree-sitter parse` on some real Swift codebase and see whether (or where) it fails.
+4. Use any failures to create new corpus test cases.
+
+## Contributions
+
+All contributions to this repository are welcome.
+
+If said contribution is to check generated files (e.g., `parser.c`) into the repository, be aware that your contribution will not be accepted. Make sure to read the [FAQ entry](https://github.com/alex-pinkus/tree-sitter-swift?tab=readme-ov-file#where-is-your-parserc) and the [prior](https://github.com/alex-pinkus/tree-sitter-swift/issues/362) [discussions](https://github.com/alex-pinkus/tree-sitter-swift/pull/315) and [compromises](https://github.com/alex-pinkus/tree-sitter-swift/issues/149) that have occurred already on this topic.
+
+## Using tree-sitter-swift in Web Assembly
+
+To use tree-sitter-swift as a language for the web bindings version tree-sitter, which will likely be a more modern version than the published node
+module. [see](https://github.com/tree-sitter/tree-sitter/blob/master/lib/binding_web/README.md). Follow the instructions below
+
+1. Install the node modules `npm install web-tree-sitter tree-sitter-swift`
+2. Run the tree-sitter cli to create the wasm bundle
+ ```sh
+ $ npx tree-sitter build-asm ./node_modules/tree-sitter
+ ```
+3. Boot tree-sitter wasm like this.
+
+```js
+const Parser = require("web-tree-sitter");
+async function run() {
+ //needs to happen first
+ await Parser.init();
+ //wait for the load of swift
+ const Swift = await Parser.Language.load("./tree-sitter-swift.wasm");
+
+ const parser = new Parser();
+ parser.setLanguage(Swift);
+
+ //Parse your swift code here.
+ const tree = parser.parse('print("Hello, World!")');
+}
+//if you want to run this
+run().then(console.log, console.error);
+```
+
+## Frequently asked questions
+
+### Where is your `parser.c`?
+
+This repository currently omits most of the code that is autogenerated during a build. This means, for instance, that
+`grammar.json` and `parser.c` are both only available following a build. It also significantly reduces noise during
+diffs.
+
+The side benefit of not checking in `parser.c` is that you can guarantee backwards compatibility. Parsers generated by
+the tree-sitter CLI aren't always backwards compatible. If you need a parser, generate it yourself using the CLI; all
+the information to do so is available in this package. By doing that, you'll also know for sure that your parser version
+and your library version are compatible.
+
+If you need a `parser.c`, and you don't care about the tree-sitter version, but you don't have a local setup that would
+allow you to obtain the parser, you can just download one from a recent workflow run in this package. To do so:
+
+- Go to the [GitHub actions page](https://github.com/alex-pinkus/tree-sitter-swift/actions) for this
+ repository.
+- Click on the "Publish `grammar.json` and `parser.c`" action for the appropriate commit.
+- Go down to `Artifacts` and click on `generated-parser-src`. All the relevant parser files will be available in your
+ download.
diff --git a/unified/extractor/tree-sitter-swift/binding.gyp b/unified/extractor/tree-sitter-swift/binding.gyp
new file mode 100644
index 000000000000..4d9270af7d47
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/binding.gyp
@@ -0,0 +1,44 @@
+{
+ "targets": [
+ {
+ "target_name": "tree_sitter_swift_binding",
+ "dependencies": [
+ "
+
+typedef struct TSLanguage TSLanguage;
+
+extern "C" TSLanguage *tree_sitter_swift();
+
+// "tree-sitter", "language" hashed with BLAKE2
+const napi_type_tag LANGUAGE_TYPE_TAG = {
+ 0x8AF2E5212AD58ABF, 0xD5006CAD83ABBA16
+};
+
+Napi::Object Init(Napi::Env env, Napi::Object exports) {
+ exports["name"] = Napi::String::New(env, "swift");
+ auto language = Napi::External::New(env, tree_sitter_swift());
+ language.TypeTag(&LANGUAGE_TYPE_TAG);
+ exports["language"] = language;
+ return exports;
+}
+
+NODE_API_MODULE(tree_sitter_swift_binding, Init)
diff --git a/unified/extractor/tree-sitter-swift/bindings/node/index.js b/unified/extractor/tree-sitter-swift/bindings/node/index.js
new file mode 100644
index 000000000000..6657bcf42dec
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/bindings/node/index.js
@@ -0,0 +1,7 @@
+const root = require("path").join(__dirname, "..", "..");
+
+module.exports = require("node-gyp-build")(root);
+
+try {
+ module.exports.nodeTypeInfo = require("../../src/node-types.json");
+} catch (_) {}
diff --git a/unified/extractor/tree-sitter-swift/bindings/rust/build.rs b/unified/extractor/tree-sitter-swift/bindings/rust/build.rs
new file mode 100644
index 000000000000..6b939358ed4b
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/bindings/rust/build.rs
@@ -0,0 +1,49 @@
+use std::env;
+use std::path::PathBuf;
+
+fn main() {
+ // tree-sitter-generate produces parser.c, grammar.json, node-types.json,
+ // and src/tree_sitter/*.h headers from grammar.js. We write them into
+ // OUT_DIR so the build is sandbox-friendly and we don't litter the source
+ // tree.
+ let crate_dir: PathBuf = env::var("CARGO_MANIFEST_DIR").unwrap().into();
+ let out_dir: PathBuf = env::var("OUT_DIR").unwrap().into();
+ let grammar_js = crate_dir.join("grammar.js");
+
+ tree_sitter_generate::generate_parser_in_directory(
+ &crate_dir,
+ Some(&out_dir),
+ Some(&grammar_js),
+ tree_sitter_generate::ABI_VERSION_MAX,
+ None,
+ None,
+ true,
+ tree_sitter_generate::OptLevel::default(),
+ )
+ .expect("failed to generate tree-sitter-swift parser");
+
+ let mut c_config = cc::Build::new();
+ c_config
+ .std("c11")
+ .include(&out_dir)
+ .include(out_dir.join("tree_sitter"));
+
+ #[cfg(target_env = "msvc")]
+ c_config.flag("-utf-8");
+
+ c_config.file(out_dir.join("parser.c"));
+
+ // scanner.c is hand-written and lives in the source tree.
+ let scanner_path = crate_dir.join("src").join("scanner.c");
+ c_config.include(crate_dir.join("src")).file(&scanner_path);
+
+ println!("cargo:rerun-if-changed={}", grammar_js.to_str().unwrap());
+ println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
+ // Re-export OUT_DIR so consumers can include_str! the generated files.
+ println!(
+ "cargo:rustc-env=TREE_SITTER_SWIFT_OUT_DIR={}",
+ out_dir.to_str().unwrap()
+ );
+
+ c_config.compile("tree-sitter-swift");
+}
diff --git a/unified/extractor/tree-sitter-swift/bindings/rust/lib.rs b/unified/extractor/tree-sitter-swift/bindings/rust/lib.rs
new file mode 100644
index 000000000000..891df87778f0
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/bindings/rust/lib.rs
@@ -0,0 +1,68 @@
+//! This crate provides Swift language support for the [tree-sitter][] parsing library.
+//!
+//! Typically, you will use the [language][language func] function to add this language to a
+//! tree-sitter [Parser][], and then use the parser to parse some code:
+//!
+//! ```
+//! let code = r#"
+//! "#;
+//! let mut parser = tree_sitter::Parser::new();
+//! let language = tree_sitter_swift::LANGUAGE;
+//! parser
+//! .set_language(&language.into())
+//! .expect("Error loading Swift parser");
+//! let tree = parser.parse(code, None).unwrap();
+//! assert!(!tree.root_node().has_error());
+//! ```
+//!
+//! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
+//! [language func]: fn.language.html
+//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html
+//! [tree-sitter]: https://tree-sitter.github.io/
+
+use tree_sitter_language::LanguageFn;
+
+unsafe extern "C" {
+ fn tree_sitter_swift() -> *const ();
+}
+
+/// The tree-sitter [`LanguageFn`] for this grammar.
+pub const LANGUAGE: LanguageFn = unsafe { LanguageFn::from_raw(tree_sitter_swift) };
+
+/// The content of the [`node-types.json`][] file for this grammar.
+///
+/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
+pub const NODE_TYPES: &str = include_str!(concat!(env!("TREE_SITTER_SWIFT_OUT_DIR"), "/node-types.json"));
+
+pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm");
+pub const INJECTIONS_QUERY: &str = include_str!("../../queries/injections.scm");
+pub const LOCALS_QUERY: &str = include_str!("../../queries/locals.scm");
+pub const TAGS_QUERY: &str = include_str!("../../queries/tags.scm");
+
+#[cfg(test)]
+mod tests {
+ #[test]
+ fn test_can_load_grammar() {
+ let mut parser = tree_sitter::Parser::new();
+ parser
+ .set_language(&super::LANGUAGE.into())
+ .expect("Error loading Swift parser");
+ }
+
+ #[test]
+ fn test_can_parse_basic_file() {
+ let mut parser = tree_sitter::Parser::new();
+ parser
+ .set_language(&super::LANGUAGE.into())
+ .expect("Error loading Swift parser");
+
+ let tree = parser
+ .parse("_ = \"Hello!\"\n", None)
+ .expect("Unable to parse!");
+
+ assert_eq!(
+ "(source_file (assignment target: (directly_assignable_expression (simple_identifier)) result: (line_string_literal text: (line_str_text))))",
+ tree.root_node().to_sexp(),
+ );
+ }
+}
diff --git a/unified/extractor/tree-sitter-swift/grammar.js b/unified/extractor/tree-sitter-swift/grammar.js
new file mode 100644
index 000000000000..5dbfd7fdbbf2
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/grammar.js
@@ -0,0 +1,2114 @@
+"use strict";
+/*
+ * MIT License
+ *
+ * Copyright (c) 2021 alex-pinkus
+ *
+ * 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.
+ */
+const PRECS = {
+ multiplication: 11,
+ addition: 10,
+ infix_operations: 9,
+ nil_coalescing: 8,
+ check: 7,
+ prefix_operations: 7,
+ comparison: 6,
+ postfix_operations: 6,
+ equality: 5,
+ conjunction: 4,
+ disjunction: 3,
+ block: 2,
+ loop: 1,
+ keypath: 1,
+ parameter_pack: 1,
+ control_transfer: 0,
+ as: -1,
+ tuple: -1,
+ if: -1,
+ switch: -1,
+ do: -1,
+ fully_open_range: -1,
+ range: -1,
+ navigation: -1,
+ expr: -1,
+ ty: -1,
+ call: -2,
+ ternary: -2,
+ try: -2,
+ call_suffix: -2,
+ range_suffix: -2,
+ ternary_binary_suffix: -2,
+ await: -2,
+ assignment: -3,
+ comment: -3,
+ lambda: -3,
+ regex: -4,
+};
+
+const DYNAMIC_PRECS = {
+ call: 1,
+};
+
+const DEC_DIGITS = token(sep1(/[0-9]+/, /_+/));
+const HEX_DIGITS = token(sep1(/[0-9a-fA-F]+/, /_+/));
+const OCT_DIGITS = token(sep1(/[0-7]+/, /_+/));
+const BIN_DIGITS = token(sep1(/[01]+/, /_+/));
+const REAL_EXPONENT = token(seq(/[eE]/, optional(/[+-]/), DEC_DIGITS));
+const HEX_REAL_EXPONENT = token(seq(/[pP]/, optional(/[+-]/), DEC_DIGITS));
+
+var LEXICAL_IDENTIFIER;
+
+if (tree_sitter_version_supports_emoji()) {
+ LEXICAL_IDENTIFIER =
+ /[_\p{XID_Start}\p{Emoji}&&[^0-9#*]](\p{EMod}|\x{FE0F}\x{20E3}?)?([_\p{XID_Continue}\p{Emoji}\x{200D}](\p{EMod}|\x{FE0F}\x{20E3}?)?)*/;
+} else {
+ LEXICAL_IDENTIFIER = /[_\p{XID_Start}][_\p{XID_Continue}]*/;
+}
+
+module.exports = grammar({
+ name: "swift",
+ supertypes: ($) => [
+ $.expression,
+ $.unannotated_type,
+ $.global_declaration,
+ $.type_level_declaration,
+ $.local_declaration,
+ $.protocol_member_declaration,
+ ],
+ conflicts: ($) => [
+ // @Type(... could either be an annotation constructor invocation or an annotated expression
+ [$.attribute],
+ [$._attribute_argument],
+ // Is `foo { ... }` a constructor invocation or function invocation?
+ [$._simple_user_type, $.expression],
+ // To support nested types A.B not being interpreted as `(navigation_expression ... (type_identifier)) (navigation_suffix)`
+ [$.user_type],
+ // How to tell the difference between Foo.bar(with:and:), and Foo.bar(with: smth, and: other)? You need GLR
+ [$.value_argument],
+ // { (foo, bar) ...
+ [$.expression, $.lambda_parameter],
+ [$._primary_expression, $.lambda_parameter],
+ // (start: start, end: end)
+ [$._tuple_type_item_identifier, $.tuple_expression],
+ // After a `{` in a function or switch context, it's ambigous whether we're starting a set of local statements or
+ // applying some modifiers to a capture or pattern.
+ [$.modifiers],
+ // `+(...)` is ambigously either "call the function produced by a reference to the operator `+`" or "use the unary
+ // operator `+` on the result of the parenthetical expression."
+ [$._additive_operator, $._prefix_unary_operator],
+ [$.referenceable_operator, $._prefix_unary_operator],
+ // `{ [self, b, c] ...` could be a capture list or an array literal depending on what else happens.
+ [$.capture_list_item, $.expression],
+ [$.capture_list_item, $.expression, $._simple_user_type],
+ [$._primary_expression, $.capture_list_item],
+ // a ? b : c () could be calling c(), or it could be calling a function that's produced by the result of
+ // `(a ? b : c)`. We have a small hack to force it to be the former of these by intentionally introducing a
+ // conflict.
+ [$.call_suffix, $.expr_hack_at_ternary_binary_call_suffix],
+ // try {expression} is a bit magic and applies quite broadly: `try foo()` and `try foo { }` show that this is right
+ // associative, and `try foo ? bar() : baz` even more so. But it doesn't always win: something like
+ // `if try foo { } ...` should award its braces to the `if`. In order to make this actually happen, we need to parse
+ // all the options and pick the best one that doesn't error out.
+ [$.try_expression, $._unary_expression],
+ [$.try_expression, $.expression],
+ // await {expression} has the same special cases as `try`.
+ [$.await_expression, $._unary_expression],
+ [$.await_expression, $.expression],
+ // In a computed property, when you see an @attribute, it's not yet clear if that's going to be for a
+ // locally-declared class or a getter / setter specifier.
+ [
+ $._local_property_declaration,
+ $._local_typealias_declaration,
+ $._local_function_declaration,
+ $._local_class_declaration,
+ $.computed_getter,
+ $.computed_modify,
+ $.computed_setter,
+ ],
+ // The `class` modifier is legal in many of the same positions that a class declaration itself would be.
+ [$._bodyless_function_declaration, $.property_modifier],
+ [$.init_declaration, $.property_modifier],
+ // Patterns, man
+ [$._navigable_type_expression, $._case_pattern],
+ [$._no_expr_pattern_already_bound, $._binding_pattern_no_expr],
+
+ // On encountering a closure starting with `{ @Foo ...`, we don't yet know if that attribute applies to the closure
+ // type or to a declaration within the closure. What a mess! We just have to hope that if we keep going, only one of
+ // those will parse (because there will be an `in` or a `let`).
+ [
+ $._lambda_type_declaration,
+ $._local_property_declaration,
+ $._local_typealias_declaration,
+ $._local_function_declaration,
+ $._local_class_declaration,
+ ],
+
+ // We want `foo() { }` to be treated as one function call, but we _also_ want `if foo() { ... }` to be treated as a
+ // full if-statement. This means we have to treat it as a conflict rather than purely a left or right associative
+ // construct, and let the parser realize that the second expression won't parse properly with the `{ ... }` as a
+ // lambda.
+ [$.constructor_suffix],
+ [$.call_suffix],
+
+ // `actor` is allowed to be an identifier, even though it is also a locally permitted declaration. If we encounter
+ // it, the only way to know what it's meant to be is to keep going.
+ [$._modifierless_class_declaration, $.property_modifier],
+ [$._fn_call_lambda_arguments],
+
+ // `borrowing` and `consuming` are legal as identifiers, but are also legal modifiers
+ [$.parameter_modifiers],
+
+ // These are keywords sometimes, but simple identifiers other times, and it just depends on the rest of their usage.
+ [$._contextual_simple_identifier, $._modifierless_class_declaration],
+ [$._contextual_simple_identifier, $.property_behavior_modifier],
+ [$._contextual_simple_identifier, $.parameter_modifier],
+ [$._contextual_simple_identifier, $.type_parameter_pack],
+ [$._contextual_simple_identifier, $.type_pack_expansion],
+ [$._contextual_simple_identifier, $.visibility_modifier],
+ ],
+ extras: ($) => [
+ $.comment,
+ $.multiline_comment,
+ /\s+/, // Whitespace
+ ],
+ externals: ($) => [
+ // Comments and raw strings are parsed in a custom scanner because they require us to carry forward state to
+ // maintain symmetry. For instance, parsing a multiline comment requires us to increment a counter whenever we see
+ // `/*`, and decrement it whenever we see `*/`. A standard grammar would only be able to exit the comment at the
+ // first `*/` (like C does). Similarly, when you start a string with `##"`, you're required to include the same
+ // number of `#` symbols to end it.
+ $.multiline_comment,
+ $.raw_str_part,
+ $.raw_str_continuing_indicator,
+ $.raw_str_end_part,
+ // Because Swift doesn't have explicit semicolons, we also do some whitespace handling in a custom scanner. Line
+ // breaks are _sometimes_ meaningful as the end of a statement: try to write `let foo: Foo let bar: Bar`, for
+ // instance and the compiler will complain, but add either a newline or a semicolon and it's fine. We borrow the
+ // idea from the Kotlin grammar that a newline is sometimes a "semicolon". By including `\n` in both `_semi` and
+ // an anonymous `whitespace` extras, we _should_ be able to let the parser decide if a newline is meaningful. If the
+ // parser sees something like `foo.bar(1\n)`, it knows that a "semicolon" would not be valid there, so it parses
+ // that as whitespace. On the other hand, `let foo: Foo\n let bar: Bar` has a meaningful newline.
+ // Unfortunately, we can't simply stop at that. There are some expressions and statements that remain valid if you
+ // end them early, but are expected to be parsed across multiple lines. One particular nefarious example is a
+ // function declaration, where you might have something like `func foo(args: A) -> Foo throws where A: Hashable`.
+ // This would still be a valid declaration even if it ended after the `)`, the `Foo`, or the `throws`, so a grammar
+ // that simply interprets a newline as "sometimes a semi" would parse those incorrectly.
+ // To solve that case, our custom scanner must do a bit of extra lookahead itself. If we're about to generate a
+ // `_semi`, we advance a bit further to see if the next non-whitespace token would be one of these other operators.
+ // If so, we ignore the `_semi` and just produce the operator; if not, we produce the `_semi` and let the rest of
+ // the grammar sort it out. This isn't perfect, but it works well enough most of the time.
+ $._implicit_semi,
+ $._explicit_semi,
+ // Every one of the below operators will suppress a `_semi` if we encounter it after a newline.
+ $._arrow_operator_custom,
+ $._dot_custom,
+ $._conjunction_operator_custom,
+ $._disjunction_operator_custom,
+ $._nil_coalescing_operator_custom,
+ $._eq_custom,
+ $._eq_eq_custom,
+ $._plus_then_ws,
+ $._minus_then_ws,
+ $._bang_custom,
+ $._throws_keyword,
+ $._rethrows_keyword,
+ $.default_keyword,
+ $.where_keyword,
+ $["else"],
+ $.catch_keyword,
+ $._as_custom,
+ $._as_quest_custom,
+ $._as_bang_custom,
+ $._async_keyword_custom,
+ $._custom_operator,
+ $._hash_symbol_custom,
+ $._directive_if,
+ $._directive_elseif,
+ $._directive_else,
+ $._directive_endif,
+
+ // Fake operator that will never get triggered, but follows the sequence of characters for `try!`. Tracked by the
+ // custom scanner so that it can avoid triggering `$.bang` for that case.
+ $._fake_try_bang,
+ ],
+ inline: ($) => [$._locally_permitted_modifiers],
+ rules: {
+ ////////////////////////////////
+ // File Structure
+ ////////////////////////////////
+ source_file: ($) =>
+ seq(
+ optional($.shebang_line),
+ optional(
+ seq(
+ $._top_level_statement,
+ repeat(seq($._semi, $._top_level_statement)),
+ optional($._semi)
+ )
+ )
+ ),
+ _semi: ($) => choice($._implicit_semi, $._explicit_semi),
+ shebang_line: ($) => seq($._hash_symbol, "!", /[^\r\n]*/),
+ ////////////////////////////////
+ // Lexical Structure - https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html
+ ////////////////////////////////
+ comment: ($) => token(prec(PRECS.comment, seq("//", /.*/))),
+ // Identifiers
+ simple_identifier: ($) =>
+ choice(
+ LEXICAL_IDENTIFIER,
+ /`[^\r\n` ]*`/,
+ /\$[0-9]+/,
+ token(seq("$", LEXICAL_IDENTIFIER)),
+ $._contextual_simple_identifier
+ ),
+ // Keywords that were added after they were already legal as identifiers. `tree-sitter` will prefer exact matches
+ // when parsing so unless we explicitly say that these are legal, the parser will interpret them as their keyword.
+ _contextual_simple_identifier: ($) =>
+ choice(
+ "actor",
+ "async",
+ "each",
+ "lazy",
+ "repeat",
+ "package",
+ $._parameter_ownership_modifier
+ ),
+ identifier: ($) => sep1($.simple_identifier, $._dot),
+ // Literals
+ _basic_literal: ($) =>
+ choice(
+ $.integer_literal,
+ $.hex_literal,
+ $.oct_literal,
+ $.bin_literal,
+ $.real_literal,
+ $.boolean_literal,
+ $._string_literal,
+ $.regex_literal,
+ "nil"
+ ),
+ real_literal: ($) =>
+ token(
+ choice(
+ seq(DEC_DIGITS, REAL_EXPONENT),
+ seq(optional(DEC_DIGITS), ".", DEC_DIGITS, optional(REAL_EXPONENT)),
+ seq(
+ "0x",
+ HEX_DIGITS,
+ optional(seq(".", HEX_DIGITS)),
+ HEX_REAL_EXPONENT
+ )
+ )
+ ),
+ integer_literal: ($) => token(seq(optional(/[1-9]/), DEC_DIGITS)),
+ hex_literal: ($) => token(seq("0", /[xX]/, HEX_DIGITS)),
+ oct_literal: ($) => token(seq("0", /[oO]/, OCT_DIGITS)),
+ bin_literal: ($) => token(seq("0", /[bB]/, BIN_DIGITS)),
+ boolean_literal: ($) => choice("true", "false"),
+ // String literals
+ _string_literal: ($) =>
+ choice(
+ $.line_string_literal,
+ $.multi_line_string_literal,
+ $.raw_string_literal
+ ),
+ line_string_literal: ($) =>
+ seq(
+ '"',
+ repeat(choice(field("text", $._line_string_content), $._interpolation)),
+ '"'
+ ),
+ _line_string_content: ($) => choice($.line_str_text, $.str_escaped_char),
+ line_str_text: ($) => /[^\\"]+/,
+ str_escaped_char: ($) =>
+ choice($._escaped_identifier, $._uni_character_literal),
+ _uni_character_literal: ($) => seq("\\", "u", /\{[0-9a-fA-F]+\}/),
+ multi_line_string_literal: ($) =>
+ seq(
+ '"""',
+ repeat(
+ choice(field("text", $._multi_line_string_content), $._interpolation)
+ ),
+ '"""'
+ ),
+ raw_string_literal: ($) =>
+ seq(
+ repeat(
+ seq(
+ field("text", $.raw_str_part),
+ field("interpolation", $.raw_str_interpolation),
+ optional($.raw_str_continuing_indicator)
+ )
+ ),
+ field("text", $.raw_str_end_part)
+ ),
+ raw_str_interpolation: ($) =>
+ seq($.raw_str_interpolation_start, $._interpolation_contents, ")"),
+ raw_str_interpolation_start: ($) => /\\#*\(/,
+ _multi_line_string_content: ($) =>
+ choice($.multi_line_str_text, $.str_escaped_char, '"'),
+ _interpolation: ($) => seq("\\(", $._interpolation_contents, ")"),
+ _interpolation_contents: ($) =>
+ sep1Opt(
+ field(
+ "interpolation",
+ alias($.value_argument, $.interpolated_expression)
+ ),
+ ","
+ ),
+ _escaped_identifier: ($) => /\\[0\\tnr"'\n]/,
+ multi_line_str_text: ($) => /[^\\"]+/,
+ // Based on https://gitlab.com/woolsweater/tree-sitter-swifter/-/blob/3d47c85bd47ce54cdf2023a9c0e01eb90adfcc1d/grammar.js#L1019
+ // But required modifications to hit all of the cases in SE-354
+ regex_literal: ($) =>
+ choice(
+ $._extended_regex_literal,
+ $._multiline_regex_literal,
+ $._oneline_regex_literal
+ ),
+
+ _extended_regex_literal: ($) =>
+ seq($._hash_symbol, /\/((\/[^#])|[^\n])+\/#/),
+
+ _multiline_regex_literal: ($) =>
+ seq($._hash_symbol, /\/\n/, /(\/[^#]|[^/])*?\n\/#/),
+
+ _oneline_regex_literal: ($) =>
+ token(
+ prec(
+ PRECS.regex,
+ seq(
+ "/",
+ token.immediate(/[^ \t\n]?[^/\n]*[^ \t\n/]/),
+ token.immediate("/")
+ )
+ )
+ ),
+ ////////////////////////////////
+ // Types - https://docs.swift.org/swift-book/ReferenceManual/Types.html
+ ////////////////////////////////
+ type_annotation: ($) =>
+ seq(":", field("type", $._possibly_implicitly_unwrapped_type)),
+ _possibly_implicitly_unwrapped_type: ($) =>
+ choice($.type, $.implicitly_unwrapped_type),
+ implicitly_unwrapped_type: ($) =>
+ seq($.type, token.immediate("!")),
+ type: ($) =>
+ prec.right(
+ PRECS.ty,
+ seq(field("modifiers", optional($.type_modifiers)), field("name", $.unannotated_type))
+ ),
+ unannotated_type: ($) =>
+ prec.right(
+ PRECS.ty,
+ choice(
+ $.user_type,
+ $.tuple_type,
+ $.function_type,
+ $.array_type,
+ $.dictionary_type,
+ $.optional_type,
+ $.metatype,
+ $.opaque_type,
+ $.existential_type,
+ $.protocol_composition_type,
+ $.type_parameter_pack,
+ $.type_pack_expansion,
+ $.suppressed_constraint
+ )
+ ),
+ // The grammar just calls this whole thing a `type-identifier` but that's a bit confusing.
+ user_type: ($) => sep1($._simple_user_type, $._dot),
+ _simple_user_type: ($) =>
+ prec.right(
+ PRECS.ty,
+ seq(
+ alias($.simple_identifier, $.type_identifier),
+ optional($.type_arguments)
+ )
+ ),
+ tuple_type: ($) =>
+ choice(
+ seq(
+ "(",
+ optional(sep1Opt(field("element", $.tuple_type_item), ",")),
+ ")"
+ ),
+ alias($._parenthesized_type, $.tuple_type_item)
+ ),
+ tuple_type_item: ($) =>
+ prec(
+ PRECS.expr,
+ seq(
+ optional($._tuple_type_item_identifier),
+ optional($.parameter_modifiers),
+ field("type", $.type)
+ )
+ ),
+ _tuple_type_item_identifier: ($) =>
+ prec(
+ PRECS.expr,
+ seq(
+ optional($.wildcard_pattern),
+ field("name", $.simple_identifier),
+ ":"
+ )
+ ),
+ function_type: ($) =>
+ seq(
+ field("params", choice($.tuple_type, $.unannotated_type)),
+ optional($._async_keyword),
+ optional(choice($.throws_clause, $.throws)),
+ $._arrow_operator,
+ field("return_type", $.type)
+ ),
+ array_type: ($) => seq("[", field("element", $.type), "]"),
+ dictionary_type: ($) =>
+ seq("[", field("key", $.type), ":", field("value", $.type), "]"),
+ optional_type: ($) =>
+ prec.left(
+ seq(
+ field(
+ "wrapped",
+ choice($.user_type, $.tuple_type, $.array_type, $.dictionary_type)
+ ),
+ repeat1(alias($._immediate_quest, "?"))
+ )
+ ),
+ metatype: ($) => seq($.unannotated_type, ".", choice("Type", "Protocol")),
+ _quest: ($) => "?",
+ _immediate_quest: ($) => token.immediate("?"),
+ opaque_type: ($) => prec.right(seq("some", $.unannotated_type)),
+ existential_type: ($) => prec.right(seq("any", $.unannotated_type)),
+ type_parameter_pack: ($) => prec.left(seq("each", $.unannotated_type)),
+ type_pack_expansion: ($) => prec.left(seq("repeat", $.unannotated_type)),
+ protocol_composition_type: ($) =>
+ prec.left(
+ seq(
+ $.unannotated_type,
+ repeat1(seq("&", prec.right($.unannotated_type)))
+ )
+ ),
+ suppressed_constraint: ($) =>
+ prec.right(
+ seq(
+ "~",
+ field("suppressed", alias($.simple_identifier, $.type_identifier))
+ )
+ ),
+ ////////////////////////////////
+ // Expressions - https://docs.swift.org/swift-book/ReferenceManual/Expressions.html
+ ////////////////////////////////
+ expression: ($) =>
+ prec(
+ PRECS.expr,
+ choice(
+ $.simple_identifier,
+ $._unary_expression,
+ $._binary_expression,
+ $.ternary_expression,
+ $._primary_expression,
+ $.if_statement,
+ $.switch_statement,
+ $.assignment,
+ $.value_parameter_pack,
+ $.value_pack_expansion,
+ $.optional_chain_marker
+ )
+ ),
+ optional_chain_marker: ($) =>
+ seq($.expression, alias($._immediate_quest, "?")),
+ // Unary expressions
+ _unary_expression: ($) =>
+ choice(
+ $.postfix_expression,
+ $.call_expression,
+ $.macro_invocation,
+ $.constructor_expression,
+ $.navigation_expression,
+ $.prefix_expression,
+ $.as_expression,
+ $.selector_expression,
+ $.open_start_range_expression,
+ $.open_end_range_expression,
+ $.directive,
+ $.diagnostic
+ ),
+ postfix_expression: ($) =>
+ prec.left(
+ PRECS.postfix_operations,
+ seq(
+ field("target", $.expression),
+ field("operation", $._postfix_unary_operator)
+ )
+ ),
+ constructor_expression: ($) =>
+ prec(
+ PRECS.call,
+ seq(
+ field(
+ "constructed_type",
+ choice($.array_type, $.dictionary_type, $.user_type)
+ ),
+ $.constructor_suffix
+ )
+ ),
+ _parenthesized_type: ($) =>
+ seq(
+ "(",
+ choice($.opaque_type, $.existential_type, $.dictionary_type),
+ ")"
+ ),
+ navigation_expression: ($) =>
+ prec.left(
+ PRECS.navigation,
+ seq(
+ field(
+ "target",
+ choice(
+ $._navigable_type_expression,
+ $.expression,
+ $._parenthesized_type
+ )
+ ),
+ field("suffix", $.navigation_suffix)
+ )
+ ),
+ _navigable_type_expression: ($) =>
+ choice($.user_type, $.array_type, $.dictionary_type),
+ open_start_range_expression: ($) =>
+ prec.right(
+ PRECS.range,
+ seq(
+ $._range_operator,
+ prec.right(PRECS.range_suffix, field("end", $.expression))
+ )
+ ),
+ _range_operator: ($) =>
+ choice($._open_ended_range_operator, $._three_dot_operator),
+ open_end_range_expression: ($) =>
+ prec.right(
+ PRECS.range,
+ seq(field("start", $.expression), $._three_dot_operator)
+ ),
+ prefix_expression: ($) =>
+ prec.left(
+ PRECS.prefix_operations,
+ seq(
+ field("operation", $._prefix_unary_operator),
+ field(
+ "target",
+ choice(
+ $.expression,
+ alias(choice("async", "if", "switch"), $.expression)
+ )
+ )
+ )
+ ),
+ as_expression: ($) =>
+ prec.left(
+ PRECS.as,
+ seq(field("expr", $.expression), $.as_operator, field("type", $.type))
+ ),
+ selector_expression: ($) =>
+ seq(
+ $._hash_symbol,
+ "selector",
+ "(",
+ optional(choice("getter:", "setter:")),
+ $.expression,
+ ")"
+ ),
+ // Binary expressions
+ _binary_expression: ($) =>
+ choice(
+ $.multiplicative_expression,
+ $.additive_expression,
+ $.range_expression,
+ $.infix_expression,
+ $.nil_coalescing_expression,
+ $.check_expression,
+ $.equality_expression,
+ $.comparison_expression,
+ $.conjunction_expression,
+ $.disjunction_expression,
+ $.bitwise_operation
+ ),
+ multiplicative_expression: ($) =>
+ prec.left(
+ PRECS.multiplication,
+ seq(
+ field("lhs", $.expression),
+ field("op", $._multiplicative_operator),
+ field("rhs", $.expression)
+ )
+ ),
+ additive_expression: ($) =>
+ prec.left(
+ PRECS.addition,
+ seq(
+ field("lhs", $.expression),
+ field("op", $._additive_operator),
+ field("rhs", $.expression)
+ )
+ ),
+ range_expression: ($) =>
+ prec.right(
+ PRECS.range,
+ seq(
+ field("start", $.expression),
+ field("op", $._range_operator),
+ field("end", $._expr_hack_at_ternary_binary_suffix)
+ )
+ ),
+ infix_expression: ($) =>
+ prec.left(
+ PRECS.infix_operations,
+ seq(
+ field("lhs", $.expression),
+ field("op", $.custom_operator),
+ field("rhs", $._expr_hack_at_ternary_binary_suffix)
+ )
+ ),
+ nil_coalescing_expression: ($) =>
+ prec.right(
+ PRECS.nil_coalescing,
+ seq(
+ field("value", $.expression),
+ $._nil_coalescing_operator,
+ field("if_nil", $._expr_hack_at_ternary_binary_suffix)
+ )
+ ),
+ check_expression: ($) =>
+ prec.left(
+ PRECS.check,
+ seq(
+ field("target", $.expression),
+ field("op", $._is_operator),
+ field("type", $.type)
+ )
+ ),
+ comparison_expression: ($) =>
+ prec.left(
+ seq(
+ field("lhs", $.expression),
+ field("op", $._comparison_operator),
+ field("rhs", $._expr_hack_at_ternary_binary_suffix)
+ )
+ ),
+ equality_expression: ($) =>
+ prec.left(
+ PRECS.equality,
+ seq(
+ field("lhs", $.expression),
+ field("op", $._equality_operator),
+ field("rhs", $._expr_hack_at_ternary_binary_suffix)
+ )
+ ),
+ conjunction_expression: ($) =>
+ prec.left(
+ PRECS.conjunction,
+ seq(
+ field("lhs", $.expression),
+ field("op", $._conjunction_operator),
+ field("rhs", $._expr_hack_at_ternary_binary_suffix)
+ )
+ ),
+ disjunction_expression: ($) =>
+ prec.left(
+ PRECS.disjunction,
+ seq(
+ field("lhs", $.expression),
+ field("op", $._disjunction_operator),
+ field("rhs", $._expr_hack_at_ternary_binary_suffix)
+ )
+ ),
+ bitwise_operation: ($) =>
+ prec.left(
+ seq(
+ field("lhs", $.expression),
+ field("op", $._bitwise_binary_operator),
+ field("rhs", $._expr_hack_at_ternary_binary_suffix)
+ )
+ ),
+ custom_operator: ($) => choice(token(/[\/]+[*]+/), $._custom_operator),
+ // Suffixes
+ navigation_suffix: ($) =>
+ seq(
+ $._dot,
+ field("suffix", choice($.simple_identifier, $.integer_literal))
+ ),
+ call_suffix: ($) =>
+ prec(
+ PRECS.call_suffix,
+ choice(
+ $.value_arguments,
+ prec.dynamic(-1, $._fn_call_lambda_arguments), // Prefer to treat `foo() { }` as one call not two
+ seq($.value_arguments, $._fn_call_lambda_arguments)
+ )
+ ),
+ constructor_suffix: ($) =>
+ prec(
+ PRECS.call_suffix,
+ choice(
+ alias($._constructor_value_arguments, $.value_arguments),
+ prec.dynamic(-1, $._fn_call_lambda_arguments), // As above
+ seq(
+ alias($._constructor_value_arguments, $.value_arguments),
+ $._fn_call_lambda_arguments
+ )
+ )
+ ),
+ _constructor_value_arguments: ($) =>
+ seq("(", optional(sep1Opt($.value_argument, ",")), ")"),
+ _fn_call_lambda_arguments: ($) =>
+ sep1($.lambda_literal, seq(field("name", $.simple_identifier), ":")),
+ type_arguments: ($) => prec.left(seq("<", sep1Opt($.type, ","), ">")),
+ value_arguments: ($) =>
+ seq(
+ choice(
+ seq("(", optional(sep1Opt($.value_argument, ",")), ")"),
+ seq("[", optional(sep1Opt($.value_argument, ",")), "]")
+ )
+ ),
+ value_argument_label: ($) =>
+ prec.left(
+ choice(
+ $.simple_identifier,
+ // We don't rely on $._contextual_simple_identifier here because
+ // these don't usually fall into that category.
+ alias("if", $.simple_identifier),
+ alias("switch", $.simple_identifier)
+ )
+ ),
+ value_argument: ($) =>
+ prec.left(
+ seq(
+ optional($.type_modifiers),
+ choice(
+ repeat1(
+ seq(field("reference_specifier", $.value_argument_label), ":")
+ ),
+ seq(
+ optional(seq(field("name", $.value_argument_label), ":")),
+ field("value", $.expression)
+ )
+ )
+ )
+ ),
+ try_expression: ($) =>
+ prec.right(
+ PRECS["try"],
+ seq(
+ $.try_operator,
+ field(
+ "expr",
+ choice(
+ // Prefer direct calls, e.g. `try foo()`, over indirect like `try a ? b() : c`. This allows us to have
+ // left associativity for the direct calls, which is technically wrong but is the only way to resolve the
+ // ambiguity of `if foo { ... }` in the correct direction.
+ prec.right(-2, $.expression),
+ prec.left(0, $._binary_expression),
+ prec.left(0, $.call_expression),
+ // Similarly special case the ternary expression, where `try` may come earlier than it is actually needed.
+ // When the parser just encounters some identifier after a `try`, it should prefer the `call_expression` (so
+ // this should be lower in priority than that), but when we encounter an ambiguous expression that might be
+ // either `try (foo() ? ...)` or `(try foo()) ? ...`, we should prefer the former. We accomplish that by
+ // giving it a _static precedence_ of -1 but a _dynamic precedence_ of 1.
+ prec.dynamic(1, prec.left(-1, $.ternary_expression))
+ )
+ )
+ )
+ ),
+ await_expression: ($) =>
+ prec.right(
+ PRECS.await,
+ seq(
+ $._await_operator,
+ field(
+ "expr",
+ choice(
+ // Prefer direct calls over indirect (same as with `try`).
+ prec.right(-2, $.expression),
+ prec.left(0, $.call_expression),
+ // Special case ternary to `await` the whole thing (same as with `try`).
+ prec.dynamic(1, prec.left(-1, $.ternary_expression))
+ )
+ )
+ )
+ ),
+ _await_operator: ($) => alias("await", "await"),
+ ternary_expression: ($) =>
+ prec.right(
+ PRECS.ternary,
+ seq(
+ field("condition", $.expression),
+ $._quest,
+ field("if_true", $.expression),
+ ":",
+ field("if_false", $._expr_hack_at_ternary_binary_suffix)
+ )
+ ),
+ _expr_hack_at_ternary_binary_suffix: ($) =>
+ prec.left(
+ PRECS.ternary_binary_suffix,
+ choice(
+ $.expression,
+ alias($.expr_hack_at_ternary_binary_call, $.call_expression)
+ )
+ ),
+ expr_hack_at_ternary_binary_call: ($) =>
+ seq(
+ $.expression,
+ alias($.expr_hack_at_ternary_binary_call_suffix, $.call_suffix)
+ ),
+ expr_hack_at_ternary_binary_call_suffix: ($) =>
+ prec(PRECS.call_suffix, $.value_arguments),
+ call_expression: ($) =>
+ prec(
+ PRECS.call,
+ prec.dynamic(DYNAMIC_PRECS.call, seq($.expression, $.call_suffix))
+ ),
+ macro_invocation: ($) =>
+ prec(
+ PRECS.call,
+ prec.dynamic(
+ DYNAMIC_PRECS.call,
+ seq(
+ $._hash_symbol,
+ $.simple_identifier,
+ optional($.type_parameters),
+ $.call_suffix
+ )
+ )
+ ),
+ _primary_expression: ($) =>
+ choice(
+ $.tuple_expression,
+ $._basic_literal,
+ $.lambda_literal,
+ $.special_literal,
+ $.playground_literal,
+ $.array_literal,
+ $.dictionary_literal,
+ $.self_expression,
+ $.super_expression,
+ $.try_expression,
+ $.await_expression,
+ $.referenceable_operator,
+ $.key_path_expression,
+ $.key_path_string_expression,
+ prec.right(
+ PRECS.fully_open_range,
+ alias($._three_dot_operator, $.fully_open_range)
+ )
+ ),
+ tuple_expression: ($) =>
+ prec.right(
+ PRECS.tuple,
+ seq(
+ "(",
+ sep1Opt(
+ seq(
+ optional(seq(field("name", $.simple_identifier), ":")),
+ field("value", $.expression)
+ ),
+ ","
+ ),
+ ")"
+ )
+ ),
+ array_literal: ($) =>
+ seq("[", optional(sep1Opt(field("element", $.expression), ",")), "]"),
+ dictionary_literal: ($) =>
+ seq(
+ "[",
+ choice(":", sep1Opt($._dictionary_literal_item, ",")),
+ optional(","),
+ "]"
+ ),
+ _dictionary_literal_item: ($) =>
+ seq(field("key", $.expression), ":", field("value", $.expression)),
+ special_literal: ($) =>
+ seq(
+ $._hash_symbol,
+ choice(
+ "file",
+ "fileID",
+ "filePath",
+ "line",
+ "column",
+ "function",
+ "dsohandle"
+ )
+ ),
+ playground_literal: ($) =>
+ seq(
+ $._hash_symbol,
+ choice("colorLiteral", "fileLiteral", "imageLiteral"),
+ "(",
+ sep1Opt(seq($.simple_identifier, ":", $.expression), ","),
+ ")"
+ ),
+ lambda_literal: ($) =>
+ prec.left(
+ PRECS.lambda,
+ seq(
+ choice("{", "^{"),
+ optional($._lambda_type_declaration),
+ optional($.statements),
+ "}"
+ )
+ ),
+ _lambda_type_declaration: ($) =>
+ seq(
+ repeat($.attribute),
+ prec(PRECS.expr, optional(field("captures", $.capture_list))),
+ optional(field("type", $.lambda_function_type)),
+ "in"
+ ),
+ capture_list: ($) => seq("[", sep1Opt($.capture_list_item, ","), "]"),
+ capture_list_item: ($) =>
+ choice(
+ field("name", $.self_expression),
+ prec(
+ PRECS.expr,
+ seq(
+ optional($.ownership_modifier),
+ field("name", $.simple_identifier),
+ optional(seq($._equal_sign, field("value", $.expression)))
+ )
+ )
+ ),
+ lambda_function_type: ($) =>
+ prec(
+ PRECS.expr,
+ seq(
+ choice(
+ $.lambda_function_type_parameters,
+ seq("(", optional($.lambda_function_type_parameters), ")")
+ ),
+ optional($._async_keyword),
+ optional(choice($.throws_clause, $.throws)),
+ optional(
+ seq(
+ $._arrow_operator,
+ field("return_type", $._possibly_implicitly_unwrapped_type)
+ )
+ )
+ )
+ ),
+ lambda_function_type_parameters: ($) => sep1Opt($.lambda_parameter, ","),
+ lambda_parameter: ($) =>
+ seq(
+ choice(
+ $.self_expression,
+ prec(PRECS.expr, field("name", $.simple_identifier)),
+ prec(
+ PRECS.expr,
+ seq(
+ optional(field("external_name", $.simple_identifier)),
+ field("name", $.simple_identifier),
+ ":",
+ optional($.parameter_modifiers),
+ field("type", $._possibly_implicitly_unwrapped_type)
+ )
+ )
+ )
+ ),
+ self_expression: ($) => "self",
+ super_expression: ($) => seq("super"),
+ _else_options: ($) => choice($._block, $.if_statement),
+ if_statement: ($) =>
+ prec.right(
+ PRECS["if"],
+ seq(
+ "if",
+ sep1(field("condition", $.if_condition), ","),
+ $._block,
+ optional(seq($["else"], $._else_options))
+ )
+ ),
+ if_condition: ($) =>
+ choice($.if_let_binding, $.expression, $.availability_condition),
+ if_let_binding: ($) =>
+ seq(
+ $._direct_or_indirect_binding,
+ optional(seq($._equal_sign, $.expression)),
+ optional($.where_clause)
+ ),
+ guard_statement: ($) =>
+ prec.right(
+ PRECS["if"],
+ seq(
+ "guard",
+ sep1(field("condition", $.if_condition), ","),
+ $["else"],
+ $._block
+ )
+ ),
+ switch_statement: ($) =>
+ prec.right(
+ PRECS["switch"],
+ seq(
+ "switch",
+ field("expr", $.expression),
+ "{",
+ repeat($.switch_entry),
+ "}"
+ )
+ ),
+ switch_entry: ($) =>
+ seq(
+ optional($.modifiers),
+ choice(
+ seq(
+ "case",
+ seq(
+ $.switch_pattern,
+ optional(seq($.where_keyword, $.expression))
+ ),
+ repeat(seq(",", $.switch_pattern))
+ ),
+ $.default_keyword
+ ),
+ ":",
+ $.statements,
+ optional("fallthrough")
+ ),
+ switch_pattern: ($) => alias($._binding_pattern_with_expr, $.pattern),
+ do_statement: ($) =>
+ prec.right(PRECS["do"], seq("do", $._block, repeat($.catch_block))),
+ catch_block: ($) =>
+ seq(
+ $.catch_keyword,
+ field("error", optional(alias($._binding_pattern_no_expr, $.pattern))),
+ optional($.where_clause),
+ $._block
+ ),
+ where_clause: ($) => prec.left(seq($.where_keyword, $.expression)),
+ key_path_expression: ($) =>
+ prec.right(
+ PRECS.keypath,
+ seq(
+ "\\",
+ optional(
+ choice($._simple_user_type, $.array_type, $.dictionary_type)
+ ),
+ repeat(seq(".", $._key_path_component))
+ )
+ ),
+ key_path_string_expression: ($) =>
+ prec.left(seq($._hash_symbol, "keyPath", "(", $.expression, ")")),
+ _key_path_component: ($) =>
+ prec.left(
+ choice(
+ seq($.simple_identifier, repeat($._key_path_postfixes)),
+ repeat1($._key_path_postfixes)
+ )
+ ),
+ _key_path_postfixes: ($) =>
+ choice(
+ "?",
+ $.bang,
+ "self",
+ seq("[", optional(sep1($.value_argument, ",")), "]")
+ ),
+ try_operator: ($) =>
+ prec.right(
+ seq("try", choice(optional($._try_operator_type), $._fake_try_bang))
+ ),
+ _try_operator_type: ($) =>
+ choice(token.immediate("!"), token.immediate("?")),
+ _assignment_and_operator: ($) =>
+ choice("+=", "-=", "*=", "/=", "%=", $._equal_sign),
+ _equality_operator: ($) => choice("!=", "!==", $._eq_eq, "==="),
+ _comparison_operator: ($) => choice("<", ">", "<=", ">="),
+ _three_dot_operator: ($) => alias("...", "..."), // Weird alias to satisfy highlight queries
+ _open_ended_range_operator: ($) => alias("..<", "..<"),
+ _is_operator: ($) => "is",
+ _additive_operator: ($) =>
+ choice(
+ alias($._plus_then_ws, "+"),
+ alias($._minus_then_ws, "-"),
+ "+",
+ "-"
+ ),
+ // The `/` operator conflicts with a regex literal (which itself appears to conflict with a
+ // comment, for some reason), so we must give it equivalent token precedence.
+ _multiplicative_operator: ($) =>
+ choice("*", alias(token(prec(PRECS.regex, "/")), "/"), "%"),
+ as_operator: ($) => choice($._as, $._as_quest, $._as_bang),
+ _prefix_unary_operator: ($) =>
+ prec.right(
+ choice(
+ "++",
+ "--",
+ "-",
+ "+",
+ $.bang,
+ "&",
+ "~",
+ $._dot,
+ $.custom_operator
+ )
+ ),
+ _bitwise_binary_operator: ($) => choice("&", "|", "^", "<<", ">>"),
+ _postfix_unary_operator: ($) => choice("++", "--", $.bang),
+ directly_assignable_expression: ($) => $.expression,
+
+ ////////////////////////////////
+ // Statements - https://docs.swift.org/swift-book/ReferenceManual/Statements.html
+ ////////////////////////////////
+ statements: ($) =>
+ prec.left(
+ // Left precedence is required in switch statements
+ seq(
+ $._local_statement,
+ repeat(seq($._semi, $._local_statement)),
+ optional($._semi)
+ )
+ ),
+ _local_statement: ($) =>
+ choice(
+ $.expression,
+ $.local_declaration,
+ $._labeled_statement,
+ $.control_transfer_statement
+ ),
+ _top_level_statement: ($) =>
+ choice(
+ $.expression,
+ $.global_declaration,
+ $._labeled_statement,
+ $._throw_statement
+ ),
+ _block: ($) => prec(PRECS.block, seq("{", optional($.statements), "}")),
+ _labeled_statement: ($) =>
+ seq(
+ optional($.statement_label),
+ choice(
+ $.for_statement,
+ $.while_statement,
+ $.repeat_while_statement,
+ $.do_statement,
+ $.if_statement,
+ $.guard_statement,
+ $.switch_statement
+ )
+ ),
+ statement_label: ($) => token(/[a-zA-Z_][a-zA-Z_0-9]*:/),
+ for_statement: ($) =>
+ prec(
+ PRECS.loop,
+ seq(
+ "for",
+ optional($.try_operator),
+ optional($._await_operator),
+ field("item", alias($._binding_pattern_no_expr, $.pattern)),
+ optional($.type_annotation),
+ "in",
+ field("collection", $._for_statement_collection),
+ optional($.where_clause),
+ $._block
+ )
+ ),
+ _for_statement_collection: ($) =>
+ // If this expression has "await", this triggers some special-cased logic to prefer function calls. We prefer
+ // the opposite, though, since function calls may contain trailing code blocks, which are undesirable here.
+ //
+ // To fix that, we simply undo the special casing by defining our own `await_expression`.
+ choice($.expression, alias($.for_statement_await, $.await_expression)),
+ for_statement_await: ($) => seq($._await_operator, $.expression),
+
+ while_statement: ($) =>
+ prec(
+ PRECS.loop,
+ seq(
+ "while",
+ sep1(field("condition", $.if_condition), ","),
+ "{",
+ optional($.statements),
+ "}"
+ )
+ ),
+ repeat_while_statement: ($) =>
+ prec(
+ PRECS.loop,
+ seq(
+ "repeat",
+ "{",
+ optional($.statements),
+ "}",
+ // Make sure we make it to the `while` before assuming this is a parameter pack.
+ repeat($._implicit_semi),
+ "while",
+ sep1(field("condition", $.if_condition), ",")
+ )
+ ),
+ control_transfer_statement: ($) =>
+ choice(
+ prec.right(PRECS.control_transfer, $._throw_statement),
+ prec.right(
+ PRECS.control_transfer,
+ seq(
+ $._optionally_valueful_control_keyword,
+ field("result", optional($.expression))
+ )
+ )
+ ),
+ _throw_statement: ($) => seq($.throw_keyword, $.expression),
+ throw_keyword: ($) => "throw",
+ _optionally_valueful_control_keyword: ($) =>
+ choice("return", "continue", "break", "yield"),
+ assignment: ($) =>
+ prec.left(
+ PRECS.assignment,
+ seq(
+ field("target", $.directly_assignable_expression),
+ field("operator", $._assignment_and_operator),
+ field("result", $.expression)
+ )
+ ),
+ value_parameter_pack: ($) =>
+ prec.left(PRECS.parameter_pack, seq("each", $.expression)),
+ value_pack_expansion: ($) =>
+ prec.left(PRECS.parameter_pack, seq("repeat", $.expression)),
+ availability_condition: ($) =>
+ seq(
+ $._hash_symbol,
+ choice("available", "unavailable"),
+ "(",
+ sep1Opt($._availability_argument, ","),
+ ")"
+ ),
+ _availability_argument: ($) =>
+ choice(seq($.identifier, sep1($.integer_literal, ".")), "*"),
+ ////////////////////////////////
+ // Declarations - https://docs.swift.org/swift-book/ReferenceManual/Declarations.html
+ ////////////////////////////////
+ global_declaration: ($) =>
+ choice(
+ $.import_declaration,
+ $.property_declaration,
+ $.typealias_declaration,
+ $.function_declaration,
+ $.init_declaration,
+ $.class_declaration,
+ $.protocol_declaration,
+ $.operator_declaration,
+ $.precedence_group_declaration,
+ $.associatedtype_declaration,
+ $.macro_declaration
+ ),
+ type_level_declaration: ($) =>
+ choice(
+ $.import_declaration,
+ $.property_declaration,
+ $.typealias_declaration,
+ $.function_declaration,
+ $.init_declaration,
+ $.class_declaration,
+ $.protocol_declaration,
+ $.deinit_declaration,
+ $.subscript_declaration,
+ $.operator_declaration,
+ $.precedence_group_declaration,
+ $.associatedtype_declaration
+ ),
+ local_declaration: ($) =>
+ choice(
+ alias($._local_property_declaration, $.property_declaration),
+ alias($._local_typealias_declaration, $.typealias_declaration),
+ alias($._local_function_declaration, $.function_declaration),
+ alias($._local_class_declaration, $.class_declaration)
+ ),
+ _local_property_declaration: ($) =>
+ seq(
+ optional($._locally_permitted_modifiers),
+ $._modifierless_property_declaration
+ ),
+ _local_typealias_declaration: ($) =>
+ seq(
+ optional($._locally_permitted_modifiers),
+ $._modifierless_typealias_declaration
+ ),
+ _local_function_declaration: ($) =>
+ seq(
+ optional($._locally_permitted_modifiers),
+ $._modifierless_function_declaration
+ ),
+ _local_class_declaration: ($) =>
+ seq(
+ optional($._locally_permitted_modifiers),
+ $._modifierless_class_declaration
+ ),
+ import_declaration: ($) =>
+ seq(
+ optional($.modifiers),
+ "import",
+ optional($._import_kind),
+ $.identifier
+ ),
+ _import_kind: ($) =>
+ choice(
+ "typealias",
+ "struct",
+ "class",
+ "enum",
+ "protocol",
+ "let",
+ "var",
+ "func"
+ ),
+ protocol_property_declaration: ($) =>
+ prec.right(
+ seq(
+ optional($.modifiers),
+ field("name", alias($._binding_kind_and_pattern, $.pattern)),
+ optional($.type_annotation),
+ optional($.type_constraints),
+ $.protocol_property_requirements
+ )
+ ),
+ protocol_property_requirements: ($) =>
+ seq("{", repeat(choice($.getter_specifier, $.setter_specifier)), "}"),
+ property_declaration: ($) =>
+ seq(optional($.modifiers), $._modifierless_property_declaration),
+ _modifierless_property_declaration: ($) =>
+ prec.right(
+ seq(
+ $._possibly_async_binding_pattern_kind,
+ sep1($._single_modifierless_property_declaration, ",")
+ )
+ ),
+ _single_modifierless_property_declaration: ($) =>
+ prec.left(
+ seq(
+ field("name", alias($._no_expr_pattern_already_bound, $.pattern)),
+ optional($.type_annotation),
+ optional($.type_constraints),
+ optional(
+ choice(
+ $._expression_with_willset_didset,
+ $._expression_without_willset_didset,
+ $.willset_didset_block,
+ field("computed_value", $.computed_property)
+ )
+ )
+ )
+ ),
+ _expression_with_willset_didset: ($) =>
+ prec.dynamic(
+ 1,
+ seq(
+ $._equal_sign,
+ field("value", $.expression),
+ $.willset_didset_block
+ )
+ ),
+ _expression_without_willset_didset: ($) =>
+ seq($._equal_sign, field("value", $.expression)),
+ willset_didset_block: ($) =>
+ choice(
+ seq("{", $.willset_clause, optional($.didset_clause), "}"),
+ seq("{", $.didset_clause, optional($.willset_clause), "}")
+ ),
+ willset_clause: ($) =>
+ seq(
+ optional($.modifiers),
+ "willSet",
+ optional(seq("(", $.simple_identifier, ")")),
+ $._block
+ ),
+ didset_clause: ($) =>
+ seq(
+ optional($.modifiers),
+ "didSet",
+ optional(seq("(", $.simple_identifier, ")")),
+ $._block
+ ),
+ typealias_declaration: ($) =>
+ seq(optional($.modifiers), $._modifierless_typealias_declaration),
+ _modifierless_typealias_declaration: ($) =>
+ seq(
+ "typealias",
+ field("name", alias($.simple_identifier, $.type_identifier)),
+ optional($.type_parameters),
+ $._equal_sign,
+ field("value", $.type)
+ ),
+ function_declaration: ($) =>
+ prec.right(
+ seq($._bodyless_function_declaration, field("body", $.function_body))
+ ),
+ _modifierless_function_declaration: ($) =>
+ prec.right(
+ seq(
+ $._modifierless_function_declaration_no_body,
+ field("body", $.function_body)
+ )
+ ),
+ _bodyless_function_declaration: ($) =>
+ seq(
+ optional($.modifiers),
+ optional("class"), // XXX: This should be possible in non-last position, but that creates parsing ambiguity
+ $._modifierless_function_declaration_no_body
+ ),
+ _modifierless_function_declaration_no_body: ($) =>
+ prec.right(
+ seq(
+ $._non_constructor_function_decl,
+ optional($.type_parameters),
+ $._function_value_parameters,
+ optional($._async_keyword),
+ optional(choice($.throws_clause, $.throws)),
+ optional(
+ seq(
+ $._arrow_operator,
+ field("return_type", $._possibly_implicitly_unwrapped_type)
+ )
+ ),
+ optional($.type_constraints)
+ )
+ ),
+ function_body: ($) => $._block,
+ macro_declaration: ($) =>
+ seq(
+ $._macro_head,
+ $.simple_identifier,
+ optional($.type_parameters),
+ $._macro_signature,
+ optional(field("definition", $.macro_definition)),
+ optional($.type_constraints)
+ ),
+ _macro_head: ($) => seq(optional($.modifiers), "macro"),
+ _macro_signature: ($) =>
+ seq(
+ $._function_value_parameters,
+ optional(seq($._arrow_operator, $.unannotated_type))
+ ),
+ macro_definition: ($) =>
+ seq(
+ $._equal_sign,
+ field("body", choice($.expression, $.external_macro_definition))
+ ),
+
+ external_macro_definition: ($) =>
+ seq($._hash_symbol, "externalMacro", $.value_arguments),
+
+ class_declaration: ($) =>
+ seq(optional($.modifiers), $._modifierless_class_declaration),
+ _modifierless_class_declaration: ($) =>
+ prec.right(
+ choice(
+ seq(
+ field("declaration_kind", choice("class", "struct", "actor")),
+ field("name", alias($.simple_identifier, $.type_identifier)),
+ optional($.type_parameters),
+ optional(seq(":", $._inheritance_specifiers)),
+ optional($.type_constraints),
+ field("body", $.class_body)
+ ),
+ seq(
+ field("declaration_kind", "extension"),
+ field("name", $.unannotated_type),
+ optional($.type_parameters),
+ optional(seq(":", $._inheritance_specifiers)),
+ optional($.type_constraints),
+ field("body", $.class_body)
+ ),
+ seq(
+ optional("indirect"),
+ field("declaration_kind", "enum"),
+ field("name", alias($.simple_identifier, $.type_identifier)),
+ optional($.type_parameters),
+ optional(seq(":", $._inheritance_specifiers)),
+ optional($.type_constraints),
+ field("body", $.enum_class_body)
+ )
+ )
+ ),
+ class_body: ($) => seq("{", optional($._class_member_declarations), "}"),
+ _inheritance_specifiers: ($) =>
+ prec.left(sep1($._annotated_inheritance_specifier, choice(",", "&"))),
+ inheritance_specifier: ($) =>
+ prec.left(
+ field(
+ "inherits_from",
+ choice($.user_type, $.function_type, $.suppressed_constraint)
+ )
+ ),
+ _annotated_inheritance_specifier: ($) =>
+ seq(repeat($.attribute), $.inheritance_specifier),
+ type_parameters: ($) =>
+ seq(
+ "<",
+ sep1Opt($.type_parameter, ","),
+ optional($.type_constraints),
+ ">"
+ ),
+ type_parameter: ($) =>
+ seq(
+ optional($.type_parameter_modifiers),
+ $._type_parameter_possibly_packed,
+ optional(seq(":", $.type))
+ ),
+ _type_parameter_possibly_packed: ($) =>
+ choice(
+ alias($.simple_identifier, $.type_identifier),
+ $.type_parameter_pack
+ ),
+
+ type_constraints: ($) =>
+ prec.right(seq($.where_keyword, sep1Opt($.type_constraint, ","))),
+ type_constraint: ($) =>
+ choice($.inheritance_constraint, $.equality_constraint),
+ inheritance_constraint: ($) =>
+ seq(
+ repeat($.attribute),
+ field("constrained_type", $._constrained_type),
+ ":",
+ field("inherits_from", $._possibly_implicitly_unwrapped_type)
+ ),
+ equality_constraint: ($) =>
+ seq(
+ repeat($.attribute),
+ field("constrained_type", $._constrained_type),
+ choice($._equal_sign, $._eq_eq),
+ field("must_equal", $.type)
+ ),
+ _constrained_type: ($) => choice($.identifier, $.nested_type_identifier),
+ nested_type_identifier: ($) =>
+ seq(
+ $.unannotated_type,
+ optional(seq(".", sep1($.simple_identifier, ".")))
+ ),
+ _class_member_separator: ($) => choice($._semi, $.multiline_comment),
+ _class_member_declarations: ($) =>
+ seq(
+ sep1($.type_level_declaration, $._class_member_separator),
+ optional($._class_member_separator)
+ ),
+ _function_value_parameters: ($) =>
+ repeat1(
+ seq("(", optional(sep1Opt($._function_value_parameter, ",")), ")")
+ ),
+ _function_value_parameter: ($) =>
+ seq(
+ optional($.attribute),
+ $.parameter,
+ optional(seq($._equal_sign, field("default_value", $.expression)))
+ ),
+ parameter: ($) =>
+ seq(
+ optional(field("external_name", $.simple_identifier)),
+ field("name", $.simple_identifier),
+ ":",
+ optional($.parameter_modifiers),
+ field("type", $._possibly_implicitly_unwrapped_type),
+ optional($._three_dot_operator)
+ ),
+ _non_constructor_function_decl: ($) =>
+ seq(
+ "func",
+ field("name", choice($.simple_identifier, $.referenceable_operator))
+ ),
+ referenceable_operator: ($) =>
+ choice(
+ $.custom_operator,
+ $._comparison_operator,
+ $._additive_operator,
+ $._multiplicative_operator,
+ $._equality_operator,
+ $._assignment_and_operator,
+ "++",
+ "--",
+ $.bang,
+ "~",
+ "|",
+ "^",
+ "<<",
+ ">>",
+ "&"
+ ),
+ // Hide the fact that certain symbols come from the custom scanner by aliasing them to their
+ // string variants. This keeps us from having to see them in the syntax tree (which would be
+ // noisy) but allows callers to refer to them as nodes by their text form like with any
+ // operator.
+ _equal_sign: ($) => alias($._eq_custom, "="),
+ _eq_eq: ($) => alias($._eq_eq_custom, "=="),
+ _dot: ($) => alias($._dot_custom, "."),
+ _arrow_operator: ($) => alias($._arrow_operator_custom, "->"),
+ _conjunction_operator: ($) => alias($._conjunction_operator_custom, "&&"),
+ _disjunction_operator: ($) => alias($._disjunction_operator_custom, "||"),
+ _nil_coalescing_operator: ($) =>
+ alias($._nil_coalescing_operator_custom, "??"),
+ _as: ($) => alias($._as_custom, "as"),
+ _as_quest: ($) => alias($._as_quest_custom, "as?"),
+ _as_bang: ($) => alias($._as_bang_custom, "as!"),
+ _hash_symbol: ($) => alias($._hash_symbol_custom, "#"),
+ bang: ($) => choice($._bang_custom, "!"),
+ _async_keyword: ($) => alias($._async_keyword_custom, "async"),
+ _async_modifier: ($) => token("async"),
+ throws: ($) => choice($._throws_keyword, $._rethrows_keyword),
+ throws_clause: ($) =>
+ seq($._throws_keyword, "(", field("type", $.unannotated_type), ")"),
+ enum_class_body: ($) =>
+ seq("{", repeat(choice($.enum_entry, $.type_level_declaration)), "}"),
+ enum_entry: ($) =>
+ seq(
+ optional($.modifiers),
+ optional("indirect"),
+ "case",
+ sep1(
+ seq(
+ field("name", $.simple_identifier),
+ optional($._enum_entry_suffix)
+ ),
+ ","
+ ),
+ optional(";")
+ ),
+ _enum_entry_suffix: ($) =>
+ choice(
+ field("data_contents", $.enum_type_parameters),
+ seq($._equal_sign, field("raw_value", $.expression))
+ ),
+ enum_type_parameters: ($) =>
+ seq(
+ "(",
+ optional(
+ sep1(
+ seq(
+ optional(
+ seq(optional($.wildcard_pattern), $.simple_identifier, ":")
+ ),
+ $.type,
+ optional(seq($._equal_sign, $.expression))
+ ),
+ ","
+ )
+ ),
+ ")"
+ ),
+ protocol_declaration: ($) =>
+ prec.right(
+ seq(
+ optional($.modifiers),
+ field("declaration_kind", "protocol"),
+ field("name", alias($.simple_identifier, $.type_identifier)),
+ optional($.type_parameters),
+ optional(seq(":", $._inheritance_specifiers)),
+ optional($.type_constraints),
+ field("body", $.protocol_body)
+ )
+ ),
+ protocol_body: ($) =>
+ seq("{", optional($._protocol_member_declarations), "}"),
+ _protocol_member_declarations: ($) =>
+ seq(sep1($.protocol_member_declaration, $._semi), optional($._semi)),
+ protocol_member_declaration: ($) =>
+ choice(
+ $.protocol_function_declaration,
+ $.init_declaration,
+ $.deinit_declaration,
+ $.protocol_property_declaration,
+ $.typealias_declaration,
+ $.associatedtype_declaration,
+ $.subscript_declaration
+ ),
+ protocol_function_declaration: ($) =>
+ seq(
+ $._bodyless_function_declaration,
+ optional(field("body", $.function_body))
+ ),
+ init_declaration: ($) =>
+ prec.right(
+ seq(
+ optional($.modifiers),
+ optional("class"),
+ field("name", "init"),
+ optional(choice($._quest, $.bang)),
+ optional($.type_parameters),
+ $._function_value_parameters,
+ optional($._async_keyword),
+ optional(choice($.throws_clause, $.throws)),
+ optional($.type_constraints),
+ optional(field("body", $.function_body))
+ )
+ ),
+ deinit_declaration: ($) =>
+ prec.right(
+ seq(optional($.modifiers), "deinit", field("body", $.function_body))
+ ),
+ subscript_declaration: ($) =>
+ prec.right(
+ seq(
+ optional($.modifiers),
+ "subscript",
+ optional($.type_parameters),
+ $._function_value_parameters,
+ optional(
+ seq(
+ $._arrow_operator,
+ field("return_type", $._possibly_implicitly_unwrapped_type)
+ )
+ ),
+ optional($.type_constraints),
+ $.computed_property
+ )
+ ),
+ computed_property: ($) =>
+ seq(
+ "{",
+ choice(
+ optional($.statements),
+ repeat(
+ choice($.computed_getter, $.computed_setter, $.computed_modify)
+ )
+ ),
+ "}"
+ ),
+ computed_getter: ($) =>
+ seq(repeat($.attribute), $.getter_specifier, optional($._block)),
+ computed_modify: ($) =>
+ seq(repeat($.attribute), $.modify_specifier, optional($._block)),
+ computed_setter: ($) =>
+ seq(
+ repeat($.attribute),
+ $.setter_specifier,
+ optional(seq("(", $.simple_identifier, ")")),
+ optional($._block)
+ ),
+ getter_specifier: ($) =>
+ seq(optional($.mutation_modifier), "get", optional($._getter_effects)),
+ setter_specifier: ($) => seq(optional($.mutation_modifier), "set"),
+ modify_specifier: ($) => seq(optional($.mutation_modifier), "_modify"),
+ _getter_effects: ($) =>
+ repeat1(choice($._async_keyword, $.throws_clause, $.throws)),
+ operator_declaration: ($) =>
+ seq(
+ choice("prefix", "infix", "postfix"),
+ "operator",
+ $.referenceable_operator,
+ optional(seq(":", $.simple_identifier)),
+ optional($.deprecated_operator_declaration_body)
+ ),
+ // The Swift compiler no longer accepts these, but some very old code still uses it.
+ deprecated_operator_declaration_body: ($) =>
+ seq("{", repeat(choice($.simple_identifier, $._basic_literal)), "}"),
+ precedence_group_declaration: ($) =>
+ seq(
+ "precedencegroup",
+ $.simple_identifier,
+ "{",
+ optional($.precedence_group_attributes),
+ "}"
+ ),
+ precedence_group_attributes: ($) => repeat1($.precedence_group_attribute),
+ precedence_group_attribute: ($) =>
+ seq(
+ $.simple_identifier,
+ ":",
+ choice($.simple_identifier, $.boolean_literal)
+ ),
+ associatedtype_declaration: ($) =>
+ seq(
+ optional($.modifiers),
+ "associatedtype",
+ field("name", alias($.simple_identifier, $.type_identifier)),
+ optional(seq(":", field("must_inherit", $.type))),
+ optional($.type_constraints),
+ optional(seq($._equal_sign, field("default_value", $.type)))
+ ),
+ ////////////////////////////////
+ // Attributes - https://docs.swift.org/swift-book/ReferenceManual/Attributes.html
+ ////////////////////////////////
+ attribute: ($) =>
+ seq(
+ "@",
+ $.user_type,
+ // attribute arguments are a mess of special cases, maybe this is good enough?
+ optional(seq("(", sep1Opt($._attribute_argument, ","), ")"))
+ ),
+ _attribute_argument: ($) =>
+ choice(
+ // labeled function parameters, used in custom property wrappers
+ seq($.simple_identifier, ":", $.expression),
+ // Unlabeled function parameters, simple identifiers, or `*`
+ $.expression,
+ // References to param names (used in `@objc(foo:bar:)`)
+ repeat1(seq($.simple_identifier, ":")),
+ // Version restrictions (iOS 3.4.5, Swift 5.0.0)
+ seq(repeat1($.simple_identifier), sep1($.integer_literal, "."))
+ ),
+ ////////////////////////////////
+ // Patterns - https://docs.swift.org/swift-book/ReferenceManual/Patterns.html
+ ////////////////////////////////
+ _universally_allowed_pattern: ($) =>
+ choice(
+ $.wildcard_pattern,
+ $._tuple_pattern,
+ $._type_casting_pattern,
+ $._case_pattern
+ ),
+ _bound_identifier: ($) => field("bound_identifier", $.simple_identifier),
+
+ _binding_pattern_no_expr: ($) =>
+ seq(
+ choice(
+ $._universally_allowed_pattern,
+ $._binding_pattern,
+ $._bound_identifier
+ ),
+ optional($._quest)
+ ),
+ _no_expr_pattern_already_bound: ($) =>
+ seq(
+ choice($._universally_allowed_pattern, $._bound_identifier),
+ optional($._quest)
+ ),
+ _binding_pattern_with_expr: ($) =>
+ seq(
+ choice(
+ $._universally_allowed_pattern,
+ $._binding_pattern,
+ $.expression
+ ),
+ optional($._quest)
+ ),
+ _non_binding_pattern_with_expr: ($) =>
+ seq(
+ choice($._universally_allowed_pattern, $.expression),
+ optional($._quest)
+ ),
+ _direct_or_indirect_binding: ($) =>
+ seq(
+ choice(
+ $._binding_kind_and_pattern,
+ seq("case", $._binding_pattern_no_expr)
+ ),
+ optional($.type_annotation)
+ ),
+ value_binding_pattern: ($) => field("mutability", choice("var", "let")),
+ _possibly_async_binding_pattern_kind: ($) =>
+ seq(optional($._async_modifier), $.value_binding_pattern),
+ _binding_kind_and_pattern: ($) =>
+ seq(
+ $._possibly_async_binding_pattern_kind,
+ $._no_expr_pattern_already_bound
+ ),
+ wildcard_pattern: ($) => "_",
+ _tuple_pattern_item: ($) =>
+ choice(
+ seq(
+ $.simple_identifier,
+ seq(":", alias($._binding_pattern_with_expr, $.pattern))
+ ),
+ alias($._binding_pattern_with_expr, $.pattern)
+ ),
+ _tuple_pattern: ($) => seq("(", sep1Opt($._tuple_pattern_item, ","), ")"),
+ _case_pattern: ($) =>
+ seq(
+ optional("case"),
+ optional($.user_type), // XXX this should just be _type but that creates ambiguity
+ $._dot,
+ $.simple_identifier,
+ optional($._tuple_pattern)
+ ),
+ _type_casting_pattern: ($) =>
+ choice(
+ seq("is", $.type),
+ seq(alias($._binding_pattern_no_expr, $.pattern), $._as, $.type)
+ ),
+ _binding_pattern: ($) =>
+ seq(
+ seq(optional("case"), $.value_binding_pattern),
+ $._no_expr_pattern_already_bound
+ ),
+
+ // ==========
+ // Modifiers
+ // ==========
+ modifiers: ($) =>
+ repeat1(
+ prec.left(
+ choice($._non_local_scope_modifier, $._locally_permitted_modifiers)
+ )
+ ),
+ _locally_permitted_modifiers: ($) =>
+ repeat1(choice($.attribute, $._locally_permitted_modifier)),
+ parameter_modifiers: ($) => repeat1($.parameter_modifier),
+ _modifier: ($) =>
+ choice($._non_local_scope_modifier, $._locally_permitted_modifier),
+ _non_local_scope_modifier: ($) =>
+ choice(
+ $.member_modifier,
+ $.visibility_modifier,
+ $.function_modifier,
+ $.mutation_modifier,
+ $.property_modifier,
+ $.parameter_modifier
+ ),
+ _locally_permitted_modifier: ($) =>
+ choice(
+ $.ownership_modifier,
+ $.inheritance_modifier,
+ $.property_behavior_modifier
+ ),
+ property_behavior_modifier: ($) => "lazy",
+ type_modifiers: ($) => repeat1($.attribute),
+ member_modifier: ($) =>
+ choice("override", "convenience", "required", "nonisolated"),
+ visibility_modifier: ($) =>
+ seq(
+ choice(
+ "public",
+ "private",
+ "internal",
+ "fileprivate",
+ "open",
+ "package"
+ ),
+ optional(seq("(", "set", ")"))
+ ),
+ type_parameter_modifiers: ($) => repeat1($.attribute),
+ function_modifier: ($) => choice("infix", "postfix", "prefix"),
+ mutation_modifier: ($) => choice("mutating", "nonmutating"),
+ property_modifier: ($) =>
+ choice("static", "dynamic", "optional", "class", "distributed"),
+ inheritance_modifier: ($) => choice("final"),
+ parameter_modifier: ($) =>
+ choice(
+ "inout",
+ "@escaping",
+ "@autoclosure",
+ $._parameter_ownership_modifier
+ ),
+ ownership_modifier: ($) =>
+ choice("weak", "unowned", "unowned(safe)", "unowned(unsafe)"),
+ _parameter_ownership_modifier: ($) => choice("borrowing", "consuming"),
+ use_site_target: ($) =>
+ seq(
+ choice(
+ "property",
+ "get",
+ "set",
+ "receiver",
+ "param",
+ "setparam",
+ "delegate"
+ ),
+ ":"
+ ),
+ directive: ($) =>
+ prec.right(
+ PRECS.comment,
+ choice(
+ seq(alias($._directive_if, "#if"), $._compilation_condition),
+ seq(alias($._directive_elseif, "#elseif"), $._compilation_condition),
+ seq(alias($._directive_else, "#else")),
+ seq(alias($._directive_endif, "#endif"))
+ )
+ ),
+ _compilation_condition: ($) =>
+ prec.right(
+ choice(
+ seq("os", "(", $.simple_identifier, ")"),
+ seq("arch", "(", $.simple_identifier, ")"),
+ seq(
+ "swift",
+ "(",
+ $._comparison_operator,
+ sep1($.integer_literal, "."),
+ ")"
+ ),
+ seq(
+ "compiler",
+ "(",
+ $._comparison_operator,
+ sep1($.integer_literal, "."),
+ ")"
+ ),
+ seq("canImport", "(", sep1($.simple_identifier, "."), ")"),
+ seq("targetEnvironment", "(", $.simple_identifier, ")"),
+ $.boolean_literal,
+ $.simple_identifier,
+ seq("(", $._compilation_condition, ")"),
+ seq("!", $._compilation_condition),
+ seq(
+ $._compilation_condition,
+ $._conjunction_operator,
+ $._compilation_condition
+ ),
+ seq(
+ $._compilation_condition,
+ $._disjunction_operator,
+ $._compilation_condition
+ )
+ )
+ ),
+ diagnostic: ($) =>
+ prec(
+ PRECS.comment,
+ seq(
+ $._hash_symbol,
+ choice(
+ // Using regexes here, rather than actually validating the string literal, because complex string literals
+ // cannot be used inside `token()` and we need that to ensure we get the right precedence.
+ seq(/error([^\r\n]*)/),
+ seq(/warning([^\r\n]*)/),
+ seq(/sourceLocation([^\r\n]*)/)
+ )
+ )
+ ),
+ // Dumping ground for any nodes that used to exist in the grammar, but have since been removed for whatever
+ // reason.
+ // Neovim applies updates non-atomically to the parser and the queries. Meanwhile, `tree-sitter` rejects any query
+ // that contains any unrecognized nodes. Putting those two facts together, we see that we must never remove nodes
+ // that once existed.
+ unused_for_backward_compatibility: ($) =>
+ choice(alias("unused1", "try?"), alias("unused2", "try!")),
+ },
+});
+function sep1(rule, separator) {
+ return seq(rule, repeat(seq(separator, rule)));
+}
+function sep1Opt(rule, separator) {
+ return seq(rule, repeat(seq(separator, rule)), optional(separator));
+}
+
+function tree_sitter_version_supports_emoji() {
+ try {
+ return (
+ TREE_SITTER_CLI_VERSION_MAJOR > 0 ||
+ TREE_SITTER_CLI_VERSION_MINOR > 20 ||
+ TREE_SITTER_CLI_VERSION_PATCH >= 5
+ );
+ } catch (err) {
+ if (err instanceof ReferenceError) {
+ return false;
+ } else {
+ throw err;
+ }
+ }
+}
diff --git a/unified/extractor/tree-sitter-swift/node-types.yml b/unified/extractor/tree-sitter-swift/node-types.yml
new file mode 100644
index 000000000000..c4bf650944b2
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/node-types.yml
@@ -0,0 +1,728 @@
+supertypes:
+ expression:
+ - additive_expression
+ - array_literal
+ - as_expression
+ - assignment
+ - await_expression
+ - bin_literal
+ - bitwise_operation
+ - boolean_literal
+ - call_expression
+ - check_expression
+ - comparison_expression
+ - conjunction_expression
+ - constructor_expression
+ - diagnostic
+ - dictionary_literal
+ - directive
+ - disjunction_expression
+ - equality_expression
+ - fully_open_range
+ - hex_literal
+ - if_statement
+ - infix_expression
+ - integer_literal
+ - key_path_expression
+ - key_path_string_expression
+ - lambda_literal
+ - line_string_literal
+ - macro_invocation
+ - multi_line_string_literal
+ - multiplicative_expression
+ - navigation_expression
+ - "nil"
+ - nil_coalescing_expression
+ - oct_literal
+ - open_end_range_expression
+ - open_start_range_expression
+ - optional_chain_marker
+ - playground_literal
+ - postfix_expression
+ - prefix_expression
+ - range_expression
+ - raw_string_literal
+ - real_literal
+ - referenceable_operator
+ - regex_literal
+ - selector_expression
+ - self_expression
+ - simple_identifier
+ - special_literal
+ - super_expression
+ - switch_statement
+ - ternary_expression
+ - try_expression
+ - tuple_expression
+ - value_pack_expansion
+ - value_parameter_pack
+ global_declaration:
+ - associatedtype_declaration
+ - class_declaration
+ - function_declaration
+ - import_declaration
+ - init_declaration
+ - macro_declaration
+ - operator_declaration
+ - precedence_group_declaration
+ - property_declaration
+ - protocol_declaration
+ - typealias_declaration
+ local_declaration:
+ - class_declaration
+ - function_declaration
+ - property_declaration
+ - typealias_declaration
+ protocol_member_declaration:
+ - associatedtype_declaration
+ - deinit_declaration
+ - init_declaration
+ - protocol_function_declaration
+ - protocol_property_declaration
+ - subscript_declaration
+ - typealias_declaration
+ type_level_declaration:
+ - associatedtype_declaration
+ - class_declaration
+ - deinit_declaration
+ - function_declaration
+ - import_declaration
+ - init_declaration
+ - operator_declaration
+ - precedence_group_declaration
+ - property_declaration
+ - protocol_declaration
+ - subscript_declaration
+ - typealias_declaration
+ unannotated_type:
+ - array_type
+ - dictionary_type
+ - existential_type
+ - function_type
+ - metatype
+ - opaque_type
+ - optional_type
+ - protocol_composition_type
+ - suppressed_constraint
+ - tuple_type
+ - type_pack_expansion
+ - type_parameter_pack
+ - user_type
+
+named:
+ additive_expression:
+ lhs: expression
+ op: ["+", "-"]
+ rhs: expression
+ array_literal:
+ element*: expression
+ array_type:
+ element: type
+ as_expression:
+ $children: as_operator
+ expr: expression
+ type: type
+ as_operator:
+ assignment:
+ operator: ["%=", "*=", "+=", "-=", "/=", "="]
+ result: expression
+ target: directly_assignable_expression
+ associatedtype_declaration:
+ $children*: [modifiers, type_constraints]
+ default_value?: type
+ must_inherit?: type
+ name: type_identifier
+ attribute:
+ $children+: [expression, user_type]
+ availability_condition:
+ $children*: [identifier, integer_literal]
+ await_expression:
+ $children?: expression
+ expr?: expression
+ bang:
+ bin_literal:
+ bitwise_operation:
+ lhs: expression
+ op: ["&", "<<", ">>", "^", "|"]
+ rhs: expression
+ boolean_literal:
+ call_expression:
+ $children+: [call_suffix, expression]
+ call_suffix:
+ $children+: [lambda_literal, value_arguments]
+ name*: simple_identifier
+ capture_list:
+ $children+: capture_list_item
+ capture_list_item:
+ $children?: ownership_modifier
+ name: [self_expression, simple_identifier]
+ value?: expression
+ catch_block:
+ $children+: [catch_keyword, statements, where_clause]
+ error?: pattern
+ catch_keyword:
+ check_expression:
+ op: "is"
+ target: expression
+ type: type
+ class_body:
+ $children*: [multiline_comment, type_level_declaration]
+ class_declaration:
+ $children*: [attribute, inheritance_modifier, inheritance_specifier, modifiers, ownership_modifier, property_behavior_modifier, type_constraints, type_parameters]
+ body: [class_body, enum_class_body]
+ declaration_kind: ["actor", "class", "enum", "extension", "struct"]
+ name: [type_identifier, unannotated_type]
+ comment:
+ comparison_expression:
+ lhs: expression
+ op: ["<", "<=", ">", ">="]
+ rhs: expression
+ computed_getter:
+ $children+: [attribute, getter_specifier, statements]
+ computed_modify:
+ $children+: [attribute, modify_specifier, statements]
+ computed_property:
+ $children*: [computed_getter, computed_modify, computed_setter, statements]
+ computed_setter:
+ $children+: [attribute, setter_specifier, simple_identifier, statements]
+ conjunction_expression:
+ lhs: expression
+ op: "&&"
+ rhs: expression
+ constructor_expression:
+ $children: constructor_suffix
+ constructed_type: [array_type, dictionary_type, user_type]
+ constructor_suffix:
+ $children+: [lambda_literal, value_arguments]
+ name*: simple_identifier
+ control_transfer_statement:
+ $children*: [expression, throw_keyword]
+ result?: expression
+ custom_operator:
+ default_keyword:
+ deinit_declaration:
+ $children?: modifiers
+ body: function_body
+ deprecated_operator_declaration_body:
+ $children*: [bin_literal, boolean_literal, hex_literal, integer_literal, line_string_literal, multi_line_string_literal, oct_literal, raw_string_literal, real_literal, regex_literal, simple_identifier]
+ diagnostic:
+ dictionary_literal:
+ key*: expression
+ value*: expression
+ dictionary_type:
+ key: type
+ value: type
+ didset_clause:
+ $children*: [modifiers, simple_identifier, statements]
+ directive:
+ $children*: [boolean_literal, integer_literal, simple_identifier]
+ directly_assignable_expression:
+ $children: expression
+ disjunction_expression:
+ lhs: expression
+ op: "||"
+ rhs: expression
+ do_statement:
+ $children*: [catch_block, statements]
+ else:
+ enum_class_body:
+ $children*: [enum_entry, type_level_declaration]
+ enum_entry:
+ $children?: modifiers
+ data_contents*: enum_type_parameters
+ name+: simple_identifier
+ raw_value*: expression
+ enum_type_parameters:
+ $children*: [expression, type, wildcard_pattern]
+ equality_constraint:
+ $children*: attribute
+ constrained_type: [identifier, nested_type_identifier]
+ must_equal: type
+ equality_expression:
+ lhs: expression
+ op: ["!=", "!==", "==", "==="]
+ rhs: expression
+ existential_type:
+ $children: unannotated_type
+ external_macro_definition:
+ $children: value_arguments
+ for_statement:
+ $children*: [statements, try_operator, type_annotation, where_clause]
+ collection: expression
+ item: pattern
+ fully_open_range:
+ function_body:
+ $children?: statements
+ function_declaration:
+ $children*: [attribute, inheritance_modifier, modifiers, ownership_modifier, parameter, property_behavior_modifier, throws, throws_clause, type_constraints, type_parameters]
+ body: function_body
+ default_value*: expression
+ name: [referenceable_operator, simple_identifier]
+ return_type?: [implicitly_unwrapped_type, type]
+ function_modifier:
+ function_type:
+ $children?: [throws, throws_clause]
+ params: unannotated_type
+ return_type: type
+ getter_specifier:
+ $children*: [mutation_modifier, throws, throws_clause]
+ guard_statement:
+ $children+: [else, statements]
+ condition+: if_condition
+ hex_literal:
+ identifier:
+ $children+: simple_identifier
+ if_condition:
+ $children: [availability_condition, expression, if_let_binding]
+ if_let_binding:
+ $children*: [expression, pattern, type, type_annotation, user_type, value_binding_pattern, where_clause, wildcard_pattern]
+ bound_identifier?: simple_identifier
+ if_statement:
+ $children*: [else, if_statement, statements]
+ condition+: if_condition
+ implicitly_unwrapped_type:
+ $children: type
+ import_declaration:
+ $children+: [identifier, modifiers]
+ infix_expression:
+ lhs: expression
+ op: custom_operator
+ rhs: expression
+ inheritance_constraint:
+ $children*: attribute
+ constrained_type: [identifier, nested_type_identifier]
+ inherits_from: [implicitly_unwrapped_type, type]
+ inheritance_modifier:
+ inheritance_specifier:
+ inherits_from: [function_type, suppressed_constraint, user_type]
+ init_declaration:
+ $children*: [attribute, bang, modifiers, parameter, throws, throws_clause, type_constraints, type_parameters]
+ body?: function_body
+ default_value*: expression
+ name: "init"
+ integer_literal:
+ interpolated_expression:
+ $children?: type_modifiers
+ name?: value_argument_label
+ reference_specifier*: value_argument_label
+ value?: expression
+ key_path_expression:
+ $children*: [array_type, bang, dictionary_type, simple_identifier, type_arguments, type_identifier, value_argument]
+ key_path_string_expression:
+ $children: expression
+ lambda_function_type:
+ $children*: [lambda_function_type_parameters, throws, throws_clause]
+ return_type?: [implicitly_unwrapped_type, type]
+ lambda_function_type_parameters:
+ $children+: lambda_parameter
+ lambda_literal:
+ $children*: [attribute, statements]
+ captures?: capture_list
+ type?: lambda_function_type
+ lambda_parameter:
+ $children?: [parameter_modifiers, self_expression]
+ external_name?: simple_identifier
+ name?: simple_identifier
+ type?: [implicitly_unwrapped_type, type]
+ line_str_text:
+ line_string_literal:
+ interpolation*: interpolated_expression
+ text*: [line_str_text, str_escaped_char]
+ macro_declaration:
+ $children+: [attribute, modifiers, parameter, simple_identifier, type_constraints, type_parameters, unannotated_type]
+ default_value*: expression
+ definition?: macro_definition
+ macro_definition:
+ body: [expression, external_macro_definition]
+ macro_invocation:
+ $children+: [call_suffix, simple_identifier, type_parameters]
+ member_modifier:
+ metatype:
+ $children: unannotated_type
+ modifiers:
+ $children+: [attribute, function_modifier, inheritance_modifier, member_modifier, mutation_modifier, ownership_modifier, parameter_modifier, property_behavior_modifier, property_modifier, visibility_modifier]
+ modify_specifier:
+ $children?: mutation_modifier
+ multi_line_str_text:
+ multi_line_string_literal:
+ interpolation*: interpolated_expression
+ text*: ["\"", multi_line_str_text, str_escaped_char]
+ multiline_comment:
+ multiplicative_expression:
+ lhs: expression
+ op: ["%", "*", "/"]
+ rhs: expression
+ mutation_modifier:
+ navigation_expression:
+ suffix: navigation_suffix
+ target+: ["(", ")", array_type, dictionary_type, existential_type, expression, opaque_type, user_type]
+ navigation_suffix:
+ suffix: [integer_literal, simple_identifier]
+ nested_type_identifier:
+ $children+: [simple_identifier, unannotated_type]
+ nil_coalescing_expression:
+ if_nil: expression
+ value: expression
+ oct_literal:
+ opaque_type:
+ $children: unannotated_type
+ open_end_range_expression:
+ start: expression
+ open_start_range_expression:
+ end: expression
+ operator_declaration:
+ $children+: [deprecated_operator_declaration_body, referenceable_operator, simple_identifier]
+ optional_chain_marker:
+ $children: expression
+ optional_type:
+ wrapped: [array_type, dictionary_type, tuple_type, user_type]
+ ownership_modifier:
+ parameter:
+ $children?: parameter_modifiers
+ external_name?: simple_identifier
+ name: simple_identifier
+ type: [implicitly_unwrapped_type, type]
+ parameter_modifier:
+ parameter_modifiers:
+ $children+: parameter_modifier
+ pattern:
+ $children*: [expression, pattern, type, user_type, value_binding_pattern, wildcard_pattern]
+ bound_identifier?: simple_identifier
+ playground_literal:
+ $children+: expression
+ postfix_expression:
+ operation: ["++", "--", bang]
+ target: expression
+ precedence_group_attribute:
+ $children+: [boolean_literal, simple_identifier]
+ precedence_group_attributes:
+ $children+: precedence_group_attribute
+ precedence_group_declaration:
+ $children+: [precedence_group_attributes, simple_identifier]
+ prefix_expression:
+ operation: ["&", "+", "++", "-", "--", ".", bang, custom_operator, "~"]
+ target: expression
+ property_behavior_modifier:
+ property_declaration:
+ $children*: [attribute, inheritance_modifier, modifiers, ownership_modifier, property_behavior_modifier, type_annotation, type_constraints, value_binding_pattern, willset_didset_block]
+ computed_value*: computed_property
+ name+: pattern
+ value*: expression
+ property_modifier:
+ protocol_body:
+ $children*: protocol_member_declaration
+ protocol_composition_type:
+ $children+: unannotated_type
+ protocol_declaration:
+ $children*: [attribute, inheritance_specifier, modifiers, type_constraints, type_parameters]
+ body: protocol_body
+ declaration_kind: "protocol"
+ name: type_identifier
+ protocol_function_declaration:
+ $children*: [attribute, modifiers, parameter, throws, throws_clause, type_constraints, type_parameters]
+ body?: function_body
+ default_value*: expression
+ name: [referenceable_operator, simple_identifier]
+ return_type?: [implicitly_unwrapped_type, type]
+ protocol_property_declaration:
+ $children+: [modifiers, protocol_property_requirements, type_annotation, type_constraints]
+ name: pattern
+ protocol_property_requirements:
+ $children*: [getter_specifier, setter_specifier]
+ range_expression:
+ end: expression
+ op: ["...", "..<"]
+ start: expression
+ raw_str_continuing_indicator:
+ raw_str_end_part:
+ raw_str_interpolation:
+ $children: raw_str_interpolation_start
+ interpolation+: interpolated_expression
+ raw_str_interpolation_start:
+ raw_str_part:
+ raw_string_literal:
+ $children*: raw_str_continuing_indicator
+ interpolation*: raw_str_interpolation
+ text+: [raw_str_end_part, raw_str_part]
+ real_literal:
+ referenceable_operator:
+ $children?: [bang, custom_operator]
+ regex_literal:
+ repeat_while_statement:
+ $children?: statements
+ condition+: if_condition
+ selector_expression:
+ $children: expression
+ self_expression:
+ setter_specifier:
+ $children?: mutation_modifier
+ shebang_line:
+ simple_identifier:
+ source_file:
+ $children*: [do_statement, expression, for_statement, global_declaration, guard_statement, repeat_while_statement, shebang_line, statement_label, throw_keyword, while_statement]
+ special_literal:
+ statement_label:
+ statements:
+ $children+: [control_transfer_statement, do_statement, expression, for_statement, guard_statement, local_declaration, repeat_while_statement, statement_label, while_statement]
+ str_escaped_char:
+ subscript_declaration:
+ $children+: [attribute, computed_property, modifiers, parameter, type_constraints, type_parameters]
+ default_value*: expression
+ return_type?: [implicitly_unwrapped_type, type]
+ super_expression:
+ suppressed_constraint:
+ suppressed: type_identifier
+ switch_entry:
+ $children+: [default_keyword, expression, modifiers, statements, switch_pattern, where_keyword]
+ switch_pattern:
+ $children: pattern
+ switch_statement:
+ $children*: switch_entry
+ expr: expression
+ ternary_expression:
+ condition: expression
+ if_false: expression
+ if_true: expression
+ throw_keyword:
+ throws:
+ throws_clause:
+ type: unannotated_type
+ try_expression:
+ $children: try_operator
+ expr: expression
+ try_operator:
+ tuple_expression:
+ name*: simple_identifier
+ value+: expression
+ tuple_type:
+ $children?: tuple_type_item
+ element*: tuple_type_item
+ tuple_type_item:
+ $children*: [dictionary_type, existential_type, opaque_type, parameter_modifiers, wildcard_pattern]
+ name?: simple_identifier
+ type?: type
+ type:
+ modifiers?: type_modifiers
+ name: unannotated_type
+ type_annotation:
+ type: [implicitly_unwrapped_type, type]
+ type_arguments:
+ $children+: type
+ type_constraint:
+ $children: [equality_constraint, inheritance_constraint]
+ type_constraints:
+ $children+: [type_constraint, where_keyword]
+ type_identifier:
+ type_modifiers:
+ $children+: attribute
+ type_pack_expansion:
+ $children: unannotated_type
+ type_parameter:
+ $children+: [type, type_identifier, type_parameter_modifiers, type_parameter_pack]
+ type_parameter_modifiers:
+ $children+: attribute
+ type_parameter_pack:
+ $children: unannotated_type
+ type_parameters:
+ $children+: [type_constraints, type_parameter]
+ typealias_declaration:
+ $children*: [attribute, inheritance_modifier, modifiers, ownership_modifier, property_behavior_modifier, type_parameters]
+ name: type_identifier
+ value: type
+ user_type:
+ $children+: [type_arguments, type_identifier]
+ value_argument:
+ $children?: type_modifiers
+ name?: value_argument_label
+ reference_specifier*: value_argument_label
+ value?: expression
+ value_argument_label:
+ $children: simple_identifier
+ value_arguments:
+ $children*: value_argument
+ value_binding_pattern:
+ mutability: ["let", "var"]
+ value_pack_expansion:
+ $children: expression
+ value_parameter_pack:
+ $children: expression
+ visibility_modifier:
+ where_clause:
+ $children+: [expression, where_keyword]
+ where_keyword:
+ while_statement:
+ $children?: statements
+ condition+: if_condition
+ wildcard_pattern:
+ willset_clause:
+ $children*: [modifiers, simple_identifier, statements]
+ willset_didset_block:
+ $children+: [didset_clause, willset_clause]
+
+unnamed:
+ - "?"
+ - "!"
+ - "!="
+ - "!=="
+ - "\""
+ - "\"\"\""
+ - "#"
+ - "#else"
+ - "#elseif"
+ - "#endif"
+ - "#if"
+ - "%"
+ - "%="
+ - "&"
+ - "&&"
+ - "("
+ - ")"
+ - "*"
+ - "*="
+ - "+"
+ - "++"
+ - "+="
+ - ","
+ - "-"
+ - "--"
+ - "-="
+ - "->"
+ - "."
+ - "..."
+ - "..<"
+ - "/"
+ - "/="
+ - ":"
+ - ";"
+ - "<"
+ - "<<"
+ - "<="
+ - "="
+ - "=="
+ - "==="
+ - ">"
+ - ">="
+ - ">>"
+ - "?"
+ - "??"
+ - "@"
+ - "@autoclosure"
+ - "@escaping"
+ - "Protocol"
+ - "Type"
+ - "["
+ - "\\"
+ - "\\("
+ - "]"
+ - "^"
+ - "^{"
+ - "_modify"
+ - "actor"
+ - "any"
+ - "arch"
+ - "as"
+ - "as!"
+ - "as?"
+ - "associatedtype"
+ - "async"
+ - "available"
+ - "await"
+ - "borrowing"
+ - "break"
+ - "canImport"
+ - "case"
+ - "class"
+ - "colorLiteral"
+ - "column"
+ - "compiler"
+ - "consuming"
+ - "continue"
+ - "convenience"
+ - "deinit"
+ - "didSet"
+ - "distributed"
+ - "do"
+ - "dsohandle"
+ - "dynamic"
+ - "each"
+ - "enum"
+ - "extension"
+ - "externalMacro"
+ - "fallthrough"
+ - "false"
+ - "file"
+ - "fileID"
+ - "fileLiteral"
+ - "filePath"
+ - "fileprivate"
+ - "final"
+ - "for"
+ - "func"
+ - "function"
+ - "get"
+ - "getter:"
+ - "guard"
+ - "if"
+ - "imageLiteral"
+ - "import"
+ - "in"
+ - "indirect"
+ - "infix"
+ - "init"
+ - "inout"
+ - "internal"
+ - "is"
+ - "keyPath"
+ - "lazy"
+ - "let"
+ - "line"
+ - "macro"
+ - "mutating"
+ - "nil"
+ - "nonisolated"
+ - "nonmutating"
+ - "open"
+ - "operator"
+ - "optional"
+ - "os"
+ - "override"
+ - "package"
+ - "postfix"
+ - "precedencegroup"
+ - "prefix"
+ - "private"
+ - "protocol"
+ - "public"
+ - "repeat"
+ - "required"
+ - "return"
+ - "selector"
+ - "self"
+ - "set"
+ - "setter:"
+ - "some"
+ - "static"
+ - "struct"
+ - "subscript"
+ - "super"
+ - "swift"
+ - "switch"
+ - "targetEnvironment"
+ - "true"
+ - "try"
+ - "typealias"
+ - "u"
+ - "unavailable"
+ - "unowned"
+ - "unowned(safe)"
+ - "unowned(unsafe)"
+ - "var"
+ - "weak"
+ - "while"
+ - "willSet"
+ - "yield"
+ - "{"
+ - "|"
+ - "||"
+ - "}"
+ - "~"
diff --git a/unified/extractor/tree-sitter-swift/package.json b/unified/extractor/tree-sitter-swift/package.json
new file mode 100644
index 000000000000..68dcf7cc42fc
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/package.json
@@ -0,0 +1,68 @@
+{
+ "name": "tree-sitter-swift",
+ "version": "0.7.2",
+ "description": "A tree-sitter grammar for the Swift programming language.",
+ "main": "bindings/node/index.js",
+ "types": "bindings/node",
+ "scripts": {
+ "install": "node-gyp-build",
+ "prestart": "tree-sitter build --wasm",
+ "start": "tree-sitter playground",
+ "test": "node --test bindings/node/*_test.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/alex-pinkus/tree-sitter-swift.git"
+ },
+ "tree-sitter": [
+ {
+ "scope": "source.swift",
+ "file-types": [
+ "swift"
+ ],
+ "injection-regex": "swift",
+ "highlights": "queries/highlights.scm",
+ "locals": "queries/locals.scm",
+ "injections": "queries/injections.scm"
+ }
+ ],
+ "keywords": [
+ "parser",
+ "swift"
+ ],
+ "files": [
+ "grammar.js",
+ "tree-sitter.json",
+ "binding.gyp",
+ "prebuilds/**",
+ "bindings/node/*",
+ "queries/*",
+ "scripts/*",
+ "src/**"
+ ],
+ "author": "Alex Pinkus ",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/alex-pinkus/tree-sitter-swift/issues"
+ },
+ "homepage": "https://github.com/alex-pinkus/tree-sitter-swift#readme",
+ "dependencies": {
+ "node-addon-api": "^8.0.0",
+ "node-gyp-build": "^4.8.0",
+ "tree-sitter-cli": "^0.23",
+ "which": "2.0.2"
+ },
+ "peerDependencies": {
+ "tree-sitter": "^0.22.1"
+ },
+ "peerDependenciesMeta": {
+ "tree_sitter": {
+ "optional": true
+ }
+ },
+ "devDependencies": {
+ "node-gyp": "^10.0.1",
+ "prebuildify": "^6.0.0",
+ "prettier": "2.3.2"
+ }
+}
diff --git a/unified/extractor/tree-sitter-swift/queries/folds.scm b/unified/extractor/tree-sitter-swift/queries/folds.scm
new file mode 100644
index 000000000000..ca7f72593aa8
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/queries/folds.scm
@@ -0,0 +1,35 @@
+; format-ignore
+[
+ (protocol_body) ; protocol Foo { ... }
+ (class_body) ; class Foo { ... }
+ (enum_class_body) ; enum Foo { ... }
+ (function_body) ; func Foo (...) {...}
+ (computed_property) ; { ... }
+
+ (computed_getter) ; get { ... }
+ (computed_setter) ; set { ... }
+
+ (do_statement)
+ (if_statement)
+ (for_statement)
+ (switch_statement)
+ (while_statement)
+ (guard_statement)
+ (switch_entry)
+
+ (type_parameters) ; x
+ (tuple_type) ; (...)
+ (array_type) ; [String]
+ (dictionary_type) ; [Foo: Bar]
+
+ (call_expression) ; callFunc(...)
+ (tuple_expression) ; ( foo + bar )
+ (array_literal) ; [ foo, bar ]
+ (dictionary_literal) ; [ foo: bar, x: y ]
+ (lambda_literal)
+ (willset_didset_block)
+ (willset_clause)
+ (didset_clause)
+
+ (import_declaration)+
+] @fold
diff --git a/unified/extractor/tree-sitter-swift/queries/highlights.scm b/unified/extractor/tree-sitter-swift/queries/highlights.scm
new file mode 100644
index 000000000000..82ad68d4ed1c
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/queries/highlights.scm
@@ -0,0 +1,336 @@
+[
+ "."
+ ";"
+ ":"
+ ","
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+; Identifiers
+(type_identifier) @type
+
+[
+ (self_expression)
+ (super_expression)
+] @variable.builtin
+
+; Declarations
+[
+ "func"
+ "deinit"
+] @keyword.function
+
+[
+ (visibility_modifier)
+ (member_modifier)
+ (function_modifier)
+ (property_modifier)
+ (parameter_modifier)
+ (inheritance_modifier)
+ (mutation_modifier)
+] @keyword.modifier
+
+(simple_identifier) @variable
+
+(function_declaration
+ (simple_identifier) @function.method)
+
+(protocol_function_declaration
+ name: (simple_identifier) @function.method)
+
+(init_declaration
+ "init" @constructor)
+
+(parameter
+ external_name: (simple_identifier) @variable.parameter)
+
+(parameter
+ name: (simple_identifier) @variable.parameter)
+
+(type_parameter
+ (type_identifier) @variable.parameter)
+
+(inheritance_constraint
+ (identifier
+ (simple_identifier) @variable.parameter))
+
+(equality_constraint
+ (identifier
+ (simple_identifier) @variable.parameter))
+
+[
+ "protocol"
+ "extension"
+ "indirect"
+ "nonisolated"
+ "override"
+ "convenience"
+ "required"
+ "some"
+ "any"
+ "weak"
+ "unowned"
+ "didSet"
+ "willSet"
+ "subscript"
+ "let"
+ "var"
+ (throws)
+ (where_keyword)
+ (getter_specifier)
+ (setter_specifier)
+ (modify_specifier)
+ (else)
+ (as_operator)
+] @keyword
+
+[
+ "enum"
+ "struct"
+ "class"
+ "typealias"
+] @keyword.type
+
+[
+ "async"
+ "await"
+] @keyword.coroutine
+
+(shebang_line) @keyword.directive
+
+(class_body
+ (property_declaration
+ (pattern
+ (simple_identifier) @variable.member)))
+
+(protocol_property_declaration
+ (pattern
+ (simple_identifier) @variable.member))
+
+(navigation_expression
+ (navigation_suffix
+ (simple_identifier) @variable.member))
+
+(value_argument
+ name: (value_argument_label
+ (simple_identifier) @variable.member))
+
+(import_declaration
+ "import" @keyword.import)
+
+(enum_entry
+ "case" @keyword)
+
+(modifiers
+ (attribute
+ "@" @attribute
+ (user_type
+ (type_identifier) @attribute)))
+
+; Function calls
+(call_expression
+ (simple_identifier) @function.call) ; foo()
+
+(call_expression
+ ; foo.bar.baz(): highlight the baz()
+ (navigation_expression
+ (navigation_suffix
+ (simple_identifier) @function.call)))
+
+(call_expression
+ (prefix_expression
+ (simple_identifier) @function.call)) ; .foo()
+
+((navigation_expression
+ (simple_identifier) @type) ; SomeType.method(): highlight SomeType as a type
+ (#match? @type "^[A-Z]"))
+
+(directive) @keyword.directive
+
+; See https://docs.swift.org/swift-book/documentation/the-swift-programming-language/lexicalstructure/#Keywords-and-Punctuation
+[
+ (diagnostic)
+ (availability_condition)
+ (playground_literal)
+ (key_path_string_expression)
+ (selector_expression)
+ (external_macro_definition)
+] @function.macro
+
+(special_literal) @constant.macro
+
+; Statements
+(for_statement
+ "for" @keyword.repeat)
+
+(for_statement
+ "in" @keyword.repeat)
+
+[
+ "while"
+ "repeat"
+ "continue"
+ "break"
+] @keyword.repeat
+
+(guard_statement
+ "guard" @keyword.conditional)
+
+(if_statement
+ "if" @keyword.conditional)
+
+(switch_statement
+ "switch" @keyword.conditional)
+
+(switch_entry
+ "case" @keyword)
+
+(switch_entry
+ "fallthrough" @keyword)
+
+(switch_entry
+ (default_keyword) @keyword)
+
+"return" @keyword.return
+
+(ternary_expression
+ [
+ "?"
+ ":"
+ ] @keyword.conditional.ternary)
+
+[
+ (try_operator)
+ "do"
+ (throw_keyword)
+ (catch_keyword)
+] @keyword.exception
+
+(statement_label) @label
+
+; Comments
+[
+ (comment)
+ (multiline_comment)
+] @comment @spell
+
+((comment) @comment.documentation
+ (#match? @comment.documentation "^///[^/]"))
+
+((comment) @comment.documentation
+ (#match? @comment.documentation "^///$"))
+
+((multiline_comment) @comment.documentation
+ (#match? @comment.documentation "^/[*][*][^*].*[*]/$"))
+
+; String literals
+(line_str_text) @string
+
+(str_escaped_char) @string.escape
+
+(multi_line_str_text) @string
+
+(raw_str_part) @string
+
+(raw_str_end_part) @string
+
+(line_string_literal
+ [
+ "\\("
+ ")"
+ ] @punctuation.special)
+
+(multi_line_string_literal
+ [
+ "\\("
+ ")"
+ ] @punctuation.special)
+
+(raw_str_interpolation
+ [
+ (raw_str_interpolation_start)
+ ")"
+ ] @punctuation.special)
+
+[
+ "\""
+ "\"\"\""
+] @string
+
+; Lambda literals
+(lambda_literal
+ "in" @keyword.operator)
+
+; Basic literals
+[
+ (integer_literal)
+ (hex_literal)
+ (oct_literal)
+ (bin_literal)
+] @number
+
+(real_literal) @number.float
+
+(boolean_literal) @boolean
+
+"nil" @constant.builtin
+
+(wildcard_pattern) @character.special
+
+; Regex literals
+(regex_literal) @string.regexp
+
+; Operators
+(custom_operator) @operator
+
+[
+ "+"
+ "-"
+ "*"
+ "/"
+ "%"
+ "="
+ "+="
+ "-="
+ "*="
+ "/="
+ "<"
+ ">"
+ "<<"
+ ">>"
+ "<="
+ ">="
+ "++"
+ "--"
+ "^"
+ "&"
+ "&&"
+ "|"
+ "||"
+ "~"
+ "%="
+ "!="
+ "!=="
+ "=="
+ "==="
+ "?"
+ "??"
+ "->"
+ "..<"
+ "..."
+ (bang)
+] @operator
+
+(type_arguments
+ [
+ "<"
+ ">"
+ ] @punctuation.bracket)
diff --git a/unified/extractor/tree-sitter-swift/queries/indents.scm b/unified/extractor/tree-sitter-swift/queries/indents.scm
new file mode 100644
index 000000000000..ec8f8af95c6f
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/queries/indents.scm
@@ -0,0 +1,123 @@
+; format-ignore
+[
+ ; ... refers to the section that will get affected by this indent.begin capture
+ (protocol_body) ; protocol Foo { ... }
+ (class_body) ; class Foo { ... }
+ (enum_class_body) ; enum Foo { ... }
+ (function_declaration) ; func Foo (...) {...}
+ (init_declaration) ; init(...) {...}
+ (deinit_declaration) ; deinit {...}
+ (computed_property) ; { ... }
+ (subscript_declaration) ; subscript Foo(...) { ... }
+
+ (computed_getter) ; get { ... }
+ (computed_setter) ; set { ... }
+
+ (assignment) ; a = b
+
+ (control_transfer_statement) ; return ...
+ (for_statement)
+ (while_statement)
+ (repeat_while_statement)
+ (do_statement)
+ (if_statement)
+ (switch_statement)
+ (guard_statement)
+
+ (type_parameters) ; x
+ (tuple_type) ; (...)
+ (array_type) ; [String]
+ (dictionary_type) ; [Foo: Bar]
+
+ (call_expression) ; callFunc(...)
+ (tuple_expression) ; ( foo + bar )
+ (array_literal) ; [ foo, bar ]
+ (dictionary_literal) ; [ foo: bar, x: y ]
+ (lambda_literal)
+ (willset_didset_block)
+ (willset_clause)
+ (didset_clause)
+] @indent.begin
+
+(init_declaration) @indent.begin
+
+(init_declaration
+ [
+ "init"
+ "("
+ ] @indent.branch)
+
+; indentation for init parameters
+(init_declaration
+ ")" @indent.branch @indent.end)
+
+(init_declaration
+ (parameter) @indent.begin
+ (#set! indent.immediate))
+
+; @something(...)
+(modifiers
+ (attribute) @indent.begin)
+
+(function_declaration
+ (modifiers
+ .
+ (attribute)
+ (_)* @indent.branch)
+ .
+ _ @indent.branch
+ (#not-kind-eq? @indent.branch "type_parameters" "parameter"))
+
+(ERROR
+ [
+ "<"
+ "{"
+ "("
+ "["
+ ]) @indent.begin
+
+; if-elseif
+(if_statement
+ (if_statement) @indent.dedent)
+
+; case Foo:
+; default Foo:
+; @attribute default Foo:
+(switch_entry
+ .
+ _ @indent.branch)
+
+(function_declaration
+ ")" @indent.branch)
+
+(type_parameters
+ ">" @indent.branch @indent.end .)
+
+(tuple_expression
+ ")" @indent.branch @indent.end)
+
+(value_arguments
+ ")" @indent.branch @indent.end)
+
+(tuple_type
+ ")" @indent.branch @indent.end)
+
+(modifiers
+ (attribute
+ ")" @indent.branch @indent.end))
+
+[
+ "}"
+ "]"
+] @indent.branch @indent.end
+
+[
+ ; (ERROR)
+ (comment)
+ (multiline_comment)
+ (raw_str_part)
+ (multi_line_string_literal)
+] @indent.auto
+
+(directive) @indent.ignore
+
diff --git a/unified/extractor/tree-sitter-swift/queries/injections.scm b/unified/extractor/tree-sitter-swift/queries/injections.scm
new file mode 100644
index 000000000000..512cfa0d5223
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/queries/injections.scm
@@ -0,0 +1,10 @@
+; Parse regex syntax within regex literals
+
+((regex_literal) @injection.content
+ (#set! injection.language "regex"))
+
+([
+ (comment)
+ (multiline_comment)
+] @injection.content
+ (#set! injection.language "comment"))
diff --git a/unified/extractor/tree-sitter-swift/queries/locals.scm b/unified/extractor/tree-sitter-swift/queries/locals.scm
new file mode 100644
index 000000000000..78032a81810b
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/queries/locals.scm
@@ -0,0 +1,23 @@
+(import_declaration
+ (identifier) @local.definition.import)
+
+(function_declaration
+ name: (simple_identifier) @local.definition.function)
+
+; Scopes
+[
+ (statements)
+ (for_statement)
+ (while_statement)
+ (repeat_while_statement)
+ (do_statement)
+ (if_statement)
+ (guard_statement)
+ (switch_statement)
+ (property_declaration)
+ (function_declaration)
+ (class_declaration)
+ (protocol_declaration)
+] @local.scope
+
+
diff --git a/unified/extractor/tree-sitter-swift/queries/outline.scm b/unified/extractor/tree-sitter-swift/queries/outline.scm
new file mode 100644
index 000000000000..31fe5d9d4a43
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/queries/outline.scm
@@ -0,0 +1,66 @@
+(protocol_declaration
+ declaration_kind: "protocol" @name
+ .
+ _ * @name
+ .
+ body: (protocol_body)
+) @item
+
+(class_declaration
+ declaration_kind: (
+ [
+ "actor"
+ "class"
+ "extension"
+ "enum"
+ "struct"
+ ]
+ ) @name
+ .
+ _ * @name
+ .
+ body: (_)
+) @item
+
+(init_declaration
+ name: "init" @name
+ .
+ _ * @name
+ .
+ body: (function_body)
+) @item
+
+(deinit_declaration
+ "deinit" @name) @item
+
+(function_declaration
+ "func" @name
+ .
+ _ * @name
+ .
+ body: (function_body)
+) @item
+
+(class_body
+ (property_declaration
+ (value_binding_pattern) @name
+ name: (pattern) @name
+ (type_annotation)? @name
+ ) @item
+)
+
+(enum_class_body
+ (property_declaration
+ (value_binding_pattern) @name
+ name: (pattern) @name
+ (type_annotation)? @name
+ ) @item
+)
+
+(
+ (protocol_function_declaration) @name
+) @item
+
+(
+ (protocol_property_declaration) @name
+) @item
diff --git a/unified/extractor/tree-sitter-swift/queries/tags.scm b/unified/extractor/tree-sitter-swift/queries/tags.scm
new file mode 100644
index 000000000000..0038571e5d72
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/queries/tags.scm
@@ -0,0 +1,51 @@
+(class_declaration
+ name: (type_identifier) @name) @definition.class
+
+(protocol_declaration
+ name: (type_identifier) @name) @definition.interface
+
+(class_declaration
+ (class_body
+ [
+ (function_declaration
+ name: (simple_identifier) @name
+ )
+ (subscript_declaration
+ (parameter (simple_identifier) @name)
+ )
+ (init_declaration "init" @name)
+ (deinit_declaration "deinit" @name)
+ ]
+ )
+) @definition.method
+
+(protocol_declaration
+ (protocol_body
+ [
+ (protocol_function_declaration
+ name: (simple_identifier) @name
+ )
+ (subscript_declaration
+ (parameter (simple_identifier) @name)
+ )
+ (init_declaration "init" @name)
+ ]
+ )
+) @definition.method
+
+(class_declaration
+ (class_body
+ [
+ (property_declaration
+ (pattern (simple_identifier) @name)
+ )
+ ]
+ )
+) @definition.property
+
+(property_declaration
+ (pattern (simple_identifier) @name)
+) @definition.property
+
+(function_declaration
+ name: (simple_identifier) @name) @definition.function
\ No newline at end of file
diff --git a/unified/extractor/tree-sitter-swift/queries/textobjects.scm b/unified/extractor/tree-sitter-swift/queries/textobjects.scm
new file mode 100644
index 000000000000..da689a1b29f6
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/queries/textobjects.scm
@@ -0,0 +1,19 @@
+
+
+; MARK: Structure
+
+(function_declaration
+ body: (_) @function.inside) @function.around
+
+; TODO: Classes/structs/enums
+
+
+; MARK: Tests
+
+; Only matches prefix test. Other conventions
+; might be nice to add!
+(function_declaration
+ name: (simple_identifier) @_name
+ (#match? @_name "^test")
+)
+
diff --git a/unified/extractor/tree-sitter-swift/src/scanner.c b/unified/extractor/tree-sitter-swift/src/scanner.c
new file mode 100644
index 000000000000..bb2dcac58b28
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/src/scanner.c
@@ -0,0 +1,929 @@
+#include "tree_sitter/parser.h"
+#include
+#include
+
+#define TOKEN_COUNT 33
+
+enum TokenType {
+ BLOCK_COMMENT,
+ RAW_STR_PART,
+ RAW_STR_CONTINUING_INDICATOR,
+ RAW_STR_END_PART,
+ IMPLICIT_SEMI,
+ EXPLICIT_SEMI,
+ ARROW_OPERATOR,
+ DOT_OPERATOR,
+ CONJUNCTION_OPERATOR,
+ DISJUNCTION_OPERATOR,
+ NIL_COALESCING_OPERATOR,
+ EQUAL_SIGN,
+ EQ_EQ,
+ PLUS_THEN_WS,
+ MINUS_THEN_WS,
+ BANG,
+ THROWS_KEYWORD,
+ RETHROWS_KEYWORD,
+ DEFAULT_KEYWORD,
+ WHERE_KEYWORD,
+ ELSE_KEYWORD,
+ CATCH_KEYWORD,
+ AS_KEYWORD,
+ AS_QUEST,
+ AS_BANG,
+ ASYNC_KEYWORD,
+ CUSTOM_OPERATOR,
+ HASH_SYMBOL,
+ DIRECTIVE_IF,
+ DIRECTIVE_ELSEIF,
+ DIRECTIVE_ELSE,
+ DIRECTIVE_ENDIF,
+ FAKE_TRY_BANG
+};
+
+#define OPERATOR_COUNT 20
+
+const char* OPERATORS[OPERATOR_COUNT] = {
+ "->",
+ ".",
+ "&&",
+ "||",
+ "??",
+ "=",
+ "==",
+ "+",
+ "-",
+ "!",
+ "throws",
+ "rethrows",
+ "default",
+ "where",
+ "else",
+ "catch",
+ "as",
+ "as?",
+ "as!",
+ "async"
+};
+
+enum IllegalTerminatorGroup {
+ ALPHANUMERIC,
+ OPERATOR_SYMBOLS,
+ OPERATOR_OR_DOT,
+ NON_WHITESPACE
+};
+
+const enum IllegalTerminatorGroup OP_ILLEGAL_TERMINATORS[OPERATOR_COUNT] = {
+ OPERATOR_SYMBOLS, // ->
+ OPERATOR_OR_DOT, // .
+ OPERATOR_SYMBOLS, // &&
+ OPERATOR_SYMBOLS, // ||
+ OPERATOR_SYMBOLS, // ??
+ OPERATOR_SYMBOLS, // =
+ OPERATOR_SYMBOLS, // ==
+ NON_WHITESPACE, // +
+ NON_WHITESPACE, // -
+ OPERATOR_SYMBOLS, // !
+ ALPHANUMERIC, // throws
+ ALPHANUMERIC, // rethrows
+ ALPHANUMERIC, // default
+ ALPHANUMERIC, // where
+ ALPHANUMERIC, // else
+ ALPHANUMERIC, // catch
+ ALPHANUMERIC, // as
+ OPERATOR_SYMBOLS, // as?
+ OPERATOR_SYMBOLS, // as!
+ ALPHANUMERIC // async
+};
+
+const enum TokenType OP_SYMBOLS[OPERATOR_COUNT] = {
+ ARROW_OPERATOR,
+ DOT_OPERATOR,
+ CONJUNCTION_OPERATOR,
+ DISJUNCTION_OPERATOR,
+ NIL_COALESCING_OPERATOR,
+ EQUAL_SIGN,
+ EQ_EQ,
+ PLUS_THEN_WS,
+ MINUS_THEN_WS,
+ BANG,
+ THROWS_KEYWORD,
+ RETHROWS_KEYWORD,
+ DEFAULT_KEYWORD,
+ WHERE_KEYWORD,
+ ELSE_KEYWORD,
+ CATCH_KEYWORD,
+ AS_KEYWORD,
+ AS_QUEST,
+ AS_BANG,
+ ASYNC_KEYWORD
+};
+
+const uint64_t OP_SYMBOL_SUPPRESSOR[OPERATOR_COUNT] = {
+ 0, // ARROW_OPERATOR,
+ 0, // DOT_OPERATOR,
+ 0, // CONJUNCTION_OPERATOR,
+ 0, // DISJUNCTION_OPERATOR,
+ 0, // NIL_COALESCING_OPERATOR,
+ 0, // EQUAL_SIGN,
+ 0, // EQ_EQ,
+ 0, // PLUS_THEN_WS,
+ 0, // MINUS_THEN_WS,
+ 1UL << FAKE_TRY_BANG, // BANG,
+ 0, // THROWS_KEYWORD,
+ 0, // RETHROWS_KEYWORD,
+ 0, // DEFAULT_KEYWORD,
+ 0, // WHERE_KEYWORD,
+ 0, // ELSE_KEYWORD,
+ 0, // CATCH_KEYWORD,
+ 0, // AS_KEYWORD,
+ 0, // AS_QUEST,
+ 0, // AS_BANG,
+ 0, // ASYNC_KEYWORD
+};
+
+#define RESERVED_OP_COUNT 31
+
+const char* RESERVED_OPS[RESERVED_OP_COUNT] = {
+ "/",
+ "=",
+ "-",
+ "+",
+ "!",
+ "*",
+ "%",
+ "<",
+ ">",
+ "&",
+ "|",
+ "^",
+ "?",
+ "~",
+ ".",
+ "..",
+ "->",
+ "/*",
+ "*/",
+ "+=",
+ "-=",
+ "*=",
+ "/=",
+ "%=",
+ ">>",
+ "<<",
+ "++",
+ "--",
+ "===",
+ "...",
+ "..<"
+};
+
+static bool is_cross_semi_token(enum TokenType op) {
+ switch(op) {
+ case ARROW_OPERATOR:
+ case DOT_OPERATOR:
+ case CONJUNCTION_OPERATOR:
+ case DISJUNCTION_OPERATOR:
+ case NIL_COALESCING_OPERATOR:
+ case EQUAL_SIGN:
+ case EQ_EQ:
+ case PLUS_THEN_WS:
+ case MINUS_THEN_WS:
+ case THROWS_KEYWORD:
+ case RETHROWS_KEYWORD:
+ case DEFAULT_KEYWORD:
+ case WHERE_KEYWORD:
+ case ELSE_KEYWORD:
+ case CATCH_KEYWORD:
+ case AS_KEYWORD:
+ case AS_QUEST:
+ case AS_BANG:
+ case ASYNC_KEYWORD:
+ case CUSTOM_OPERATOR:
+ return true;
+ case BANG:
+ default:
+ return false;
+ }
+}
+
+#define NON_CONSUMING_CROSS_SEMI_CHAR_COUNT 3
+const uint32_t NON_CONSUMING_CROSS_SEMI_CHARS[NON_CONSUMING_CROSS_SEMI_CHAR_COUNT] = { '?', ':', '{' };
+
+/**
+ * All possible results of having performed some sort of parsing.
+ *
+ * A parser can return a result along two dimensions:
+ * 1. Should the scanner continue trying to find another result?
+ * 2. Was some result produced by this parsing attempt?
+ *
+ * These are flattened into a single enum together. When the function returns one of the `TOKEN_FOUND` cases, it
+ * will always populate its `symbol_result` field. When it returns one of the `STOP_PARSING` cases, callers should
+ * immediately return (with the value, if there is one).
+ */
+enum ParseDirective {
+ CONTINUE_PARSING_NOTHING_FOUND,
+ CONTINUE_PARSING_TOKEN_FOUND,
+ CONTINUE_PARSING_SLASH_CONSUMED,
+ STOP_PARSING_NOTHING_FOUND,
+ STOP_PARSING_TOKEN_FOUND,
+ STOP_PARSING_END_OF_FILE
+};
+
+struct ScannerState {
+ uint32_t ongoing_raw_str_hash_count;
+};
+
+void *tree_sitter_swift_external_scanner_create() {
+ return calloc(1, sizeof(struct ScannerState));
+}
+
+void tree_sitter_swift_external_scanner_destroy(void *payload) {
+ free(payload);
+}
+
+void tree_sitter_swift_external_scanner_reset(void *payload) {
+ struct ScannerState *state = (struct ScannerState *)payload;
+ state->ongoing_raw_str_hash_count = 0;
+}
+
+unsigned tree_sitter_swift_external_scanner_serialize(void *payload, char *buffer) {
+ struct ScannerState *state = (struct ScannerState *)payload;
+ uint32_t hash_count = state->ongoing_raw_str_hash_count;
+ buffer[0] = (hash_count >> 24) & 0xff;
+ buffer[1] = (hash_count >> 16) & 0xff;
+ buffer[2] = (hash_count >> 8) & 0xff;
+ buffer[3] = (hash_count) & 0xff;
+ return 4;
+}
+
+void tree_sitter_swift_external_scanner_deserialize(
+ void *payload,
+ const char *buffer,
+ unsigned length
+) {
+ if (length < 4) {
+ return;
+ }
+
+ uint32_t hash_count = (
+ (((uint32_t) buffer[0]) << 24) |
+ (((uint32_t) buffer[1]) << 16) |
+ (((uint32_t) buffer[2]) << 8) |
+ (((uint32_t) buffer[3]))
+ );
+ struct ScannerState *state = (struct ScannerState *)payload;
+ state->ongoing_raw_str_hash_count = hash_count;
+}
+
+static void advance(TSLexer *lexer) {
+ lexer->advance(lexer, false);
+}
+
+static bool should_treat_as_wspace(int32_t character) {
+ return iswspace(character) || (((int32_t) ';') == character);
+}
+
+static int32_t encountered_op_count(bool *encountered_operator) {
+ int32_t encountered = 0;
+ for (int op_idx = 0; op_idx < OPERATOR_COUNT; op_idx++) {
+ if (encountered_operator[op_idx]) {
+ encountered++;
+ }
+ }
+
+ return encountered;
+}
+
+static bool any_reserved_ops(uint8_t *encountered_reserved_ops) {
+ for (int op_idx = 0; op_idx < RESERVED_OP_COUNT; op_idx++) {
+ if (encountered_reserved_ops[op_idx] == 2) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+static bool is_legal_custom_operator(
+ int32_t char_idx,
+ int32_t first_char,
+ int32_t cur_char
+) {
+ bool is_first_char = !char_idx;
+ switch (cur_char) {
+ case '=':
+ case '-':
+ case '+':
+ case '!':
+ case '%':
+ case '<':
+ case '>':
+ case '&':
+ case '|':
+ case '^':
+ case '?':
+ case '~':
+ return true;
+ case '.':
+ // Grammar allows `.` for any operator that starts with `.`
+ return is_first_char || first_char == '.';
+ case '*':
+ case '/':
+ // Not listed in the grammar, but `/*` and `//` can't be the start of an operator since they start comments
+ return char_idx != 1 || first_char != '/';
+ default:
+ if (
+ (cur_char >= 0x00A1 && cur_char <= 0x00A7) ||
+ (cur_char == 0x00A9) ||
+ (cur_char == 0x00AB) ||
+ (cur_char == 0x00AC) ||
+ (cur_char == 0x00AE) ||
+ (cur_char >= 0x00B0 && cur_char <= 0x00B1) ||
+ (cur_char == 0x00B6) ||
+ (cur_char == 0x00BB) ||
+ (cur_char == 0x00BF) ||
+ (cur_char == 0x00D7) ||
+ (cur_char == 0x00F7) ||
+ (cur_char >= 0x2016 && cur_char <= 0x2017) ||
+ (cur_char >= 0x2020 && cur_char <= 0x2027) ||
+ (cur_char >= 0x2030 && cur_char <= 0x203E) ||
+ (cur_char >= 0x2041 && cur_char <= 0x2053) ||
+ (cur_char >= 0x2055 && cur_char <= 0x205E) ||
+ (cur_char >= 0x2190 && cur_char <= 0x23FF) ||
+ (cur_char >= 0x2500 && cur_char <= 0x2775) ||
+ (cur_char >= 0x2794 && cur_char <= 0x2BFF) ||
+ (cur_char >= 0x2E00 && cur_char <= 0x2E7F) ||
+ (cur_char >= 0x3001 && cur_char <= 0x3003) ||
+ (cur_char >= 0x3008 && cur_char <= 0x3020) ||
+ (cur_char == 0x3030)
+ ) {
+ return true;
+ } else if (
+ (cur_char >= 0x0300 && cur_char <= 0x036f) ||
+ (cur_char >= 0x1DC0 && cur_char <= 0x1DFF) ||
+ (cur_char >= 0x20D0 && cur_char <= 0x20FF) ||
+ (cur_char >= 0xFE00 && cur_char <= 0xFE0F) ||
+ (cur_char >= 0xFE20 && cur_char <= 0xFE2F) ||
+ (cur_char >= 0xE0100 && cur_char <= 0xE01EF)
+ ) {
+ return !is_first_char;
+ } else {
+ return false;
+ }
+ }
+}
+
+static bool eat_operators(
+ TSLexer *lexer,
+ const bool *valid_symbols,
+ bool mark_end,
+ const int32_t prior_char,
+ enum TokenType *symbol_result
+) {
+ bool possible_operators[OPERATOR_COUNT];
+ uint8_t reserved_operators[RESERVED_OP_COUNT];
+ for (int op_idx = 0; op_idx < OPERATOR_COUNT; op_idx++) {
+ possible_operators[op_idx] = valid_symbols[OP_SYMBOLS[op_idx]] && (!prior_char || OPERATORS[op_idx][0] == prior_char);
+ }
+ for (int op_idx = 0; op_idx < RESERVED_OP_COUNT; op_idx++) {
+ reserved_operators[op_idx] = !prior_char || RESERVED_OPS[op_idx][0] == prior_char;
+ }
+
+ bool possible_custom_operator = valid_symbols[CUSTOM_OPERATOR];
+ int32_t first_char = prior_char ? prior_char : lexer->lookahead;
+ int32_t last_examined_char = first_char;
+
+ int32_t str_idx = prior_char ? 1 : 0;
+ int32_t full_match = -1;
+ while(true) {
+ for (int op_idx = 0; op_idx < OPERATOR_COUNT; op_idx++) {
+ if (!possible_operators[op_idx]) {
+ continue;
+ }
+
+ if (OPERATORS[op_idx][str_idx] == '\0') {
+ // Make sure that the operator is allowed to have the next character as its lookahead.
+ enum IllegalTerminatorGroup illegal_terminators = OP_ILLEGAL_TERMINATORS[op_idx];
+ switch (lexer->lookahead) {
+ // See "Operators":
+ // https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID418
+ case '/':
+ case '=':
+ case '-':
+ case '+':
+ case '!':
+ case '*':
+ case '%':
+ case '<':
+ case '>':
+ case '&':
+ case '|':
+ case '^':
+ case '?':
+ case '~':
+ if (illegal_terminators == OPERATOR_SYMBOLS) {
+ break;
+ } // Otherwise, intentionally fall through to the OPERATOR_OR_DOT case
+ // fall through
+ case '.':
+ if (illegal_terminators == OPERATOR_OR_DOT) {
+ break;
+ } // Otherwise, fall through to DEFAULT which checks its groups directly
+ // fall through
+ default:
+ if (iswalnum(lexer->lookahead) && illegal_terminators == ALPHANUMERIC) {
+ break;
+ }
+
+ if (!iswspace(lexer->lookahead) && illegal_terminators == NON_WHITESPACE) {
+ break;
+ }
+
+ full_match = op_idx;
+ if (mark_end) {
+ lexer->mark_end(lexer);
+ }
+ }
+
+ possible_operators[op_idx] = false;
+ continue;
+ }
+
+ if (OPERATORS[op_idx][str_idx] != lexer->lookahead) {
+ possible_operators[op_idx] = false;
+ continue;
+ }
+ }
+
+ for (int op_idx = 0; op_idx < RESERVED_OP_COUNT; op_idx++) {
+ if (!reserved_operators[op_idx]) {
+ continue;
+ }
+
+ if (RESERVED_OPS[op_idx][str_idx] == '\0') {
+ reserved_operators[op_idx] = 0;
+ continue;
+ }
+
+ if (RESERVED_OPS[op_idx][str_idx] != lexer->lookahead) {
+ reserved_operators[op_idx] = 0;
+ continue;
+ }
+
+ if (RESERVED_OPS[op_idx][str_idx + 1] == '\0') {
+ reserved_operators[op_idx] = 2;
+ continue;
+ }
+ }
+
+ possible_custom_operator = possible_custom_operator && is_legal_custom_operator(
+ str_idx,
+ first_char,
+ lexer->lookahead
+ );
+
+ uint32_t encountered_ops = encountered_op_count(possible_operators);
+ if (encountered_ops == 0) {
+ if (!possible_custom_operator) {
+ break;
+ } else if (mark_end && full_match == -1) {
+ lexer->mark_end(lexer);
+ }
+ }
+
+ last_examined_char = lexer->lookahead;
+ lexer->advance(lexer, false);
+ str_idx += 1;
+
+ if (encountered_ops == 0 && !is_legal_custom_operator(
+ str_idx,
+ first_char,
+ lexer->lookahead
+ )) {
+ break;
+ }
+ }
+
+ if (full_match != -1) {
+ // We have a match -- first see if that match has a symbol that suppresses it. For example, in `try!`, we do not
+ // want to emit the `!` as a symbol in our scanner, because we want the parser to have the chance to parse it as
+ // an immediate token.
+ uint64_t suppressing_symbols = OP_SYMBOL_SUPPRESSOR[full_match];
+ if (suppressing_symbols) {
+ for (uint64_t suppressor = 0; suppressor < TOKEN_COUNT; suppressor++) {
+ if (!(suppressing_symbols & 1ULL << suppressor)) {
+ continue;
+ }
+
+ // The suppressing symbol is valid in this position, so skip it.
+ if (valid_symbols[suppressor]) {
+ return false;
+ }
+ }
+ }
+ *symbol_result = OP_SYMBOLS[full_match];
+ return true;
+ }
+
+ if (possible_custom_operator && !any_reserved_ops(reserved_operators)) {
+ if ((last_examined_char != '<' || iswspace(lexer->lookahead)) && mark_end) {
+ lexer->mark_end(lexer);
+ }
+ *symbol_result = CUSTOM_OPERATOR;
+ return true;
+ }
+
+ return false;
+}
+
+static enum ParseDirective eat_comment(
+ TSLexer *lexer,
+ const bool *valid_symbols,
+ bool mark_end,
+ enum TokenType *symbol_result
+) {
+ if (lexer->lookahead != '/') {
+ return CONTINUE_PARSING_NOTHING_FOUND;
+ }
+
+ advance(lexer);
+
+ if (lexer->lookahead != '*') {
+ return CONTINUE_PARSING_SLASH_CONSUMED;
+ }
+
+ advance(lexer);
+
+ bool after_star = false;
+ unsigned nesting_depth = 1;
+ for (;;) {
+ switch (lexer->lookahead) {
+ case '\0':
+ return STOP_PARSING_END_OF_FILE;
+ case '*':
+ advance(lexer);
+ after_star = true;
+ break;
+ case '/':
+ if (after_star) {
+ advance(lexer);
+ after_star = false;
+ nesting_depth--;
+ if (nesting_depth == 0) {
+ if (mark_end) {
+ lexer->mark_end(lexer);
+ }
+ *symbol_result = BLOCK_COMMENT;
+ return STOP_PARSING_TOKEN_FOUND;
+ }
+ } else {
+ advance(lexer);
+ after_star = false;
+ if (lexer->lookahead == '*') {
+ nesting_depth++;
+ advance(lexer);
+ }
+ }
+ break;
+ default:
+ advance(lexer);
+ after_star = false;
+ break;
+ }
+ }
+}
+
+static enum ParseDirective eat_whitespace(
+ TSLexer *lexer,
+ const bool *valid_symbols,
+ enum TokenType *symbol_result
+) {
+ enum ParseDirective ws_directive = CONTINUE_PARSING_NOTHING_FOUND;
+ bool semi_is_valid = valid_symbols[IMPLICIT_SEMI] && valid_symbols[EXPLICIT_SEMI];
+ uint32_t lookahead;
+ while (should_treat_as_wspace(lookahead = lexer->lookahead)) {
+ if (lookahead == ';') {
+ if (semi_is_valid) {
+ ws_directive = STOP_PARSING_TOKEN_FOUND;
+ lexer->advance(lexer, false);
+ }
+
+ break;
+ }
+
+ lexer->advance(lexer, true);
+
+ lexer->mark_end(lexer);
+
+ if (ws_directive == CONTINUE_PARSING_NOTHING_FOUND && (lookahead == '\n' || lookahead == '\r')) {
+ ws_directive = CONTINUE_PARSING_TOKEN_FOUND;
+ }
+ }
+
+ enum ParseDirective any_comment = CONTINUE_PARSING_NOTHING_FOUND;
+ if (ws_directive == CONTINUE_PARSING_TOKEN_FOUND && lookahead == '/') {
+ bool has_seen_single_comment = false;
+ while (lexer->lookahead == '/') {
+ // It's possible that this is a comment - start an exploratory mission to find out, and if it is, look for what
+ // comes after it. We care about what comes after it for the purpose of suppressing the newline.
+
+ enum TokenType multiline_comment_result;
+ any_comment = eat_comment(lexer, valid_symbols, /* mark_end */ false, &multiline_comment_result);
+ if (any_comment == STOP_PARSING_TOKEN_FOUND) {
+ // This is a multiline comment. This scanner should be parsing those, so we might want to bail out and
+ // emit it instead. However, we only want to do that if we haven't advanced through a _single_ line
+ // comment on the way - otherwise that will get lumped into this.
+ if (!has_seen_single_comment) {
+ lexer->mark_end(lexer);
+ *symbol_result = multiline_comment_result;
+ return STOP_PARSING_TOKEN_FOUND;
+ }
+ } else if (any_comment == STOP_PARSING_END_OF_FILE) {
+ return STOP_PARSING_END_OF_FILE;
+ } else if (any_comment == CONTINUE_PARSING_SLASH_CONSUMED) {
+ // We accidentally ate a slash -- we should actually bail out, say we saw nothing, and let the next pass
+ // take it from after the newline.
+ return CONTINUE_PARSING_SLASH_CONSUMED;
+ } else if (lexer->lookahead == '/') {
+ // There wasn't a multiline comment, which we know means that the comment parser ate its `/` and then
+ // bailed out. If it had seen anything comment-like after that first `/` it would have continued going
+ // and eventually had a well-formed comment or an EOF. Thus, if we're currently looking at a `/`, it's
+ // the second one of those and it means we have a single-line comment.
+ has_seen_single_comment = true;
+ while (lexer->lookahead != '\n' && lexer->lookahead != '\0') {
+ lexer->advance(lexer, true);
+ }
+ } else if (iswspace(lexer->lookahead)) {
+ // We didn't see any type of comment - in fact, we saw an operator that we don't normally treat as an
+ // operator. Still, this is a reason to stop parsing.
+ return STOP_PARSING_NOTHING_FOUND;
+ }
+
+ // If we skipped through some comment, we're at whitespace now, so advance.
+ while(iswspace(lexer->lookahead)) {
+ any_comment = CONTINUE_PARSING_NOTHING_FOUND; // We're advancing, so clear out the comment
+ lexer->advance(lexer, true);
+ }
+ }
+
+ enum TokenType operator_result;
+ bool saw_operator = eat_operators(
+ lexer,
+ valid_symbols,
+ /* mark_end */ false,
+ '\0',
+ &operator_result
+ );
+ if (saw_operator) {
+ // The operator we saw should suppress the newline, so bail out.
+ return STOP_PARSING_NOTHING_FOUND;
+ } else {
+ // Promote the implicit newline to an explicit one so we don't check for operators again.
+ *symbol_result = IMPLICIT_SEMI;
+ ws_directive = STOP_PARSING_TOKEN_FOUND;
+ }
+ }
+
+ // Let's consume operators that can live after a "semicolon" style newline. Before we do that, though, we want to
+ // check for a set of characters that we do not consume, but that still suppress the semi.
+ if (ws_directive == CONTINUE_PARSING_TOKEN_FOUND) {
+ for (int i = 0; i < NON_CONSUMING_CROSS_SEMI_CHAR_COUNT; i++) {
+ if (NON_CONSUMING_CROSS_SEMI_CHARS[i] == lookahead) {
+ return CONTINUE_PARSING_NOTHING_FOUND;
+ }
+ }
+ }
+
+ if (semi_is_valid && ws_directive != CONTINUE_PARSING_NOTHING_FOUND) {
+ *symbol_result = lookahead == ';' ? EXPLICIT_SEMI : IMPLICIT_SEMI;
+ return ws_directive;
+ }
+
+ return CONTINUE_PARSING_NOTHING_FOUND;
+}
+
+#define DIRECTIVE_COUNT 4
+const char* DIRECTIVES[OPERATOR_COUNT] = {
+ "if",
+ "elseif",
+ "else",
+ "endif"
+};
+
+const enum TokenType DIRECTIVE_SYMBOLS[DIRECTIVE_COUNT] = {
+ DIRECTIVE_IF,
+ DIRECTIVE_ELSEIF,
+ DIRECTIVE_ELSE,
+ DIRECTIVE_ENDIF
+};
+
+static enum TokenType find_possible_compiler_directive(TSLexer *lexer) {
+ bool possible_directives[DIRECTIVE_COUNT];
+ for (int dir_idx = 0; dir_idx < DIRECTIVE_COUNT; dir_idx++) {
+ possible_directives[dir_idx] = true;
+ }
+
+ int32_t str_idx = 0;
+ int32_t full_match = -1;
+ while(true) {
+ for (int dir_idx = 0; dir_idx < DIRECTIVE_COUNT; dir_idx++) {
+ if (!possible_directives[dir_idx]) {
+ continue;
+ }
+
+ uint8_t expected_char = DIRECTIVES[dir_idx][str_idx];
+ if (expected_char == '\0') {
+ full_match = dir_idx;
+ lexer->mark_end(lexer);
+ }
+
+ if (expected_char != lexer->lookahead) {
+ possible_directives[dir_idx] = false;
+ continue;
+ }
+ }
+
+ uint8_t match_count = 0;
+ for (int dir_idx = 0; dir_idx < DIRECTIVE_COUNT; dir_idx += 1) {
+ if (possible_directives[dir_idx]) {
+ match_count += 1;
+ }
+ }
+
+ if (match_count == 0) {
+ break;
+ }
+
+ lexer->advance(lexer, false);
+ str_idx += 1;
+ }
+
+ if (full_match == -1) {
+ // No compiler directive found, so just match the starting symbol
+ return HASH_SYMBOL;
+ }
+
+ return DIRECTIVE_SYMBOLS[full_match];
+}
+
+static bool eat_raw_str_part(
+ struct ScannerState *state,
+ TSLexer *lexer,
+ const bool *valid_symbols,
+ enum TokenType *symbol_result
+) {
+ uint32_t hash_count = state->ongoing_raw_str_hash_count;
+ if (!valid_symbols[RAW_STR_PART]) {
+ return false;
+ } else if (hash_count == 0) {
+ // If this is a raw_str_part, it's the first one - look for hashes
+ while (lexer->lookahead == '#') {
+ hash_count += 1;
+ advance(lexer);
+ }
+
+ if (hash_count == 0) {
+ return false;
+ }
+
+ if (lexer->lookahead == '"') {
+ advance(lexer);
+ } else if (hash_count == 1) {
+ lexer->mark_end(lexer);
+ *symbol_result = find_possible_compiler_directive(lexer);
+ return true;
+ } else {
+ return false;
+ }
+
+ } else if (valid_symbols[RAW_STR_CONTINUING_INDICATOR]) {
+ // This is the end of an interpolation - now it's another raw_str_part. This is a synthetic
+ // marker to tell us that the grammar just consumed a `(` symbol to close a raw
+ // interpolation (since we don't want to fire on every `(` in existence). We don't have
+ // anything to do except continue.
+ } else {
+ return false;
+ }
+
+ // We're in a state where anything other than `hash_count` hash symbols in a row should be eaten
+ // and is part of a string.
+ // The last character _before_ the hashes will tell us what happens next.
+ // Matters are also complicated by the fact that we don't want to consume every character we
+ // visit; if we see a `\#(`, for instance, with the appropriate number of hash symbols, we want
+ // to end our parsing _before_ that sequence. This allows highlighting tools to treat that as a
+ // separate token.
+ while (lexer->lookahead != '\0') {
+ uint8_t last_char = '\0';
+ lexer->mark_end(lexer); // We always want to parse thru the start of the string so far
+ // Advance through anything that isn't a hash symbol, because we want to count those.
+ while (lexer->lookahead != '#' && lexer->lookahead != '\0') {
+ last_char = lexer->lookahead;
+ advance(lexer);
+ if (last_char != '\\' || lexer->lookahead == '\\') {
+ // Mark a new end, but only if we didn't just advance past a `\` symbol, since we
+ // don't want to consume that. Exception: if this is a `\` that happens _right
+ // after_ another `\`, we for some reason _do_ want to consume that, because
+ // apparently that is parsed as a literal `\` followed by something escaped.
+ lexer->mark_end(lexer);
+ }
+ }
+
+ // We hit at least one hash - count them and see if they match.
+ uint32_t current_hash_count = 0;
+ while (lexer->lookahead == '#' && current_hash_count < hash_count) {
+ current_hash_count += 1;
+ advance(lexer);
+ }
+
+ // If we saw exactly the right number of hashes, one of three things is true:
+ // 1. We're trying to interpolate into this string.
+ // 2. The string just ended.
+ // 3. This was just some hash characters doing nothing important.
+ if (current_hash_count == hash_count) {
+ if (last_char == '\\' && lexer->lookahead == '(') {
+ // Interpolation case! Don't consume those chars; they get saved for grammar.js.
+ *symbol_result = RAW_STR_PART;
+ state->ongoing_raw_str_hash_count = hash_count;
+ return true;
+ } else if (last_char == '"') {
+ // The string is finished! Mark the end here, on the very last hash symbol.
+ lexer->mark_end(lexer);
+ *symbol_result = RAW_STR_END_PART;
+ state->ongoing_raw_str_hash_count = 0;
+ return true;
+ }
+ // Nothing special happened - let the string continue.
+ }
+ }
+
+ return false;
+}
+
+bool tree_sitter_swift_external_scanner_scan(
+ void *payload,
+ TSLexer *lexer,
+ const bool *valid_symbols
+) {
+ // Figure out our scanner state
+ struct ScannerState *state = (struct ScannerState *)payload;
+
+ // Consume any whitespace at the start.
+ enum TokenType ws_result;
+ enum ParseDirective ws_directive = eat_whitespace(lexer, valid_symbols, &ws_result);
+ if (ws_directive == STOP_PARSING_TOKEN_FOUND) {
+ lexer->result_symbol = ws_result;
+ return true;
+ }
+
+ if (ws_directive == STOP_PARSING_NOTHING_FOUND || ws_directive == STOP_PARSING_END_OF_FILE) {
+ return false;
+ }
+
+ bool has_ws_result = (ws_directive == CONTINUE_PARSING_TOKEN_FOUND);
+
+ // Now consume comments (before custom operators so that those aren't treated as comments)
+ enum TokenType comment_result;
+ enum ParseDirective comment = ws_directive == CONTINUE_PARSING_SLASH_CONSUMED ? ws_directive : eat_comment(lexer, valid_symbols, /* mark_end */ true, &comment_result);
+ if (comment == STOP_PARSING_TOKEN_FOUND) {
+ lexer->mark_end(lexer);
+ lexer->result_symbol = comment_result;
+ return true;
+ }
+
+ if (comment == STOP_PARSING_END_OF_FILE) {
+ return false;
+ }
+ // Now consume any operators that might cause our whitespace to be suppressed.
+ enum TokenType operator_result;
+ bool saw_operator = eat_operators(
+ lexer,
+ valid_symbols,
+ /* mark_end */ !has_ws_result,
+ comment == CONTINUE_PARSING_SLASH_CONSUMED ? '/' : '\0',
+ &operator_result
+ );
+
+ if (saw_operator && (!has_ws_result || is_cross_semi_token(operator_result))) {
+ lexer->result_symbol = operator_result;
+ if (has_ws_result) lexer->mark_end(lexer);
+ return true;
+ }
+
+ if (has_ws_result) {
+ // Don't `mark_end`, since we may have advanced through some operators.
+ lexer->result_symbol = ws_result;
+ return true;
+ }
+
+ // NOTE: this will consume any `#` characters it sees, even if it does not find a result. Keep
+ // it at the end so that it doesn't interfere with special literals or selectors!
+ enum TokenType raw_str_result;
+ bool saw_raw_str_part = eat_raw_str_part(state, lexer, valid_symbols, &raw_str_result);
+ if (saw_raw_str_part) {
+ lexer->result_symbol = raw_str_result;
+ return true;
+ }
+
+ return false;
+}
+
diff --git a/unified/extractor/tree-sitter-swift/tree-sitter.json b/unified/extractor/tree-sitter-swift/tree-sitter.json
new file mode 100644
index 000000000000..3cd49a28a38f
--- /dev/null
+++ b/unified/extractor/tree-sitter-swift/tree-sitter.json
@@ -0,0 +1,39 @@
+{
+ "grammars": [
+ {
+ "name": "swift",
+ "camelcase": "Swift",
+ "scope": "source.swift",
+ "path": ".",
+ "file-types": [
+ "swift"
+ ],
+ "highlights": "queries/highlights.scm",
+ "injections": "queries/injections.scm",
+ "locals": "queries/locals.scm",
+ "injection-regex": "swift"
+ }
+ ],
+ "metadata": {
+ "version": "0.7.2",
+ "license": "MIT",
+ "description": "A tree-sitter grammar for the Swift programming language.",
+ "authors": [
+ {
+ "name": "Alex Pinkus",
+ "email": "alex.pinkus@gmail.com"
+ }
+ ],
+ "links": {
+ "repository": "git+https://github.com/alex-pinkus/tree-sitter-swift.git"
+ }
+ },
+ "bindings": {
+ "c": true,
+ "go": true,
+ "node": true,
+ "python": true,
+ "rust": true,
+ "swift": true
+ }
+}
diff --git a/unified/ql/lib/codeql/unified/Ast.qll b/unified/ql/lib/codeql/unified/Ast.qll
index 54c1caceaf4b..5b9491fdb9fe 100644
--- a/unified/ql/lib/codeql/unified/Ast.qll
+++ b/unified/ql/lib/codeql/unified/Ast.qll
@@ -87,23 +87,17 @@ module Swift {
)
}
- /** A class representing `_expression` tokens. */
- class UnderscoreExpression extends @swift_token__expression, Token {
- /** Gets the name of the primary QL class for this element. */
- final override string getAPrimaryQlClass() { result = "UnderscoreExpression" }
- }
-
/** A class representing `additive_expression` nodes. */
class AdditiveExpression extends @swift_additive_expression, AstNode {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "AdditiveExpression" }
/** Gets the node corresponding to the field `lhs`. */
- final AstNode getLhs(int i) { swift_additive_expression_lhs(this, i, result) }
+ final Expression getLhs() { swift_additive_expression_def(this, result, _, _) }
/** Gets the node corresponding to the field `op`. */
final string getOp() {
- exists(int value | swift_additive_expression_def(this, value) |
+ exists(int value | swift_additive_expression_def(this, _, value, _) |
result = "+" and value = 0
or
result = "-" and value = 1
@@ -111,12 +105,12 @@ module Swift {
}
/** Gets the node corresponding to the field `rhs`. */
- final AstNode getRhs(int i) { swift_additive_expression_rhs(this, i, result) }
+ final Expression getRhs() { swift_additive_expression_def(this, _, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_additive_expression_lhs(this, _, result) or
- swift_additive_expression_rhs(this, _, result)
+ swift_additive_expression_def(this, result, _, _) or
+ swift_additive_expression_def(this, _, _, result)
}
}
@@ -126,7 +120,7 @@ module Swift {
final override string getAPrimaryQlClass() { result = "ArrayLiteral" }
/** Gets the node corresponding to the field `element`. */
- final AstNode getElement(int i) { swift_array_literal_element(this, i, result) }
+ final Expression getElement(int i) { swift_array_literal_element(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() { swift_array_literal_element(this, _, result) }
@@ -138,15 +132,10 @@ module Swift {
final override string getAPrimaryQlClass() { result = "ArrayType" }
/** Gets the node corresponding to the field `element`. */
- final AstNode getElement(int i) { swift_array_type_element(this, i, result) }
-
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName() { swift_array_type_def(this, result) }
+ final Type getElement() { swift_array_type_def(this, result) }
/** Gets a field or child node of this node. */
- final override AstNode getAFieldOrChild() {
- swift_array_type_element(this, _, result) or swift_array_type_def(this, result)
- }
+ final override AstNode getAFieldOrChild() { swift_array_type_def(this, result) }
}
/** A class representing `as_expression` nodes. */
@@ -155,23 +144,19 @@ module Swift {
final override string getAPrimaryQlClass() { result = "AsExpression" }
/** Gets the node corresponding to the field `expr`. */
- final AstNode getExpr(int i) { swift_as_expression_expr(this, i, result) }
-
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName() { swift_as_expression_def(this, result, _) }
+ final Expression getExpr() { swift_as_expression_def(this, result, _, _) }
/** Gets the node corresponding to the field `type`. */
- final AstNode getType(int i) { swift_as_expression_type(this, i, result) }
+ final Type getType() { swift_as_expression_def(this, _, result, _) }
/** Gets the child of this node. */
- final AsOperator getChild() { swift_as_expression_def(this, _, result) }
+ final AsOperator getChild() { swift_as_expression_def(this, _, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_as_expression_expr(this, _, result) or
- swift_as_expression_def(this, result, _) or
- swift_as_expression_type(this, _, result) or
- swift_as_expression_def(this, _, result)
+ swift_as_expression_def(this, result, _, _) or
+ swift_as_expression_def(this, _, result, _) or
+ swift_as_expression_def(this, _, _, result)
}
}
@@ -188,7 +173,7 @@ module Swift {
/** Gets the node corresponding to the field `operator`. */
final string getOperator() {
- exists(int value | swift_assignment_def(this, value, _) |
+ exists(int value | swift_assignment_def(this, value, _, _) |
result = "%=" and value = 0
or
result = "*=" and value = 1
@@ -204,14 +189,14 @@ module Swift {
}
/** Gets the node corresponding to the field `result`. */
- final AstNode getResult(int i) { swift_assignment_result(this, i, result) }
+ final Expression getResult() { swift_assignment_def(this, _, result, _) }
/** Gets the node corresponding to the field `target`. */
- final DirectlyAssignableExpression getTarget() { swift_assignment_def(this, _, result) }
+ final DirectlyAssignableExpression getTarget() { swift_assignment_def(this, _, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_assignment_result(this, _, result) or swift_assignment_def(this, _, result)
+ swift_assignment_def(this, _, result, _) or swift_assignment_def(this, _, _, result)
}
}
@@ -221,26 +206,22 @@ module Swift {
final override string getAPrimaryQlClass() { result = "AssociatedtypeDeclaration" }
/** Gets the node corresponding to the field `default_value`. */
- final AstNode getDefaultValue(int i) {
- swift_associatedtype_declaration_default_value(this, i, result)
- }
+ final Type getDefaultValue() { swift_associatedtype_declaration_default_value(this, result) }
/** Gets the node corresponding to the field `must_inherit`. */
- final AstNode getMustInherit(int i) {
- swift_associatedtype_declaration_must_inherit(this, i, result)
- }
+ final Type getMustInherit() { swift_associatedtype_declaration_must_inherit(this, result) }
/** Gets the node corresponding to the field `name`. */
- final AstNode getName(int i) { swift_associatedtype_declaration_name(this, i, result) }
+ final TypeIdentifier getName() { swift_associatedtype_declaration_def(this, result) }
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_associatedtype_declaration_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_associatedtype_declaration_default_value(this, _, result) or
- swift_associatedtype_declaration_must_inherit(this, _, result) or
- swift_associatedtype_declaration_name(this, _, result) or
+ swift_associatedtype_declaration_default_value(this, result) or
+ swift_associatedtype_declaration_must_inherit(this, result) or
+ swift_associatedtype_declaration_def(this, result) or
swift_associatedtype_declaration_child(this, _, result)
}
}
@@ -277,14 +258,14 @@ module Swift {
final override string getAPrimaryQlClass() { result = "AwaitExpression" }
/** Gets the node corresponding to the field `expr`. */
- final AstNode getExpr(int i) { swift_await_expression_expr(this, i, result) }
+ final Expression getExpr() { swift_await_expression_expr(this, result) }
/** Gets the child of this node. */
- final AstNode getChild() { swift_await_expression_child(this, result) }
+ final Expression getChild() { swift_await_expression_child(this, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_await_expression_expr(this, _, result) or swift_await_expression_child(this, result)
+ swift_await_expression_expr(this, result) or swift_await_expression_child(this, result)
}
}
@@ -306,11 +287,11 @@ module Swift {
final override string getAPrimaryQlClass() { result = "BitwiseOperation" }
/** Gets the node corresponding to the field `lhs`. */
- final AstNode getLhs(int i) { swift_bitwise_operation_lhs(this, i, result) }
+ final Expression getLhs() { swift_bitwise_operation_def(this, result, _, _) }
/** Gets the node corresponding to the field `op`. */
final string getOp() {
- exists(int value | swift_bitwise_operation_def(this, value) |
+ exists(int value | swift_bitwise_operation_def(this, _, value, _) |
result = "&" and value = 0
or
result = "<<" and value = 1
@@ -324,11 +305,12 @@ module Swift {
}
/** Gets the node corresponding to the field `rhs`. */
- final AstNode getRhs(int i) { swift_bitwise_operation_rhs(this, i, result) }
+ final Expression getRhs() { swift_bitwise_operation_def(this, _, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_bitwise_operation_lhs(this, _, result) or swift_bitwise_operation_rhs(this, _, result)
+ swift_bitwise_operation_def(this, result, _, _) or
+ swift_bitwise_operation_def(this, _, _, result)
}
}
@@ -388,7 +370,7 @@ module Swift {
final AstNode getName() { swift_capture_list_item_def(this, result) }
/** Gets the node corresponding to the field `value`. */
- final AstNode getValue(int i) { swift_capture_list_item_value(this, i, result) }
+ final Expression getValue() { swift_capture_list_item_value(this, result) }
/** Gets the child of this node. */
final OwnershipModifier getChild() { swift_capture_list_item_child(this, result) }
@@ -396,7 +378,7 @@ module Swift {
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
swift_capture_list_item_def(this, result) or
- swift_capture_list_item_value(this, _, result) or
+ swift_capture_list_item_value(this, result) or
swift_capture_list_item_child(this, result)
}
}
@@ -429,25 +411,23 @@ module Swift {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "CheckExpression" }
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName() { swift_check_expression_def(this, result, _) }
-
/** Gets the node corresponding to the field `op`. */
final string getOp() {
- exists(int value | swift_check_expression_def(this, _, value) | (result = "is" and value = 0))
+ exists(int value | swift_check_expression_def(this, value, _, _) |
+ (result = "is" and value = 0)
+ )
}
/** Gets the node corresponding to the field `target`. */
- final AstNode getTarget(int i) { swift_check_expression_target(this, i, result) }
+ final Expression getTarget() { swift_check_expression_def(this, _, result, _) }
/** Gets the node corresponding to the field `type`. */
- final AstNode getType(int i) { swift_check_expression_type(this, i, result) }
+ final Type getType() { swift_check_expression_def(this, _, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_check_expression_def(this, result, _) or
- swift_check_expression_target(this, _, result) or
- swift_check_expression_type(this, _, result)
+ swift_check_expression_def(this, _, result, _) or
+ swift_check_expression_def(this, _, _, result)
}
}
@@ -512,11 +492,11 @@ module Swift {
final override string getAPrimaryQlClass() { result = "ComparisonExpression" }
/** Gets the node corresponding to the field `lhs`. */
- final AstNode getLhs(int i) { swift_comparison_expression_lhs(this, i, result) }
+ final Expression getLhs() { swift_comparison_expression_def(this, result, _, _) }
/** Gets the node corresponding to the field `op`. */
final string getOp() {
- exists(int value | swift_comparison_expression_def(this, value) |
+ exists(int value | swift_comparison_expression_def(this, _, value, _) |
result = "<" and value = 0
or
result = "<=" and value = 1
@@ -528,12 +508,12 @@ module Swift {
}
/** Gets the node corresponding to the field `rhs`. */
- final AstNode getRhs(int i) { swift_comparison_expression_rhs(this, i, result) }
+ final Expression getRhs() { swift_comparison_expression_def(this, _, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_comparison_expression_lhs(this, _, result) or
- swift_comparison_expression_rhs(this, _, result)
+ swift_comparison_expression_def(this, result, _, _) or
+ swift_comparison_expression_def(this, _, _, result)
}
}
@@ -591,22 +571,22 @@ module Swift {
final override string getAPrimaryQlClass() { result = "ConjunctionExpression" }
/** Gets the node corresponding to the field `lhs`. */
- final AstNode getLhs(int i) { swift_conjunction_expression_lhs(this, i, result) }
+ final Expression getLhs() { swift_conjunction_expression_def(this, result, _, _) }
/** Gets the node corresponding to the field `op`. */
final string getOp() {
- exists(int value | swift_conjunction_expression_def(this, value) |
+ exists(int value | swift_conjunction_expression_def(this, _, value, _) |
(result = "&&" and value = 0)
)
}
/** Gets the node corresponding to the field `rhs`. */
- final AstNode getRhs(int i) { swift_conjunction_expression_rhs(this, i, result) }
+ final Expression getRhs() { swift_conjunction_expression_def(this, _, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_conjunction_expression_lhs(this, _, result) or
- swift_conjunction_expression_rhs(this, _, result)
+ swift_conjunction_expression_def(this, result, _, _) or
+ swift_conjunction_expression_def(this, _, _, result)
}
}
@@ -652,14 +632,14 @@ module Swift {
final override string getAPrimaryQlClass() { result = "ControlTransferStatement" }
/** Gets the node corresponding to the field `result`. */
- final AstNode getResult(int i) { swift_control_transfer_statement_result(this, i, result) }
+ final Expression getResult() { swift_control_transfer_statement_result(this, result) }
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_control_transfer_statement_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_control_transfer_statement_result(this, _, result) or
+ swift_control_transfer_statement_result(this, result) or
swift_control_transfer_statement_child(this, _, result)
}
}
@@ -723,10 +703,10 @@ module Swift {
final override string getAPrimaryQlClass() { result = "DictionaryLiteral" }
/** Gets the node corresponding to the field `key`. */
- final AstNode getKey(int i) { swift_dictionary_literal_key(this, i, result) }
+ final Expression getKey(int i) { swift_dictionary_literal_key(this, i, result) }
/** Gets the node corresponding to the field `value`. */
- final AstNode getValue(int i) { swift_dictionary_literal_value(this, i, result) }
+ final Expression getValue(int i) { swift_dictionary_literal_value(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
@@ -741,19 +721,14 @@ module Swift {
final override string getAPrimaryQlClass() { result = "DictionaryType" }
/** Gets the node corresponding to the field `key`. */
- final AstNode getKey(int i) { swift_dictionary_type_key(this, i, result) }
-
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName(int i) { swift_dictionary_type_name(this, i, result) }
+ final Type getKey() { swift_dictionary_type_def(this, result, _) }
/** Gets the node corresponding to the field `value`. */
- final AstNode getValue(int i) { swift_dictionary_type_value(this, i, result) }
+ final Type getValue() { swift_dictionary_type_def(this, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_dictionary_type_key(this, _, result) or
- swift_dictionary_type_name(this, _, result) or
- swift_dictionary_type_value(this, _, result)
+ swift_dictionary_type_def(this, result, _) or swift_dictionary_type_def(this, _, result)
}
}
@@ -787,11 +762,11 @@ module Swift {
final override string getAPrimaryQlClass() { result = "DirectlyAssignableExpression" }
/** Gets the child of this node. */
- final AstNode getChild() { swift_directly_assignable_expression_child(this, result) }
+ final Expression getChild() { swift_directly_assignable_expression_def(this, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_directly_assignable_expression_child(this, result)
+ swift_directly_assignable_expression_def(this, result)
}
}
@@ -801,22 +776,22 @@ module Swift {
final override string getAPrimaryQlClass() { result = "DisjunctionExpression" }
/** Gets the node corresponding to the field `lhs`. */
- final AstNode getLhs(int i) { swift_disjunction_expression_lhs(this, i, result) }
+ final Expression getLhs() { swift_disjunction_expression_def(this, result, _, _) }
/** Gets the node corresponding to the field `op`. */
final string getOp() {
- exists(int value | swift_disjunction_expression_def(this, value) |
+ exists(int value | swift_disjunction_expression_def(this, _, value, _) |
(result = "||" and value = 0)
)
}
/** Gets the node corresponding to the field `rhs`. */
- final AstNode getRhs(int i) { swift_disjunction_expression_rhs(this, i, result) }
+ final Expression getRhs() { swift_disjunction_expression_def(this, _, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_disjunction_expression_lhs(this, _, result) or
- swift_disjunction_expression_rhs(this, _, result)
+ swift_disjunction_expression_def(this, result, _, _) or
+ swift_disjunction_expression_def(this, _, _, result)
}
}
@@ -864,7 +839,7 @@ module Swift {
final SimpleIdentifier getName(int i) { swift_enum_entry_name(this, i, result) }
/** Gets the node corresponding to the field `raw_value`. */
- final AstNode getRawValue(int i) { swift_enum_entry_raw_value(this, i, result) }
+ final Expression getRawValue(int i) { swift_enum_entry_raw_value(this, i, result) }
/** Gets the child of this node. */
final Modifiers getChild() { swift_enum_entry_child(this, result) }
@@ -883,17 +858,11 @@ module Swift {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "EnumTypeParameters" }
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName(int i) { swift_enum_type_parameters_name(this, i, result) }
-
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_enum_type_parameters_child(this, i, result) }
/** Gets a field or child node of this node. */
- final override AstNode getAFieldOrChild() {
- swift_enum_type_parameters_name(this, _, result) or
- swift_enum_type_parameters_child(this, _, result)
- }
+ final override AstNode getAFieldOrChild() { swift_enum_type_parameters_child(this, _, result) }
}
/** A class representing `equality_constraint` nodes. */
@@ -902,24 +871,18 @@ module Swift {
final override string getAPrimaryQlClass() { result = "EqualityConstraint" }
/** Gets the node corresponding to the field `constrained_type`. */
- final AstNode getConstrainedType(int i) {
- swift_equality_constraint_constrained_type(this, i, result)
- }
+ final AstNode getConstrainedType() { swift_equality_constraint_def(this, result, _) }
/** Gets the node corresponding to the field `must_equal`. */
- final AstNode getMustEqual(int i) { swift_equality_constraint_must_equal(this, i, result) }
-
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName() { swift_equality_constraint_def(this, result) }
+ final Type getMustEqual() { swift_equality_constraint_def(this, _, result) }
/** Gets the `i`th child of this node. */
final Attribute getChild(int i) { swift_equality_constraint_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_equality_constraint_constrained_type(this, _, result) or
- swift_equality_constraint_must_equal(this, _, result) or
- swift_equality_constraint_def(this, result) or
+ swift_equality_constraint_def(this, result, _) or
+ swift_equality_constraint_def(this, _, result) or
swift_equality_constraint_child(this, _, result)
}
}
@@ -930,11 +893,11 @@ module Swift {
final override string getAPrimaryQlClass() { result = "EqualityExpression" }
/** Gets the node corresponding to the field `lhs`. */
- final AstNode getLhs(int i) { swift_equality_expression_lhs(this, i, result) }
+ final Expression getLhs() { swift_equality_expression_def(this, result, _, _) }
/** Gets the node corresponding to the field `op`. */
final string getOp() {
- exists(int value | swift_equality_expression_def(this, value) |
+ exists(int value | swift_equality_expression_def(this, _, value, _) |
result = "!=" and value = 0
or
result = "!==" and value = 1
@@ -946,12 +909,12 @@ module Swift {
}
/** Gets the node corresponding to the field `rhs`. */
- final AstNode getRhs(int i) { swift_equality_expression_rhs(this, i, result) }
+ final Expression getRhs() { swift_equality_expression_def(this, _, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_equality_expression_lhs(this, _, result) or
- swift_equality_expression_rhs(this, _, result)
+ swift_equality_expression_def(this, result, _, _) or
+ swift_equality_expression_def(this, _, _, result)
}
}
@@ -961,12 +924,14 @@ module Swift {
final override string getAPrimaryQlClass() { result = "ExistentialType" }
/** Gets the child of this node. */
- final AstNode getChild() { swift_existential_type_def(this, result) }
+ final UnannotatedType getChild() { swift_existential_type_def(this, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() { swift_existential_type_def(this, result) }
}
+ class Expression extends @swift_expression, AstNode { }
+
/** A class representing `external_macro_definition` nodes. */
class ExternalMacroDefinition extends @swift_external_macro_definition, AstNode {
/** Gets the name of the primary QL class for this element. */
@@ -985,18 +950,18 @@ module Swift {
final override string getAPrimaryQlClass() { result = "ForStatement" }
/** Gets the node corresponding to the field `collection`. */
- final AstNode getCollection(int i) { swift_for_statement_collection(this, i, result) }
+ final Expression getCollection() { swift_for_statement_def(this, result, _) }
/** Gets the node corresponding to the field `item`. */
- final Pattern getItem() { swift_for_statement_def(this, result) }
+ final Pattern getItem() { swift_for_statement_def(this, _, result) }
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_for_statement_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_for_statement_collection(this, _, result) or
- swift_for_statement_def(this, result) or
+ swift_for_statement_def(this, result, _) or
+ swift_for_statement_def(this, _, result) or
swift_for_statement_child(this, _, result)
}
}
@@ -1025,28 +990,28 @@ module Swift {
final override string getAPrimaryQlClass() { result = "FunctionDeclaration" }
/** Gets the node corresponding to the field `body`. */
- final FunctionBody getBody() { swift_function_declaration_def(this, result) }
+ final FunctionBody getBody() { swift_function_declaration_def(this, result, _) }
/** Gets the node corresponding to the field `default_value`. */
- final AstNode getDefaultValue(int i) {
+ final Expression getDefaultValue(int i) {
swift_function_declaration_default_value(this, i, result)
}
/** Gets the node corresponding to the field `name`. */
- final AstNode getName(int i) { swift_function_declaration_name(this, i, result) }
+ final AstNode getName() { swift_function_declaration_def(this, _, result) }
/** Gets the node corresponding to the field `return_type`. */
- final AstNode getReturnType(int i) { swift_function_declaration_return_type(this, i, result) }
+ final AstNode getReturnType() { swift_function_declaration_return_type(this, result) }
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_function_declaration_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_function_declaration_def(this, result) or
+ swift_function_declaration_def(this, result, _) or
swift_function_declaration_default_value(this, _, result) or
- swift_function_declaration_name(this, _, result) or
- swift_function_declaration_return_type(this, _, result) or
+ swift_function_declaration_def(this, _, result) or
+ swift_function_declaration_return_type(this, result) or
swift_function_declaration_child(this, _, result)
}
}
@@ -1062,14 +1027,11 @@ module Swift {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "FunctionType" }
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName() { swift_function_type_def(this, result, _) }
-
/** Gets the node corresponding to the field `params`. */
- final AstNode getParams() { swift_function_type_def(this, _, result) }
+ final UnannotatedType getParams() { swift_function_type_def(this, result, _) }
/** Gets the node corresponding to the field `return_type`. */
- final AstNode getReturnType(int i) { swift_function_type_return_type(this, i, result) }
+ final Type getReturnType() { swift_function_type_def(this, _, result) }
/** Gets the child of this node. */
final AstNode getChild() { swift_function_type_child(this, result) }
@@ -1078,7 +1040,6 @@ module Swift {
final override AstNode getAFieldOrChild() {
swift_function_type_def(this, result, _) or
swift_function_type_def(this, _, result) or
- swift_function_type_return_type(this, _, result) or
swift_function_type_child(this, result)
}
}
@@ -1095,30 +1056,22 @@ module Swift {
final override AstNode getAFieldOrChild() { swift_getter_specifier_child(this, _, result) }
}
+ class GlobalDeclaration extends @swift_global_declaration, AstNode { }
+
/** A class representing `guard_statement` nodes. */
class GuardStatement extends @swift_guard_statement, AstNode {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "GuardStatement" }
- /** Gets the node corresponding to the field `bound_identifier`. */
- final SimpleIdentifier getBoundIdentifier(int i) {
- swift_guard_statement_bound_identifier(this, i, result)
- }
-
/** Gets the node corresponding to the field `condition`. */
- final AstNode getCondition(int i) { swift_guard_statement_condition(this, i, result) }
-
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName(int i) { swift_guard_statement_name(this, i, result) }
+ final IfCondition getCondition(int i) { swift_guard_statement_condition(this, i, result) }
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_guard_statement_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_guard_statement_bound_identifier(this, _, result) or
swift_guard_statement_condition(this, _, result) or
- swift_guard_statement_name(this, _, result) or
swift_guard_statement_child(this, _, result)
}
}
@@ -1141,34 +1094,67 @@ module Swift {
final override AstNode getAFieldOrChild() { swift_identifier_child(this, _, result) }
}
- /** A class representing `if_statement` nodes. */
- class IfStatement extends @swift_if_statement, AstNode {
+ /** A class representing `if_condition` nodes. */
+ class IfCondition extends @swift_if_condition, AstNode {
/** Gets the name of the primary QL class for this element. */
- final override string getAPrimaryQlClass() { result = "IfStatement" }
+ final override string getAPrimaryQlClass() { result = "IfCondition" }
+
+ /** Gets the child of this node. */
+ final AstNode getChild() { swift_if_condition_def(this, result) }
+
+ /** Gets a field or child node of this node. */
+ final override AstNode getAFieldOrChild() { swift_if_condition_def(this, result) }
+ }
+
+ /** A class representing `if_let_binding` nodes. */
+ class IfLetBinding extends @swift_if_let_binding, AstNode {
+ /** Gets the name of the primary QL class for this element. */
+ final override string getAPrimaryQlClass() { result = "IfLetBinding" }
/** Gets the node corresponding to the field `bound_identifier`. */
- final SimpleIdentifier getBoundIdentifier(int i) {
- swift_if_statement_bound_identifier(this, i, result)
+ final SimpleIdentifier getBoundIdentifier() {
+ swift_if_let_binding_bound_identifier(this, result)
}
- /** Gets the node corresponding to the field `condition`. */
- final AstNode getCondition(int i) { swift_if_statement_condition(this, i, result) }
+ /** Gets the `i`th child of this node. */
+ final AstNode getChild(int i) { swift_if_let_binding_child(this, i, result) }
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName(int i) { swift_if_statement_name(this, i, result) }
+ /** Gets a field or child node of this node. */
+ final override AstNode getAFieldOrChild() {
+ swift_if_let_binding_bound_identifier(this, result) or
+ swift_if_let_binding_child(this, _, result)
+ }
+ }
+
+ /** A class representing `if_statement` nodes. */
+ class IfStatement extends @swift_if_statement, AstNode {
+ /** Gets the name of the primary QL class for this element. */
+ final override string getAPrimaryQlClass() { result = "IfStatement" }
+
+ /** Gets the node corresponding to the field `condition`. */
+ final IfCondition getCondition(int i) { swift_if_statement_condition(this, i, result) }
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_if_statement_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_if_statement_bound_identifier(this, _, result) or
- swift_if_statement_condition(this, _, result) or
- swift_if_statement_name(this, _, result) or
- swift_if_statement_child(this, _, result)
+ swift_if_statement_condition(this, _, result) or swift_if_statement_child(this, _, result)
}
}
+ /** A class representing `implicitly_unwrapped_type` nodes. */
+ class ImplicitlyUnwrappedType extends @swift_implicitly_unwrapped_type, AstNode {
+ /** Gets the name of the primary QL class for this element. */
+ final override string getAPrimaryQlClass() { result = "ImplicitlyUnwrappedType" }
+
+ /** Gets the child of this node. */
+ final Type getChild() { swift_implicitly_unwrapped_type_def(this, result) }
+
+ /** Gets a field or child node of this node. */
+ final override AstNode getAFieldOrChild() { swift_implicitly_unwrapped_type_def(this, result) }
+ }
+
/** A class representing `import_declaration` nodes. */
class ImportDeclaration extends @swift_import_declaration, AstNode {
/** Gets the name of the primary QL class for this element. */
@@ -1187,19 +1173,19 @@ module Swift {
final override string getAPrimaryQlClass() { result = "InfixExpression" }
/** Gets the node corresponding to the field `lhs`. */
- final AstNode getLhs(int i) { swift_infix_expression_lhs(this, i, result) }
+ final Expression getLhs() { swift_infix_expression_def(this, result, _, _) }
/** Gets the node corresponding to the field `op`. */
- final CustomOperator getOp() { swift_infix_expression_def(this, result) }
+ final CustomOperator getOp() { swift_infix_expression_def(this, _, result, _) }
/** Gets the node corresponding to the field `rhs`. */
- final AstNode getRhs(int i) { swift_infix_expression_rhs(this, i, result) }
+ final Expression getRhs() { swift_infix_expression_def(this, _, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_infix_expression_lhs(this, _, result) or
- swift_infix_expression_def(this, result) or
- swift_infix_expression_rhs(this, _, result)
+ swift_infix_expression_def(this, result, _, _) or
+ swift_infix_expression_def(this, _, result, _) or
+ swift_infix_expression_def(this, _, _, result)
}
}
@@ -1209,26 +1195,18 @@ module Swift {
final override string getAPrimaryQlClass() { result = "InheritanceConstraint" }
/** Gets the node corresponding to the field `constrained_type`. */
- final AstNode getConstrainedType(int i) {
- swift_inheritance_constraint_constrained_type(this, i, result)
- }
+ final AstNode getConstrainedType() { swift_inheritance_constraint_def(this, result, _) }
/** Gets the node corresponding to the field `inherits_from`. */
- final AstNode getInheritsFrom(int i) {
- swift_inheritance_constraint_inherits_from(this, i, result)
- }
-
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName() { swift_inheritance_constraint_def(this, result) }
+ final AstNode getInheritsFrom() { swift_inheritance_constraint_def(this, _, result) }
/** Gets the `i`th child of this node. */
final Attribute getChild(int i) { swift_inheritance_constraint_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_inheritance_constraint_constrained_type(this, _, result) or
- swift_inheritance_constraint_inherits_from(this, _, result) or
- swift_inheritance_constraint_def(this, result) or
+ swift_inheritance_constraint_def(this, result, _) or
+ swift_inheritance_constraint_def(this, _, result) or
swift_inheritance_constraint_child(this, _, result)
}
}
@@ -1260,7 +1238,9 @@ module Swift {
final FunctionBody getBody() { swift_init_declaration_body(this, result) }
/** Gets the node corresponding to the field `default_value`. */
- final AstNode getDefaultValue(int i) { swift_init_declaration_default_value(this, i, result) }
+ final Expression getDefaultValue(int i) {
+ swift_init_declaration_default_value(this, i, result)
+ }
/** Gets the node corresponding to the field `name`. */
final string getName() {
@@ -1298,7 +1278,7 @@ module Swift {
}
/** Gets the node corresponding to the field `value`. */
- final AstNode getValue(int i) { swift_interpolated_expression_value(this, i, result) }
+ final Expression getValue() { swift_interpolated_expression_value(this, result) }
/** Gets the child of this node. */
final TypeModifiers getChild() { swift_interpolated_expression_child(this, result) }
@@ -1307,7 +1287,7 @@ module Swift {
final override AstNode getAFieldOrChild() {
swift_interpolated_expression_name(this, result) or
swift_interpolated_expression_reference_specifier(this, _, result) or
- swift_interpolated_expression_value(this, _, result) or
+ swift_interpolated_expression_value(this, result) or
swift_interpolated_expression_child(this, result)
}
}
@@ -1330,12 +1310,10 @@ module Swift {
final override string getAPrimaryQlClass() { result = "KeyPathStringExpression" }
/** Gets the child of this node. */
- final AstNode getChild() { swift_key_path_string_expression_child(this, result) }
+ final Expression getChild() { swift_key_path_string_expression_def(this, result) }
/** Gets a field or child node of this node. */
- final override AstNode getAFieldOrChild() {
- swift_key_path_string_expression_child(this, result)
- }
+ final override AstNode getAFieldOrChild() { swift_key_path_string_expression_def(this, result) }
}
/** A class representing `lambda_function_type` nodes. */
@@ -1343,19 +1321,15 @@ module Swift {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "LambdaFunctionType" }
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName() { swift_lambda_function_type_name(this, result) }
-
/** Gets the node corresponding to the field `return_type`. */
- final AstNode getReturnType(int i) { swift_lambda_function_type_return_type(this, i, result) }
+ final AstNode getReturnType() { swift_lambda_function_type_return_type(this, result) }
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_lambda_function_type_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_lambda_function_type_name(this, result) or
- swift_lambda_function_type_return_type(this, _, result) or
+ swift_lambda_function_type_return_type(this, result) or
swift_lambda_function_type_child(this, _, result)
}
}
@@ -1407,10 +1381,10 @@ module Swift {
final SimpleIdentifier getExternalName() { swift_lambda_parameter_external_name(this, result) }
/** Gets the node corresponding to the field `name`. */
- final AstNode getName(int i) { swift_lambda_parameter_name(this, i, result) }
+ final SimpleIdentifier getName() { swift_lambda_parameter_name(this, result) }
/** Gets the node corresponding to the field `type`. */
- final AstNode getType(int i) { swift_lambda_parameter_type(this, i, result) }
+ final AstNode getType() { swift_lambda_parameter_type(this, result) }
/** Gets the child of this node. */
final AstNode getChild() { swift_lambda_parameter_child(this, result) }
@@ -1418,8 +1392,8 @@ module Swift {
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
swift_lambda_parameter_external_name(this, result) or
- swift_lambda_parameter_name(this, _, result) or
- swift_lambda_parameter_type(this, _, result) or
+ swift_lambda_parameter_name(this, result) or
+ swift_lambda_parameter_type(this, result) or
swift_lambda_parameter_child(this, result)
}
}
@@ -1450,13 +1424,17 @@ module Swift {
}
}
+ class LocalDeclaration extends @swift_local_declaration, AstNode { }
+
/** A class representing `macro_declaration` nodes. */
class MacroDeclaration extends @swift_macro_declaration, AstNode {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "MacroDeclaration" }
/** Gets the node corresponding to the field `default_value`. */
- final AstNode getDefaultValue(int i) { swift_macro_declaration_default_value(this, i, result) }
+ final Expression getDefaultValue(int i) {
+ swift_macro_declaration_default_value(this, i, result)
+ }
/** Gets the node corresponding to the field `definition`. */
final MacroDefinition getDefinition() { swift_macro_declaration_definition(this, result) }
@@ -1478,10 +1456,10 @@ module Swift {
final override string getAPrimaryQlClass() { result = "MacroDefinition" }
/** Gets the node corresponding to the field `body`. */
- final AstNode getBody(int i) { swift_macro_definition_body(this, i, result) }
+ final AstNode getBody() { swift_macro_definition_def(this, result) }
/** Gets a field or child node of this node. */
- final override AstNode getAFieldOrChild() { swift_macro_definition_body(this, _, result) }
+ final override AstNode getAFieldOrChild() { swift_macro_definition_def(this, result) }
}
/** A class representing `macro_invocation` nodes. */
@@ -1508,7 +1486,7 @@ module Swift {
final override string getAPrimaryQlClass() { result = "Metatype" }
/** Gets the child of this node. */
- final AstNode getChild() { swift_metatype_def(this, result) }
+ final UnannotatedType getChild() { swift_metatype_def(this, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() { swift_metatype_def(this, result) }
@@ -1576,11 +1554,11 @@ module Swift {
final override string getAPrimaryQlClass() { result = "MultiplicativeExpression" }
/** Gets the node corresponding to the field `lhs`. */
- final AstNode getLhs(int i) { swift_multiplicative_expression_lhs(this, i, result) }
+ final Expression getLhs() { swift_multiplicative_expression_def(this, result, _, _) }
/** Gets the node corresponding to the field `op`. */
final string getOp() {
- exists(int value | swift_multiplicative_expression_def(this, value) |
+ exists(int value | swift_multiplicative_expression_def(this, _, value, _) |
result = "%" and value = 0
or
result = "*" and value = 1
@@ -1590,12 +1568,12 @@ module Swift {
}
/** Gets the node corresponding to the field `rhs`. */
- final AstNode getRhs(int i) { swift_multiplicative_expression_rhs(this, i, result) }
+ final Expression getRhs() { swift_multiplicative_expression_def(this, _, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_multiplicative_expression_lhs(this, _, result) or
- swift_multiplicative_expression_rhs(this, _, result)
+ swift_multiplicative_expression_def(this, result, _, _) or
+ swift_multiplicative_expression_def(this, _, _, result)
}
}
@@ -1610,9 +1588,6 @@ module Swift {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "NavigationExpression" }
- /** Gets the node corresponding to the field `element`. */
- final AstNode getElement() { swift_navigation_expression_element(this, result) }
-
/** Gets the node corresponding to the field `suffix`. */
final NavigationSuffix getSuffix() { swift_navigation_expression_def(this, result) }
@@ -1621,7 +1596,6 @@ module Swift {
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_navigation_expression_element(this, result) or
swift_navigation_expression_def(this, result) or
swift_navigation_expression_target(this, _, result)
}
@@ -1639,21 +1613,35 @@ module Swift {
final override AstNode getAFieldOrChild() { swift_navigation_suffix_def(this, result) }
}
+ /** A class representing `nested_type_identifier` nodes. */
+ class NestedTypeIdentifier extends @swift_nested_type_identifier, AstNode {
+ /** Gets the name of the primary QL class for this element. */
+ final override string getAPrimaryQlClass() { result = "NestedTypeIdentifier" }
+
+ /** Gets the `i`th child of this node. */
+ final AstNode getChild(int i) { swift_nested_type_identifier_child(this, i, result) }
+
+ /** Gets a field or child node of this node. */
+ final override AstNode getAFieldOrChild() {
+ swift_nested_type_identifier_child(this, _, result)
+ }
+ }
+
/** A class representing `nil_coalescing_expression` nodes. */
class NilCoalescingExpression extends @swift_nil_coalescing_expression, AstNode {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "NilCoalescingExpression" }
/** Gets the node corresponding to the field `if_nil`. */
- final AstNode getIfNil(int i) { swift_nil_coalescing_expression_if_nil(this, i, result) }
+ final Expression getIfNil() { swift_nil_coalescing_expression_def(this, result, _) }
/** Gets the node corresponding to the field `value`. */
- final AstNode getValue(int i) { swift_nil_coalescing_expression_value(this, i, result) }
+ final Expression getValue() { swift_nil_coalescing_expression_def(this, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_nil_coalescing_expression_if_nil(this, _, result) or
- swift_nil_coalescing_expression_value(this, _, result)
+ swift_nil_coalescing_expression_def(this, result, _) or
+ swift_nil_coalescing_expression_def(this, _, result)
}
}
@@ -1669,7 +1657,7 @@ module Swift {
final override string getAPrimaryQlClass() { result = "OpaqueType" }
/** Gets the child of this node. */
- final AstNode getChild() { swift_opaque_type_def(this, result) }
+ final UnannotatedType getChild() { swift_opaque_type_def(this, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() { swift_opaque_type_def(this, result) }
@@ -1681,12 +1669,10 @@ module Swift {
final override string getAPrimaryQlClass() { result = "OpenEndRangeExpression" }
/** Gets the node corresponding to the field `start`. */
- final AstNode getStart(int i) { swift_open_end_range_expression_start(this, i, result) }
+ final Expression getStart() { swift_open_end_range_expression_def(this, result) }
/** Gets a field or child node of this node. */
- final override AstNode getAFieldOrChild() {
- swift_open_end_range_expression_start(this, _, result)
- }
+ final override AstNode getAFieldOrChild() { swift_open_end_range_expression_def(this, result) }
}
/** A class representing `open_start_range_expression` nodes. */
@@ -1695,11 +1681,11 @@ module Swift {
final override string getAPrimaryQlClass() { result = "OpenStartRangeExpression" }
/** Gets the node corresponding to the field `end`. */
- final AstNode getEnd(int i) { swift_open_start_range_expression_end(this, i, result) }
+ final Expression getEnd() { swift_open_start_range_expression_def(this, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_open_start_range_expression_end(this, _, result)
+ swift_open_start_range_expression_def(this, result)
}
}
@@ -1715,6 +1701,18 @@ module Swift {
final override AstNode getAFieldOrChild() { swift_operator_declaration_child(this, _, result) }
}
+ /** A class representing `optional_chain_marker` nodes. */
+ class OptionalChainMarker extends @swift_optional_chain_marker, AstNode {
+ /** Gets the name of the primary QL class for this element. */
+ final override string getAPrimaryQlClass() { result = "OptionalChainMarker" }
+
+ /** Gets the child of this node. */
+ final Expression getChild() { swift_optional_chain_marker_def(this, result) }
+
+ /** Gets a field or child node of this node. */
+ final override AstNode getAFieldOrChild() { swift_optional_chain_marker_def(this, result) }
+ }
+
/** A class representing `optional_type` nodes. */
class OptionalType extends @swift_optional_type, AstNode {
/** Gets the name of the primary QL class for this element. */
@@ -1742,10 +1740,10 @@ module Swift {
final SimpleIdentifier getExternalName() { swift_parameter_external_name(this, result) }
/** Gets the node corresponding to the field `name`. */
- final AstNode getName(int i) { swift_parameter_name(this, i, result) }
+ final SimpleIdentifier getName() { swift_parameter_def(this, result, _) }
/** Gets the node corresponding to the field `type`. */
- final AstNode getType(int i) { swift_parameter_type(this, i, result) }
+ final AstNode getType() { swift_parameter_def(this, _, result) }
/** Gets the child of this node. */
final ParameterModifiers getChild() { swift_parameter_child(this, result) }
@@ -1753,8 +1751,8 @@ module Swift {
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
swift_parameter_external_name(this, result) or
- swift_parameter_name(this, _, result) or
- swift_parameter_type(this, _, result) or
+ swift_parameter_def(this, result, _) or
+ swift_parameter_def(this, _, result) or
swift_parameter_child(this, result)
}
}
@@ -1785,17 +1783,12 @@ module Swift {
/** Gets the node corresponding to the field `bound_identifier`. */
final SimpleIdentifier getBoundIdentifier() { swift_pattern_bound_identifier(this, result) }
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName() { swift_pattern_name(this, result) }
-
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_pattern_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_pattern_bound_identifier(this, result) or
- swift_pattern_name(this, result) or
- swift_pattern_child(this, _, result)
+ swift_pattern_bound_identifier(this, result) or swift_pattern_child(this, _, result)
}
}
@@ -1805,7 +1798,7 @@ module Swift {
final override string getAPrimaryQlClass() { result = "PlaygroundLiteral" }
/** Gets the `i`th child of this node. */
- final AstNode getChild(int i) { swift_playground_literal_child(this, i, result) }
+ final Expression getChild(int i) { swift_playground_literal_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() { swift_playground_literal_child(this, _, result) }
@@ -1817,14 +1810,14 @@ module Swift {
final override string getAPrimaryQlClass() { result = "PostfixExpression" }
/** Gets the node corresponding to the field `operation`. */
- final AstNode getOperation() { swift_postfix_expression_def(this, result) }
+ final AstNode getOperation() { swift_postfix_expression_def(this, result, _) }
/** Gets the node corresponding to the field `target`. */
- final AstNode getTarget(int i) { swift_postfix_expression_target(this, i, result) }
+ final Expression getTarget() { swift_postfix_expression_def(this, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_postfix_expression_def(this, result) or swift_postfix_expression_target(this, _, result)
+ swift_postfix_expression_def(this, result, _) or swift_postfix_expression_def(this, _, result)
}
}
@@ -1878,14 +1871,14 @@ module Swift {
final override string getAPrimaryQlClass() { result = "PrefixExpression" }
/** Gets the node corresponding to the field `operation`. */
- final AstNode getOperation() { swift_prefix_expression_def(this, result) }
+ final AstNode getOperation() { swift_prefix_expression_def(this, result, _) }
/** Gets the node corresponding to the field `target`. */
- final AstNode getTarget(int i) { swift_prefix_expression_target(this, i, result) }
+ final Expression getTarget() { swift_prefix_expression_def(this, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_prefix_expression_def(this, result) or swift_prefix_expression_target(this, _, result)
+ swift_prefix_expression_def(this, result, _) or swift_prefix_expression_def(this, _, result)
}
}
@@ -1909,7 +1902,7 @@ module Swift {
final Pattern getName(int i) { swift_property_declaration_name(this, i, result) }
/** Gets the node corresponding to the field `value`. */
- final AstNode getValue(int i) { swift_property_declaration_value(this, i, result) }
+ final Expression getValue(int i) { swift_property_declaration_value(this, i, result) }
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_property_declaration_child(this, i, result) }
@@ -1934,16 +1927,11 @@ module Swift {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "ProtocolBody" }
- /** Gets the node corresponding to the field `body`. */
- final ProtocolFunctionDeclaration getBody(int i) { swift_protocol_body_body(this, i, result) }
-
/** Gets the `i`th child of this node. */
- final AstNode getChild(int i) { swift_protocol_body_child(this, i, result) }
+ final ProtocolMemberDeclaration getChild(int i) { swift_protocol_body_child(this, i, result) }
/** Gets a field or child node of this node. */
- final override AstNode getAFieldOrChild() {
- swift_protocol_body_body(this, _, result) or swift_protocol_body_child(this, _, result)
- }
+ final override AstNode getAFieldOrChild() { swift_protocol_body_child(this, _, result) }
}
/** A class representing `protocol_composition_type` nodes. */
@@ -1952,7 +1940,7 @@ module Swift {
final override string getAPrimaryQlClass() { result = "ProtocolCompositionType" }
/** Gets the `i`th child of this node. */
- final AstNode getChild(int i) { swift_protocol_composition_type_child(this, i, result) }
+ final UnannotatedType getChild(int i) { swift_protocol_composition_type_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
@@ -1994,31 +1982,35 @@ module Swift {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "ProtocolFunctionDeclaration" }
+ /** Gets the node corresponding to the field `body`. */
+ final FunctionBody getBody() { swift_protocol_function_declaration_body(this, result) }
+
/** Gets the node corresponding to the field `default_value`. */
- final AstNode getDefaultValue(int i) {
+ final Expression getDefaultValue(int i) {
swift_protocol_function_declaration_default_value(this, i, result)
}
/** Gets the node corresponding to the field `name`. */
- final AstNode getName(int i) { swift_protocol_function_declaration_name(this, i, result) }
+ final AstNode getName() { swift_protocol_function_declaration_def(this, result) }
/** Gets the node corresponding to the field `return_type`. */
- final AstNode getReturnType(int i) {
- swift_protocol_function_declaration_return_type(this, i, result)
- }
+ final AstNode getReturnType() { swift_protocol_function_declaration_return_type(this, result) }
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_protocol_function_declaration_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
+ swift_protocol_function_declaration_body(this, result) or
swift_protocol_function_declaration_default_value(this, _, result) or
- swift_protocol_function_declaration_name(this, _, result) or
- swift_protocol_function_declaration_return_type(this, _, result) or
+ swift_protocol_function_declaration_def(this, result) or
+ swift_protocol_function_declaration_return_type(this, result) or
swift_protocol_function_declaration_child(this, _, result)
}
}
+ class ProtocolMemberDeclaration extends @swift_protocol_member_declaration, AstNode { }
+
/** A class representing `protocol_property_declaration` nodes. */
class ProtocolPropertyDeclaration extends @swift_protocol_property_declaration, AstNode {
/** Gets the name of the primary QL class for this element. */
@@ -2057,11 +2049,11 @@ module Swift {
final override string getAPrimaryQlClass() { result = "RangeExpression" }
/** Gets the node corresponding to the field `end`. */
- final AstNode getEnd(int i) { swift_range_expression_end(this, i, result) }
+ final Expression getEnd() { swift_range_expression_def(this, result, _, _) }
/** Gets the node corresponding to the field `op`. */
final string getOp() {
- exists(int value | swift_range_expression_def(this, value) |
+ exists(int value | swift_range_expression_def(this, _, value, _) |
result = "..." and value = 0
or
result = "..<" and value = 1
@@ -2069,11 +2061,12 @@ module Swift {
}
/** Gets the node corresponding to the field `start`. */
- final AstNode getStart(int i) { swift_range_expression_start(this, i, result) }
+ final Expression getStart() { swift_range_expression_def(this, _, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_range_expression_end(this, _, result) or swift_range_expression_start(this, _, result)
+ swift_range_expression_def(this, result, _, _) or
+ swift_range_expression_def(this, _, _, result)
}
}
@@ -2153,6 +2146,18 @@ module Swift {
final override string getAPrimaryQlClass() { result = "RealLiteral" }
}
+ /** A class representing `referenceable_operator` nodes. */
+ class ReferenceableOperator extends @swift_referenceable_operator, AstNode {
+ /** Gets the name of the primary QL class for this element. */
+ final override string getAPrimaryQlClass() { result = "ReferenceableOperator" }
+
+ /** Gets the child of this node. */
+ final AstNode getChild() { swift_referenceable_operator_child(this, result) }
+
+ /** Gets a field or child node of this node. */
+ final override AstNode getAFieldOrChild() { swift_referenceable_operator_child(this, result) }
+ }
+
/** A class representing `regex_literal` tokens. */
class RegexLiteral extends @swift_token_regex_literal, Token {
/** Gets the name of the primary QL class for this element. */
@@ -2164,25 +2169,17 @@ module Swift {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "RepeatWhileStatement" }
- /** Gets the node corresponding to the field `bound_identifier`. */
- final SimpleIdentifier getBoundIdentifier(int i) {
- swift_repeat_while_statement_bound_identifier(this, i, result)
- }
-
/** Gets the node corresponding to the field `condition`. */
- final AstNode getCondition(int i) { swift_repeat_while_statement_condition(this, i, result) }
-
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName(int i) { swift_repeat_while_statement_name(this, i, result) }
+ final IfCondition getCondition(int i) {
+ swift_repeat_while_statement_condition(this, i, result)
+ }
/** Gets the child of this node. */
final Statements getChild() { swift_repeat_while_statement_child(this, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_repeat_while_statement_bound_identifier(this, _, result) or
swift_repeat_while_statement_condition(this, _, result) or
- swift_repeat_while_statement_name(this, _, result) or
swift_repeat_while_statement_child(this, result)
}
}
@@ -2193,10 +2190,10 @@ module Swift {
final override string getAPrimaryQlClass() { result = "SelectorExpression" }
/** Gets the child of this node. */
- final AstNode getChild() { swift_selector_expression_child(this, result) }
+ final Expression getChild() { swift_selector_expression_def(this, result) }
/** Gets a field or child node of this node. */
- final override AstNode getAFieldOrChild() { swift_selector_expression_child(this, result) }
+ final override AstNode getAFieldOrChild() { swift_selector_expression_def(this, result) }
}
/** A class representing `self_expression` tokens. */
@@ -2277,15 +2274,12 @@ module Swift {
final override string getAPrimaryQlClass() { result = "SubscriptDeclaration" }
/** Gets the node corresponding to the field `default_value`. */
- final AstNode getDefaultValue(int i) {
+ final Expression getDefaultValue(int i) {
swift_subscript_declaration_default_value(this, i, result)
}
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName() { swift_subscript_declaration_name(this, result) }
-
/** Gets the node corresponding to the field `return_type`. */
- final AstNode getReturnType(int i) { swift_subscript_declaration_return_type(this, i, result) }
+ final AstNode getReturnType() { swift_subscript_declaration_return_type(this, result) }
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_subscript_declaration_child(this, i, result) }
@@ -2293,8 +2287,7 @@ module Swift {
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
swift_subscript_declaration_default_value(this, _, result) or
- swift_subscript_declaration_name(this, result) or
- swift_subscript_declaration_return_type(this, _, result) or
+ swift_subscript_declaration_return_type(this, result) or
swift_subscript_declaration_child(this, _, result)
}
}
@@ -2347,14 +2340,14 @@ module Swift {
final override string getAPrimaryQlClass() { result = "SwitchStatement" }
/** Gets the node corresponding to the field `expr`. */
- final AstNode getExpr(int i) { swift_switch_statement_expr(this, i, result) }
+ final Expression getExpr() { swift_switch_statement_def(this, result) }
/** Gets the `i`th child of this node. */
final SwitchEntry getChild(int i) { swift_switch_statement_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_switch_statement_expr(this, _, result) or swift_switch_statement_child(this, _, result)
+ swift_switch_statement_def(this, result) or swift_switch_statement_child(this, _, result)
}
}
@@ -2364,19 +2357,19 @@ module Swift {
final override string getAPrimaryQlClass() { result = "TernaryExpression" }
/** Gets the node corresponding to the field `condition`. */
- final AstNode getCondition(int i) { swift_ternary_expression_condition(this, i, result) }
+ final Expression getCondition() { swift_ternary_expression_def(this, result, _, _) }
/** Gets the node corresponding to the field `if_false`. */
- final AstNode getIfFalse(int i) { swift_ternary_expression_if_false(this, i, result) }
+ final Expression getIfFalse() { swift_ternary_expression_def(this, _, result, _) }
/** Gets the node corresponding to the field `if_true`. */
- final AstNode getIfTrue(int i) { swift_ternary_expression_if_true(this, i, result) }
+ final Expression getIfTrue() { swift_ternary_expression_def(this, _, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_ternary_expression_condition(this, _, result) or
- swift_ternary_expression_if_false(this, _, result) or
- swift_ternary_expression_if_true(this, _, result)
+ swift_ternary_expression_def(this, result, _, _) or
+ swift_ternary_expression_def(this, _, result, _) or
+ swift_ternary_expression_def(this, _, _, result)
}
}
@@ -2398,7 +2391,7 @@ module Swift {
final override string getAPrimaryQlClass() { result = "ThrowsClause" }
/** Gets the node corresponding to the field `type`. */
- final AstNode getType() { swift_throws_clause_def(this, result) }
+ final UnannotatedType getType() { swift_throws_clause_def(this, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() { swift_throws_clause_def(this, result) }
@@ -2410,14 +2403,14 @@ module Swift {
final override string getAPrimaryQlClass() { result = "TryExpression" }
/** Gets the node corresponding to the field `expr`. */
- final AstNode getExpr(int i) { swift_try_expression_expr(this, i, result) }
+ final Expression getExpr() { swift_try_expression_def(this, result, _) }
/** Gets the child of this node. */
- final TryOperator getChild() { swift_try_expression_def(this, result) }
+ final TryOperator getChild() { swift_try_expression_def(this, _, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_try_expression_expr(this, _, result) or swift_try_expression_def(this, result)
+ swift_try_expression_def(this, result, _) or swift_try_expression_def(this, _, result)
}
}
@@ -2436,7 +2429,7 @@ module Swift {
final SimpleIdentifier getName(int i) { swift_tuple_expression_name(this, i, result) }
/** Gets the node corresponding to the field `value`. */
- final AstNode getValue(int i) { swift_tuple_expression_value(this, i, result) }
+ final Expression getValue(int i) { swift_tuple_expression_value(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
@@ -2466,42 +2459,50 @@ module Swift {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TupleTypeItem" }
- /** Gets the node corresponding to the field `element`. */
- final AstNode getElement() { swift_tuple_type_item_element(this, result) }
-
/** Gets the node corresponding to the field `name`. */
- final AstNode getName(int i) { swift_tuple_type_item_name(this, i, result) }
+ final SimpleIdentifier getName() { swift_tuple_type_item_name(this, result) }
/** Gets the node corresponding to the field `type`. */
- final AstNode getType(int i) { swift_tuple_type_item_type(this, i, result) }
+ final Type getType() { swift_tuple_type_item_type(this, result) }
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_tuple_type_item_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_tuple_type_item_element(this, result) or
- swift_tuple_type_item_name(this, _, result) or
- swift_tuple_type_item_type(this, _, result) or
+ swift_tuple_type_item_name(this, result) or
+ swift_tuple_type_item_type(this, result) or
swift_tuple_type_item_child(this, _, result)
}
}
+ /** A class representing `type` nodes. */
+ class Type extends @swift_type__, AstNode {
+ /** Gets the name of the primary QL class for this element. */
+ final override string getAPrimaryQlClass() { result = "Type" }
+
+ /** Gets the node corresponding to the field `modifiers`. */
+ final TypeModifiers getModifiers() { swift_type_modifiers(this, result) }
+
+ /** Gets the node corresponding to the field `name`. */
+ final UnannotatedType getName() { swift_type_def(this, result) }
+
+ /** Gets a field or child node of this node. */
+ final override AstNode getAFieldOrChild() {
+ swift_type_modifiers(this, result) or swift_type_def(this, result)
+ }
+ }
+
/** A class representing `type_annotation` nodes. */
class TypeAnnotation extends @swift_type_annotation, AstNode {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TypeAnnotation" }
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName() { swift_type_annotation_def(this, result) }
-
/** Gets the node corresponding to the field `type`. */
- final AstNode getType(int i) { swift_type_annotation_type(this, i, result) }
+ final AstNode getType() { swift_type_annotation_def(this, result) }
/** Gets a field or child node of this node. */
- final override AstNode getAFieldOrChild() {
- swift_type_annotation_def(this, result) or swift_type_annotation_type(this, _, result)
- }
+ final override AstNode getAFieldOrChild() { swift_type_annotation_def(this, result) }
}
/** A class representing `type_arguments` nodes. */
@@ -2509,16 +2510,11 @@ module Swift {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TypeArguments" }
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName(int i) { swift_type_arguments_name(this, i, result) }
-
/** Gets the `i`th child of this node. */
- final TypeModifiers getChild(int i) { swift_type_arguments_child(this, i, result) }
+ final Type getChild(int i) { swift_type_arguments_child(this, i, result) }
/** Gets a field or child node of this node. */
- final override AstNode getAFieldOrChild() {
- swift_type_arguments_name(this, _, result) or swift_type_arguments_child(this, _, result)
- }
+ final override AstNode getAFieldOrChild() { swift_type_arguments_child(this, _, result) }
}
/** A class representing `type_constraint` nodes. */
@@ -2551,6 +2547,8 @@ module Swift {
final override string getAPrimaryQlClass() { result = "TypeIdentifier" }
}
+ class TypeLevelDeclaration extends @swift_type_level_declaration, AstNode { }
+
/** A class representing `type_modifiers` nodes. */
class TypeModifiers extends @swift_type_modifiers, AstNode {
/** Gets the name of the primary QL class for this element. */
@@ -2569,7 +2567,7 @@ module Swift {
final override string getAPrimaryQlClass() { result = "TypePackExpansion" }
/** Gets the child of this node. */
- final AstNode getChild() { swift_type_pack_expansion_def(this, result) }
+ final UnannotatedType getChild() { swift_type_pack_expansion_def(this, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() { swift_type_pack_expansion_def(this, result) }
@@ -2580,16 +2578,11 @@ module Swift {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TypeParameter" }
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName() { swift_type_parameter_name(this, result) }
-
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_type_parameter_child(this, i, result) }
/** Gets a field or child node of this node. */
- final override AstNode getAFieldOrChild() {
- swift_type_parameter_name(this, result) or swift_type_parameter_child(this, _, result)
- }
+ final override AstNode getAFieldOrChild() { swift_type_parameter_child(this, _, result) }
}
/** A class representing `type_parameter_modifiers` nodes. */
@@ -2612,7 +2605,7 @@ module Swift {
final override string getAPrimaryQlClass() { result = "TypeParameterPack" }
/** Gets the child of this node. */
- final AstNode getChild() { swift_type_parameter_pack_def(this, result) }
+ final UnannotatedType getChild() { swift_type_parameter_pack_def(this, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() { swift_type_parameter_pack_def(this, result) }
@@ -2636,22 +2629,24 @@ module Swift {
final override string getAPrimaryQlClass() { result = "TypealiasDeclaration" }
/** Gets the node corresponding to the field `name`. */
- final AstNode getName(int i) { swift_typealias_declaration_name(this, i, result) }
+ final TypeIdentifier getName() { swift_typealias_declaration_def(this, result, _) }
/** Gets the node corresponding to the field `value`. */
- final AstNode getValue(int i) { swift_typealias_declaration_value(this, i, result) }
+ final Type getValue() { swift_typealias_declaration_def(this, _, result) }
/** Gets the `i`th child of this node. */
final AstNode getChild(int i) { swift_typealias_declaration_child(this, i, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_typealias_declaration_name(this, _, result) or
- swift_typealias_declaration_value(this, _, result) or
+ swift_typealias_declaration_def(this, result, _) or
+ swift_typealias_declaration_def(this, _, result) or
swift_typealias_declaration_child(this, _, result)
}
}
+ class UnannotatedType extends @swift_unannotated_type, AstNode { }
+
/** A class representing `user_type` nodes. */
class UserType extends @swift_user_type, AstNode {
/** Gets the name of the primary QL class for this element. */
@@ -2678,7 +2673,7 @@ module Swift {
}
/** Gets the node corresponding to the field `value`. */
- final AstNode getValue(int i) { swift_value_argument_value(this, i, result) }
+ final Expression getValue() { swift_value_argument_value(this, result) }
/** Gets the child of this node. */
final TypeModifiers getChild() { swift_value_argument_child(this, result) }
@@ -2687,7 +2682,7 @@ module Swift {
final override AstNode getAFieldOrChild() {
swift_value_argument_name(this, result) or
swift_value_argument_reference_specifier(this, _, result) or
- swift_value_argument_value(this, _, result) or
+ swift_value_argument_value(this, result) or
swift_value_argument_child(this, result)
}
}
@@ -2740,10 +2735,10 @@ module Swift {
final override string getAPrimaryQlClass() { result = "ValuePackExpansion" }
/** Gets the child of this node. */
- final AstNode getChild() { swift_value_pack_expansion_child(this, result) }
+ final Expression getChild() { swift_value_pack_expansion_def(this, result) }
/** Gets a field or child node of this node. */
- final override AstNode getAFieldOrChild() { swift_value_pack_expansion_child(this, result) }
+ final override AstNode getAFieldOrChild() { swift_value_pack_expansion_def(this, result) }
}
/** A class representing `value_parameter_pack` nodes. */
@@ -2752,10 +2747,10 @@ module Swift {
final override string getAPrimaryQlClass() { result = "ValueParameterPack" }
/** Gets the child of this node. */
- final AstNode getChild() { swift_value_parameter_pack_child(this, result) }
+ final Expression getChild() { swift_value_parameter_pack_def(this, result) }
/** Gets a field or child node of this node. */
- final override AstNode getAFieldOrChild() { swift_value_parameter_pack_child(this, result) }
+ final override AstNode getAFieldOrChild() { swift_value_parameter_pack_def(this, result) }
}
/** A class representing `visibility_modifier` tokens. */
@@ -2787,26 +2782,15 @@ module Swift {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "WhileStatement" }
- /** Gets the node corresponding to the field `bound_identifier`. */
- final SimpleIdentifier getBoundIdentifier(int i) {
- swift_while_statement_bound_identifier(this, i, result)
- }
-
/** Gets the node corresponding to the field `condition`. */
- final AstNode getCondition(int i) { swift_while_statement_condition(this, i, result) }
-
- /** Gets the node corresponding to the field `name`. */
- final AstNode getName(int i) { swift_while_statement_name(this, i, result) }
+ final IfCondition getCondition(int i) { swift_while_statement_condition(this, i, result) }
/** Gets the child of this node. */
final Statements getChild() { swift_while_statement_child(this, result) }
/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
- swift_while_statement_bound_identifier(this, _, result) or
- swift_while_statement_condition(this, _, result) or
- swift_while_statement_name(this, _, result) or
- swift_while_statement_child(this, result)
+ swift_while_statement_condition(this, _, result) or swift_while_statement_child(this, result)
}
}
diff --git a/unified/ql/lib/unified.dbscheme b/unified/ql/lib/unified.dbscheme
index c580e8e69271..b50bc56eaa2a 100644
--- a/unified/ql/lib/unified.dbscheme
+++ b/unified/ql/lib/unified.dbscheme
@@ -132,87 +132,39 @@ overlayChangedFiles(
);
/*- Swift dbscheme -*/
-@swift_additive_expression_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_additive_expression, index]
-swift_additive_expression_lhs(
- int swift_additive_expression: @swift_additive_expression ref,
- int index: int ref,
- unique int lhs: @swift_additive_expression_lhs_type ref
-);
-
case @swift_additive_expression.op of
0 = @swift_additive_expression_plus
| 1 = @swift_additive_expression_minus
;
-@swift_additive_expression_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_additive_expression, index]
-swift_additive_expression_rhs(
- int swift_additive_expression: @swift_additive_expression ref,
- int index: int ref,
- unique int rhs: @swift_additive_expression_rhs_type ref
-);
-
swift_additive_expression_def(
unique int id: @swift_additive_expression,
- int op: int ref
+ int lhs: @swift_expression ref,
+ int op: int ref,
+ int rhs: @swift_expression ref
);
-@swift_array_literal_element_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
#keyset[swift_array_literal, index]
swift_array_literal_element(
int swift_array_literal: @swift_array_literal ref,
int index: int ref,
- unique int element: @swift_array_literal_element_type ref
+ unique int element: @swift_expression ref
);
swift_array_literal_def(
unique int id: @swift_array_literal
);
-@swift_array_type_element_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_array_type, index]
-swift_array_type_element(
- int swift_array_type: @swift_array_type ref,
- int index: int ref,
- unique int element: @swift_array_type_element_type ref
-);
-
-@swift_array_type_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
swift_array_type_def(
unique int id: @swift_array_type,
- int name: @swift_array_type_name_type ref
-);
-
-@swift_as_expression_expr_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_as_expression, index]
-swift_as_expression_expr(
- int swift_as_expression: @swift_as_expression ref,
- int index: int ref,
- unique int expr: @swift_as_expression_expr_type ref
-);
-
-@swift_as_expression_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-@swift_as_expression_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_as_expression, index]
-swift_as_expression_type(
- int swift_as_expression: @swift_as_expression ref,
- int index: int ref,
- unique int type__: @swift_as_expression_type_type ref
+ int element: @swift_type__ ref
);
swift_as_expression_def(
unique int id: @swift_as_expression,
- int name: @swift_as_expression_name_type ref,
+ int expr: @swift_expression ref,
+ int type__: @swift_type__ ref,
int child: @swift_token_as_operator ref
);
@@ -226,46 +178,21 @@ case @swift_assignment.operator of
;
-@swift_assignment_result_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_assignment, index]
-swift_assignment_result(
- int swift_assignment: @swift_assignment ref,
- int index: int ref,
- unique int result: @swift_assignment_result_type ref
-);
-
swift_assignment_def(
unique int id: @swift_assignment,
int operator: int ref,
+ int result: @swift_expression ref,
int target: @swift_directly_assignable_expression ref
);
-@swift_associatedtype_declaration_default_value_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_associatedtype_declaration, index]
swift_associatedtype_declaration_default_value(
- int swift_associatedtype_declaration: @swift_associatedtype_declaration ref,
- int index: int ref,
- unique int default_value: @swift_associatedtype_declaration_default_value_type ref
+ unique int swift_associatedtype_declaration: @swift_associatedtype_declaration ref,
+ unique int default_value: @swift_type__ ref
);
-@swift_associatedtype_declaration_must_inherit_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_associatedtype_declaration, index]
swift_associatedtype_declaration_must_inherit(
- int swift_associatedtype_declaration: @swift_associatedtype_declaration ref,
- int index: int ref,
- unique int must_inherit: @swift_associatedtype_declaration_must_inherit_type ref
-);
-
-@swift_associatedtype_declaration_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_token_type_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_associatedtype_declaration, index]
-swift_associatedtype_declaration_name(
- int swift_associatedtype_declaration: @swift_associatedtype_declaration ref,
- int index: int ref,
- unique int name: @swift_associatedtype_declaration_name_type ref
+ unique int swift_associatedtype_declaration: @swift_associatedtype_declaration ref,
+ unique int must_inherit: @swift_type__ ref
);
@swift_associatedtype_declaration_child_type = @swift_modifiers | @swift_type_constraints
@@ -278,10 +205,11 @@ swift_associatedtype_declaration_child(
);
swift_associatedtype_declaration_def(
- unique int id: @swift_associatedtype_declaration
+ unique int id: @swift_associatedtype_declaration,
+ int name: @swift_token_type_identifier ref
);
-@swift_attribute_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_user_type | @swift_value_pack_expansion | @swift_value_parameter_pack
+@swift_attribute_child_type = @swift_expression | @swift_user_type
#keyset[swift_attribute, index]
swift_attribute_child(
@@ -307,35 +235,20 @@ swift_availability_condition_def(
unique int id: @swift_availability_condition
);
-@swift_await_expression_expr_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_await_expression, index]
swift_await_expression_expr(
- int swift_await_expression: @swift_await_expression ref,
- int index: int ref,
- unique int expr: @swift_await_expression_expr_type ref
+ unique int swift_await_expression: @swift_await_expression ref,
+ unique int expr: @swift_expression ref
);
-@swift_await_expression_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
swift_await_expression_child(
unique int swift_await_expression: @swift_await_expression ref,
- unique int child: @swift_await_expression_child_type ref
+ unique int child: @swift_expression ref
);
swift_await_expression_def(
unique int id: @swift_await_expression
);
-@swift_bitwise_operation_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_bitwise_operation, index]
-swift_bitwise_operation_lhs(
- int swift_bitwise_operation: @swift_bitwise_operation ref,
- int index: int ref,
- unique int lhs: @swift_bitwise_operation_lhs_type ref
-);
-
case @swift_bitwise_operation.op of
0 = @swift_bitwise_operation_ampersand
| 1 = @swift_bitwise_operation_langlelangle
@@ -345,21 +258,14 @@ case @swift_bitwise_operation.op of
;
-@swift_bitwise_operation_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_bitwise_operation, index]
-swift_bitwise_operation_rhs(
- int swift_bitwise_operation: @swift_bitwise_operation ref,
- int index: int ref,
- unique int rhs: @swift_bitwise_operation_rhs_type ref
-);
-
swift_bitwise_operation_def(
unique int id: @swift_bitwise_operation,
- int op: int ref
+ int lhs: @swift_expression ref,
+ int op: int ref,
+ int rhs: @swift_expression ref
);
-@swift_call_expression_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_call_suffix | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
+@swift_call_expression_child_type = @swift_call_suffix | @swift_expression
#keyset[swift_call_expression, index]
swift_call_expression_child(
@@ -405,13 +311,9 @@ swift_capture_list_def(
@swift_capture_list_item_name_type = @swift_token_self_expression | @swift_token_simple_identifier
-@swift_capture_list_item_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_capture_list_item, index]
swift_capture_list_item_value(
- int swift_capture_list_item: @swift_capture_list_item ref,
- int index: int ref,
- unique int value: @swift_capture_list_item_value_type ref
+ unique int swift_capture_list_item: @swift_capture_list_item ref,
+ unique int value: @swift_expression ref
);
swift_capture_list_item_child(
@@ -442,38 +344,19 @@ swift_catch_block_def(
unique int id: @swift_catch_block
);
-@swift_check_expression_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
case @swift_check_expression.op of
0 = @swift_check_expression_is
;
-@swift_check_expression_target_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_check_expression, index]
-swift_check_expression_target(
- int swift_check_expression: @swift_check_expression ref,
- int index: int ref,
- unique int target: @swift_check_expression_target_type ref
-);
-
-@swift_check_expression_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_check_expression, index]
-swift_check_expression_type(
- int swift_check_expression: @swift_check_expression ref,
- int index: int ref,
- unique int type__: @swift_check_expression_type_type ref
-);
-
swift_check_expression_def(
unique int id: @swift_check_expression,
- int name: @swift_check_expression_name_type ref,
- int op: int ref
+ int op: int ref,
+ int target: @swift_expression ref,
+ int type__: @swift_type__ ref
);
-@swift_class_body_child_type = @swift_associatedtype_declaration | @swift_class_declaration | @swift_deinit_declaration | @swift_function_declaration | @swift_import_declaration | @swift_init_declaration | @swift_operator_declaration | @swift_precedence_group_declaration | @swift_property_declaration | @swift_protocol_declaration | @swift_subscript_declaration | @swift_token_multiline_comment | @swift_typealias_declaration
+@swift_class_body_child_type = @swift_token_multiline_comment | @swift_type_level_declaration
#keyset[swift_class_body, index]
swift_class_body_child(
@@ -497,7 +380,7 @@ case @swift_class_declaration.declaration_kind of
;
-@swift_class_declaration_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_token_type_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
+@swift_class_declaration_name_type = @swift_token_type_identifier | @swift_unannotated_type
@swift_class_declaration_child_type = @swift_attribute | @swift_inheritance_specifier | @swift_modifiers | @swift_token_inheritance_modifier | @swift_token_ownership_modifier | @swift_token_property_behavior_modifier | @swift_type_constraints | @swift_type_parameters
@@ -515,15 +398,6 @@ swift_class_declaration_def(
int name: @swift_class_declaration_name_type ref
);
-@swift_comparison_expression_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_comparison_expression, index]
-swift_comparison_expression_lhs(
- int swift_comparison_expression: @swift_comparison_expression ref,
- int index: int ref,
- unique int lhs: @swift_comparison_expression_lhs_type ref
-);
-
case @swift_comparison_expression.op of
0 = @swift_comparison_expression_langle
| 1 = @swift_comparison_expression_langleequal
@@ -532,18 +406,11 @@ case @swift_comparison_expression.op of
;
-@swift_comparison_expression_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_comparison_expression, index]
-swift_comparison_expression_rhs(
- int swift_comparison_expression: @swift_comparison_expression ref,
- int index: int ref,
- unique int rhs: @swift_comparison_expression_rhs_type ref
-);
-
swift_comparison_expression_def(
unique int id: @swift_comparison_expression,
- int op: int ref
+ int lhs: @swift_expression ref,
+ int op: int ref,
+ int rhs: @swift_expression ref
);
@swift_computed_getter_child_type = @swift_attribute | @swift_getter_specifier | @swift_statements
@@ -598,32 +465,16 @@ swift_computed_setter_def(
unique int id: @swift_computed_setter
);
-@swift_conjunction_expression_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_conjunction_expression, index]
-swift_conjunction_expression_lhs(
- int swift_conjunction_expression: @swift_conjunction_expression ref,
- int index: int ref,
- unique int lhs: @swift_conjunction_expression_lhs_type ref
-);
-
case @swift_conjunction_expression.op of
0 = @swift_conjunction_expression_ampersandampersand
;
-@swift_conjunction_expression_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_conjunction_expression, index]
-swift_conjunction_expression_rhs(
- int swift_conjunction_expression: @swift_conjunction_expression ref,
- int index: int ref,
- unique int rhs: @swift_conjunction_expression_rhs_type ref
-);
-
swift_conjunction_expression_def(
unique int id: @swift_conjunction_expression,
- int op: int ref
+ int lhs: @swift_expression ref,
+ int op: int ref,
+ int rhs: @swift_expression ref
);
@swift_constructor_expression_constructed_type_type = @swift_array_type | @swift_dictionary_type | @swift_user_type
@@ -654,16 +505,12 @@ swift_constructor_suffix_def(
unique int id: @swift_constructor_suffix
);
-@swift_control_transfer_statement_result_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_control_transfer_statement, index]
swift_control_transfer_statement_result(
- int swift_control_transfer_statement: @swift_control_transfer_statement ref,
- int index: int ref,
- unique int result: @swift_control_transfer_statement_result_type ref
+ unique int swift_control_transfer_statement: @swift_control_transfer_statement ref,
+ unique int result: @swift_expression ref
);
-@swift_control_transfer_statement_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_throw_keyword | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
+@swift_control_transfer_statement_child_type = @swift_expression | @swift_token_throw_keyword
#keyset[swift_control_transfer_statement, index]
swift_control_transfer_statement_child(
@@ -699,57 +546,28 @@ swift_deprecated_operator_declaration_body_def(
unique int id: @swift_deprecated_operator_declaration_body
);
-@swift_dictionary_literal_key_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
#keyset[swift_dictionary_literal, index]
swift_dictionary_literal_key(
int swift_dictionary_literal: @swift_dictionary_literal ref,
int index: int ref,
- unique int key__: @swift_dictionary_literal_key_type ref
+ unique int key__: @swift_expression ref
);
-@swift_dictionary_literal_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
#keyset[swift_dictionary_literal, index]
swift_dictionary_literal_value(
int swift_dictionary_literal: @swift_dictionary_literal ref,
int index: int ref,
- unique int value: @swift_dictionary_literal_value_type ref
+ unique int value: @swift_expression ref
);
swift_dictionary_literal_def(
unique int id: @swift_dictionary_literal
);
-@swift_dictionary_type_key_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_dictionary_type, index]
-swift_dictionary_type_key(
- int swift_dictionary_type: @swift_dictionary_type ref,
- int index: int ref,
- unique int key__: @swift_dictionary_type_key_type ref
-);
-
-@swift_dictionary_type_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_dictionary_type, index]
-swift_dictionary_type_name(
- int swift_dictionary_type: @swift_dictionary_type ref,
- int index: int ref,
- unique int name: @swift_dictionary_type_name_type ref
-);
-
-@swift_dictionary_type_value_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_dictionary_type, index]
-swift_dictionary_type_value(
- int swift_dictionary_type: @swift_dictionary_type ref,
- int index: int ref,
- unique int value: @swift_dictionary_type_value_type ref
-);
-
swift_dictionary_type_def(
- unique int id: @swift_dictionary_type
+ unique int id: @swift_dictionary_type,
+ int key__: @swift_type__ ref,
+ int value: @swift_type__ ref
);
@swift_didset_clause_child_type = @swift_modifiers | @swift_statements | @swift_token_simple_identifier
@@ -778,24 +596,9 @@ swift_directive_def(
unique int id: @swift_directive
);
-@swift_directly_assignable_expression_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-swift_directly_assignable_expression_child(
- unique int swift_directly_assignable_expression: @swift_directly_assignable_expression ref,
- unique int child: @swift_directly_assignable_expression_child_type ref
-);
-
swift_directly_assignable_expression_def(
- unique int id: @swift_directly_assignable_expression
-);
-
-@swift_disjunction_expression_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_disjunction_expression, index]
-swift_disjunction_expression_lhs(
- int swift_disjunction_expression: @swift_disjunction_expression ref,
- int index: int ref,
- unique int lhs: @swift_disjunction_expression_lhs_type ref
+ unique int id: @swift_directly_assignable_expression,
+ int child: @swift_expression ref
);
case @swift_disjunction_expression.op of
@@ -803,18 +606,11 @@ case @swift_disjunction_expression.op of
;
-@swift_disjunction_expression_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_disjunction_expression, index]
-swift_disjunction_expression_rhs(
- int swift_disjunction_expression: @swift_disjunction_expression ref,
- int index: int ref,
- unique int rhs: @swift_disjunction_expression_rhs_type ref
-);
-
swift_disjunction_expression_def(
unique int id: @swift_disjunction_expression,
- int op: int ref
+ int lhs: @swift_expression ref,
+ int op: int ref,
+ int rhs: @swift_expression ref
);
@swift_do_statement_child_type = @swift_catch_block | @swift_statements
@@ -830,7 +626,7 @@ swift_do_statement_def(
unique int id: @swift_do_statement
);
-@swift_enum_class_body_child_type = @swift_associatedtype_declaration | @swift_class_declaration | @swift_deinit_declaration | @swift_enum_entry | @swift_function_declaration | @swift_import_declaration | @swift_init_declaration | @swift_operator_declaration | @swift_precedence_group_declaration | @swift_property_declaration | @swift_protocol_declaration | @swift_subscript_declaration | @swift_typealias_declaration
+@swift_enum_class_body_child_type = @swift_enum_entry | @swift_type_level_declaration
#keyset[swift_enum_class_body, index]
swift_enum_class_body_child(
@@ -857,13 +653,11 @@ swift_enum_entry_name(
unique int name: @swift_token_simple_identifier ref
);
-@swift_enum_entry_raw_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
#keyset[swift_enum_entry, index]
swift_enum_entry_raw_value(
int swift_enum_entry: @swift_enum_entry ref,
int index: int ref,
- unique int raw_value: @swift_enum_entry_raw_value_type ref
+ unique int raw_value: @swift_expression ref
);
swift_enum_entry_child(
@@ -875,16 +669,7 @@ swift_enum_entry_def(
unique int id: @swift_enum_entry
);
-@swift_enum_type_parameters_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_enum_type_parameters, index]
-swift_enum_type_parameters_name(
- int swift_enum_type_parameters: @swift_enum_type_parameters ref,
- int index: int ref,
- unique int name: @swift_enum_type_parameters_name_type ref
-);
-
-@swift_enum_type_parameters_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_wildcard_pattern | @swift_try_expression | @swift_tuple_expression | @swift_type_modifiers | @swift_value_pack_expansion | @swift_value_parameter_pack
+@swift_enum_type_parameters_child_type = @swift_expression | @swift_token_wildcard_pattern | @swift_type__
#keyset[swift_enum_type_parameters, index]
swift_enum_type_parameters_child(
@@ -897,25 +682,7 @@ swift_enum_type_parameters_def(
unique int id: @swift_enum_type_parameters
);
-@swift_equality_constraint_constrained_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_identifier | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_equality_constraint, index]
-swift_equality_constraint_constrained_type(
- int swift_equality_constraint: @swift_equality_constraint ref,
- int index: int ref,
- unique int constrained_type: @swift_equality_constraint_constrained_type_type ref
-);
-
-@swift_equality_constraint_must_equal_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_equality_constraint, index]
-swift_equality_constraint_must_equal(
- int swift_equality_constraint: @swift_equality_constraint ref,
- int index: int ref,
- unique int must_equal: @swift_equality_constraint_must_equal_type ref
-);
-
-@swift_equality_constraint_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
+@swift_equality_constraint_constrained_type_type = @swift_identifier | @swift_nested_type_identifier
#keyset[swift_equality_constraint, index]
swift_equality_constraint_child(
@@ -926,16 +693,8 @@ swift_equality_constraint_child(
swift_equality_constraint_def(
unique int id: @swift_equality_constraint,
- int name: @swift_equality_constraint_name_type ref
-);
-
-@swift_equality_expression_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_equality_expression, index]
-swift_equality_expression_lhs(
- int swift_equality_expression: @swift_equality_expression ref,
- int index: int ref,
- unique int lhs: @swift_equality_expression_lhs_type ref
+ int constrained_type: @swift_equality_constraint_constrained_type_type ref,
+ int must_equal: @swift_type__ ref
);
case @swift_equality_expression.op of
@@ -946,41 +705,25 @@ case @swift_equality_expression.op of
;
-@swift_equality_expression_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_equality_expression, index]
-swift_equality_expression_rhs(
- int swift_equality_expression: @swift_equality_expression ref,
- int index: int ref,
- unique int rhs: @swift_equality_expression_rhs_type ref
-);
-
swift_equality_expression_def(
unique int id: @swift_equality_expression,
- int op: int ref
+ int lhs: @swift_expression ref,
+ int op: int ref,
+ int rhs: @swift_expression ref
);
-@swift_existential_type_child_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
swift_existential_type_def(
unique int id: @swift_existential_type,
- int child: @swift_existential_type_child_type ref
+ int child: @swift_unannotated_type ref
);
+@swift_expression = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_optional_chain_marker | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_referenceable_operator | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
+
swift_external_macro_definition_def(
unique int id: @swift_external_macro_definition,
int child: @swift_value_arguments ref
);
-@swift_for_statement_collection_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_for_statement, index]
-swift_for_statement_collection(
- int swift_for_statement: @swift_for_statement ref,
- int index: int ref,
- unique int collection: @swift_for_statement_collection_type ref
-);
-
@swift_for_statement_child_type = @swift_statements | @swift_token_try_operator | @swift_type_annotation | @swift_where_clause
#keyset[swift_for_statement, index]
@@ -992,6 +735,7 @@ swift_for_statement_child(
swift_for_statement_def(
unique int id: @swift_for_statement,
+ int collection: @swift_expression ref,
int item: @swift_pattern ref
);
@@ -1004,30 +748,19 @@ swift_function_body_def(
unique int id: @swift_function_body
);
-@swift_function_declaration_default_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
#keyset[swift_function_declaration, index]
swift_function_declaration_default_value(
int swift_function_declaration: @swift_function_declaration ref,
int index: int ref,
- unique int default_value: @swift_function_declaration_default_value_type ref
+ unique int default_value: @swift_expression ref
);
-@swift_function_declaration_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_token_bang | @swift_token_custom_operator | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
+@swift_function_declaration_name_type = @swift_referenceable_operator | @swift_token_simple_identifier
-#keyset[swift_function_declaration, index]
-swift_function_declaration_name(
- int swift_function_declaration: @swift_function_declaration ref,
- int index: int ref,
- unique int name: @swift_function_declaration_name_type ref
-);
-
-@swift_function_declaration_return_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
+@swift_function_declaration_return_type_type = @swift_implicitly_unwrapped_type | @swift_type__
-#keyset[swift_function_declaration, index]
swift_function_declaration_return_type(
- int swift_function_declaration: @swift_function_declaration ref,
- int index: int ref,
+ unique int swift_function_declaration: @swift_function_declaration ref,
unique int return_type: @swift_function_declaration_return_type_type ref
);
@@ -1042,20 +775,8 @@ swift_function_declaration_child(
swift_function_declaration_def(
unique int id: @swift_function_declaration,
- int body: @swift_function_body ref
-);
-
-@swift_function_type_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-@swift_function_type_params_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-@swift_function_type_return_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_function_type, index]
-swift_function_type_return_type(
- int swift_function_type: @swift_function_type ref,
- int index: int ref,
- unique int return_type: @swift_function_type_return_type_type ref
+ int body: @swift_function_body ref,
+ int name: @swift_function_declaration_name_type ref
);
@swift_function_type_child_type = @swift_throws_clause | @swift_token_throws
@@ -1067,8 +788,8 @@ swift_function_type_child(
swift_function_type_def(
unique int id: @swift_function_type,
- int name: @swift_function_type_name_type ref,
- int params: @swift_function_type_params_type ref
+ int params: @swift_unannotated_type ref,
+ int return_type: @swift_type__ ref
);
@swift_getter_specifier_child_type = @swift_throws_clause | @swift_token_mutation_modifier | @swift_token_throws
@@ -1084,29 +805,13 @@ swift_getter_specifier_def(
unique int id: @swift_getter_specifier
);
-#keyset[swift_guard_statement, index]
-swift_guard_statement_bound_identifier(
- int swift_guard_statement: @swift_guard_statement ref,
- int index: int ref,
- unique int bound_identifier: @swift_token_simple_identifier ref
-);
-
-@swift_guard_statement_condition_type = @swift_additive_expression | @swift_array_literal | @swift_array_type | @swift_as_expression | @swift_assignment | @swift_availability_condition | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_dictionary_type | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_existential_type | @swift_function_type | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_metatype | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_opaque_type | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_optional_type | @swift_pattern | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_protocol_composition_type | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_suppressed_constraint | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_wildcard_pattern | @swift_try_expression | @swift_tuple_expression | @swift_tuple_type | @swift_type_annotation | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type | @swift_value_binding_pattern | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_where_clause
+@swift_global_declaration = @swift_associatedtype_declaration | @swift_class_declaration | @swift_function_declaration | @swift_import_declaration | @swift_init_declaration | @swift_macro_declaration | @swift_operator_declaration | @swift_precedence_group_declaration | @swift_property_declaration | @swift_protocol_declaration | @swift_typealias_declaration
#keyset[swift_guard_statement, index]
swift_guard_statement_condition(
int swift_guard_statement: @swift_guard_statement ref,
int index: int ref,
- unique int condition: @swift_guard_statement_condition_type ref
-);
-
-@swift_guard_statement_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_guard_statement, index]
-swift_guard_statement_name(
- int swift_guard_statement: @swift_guard_statement ref,
- int index: int ref,
- unique int name: @swift_guard_statement_name_type ref
+ unique int condition: @swift_if_condition ref
);
@swift_guard_statement_child_type = @swift_statements | @swift_token_else
@@ -1133,29 +838,36 @@ swift_identifier_def(
unique int id: @swift_identifier
);
-#keyset[swift_if_statement, index]
-swift_if_statement_bound_identifier(
- int swift_if_statement: @swift_if_statement ref,
- int index: int ref,
+@swift_if_condition_child_type = @swift_availability_condition | @swift_expression | @swift_if_let_binding
+
+swift_if_condition_def(
+ unique int id: @swift_if_condition,
+ int child: @swift_if_condition_child_type ref
+);
+
+swift_if_let_binding_bound_identifier(
+ unique int swift_if_let_binding: @swift_if_let_binding ref,
unique int bound_identifier: @swift_token_simple_identifier ref
);
-@swift_if_statement_condition_type = @swift_additive_expression | @swift_array_literal | @swift_array_type | @swift_as_expression | @swift_assignment | @swift_availability_condition | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_dictionary_type | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_existential_type | @swift_function_type | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_metatype | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_opaque_type | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_optional_type | @swift_pattern | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_protocol_composition_type | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_suppressed_constraint | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_wildcard_pattern | @swift_try_expression | @swift_tuple_expression | @swift_tuple_type | @swift_type_annotation | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type | @swift_value_binding_pattern | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_where_clause
+@swift_if_let_binding_child_type = @swift_expression | @swift_pattern | @swift_token_wildcard_pattern | @swift_type__ | @swift_type_annotation | @swift_user_type | @swift_value_binding_pattern | @swift_where_clause
-#keyset[swift_if_statement, index]
-swift_if_statement_condition(
- int swift_if_statement: @swift_if_statement ref,
+#keyset[swift_if_let_binding, index]
+swift_if_let_binding_child(
+ int swift_if_let_binding: @swift_if_let_binding ref,
int index: int ref,
- unique int condition: @swift_if_statement_condition_type ref
+ unique int child: @swift_if_let_binding_child_type ref
);
-@swift_if_statement_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
+swift_if_let_binding_def(
+ unique int id: @swift_if_let_binding
+);
#keyset[swift_if_statement, index]
-swift_if_statement_name(
+swift_if_statement_condition(
int swift_if_statement: @swift_if_statement ref,
int index: int ref,
- unique int name: @swift_if_statement_name_type ref
+ unique int condition: @swift_if_condition ref
);
@swift_if_statement_child_type = @swift_if_statement | @swift_statements | @swift_token_else
@@ -1171,6 +883,11 @@ swift_if_statement_def(
unique int id: @swift_if_statement
);
+swift_implicitly_unwrapped_type_def(
+ unique int id: @swift_implicitly_unwrapped_type,
+ int child: @swift_type__ ref
+);
+
@swift_import_declaration_child_type = @swift_identifier | @swift_modifiers
#keyset[swift_import_declaration, index]
@@ -1184,48 +901,16 @@ swift_import_declaration_def(
unique int id: @swift_import_declaration
);
-@swift_infix_expression_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_infix_expression, index]
-swift_infix_expression_lhs(
- int swift_infix_expression: @swift_infix_expression ref,
- int index: int ref,
- unique int lhs: @swift_infix_expression_lhs_type ref
-);
-
-@swift_infix_expression_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_infix_expression, index]
-swift_infix_expression_rhs(
- int swift_infix_expression: @swift_infix_expression ref,
- int index: int ref,
- unique int rhs: @swift_infix_expression_rhs_type ref
-);
-
swift_infix_expression_def(
unique int id: @swift_infix_expression,
- int op: @swift_token_custom_operator ref
-);
-
-@swift_inheritance_constraint_constrained_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_identifier | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_inheritance_constraint, index]
-swift_inheritance_constraint_constrained_type(
- int swift_inheritance_constraint: @swift_inheritance_constraint ref,
- int index: int ref,
- unique int constrained_type: @swift_inheritance_constraint_constrained_type_type ref
+ int lhs: @swift_expression ref,
+ int op: @swift_token_custom_operator ref,
+ int rhs: @swift_expression ref
);
-@swift_inheritance_constraint_inherits_from_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
+@swift_inheritance_constraint_constrained_type_type = @swift_identifier | @swift_nested_type_identifier
-#keyset[swift_inheritance_constraint, index]
-swift_inheritance_constraint_inherits_from(
- int swift_inheritance_constraint: @swift_inheritance_constraint ref,
- int index: int ref,
- unique int inherits_from: @swift_inheritance_constraint_inherits_from_type ref
-);
-
-@swift_inheritance_constraint_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
+@swift_inheritance_constraint_inherits_from_type = @swift_implicitly_unwrapped_type | @swift_type__
#keyset[swift_inheritance_constraint, index]
swift_inheritance_constraint_child(
@@ -1236,7 +921,8 @@ swift_inheritance_constraint_child(
swift_inheritance_constraint_def(
unique int id: @swift_inheritance_constraint,
- int name: @swift_inheritance_constraint_name_type ref
+ int constrained_type: @swift_inheritance_constraint_constrained_type_type ref,
+ int inherits_from: @swift_inheritance_constraint_inherits_from_type ref
);
@swift_inheritance_specifier_inherits_from_type = @swift_function_type | @swift_suppressed_constraint | @swift_user_type
@@ -1251,13 +937,11 @@ swift_init_declaration_body(
unique int body: @swift_function_body ref
);
-@swift_init_declaration_default_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
#keyset[swift_init_declaration, index]
swift_init_declaration_default_value(
int swift_init_declaration: @swift_init_declaration ref,
int index: int ref,
- unique int default_value: @swift_init_declaration_default_value_type ref
+ unique int default_value: @swift_expression ref
);
case @swift_init_declaration.name of
@@ -1291,13 +975,9 @@ swift_interpolated_expression_reference_specifier(
unique int reference_specifier: @swift_value_argument_label ref
);
-@swift_interpolated_expression_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_interpolated_expression, index]
swift_interpolated_expression_value(
- int swift_interpolated_expression: @swift_interpolated_expression ref,
- int index: int ref,
- unique int value: @swift_interpolated_expression_value_type ref
+ unique int swift_interpolated_expression: @swift_interpolated_expression ref,
+ unique int value: @swift_expression ref
);
swift_interpolated_expression_child(
@@ -1322,30 +1002,15 @@ swift_key_path_expression_def(
unique int id: @swift_key_path_expression
);
-@swift_key_path_string_expression_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-swift_key_path_string_expression_child(
- unique int swift_key_path_string_expression: @swift_key_path_string_expression ref,
- unique int child: @swift_key_path_string_expression_child_type ref
-);
-
swift_key_path_string_expression_def(
- unique int id: @swift_key_path_string_expression
-);
-
-@swift_lambda_function_type_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-swift_lambda_function_type_name(
- unique int swift_lambda_function_type: @swift_lambda_function_type ref,
- unique int name: @swift_lambda_function_type_name_type ref
+ unique int id: @swift_key_path_string_expression,
+ int child: @swift_expression ref
);
-@swift_lambda_function_type_return_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
+@swift_lambda_function_type_return_type_type = @swift_implicitly_unwrapped_type | @swift_type__
-#keyset[swift_lambda_function_type, index]
swift_lambda_function_type_return_type(
- int swift_lambda_function_type: @swift_lambda_function_type ref,
- int index: int ref,
+ unique int swift_lambda_function_type: @swift_lambda_function_type ref,
unique int return_type: @swift_lambda_function_type_return_type_type ref
);
@@ -1401,21 +1066,15 @@ swift_lambda_parameter_external_name(
unique int external_name: @swift_token_simple_identifier ref
);
-@swift_lambda_parameter_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_lambda_parameter, index]
swift_lambda_parameter_name(
- int swift_lambda_parameter: @swift_lambda_parameter ref,
- int index: int ref,
- unique int name: @swift_lambda_parameter_name_type ref
+ unique int swift_lambda_parameter: @swift_lambda_parameter ref,
+ unique int name: @swift_token_simple_identifier ref
);
-@swift_lambda_parameter_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
+@swift_lambda_parameter_type_type = @swift_implicitly_unwrapped_type | @swift_type__
-#keyset[swift_lambda_parameter, index]
swift_lambda_parameter_type(
- int swift_lambda_parameter: @swift_lambda_parameter ref,
- int index: int ref,
+ unique int swift_lambda_parameter: @swift_lambda_parameter ref,
unique int type__: @swift_lambda_parameter_type_type ref
);
@@ -1450,13 +1109,13 @@ swift_line_string_literal_def(
unique int id: @swift_line_string_literal
);
-@swift_macro_declaration_default_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
+@swift_local_declaration = @swift_class_declaration | @swift_function_declaration | @swift_property_declaration | @swift_typealias_declaration
#keyset[swift_macro_declaration, index]
swift_macro_declaration_default_value(
int swift_macro_declaration: @swift_macro_declaration ref,
int index: int ref,
- unique int default_value: @swift_macro_declaration_default_value_type ref
+ unique int default_value: @swift_expression ref
);
swift_macro_declaration_definition(
@@ -1464,7 +1123,7 @@ swift_macro_declaration_definition(
unique int definition: @swift_macro_definition ref
);
-@swift_macro_declaration_child_type = @swift_array_type | @swift_attribute | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_modifiers | @swift_opaque_type | @swift_optional_type | @swift_parameter | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_constraints | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_type_parameters | @swift_user_type
+@swift_macro_declaration_child_type = @swift_attribute | @swift_modifiers | @swift_parameter | @swift_token_simple_identifier | @swift_type_constraints | @swift_type_parameters | @swift_unannotated_type
#keyset[swift_macro_declaration, index]
swift_macro_declaration_child(
@@ -1477,17 +1136,11 @@ swift_macro_declaration_def(
unique int id: @swift_macro_declaration
);
-@swift_macro_definition_body_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_external_macro_definition | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_macro_definition, index]
-swift_macro_definition_body(
- int swift_macro_definition: @swift_macro_definition ref,
- int index: int ref,
- unique int body: @swift_macro_definition_body_type ref
-);
+@swift_macro_definition_body_type = @swift_expression | @swift_external_macro_definition
swift_macro_definition_def(
- unique int id: @swift_macro_definition
+ unique int id: @swift_macro_definition,
+ int body: @swift_macro_definition_body_type ref
);
@swift_macro_invocation_child_type = @swift_call_suffix | @swift_token_simple_identifier | @swift_type_parameters
@@ -1503,11 +1156,9 @@ swift_macro_invocation_def(
unique int id: @swift_macro_invocation
);
-@swift_metatype_child_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
swift_metatype_def(
unique int id: @swift_metatype,
- int child: @swift_metatype_child_type ref
+ int child: @swift_unannotated_type ref
);
@swift_modifiers_child_type = @swift_attribute | @swift_token_function_modifier | @swift_token_inheritance_modifier | @swift_token_member_modifier | @swift_token_mutation_modifier | @swift_token_ownership_modifier | @swift_token_parameter_modifier | @swift_token_property_behavior_modifier | @swift_token_property_modifier | @swift_token_visibility_modifier
@@ -1552,15 +1203,6 @@ swift_multi_line_string_literal_def(
unique int id: @swift_multi_line_string_literal
);
-@swift_multiplicative_expression_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_multiplicative_expression, index]
-swift_multiplicative_expression_lhs(
- int swift_multiplicative_expression: @swift_multiplicative_expression ref,
- int index: int ref,
- unique int lhs: @swift_multiplicative_expression_lhs_type ref
-);
-
case @swift_multiplicative_expression.op of
0 = @swift_multiplicative_expression_percent
| 1 = @swift_multiplicative_expression_star
@@ -1568,28 +1210,14 @@ case @swift_multiplicative_expression.op of
;
-@swift_multiplicative_expression_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_multiplicative_expression, index]
-swift_multiplicative_expression_rhs(
- int swift_multiplicative_expression: @swift_multiplicative_expression ref,
- int index: int ref,
- unique int rhs: @swift_multiplicative_expression_rhs_type ref
-);
-
swift_multiplicative_expression_def(
unique int id: @swift_multiplicative_expression,
- int op: int ref
+ int lhs: @swift_expression ref,
+ int op: int ref,
+ int rhs: @swift_expression ref
);
-@swift_navigation_expression_element_type = @swift_dictionary_type | @swift_existential_type | @swift_opaque_type
-
-swift_navigation_expression_element(
- unique int swift_navigation_expression: @swift_navigation_expression ref,
- unique int element: @swift_navigation_expression_element_type ref
-);
-
-@swift_navigation_expression_target_type = @swift_additive_expression | @swift_array_literal | @swift_array_type | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_dictionary_type | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_existential_type | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_opaque_type | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_user_type | @swift_value_pack_expansion | @swift_value_parameter_pack
+@swift_navigation_expression_target_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_expression | @swift_opaque_type | @swift_reserved_word | @swift_user_type
#keyset[swift_navigation_expression, index]
swift_navigation_expression_target(
@@ -1610,62 +1238,41 @@ swift_navigation_suffix_def(
int suffix: @swift_navigation_suffix_suffix_type ref
);
-@swift_nil_coalescing_expression_if_nil_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
+@swift_nested_type_identifier_child_type = @swift_token_simple_identifier | @swift_unannotated_type
-#keyset[swift_nil_coalescing_expression, index]
-swift_nil_coalescing_expression_if_nil(
- int swift_nil_coalescing_expression: @swift_nil_coalescing_expression ref,
+#keyset[swift_nested_type_identifier, index]
+swift_nested_type_identifier_child(
+ int swift_nested_type_identifier: @swift_nested_type_identifier ref,
int index: int ref,
- unique int if_nil: @swift_nil_coalescing_expression_if_nil_type ref
+ unique int child: @swift_nested_type_identifier_child_type ref
);
-@swift_nil_coalescing_expression_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_nil_coalescing_expression, index]
-swift_nil_coalescing_expression_value(
- int swift_nil_coalescing_expression: @swift_nil_coalescing_expression ref,
- int index: int ref,
- unique int value: @swift_nil_coalescing_expression_value_type ref
+swift_nested_type_identifier_def(
+ unique int id: @swift_nested_type_identifier
);
swift_nil_coalescing_expression_def(
- unique int id: @swift_nil_coalescing_expression
+ unique int id: @swift_nil_coalescing_expression,
+ int if_nil: @swift_expression ref,
+ int value: @swift_expression ref
);
-@swift_opaque_type_child_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
swift_opaque_type_def(
unique int id: @swift_opaque_type,
- int child: @swift_opaque_type_child_type ref
-);
-
-@swift_open_end_range_expression_start_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_open_end_range_expression, index]
-swift_open_end_range_expression_start(
- int swift_open_end_range_expression: @swift_open_end_range_expression ref,
- int index: int ref,
- unique int start: @swift_open_end_range_expression_start_type ref
+ int child: @swift_unannotated_type ref
);
swift_open_end_range_expression_def(
- unique int id: @swift_open_end_range_expression
-);
-
-@swift_open_start_range_expression_end_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_open_start_range_expression, index]
-swift_open_start_range_expression_end(
- int swift_open_start_range_expression: @swift_open_start_range_expression ref,
- int index: int ref,
- unique int end: @swift_open_start_range_expression_end_type ref
+ unique int id: @swift_open_end_range_expression,
+ int start: @swift_expression ref
);
swift_open_start_range_expression_def(
- unique int id: @swift_open_start_range_expression
+ unique int id: @swift_open_start_range_expression,
+ int end: @swift_expression ref
);
-@swift_operator_declaration_child_type = @swift_deprecated_operator_declaration_body | @swift_token_bang | @swift_token_custom_operator | @swift_token_simple_identifier
+@swift_operator_declaration_child_type = @swift_deprecated_operator_declaration_body | @swift_referenceable_operator | @swift_token_simple_identifier
#keyset[swift_operator_declaration, index]
swift_operator_declaration_child(
@@ -1678,6 +1285,11 @@ swift_operator_declaration_def(
unique int id: @swift_operator_declaration
);
+swift_optional_chain_marker_def(
+ unique int id: @swift_optional_chain_marker,
+ int child: @swift_expression ref
+);
+
@swift_optional_type_wrapped_type = @swift_array_type | @swift_dictionary_type | @swift_tuple_type | @swift_user_type
swift_optional_type_def(
@@ -1690,23 +1302,7 @@ swift_parameter_external_name(
unique int external_name: @swift_token_simple_identifier ref
);
-@swift_parameter_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_parameter, index]
-swift_parameter_name(
- int swift_parameter: @swift_parameter ref,
- int index: int ref,
- unique int name: @swift_parameter_name_type ref
-);
-
-@swift_parameter_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_parameter, index]
-swift_parameter_type(
- int swift_parameter: @swift_parameter ref,
- int index: int ref,
- unique int type__: @swift_parameter_type_type ref
-);
+@swift_parameter_type_type = @swift_implicitly_unwrapped_type | @swift_type__
swift_parameter_child(
unique int swift_parameter: @swift_parameter ref,
@@ -1714,7 +1310,9 @@ swift_parameter_child(
);
swift_parameter_def(
- unique int id: @swift_parameter
+ unique int id: @swift_parameter,
+ int name: @swift_token_simple_identifier ref,
+ int type__: @swift_parameter_type_type ref
);
#keyset[swift_parameter_modifiers, index]
@@ -1733,14 +1331,7 @@ swift_pattern_bound_identifier(
unique int bound_identifier: @swift_token_simple_identifier ref
);
-@swift_pattern_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-swift_pattern_name(
- unique int swift_pattern: @swift_pattern ref,
- unique int name: @swift_pattern_name_type ref
-);
-
-@swift_pattern_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_pattern | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_wildcard_pattern | @swift_try_expression | @swift_tuple_expression | @swift_type_modifiers | @swift_user_type | @swift_value_binding_pattern | @swift_value_pack_expansion | @swift_value_parameter_pack
+@swift_pattern_child_type = @swift_expression | @swift_pattern | @swift_token_wildcard_pattern | @swift_type__ | @swift_user_type | @swift_value_binding_pattern
#keyset[swift_pattern, index]
swift_pattern_child(
@@ -1753,13 +1344,11 @@ swift_pattern_def(
unique int id: @swift_pattern
);
-@swift_playground_literal_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
#keyset[swift_playground_literal, index]
swift_playground_literal_child(
int swift_playground_literal: @swift_playground_literal ref,
int index: int ref,
- unique int child: @swift_playground_literal_child_type ref
+ unique int child: @swift_expression ref
);
swift_playground_literal_def(
@@ -1768,18 +1357,10 @@ swift_playground_literal_def(
@swift_postfix_expression_operation_type = @swift_reserved_word | @swift_token_bang
-@swift_postfix_expression_target_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_postfix_expression, index]
-swift_postfix_expression_target(
- int swift_postfix_expression: @swift_postfix_expression ref,
- int index: int ref,
- unique int target: @swift_postfix_expression_target_type ref
-);
-
swift_postfix_expression_def(
unique int id: @swift_postfix_expression,
- int operation: @swift_postfix_expression_operation_type ref
+ int operation: @swift_postfix_expression_operation_type ref,
+ int target: @swift_expression ref
);
@swift_precedence_group_attribute_child_type = @swift_token_boolean_literal | @swift_token_simple_identifier
@@ -1821,18 +1402,10 @@ swift_precedence_group_declaration_def(
@swift_prefix_expression_operation_type = @swift_reserved_word | @swift_token_bang | @swift_token_custom_operator
-@swift_prefix_expression_target_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token__expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_prefix_expression, index]
-swift_prefix_expression_target(
- int swift_prefix_expression: @swift_prefix_expression ref,
- int index: int ref,
- unique int target: @swift_prefix_expression_target_type ref
-);
-
swift_prefix_expression_def(
unique int id: @swift_prefix_expression,
- int operation: @swift_prefix_expression_operation_type ref
+ int operation: @swift_prefix_expression_operation_type ref,
+ int target: @swift_expression ref
);
#keyset[swift_property_declaration, index]
@@ -1849,13 +1422,11 @@ swift_property_declaration_name(
unique int name: @swift_pattern ref
);
-@swift_property_declaration_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
#keyset[swift_property_declaration, index]
swift_property_declaration_value(
int swift_property_declaration: @swift_property_declaration ref,
int index: int ref,
- unique int value: @swift_property_declaration_value_type ref
+ unique int value: @swift_expression ref
);
@swift_property_declaration_child_type = @swift_attribute | @swift_modifiers | @swift_token_inheritance_modifier | @swift_token_ownership_modifier | @swift_token_property_behavior_modifier | @swift_type_annotation | @swift_type_constraints | @swift_value_binding_pattern | @swift_willset_didset_block
@@ -1871,33 +1442,22 @@ swift_property_declaration_def(
unique int id: @swift_property_declaration
);
-#keyset[swift_protocol_body, index]
-swift_protocol_body_body(
- int swift_protocol_body: @swift_protocol_body ref,
- int index: int ref,
- unique int body: @swift_protocol_function_declaration ref
-);
-
-@swift_protocol_body_child_type = @swift_associatedtype_declaration | @swift_deinit_declaration | @swift_init_declaration | @swift_protocol_function_declaration | @swift_protocol_property_declaration | @swift_subscript_declaration | @swift_typealias_declaration
-
#keyset[swift_protocol_body, index]
swift_protocol_body_child(
int swift_protocol_body: @swift_protocol_body ref,
int index: int ref,
- unique int child: @swift_protocol_body_child_type ref
+ unique int child: @swift_protocol_member_declaration ref
);
swift_protocol_body_def(
unique int id: @swift_protocol_body
);
-@swift_protocol_composition_type_child_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
#keyset[swift_protocol_composition_type, index]
swift_protocol_composition_type_child(
int swift_protocol_composition_type: @swift_protocol_composition_type ref,
int index: int ref,
- unique int child: @swift_protocol_composition_type_child_type ref
+ unique int child: @swift_unannotated_type ref
);
swift_protocol_composition_type_def(
@@ -1925,34 +1485,28 @@ swift_protocol_declaration_def(
int name: @swift_token_type_identifier ref
);
-@swift_protocol_function_declaration_default_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
+swift_protocol_function_declaration_body(
+ unique int swift_protocol_function_declaration: @swift_protocol_function_declaration ref,
+ unique int body: @swift_function_body ref
+);
#keyset[swift_protocol_function_declaration, index]
swift_protocol_function_declaration_default_value(
int swift_protocol_function_declaration: @swift_protocol_function_declaration ref,
int index: int ref,
- unique int default_value: @swift_protocol_function_declaration_default_value_type ref
+ unique int default_value: @swift_expression ref
);
-@swift_protocol_function_declaration_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_token_bang | @swift_token_custom_operator | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_protocol_function_declaration, index]
-swift_protocol_function_declaration_name(
- int swift_protocol_function_declaration: @swift_protocol_function_declaration ref,
- int index: int ref,
- unique int name: @swift_protocol_function_declaration_name_type ref
-);
+@swift_protocol_function_declaration_name_type = @swift_referenceable_operator | @swift_token_simple_identifier
-@swift_protocol_function_declaration_return_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
+@swift_protocol_function_declaration_return_type_type = @swift_implicitly_unwrapped_type | @swift_type__
-#keyset[swift_protocol_function_declaration, index]
swift_protocol_function_declaration_return_type(
- int swift_protocol_function_declaration: @swift_protocol_function_declaration ref,
- int index: int ref,
+ unique int swift_protocol_function_declaration: @swift_protocol_function_declaration ref,
unique int return_type: @swift_protocol_function_declaration_return_type_type ref
);
-@swift_protocol_function_declaration_child_type = @swift_attribute | @swift_modifiers | @swift_parameter | @swift_statements | @swift_throws_clause | @swift_token_throws | @swift_type_constraints | @swift_type_parameters
+@swift_protocol_function_declaration_child_type = @swift_attribute | @swift_modifiers | @swift_parameter | @swift_throws_clause | @swift_token_throws | @swift_type_constraints | @swift_type_parameters
#keyset[swift_protocol_function_declaration, index]
swift_protocol_function_declaration_child(
@@ -1962,9 +1516,12 @@ swift_protocol_function_declaration_child(
);
swift_protocol_function_declaration_def(
- unique int id: @swift_protocol_function_declaration
+ unique int id: @swift_protocol_function_declaration,
+ int name: @swift_protocol_function_declaration_name_type ref
);
+@swift_protocol_member_declaration = @swift_associatedtype_declaration | @swift_deinit_declaration | @swift_init_declaration | @swift_protocol_function_declaration | @swift_protocol_property_declaration | @swift_subscript_declaration | @swift_typealias_declaration
+
@swift_protocol_property_declaration_child_type = @swift_modifiers | @swift_protocol_property_requirements | @swift_type_annotation | @swift_type_constraints
#keyset[swift_protocol_property_declaration, index]
@@ -1992,33 +1549,17 @@ swift_protocol_property_requirements_def(
unique int id: @swift_protocol_property_requirements
);
-@swift_range_expression_end_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_range_expression, index]
-swift_range_expression_end(
- int swift_range_expression: @swift_range_expression ref,
- int index: int ref,
- unique int end: @swift_range_expression_end_type ref
-);
-
case @swift_range_expression.op of
0 = @swift_range_expression_dotdotdot
| 1 = @swift_range_expression_dotdotlangle
;
-@swift_range_expression_start_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_range_expression, index]
-swift_range_expression_start(
- int swift_range_expression: @swift_range_expression ref,
- int index: int ref,
- unique int start: @swift_range_expression_start_type ref
-);
-
swift_range_expression_def(
unique int id: @swift_range_expression,
- int op: int ref
+ int end: @swift_expression ref,
+ int op: int ref,
+ int start: @swift_expression ref
);
#keyset[swift_raw_str_interpolation, index]
@@ -2060,29 +1601,22 @@ swift_raw_string_literal_def(
unique int id: @swift_raw_string_literal
);
-#keyset[swift_repeat_while_statement, index]
-swift_repeat_while_statement_bound_identifier(
- int swift_repeat_while_statement: @swift_repeat_while_statement ref,
- int index: int ref,
- unique int bound_identifier: @swift_token_simple_identifier ref
-);
-
-@swift_repeat_while_statement_condition_type = @swift_additive_expression | @swift_array_literal | @swift_array_type | @swift_as_expression | @swift_assignment | @swift_availability_condition | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_dictionary_type | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_existential_type | @swift_function_type | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_metatype | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_opaque_type | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_optional_type | @swift_pattern | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_protocol_composition_type | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_suppressed_constraint | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_wildcard_pattern | @swift_try_expression | @swift_tuple_expression | @swift_tuple_type | @swift_type_annotation | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type | @swift_value_binding_pattern | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_where_clause
+@swift_referenceable_operator_child_type = @swift_token_bang | @swift_token_custom_operator
-#keyset[swift_repeat_while_statement, index]
-swift_repeat_while_statement_condition(
- int swift_repeat_while_statement: @swift_repeat_while_statement ref,
- int index: int ref,
- unique int condition: @swift_repeat_while_statement_condition_type ref
+swift_referenceable_operator_child(
+ unique int swift_referenceable_operator: @swift_referenceable_operator ref,
+ unique int child: @swift_referenceable_operator_child_type ref
);
-@swift_repeat_while_statement_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
+swift_referenceable_operator_def(
+ unique int id: @swift_referenceable_operator
+);
#keyset[swift_repeat_while_statement, index]
-swift_repeat_while_statement_name(
+swift_repeat_while_statement_condition(
int swift_repeat_while_statement: @swift_repeat_while_statement ref,
int index: int ref,
- unique int name: @swift_repeat_while_statement_name_type ref
+ unique int condition: @swift_if_condition ref
);
swift_repeat_while_statement_child(
@@ -2094,15 +1628,9 @@ swift_repeat_while_statement_def(
unique int id: @swift_repeat_while_statement
);
-@swift_selector_expression_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-swift_selector_expression_child(
- unique int swift_selector_expression: @swift_selector_expression ref,
- unique int child: @swift_selector_expression_child_type ref
-);
-
swift_selector_expression_def(
- unique int id: @swift_selector_expression
+ unique int id: @swift_selector_expression,
+ int child: @swift_expression ref
);
swift_setter_specifier_child(
@@ -2114,7 +1642,7 @@ swift_setter_specifier_def(
unique int id: @swift_setter_specifier
);
-@swift_source_file_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_associatedtype_declaration | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_class_declaration | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_do_statement | @swift_equality_expression | @swift_for_statement | @swift_function_declaration | @swift_guard_statement | @swift_if_statement | @swift_import_declaration | @swift_infix_expression | @swift_init_declaration | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_declaration | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_operator_declaration | @swift_playground_literal | @swift_postfix_expression | @swift_precedence_group_declaration | @swift_prefix_expression | @swift_property_declaration | @swift_protocol_declaration | @swift_range_expression | @swift_raw_string_literal | @swift_repeat_while_statement | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_shebang_line | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_statement_label | @swift_token_super_expression | @swift_token_throw_keyword | @swift_try_expression | @swift_tuple_expression | @swift_typealias_declaration | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_while_statement
+@swift_source_file_child_type = @swift_do_statement | @swift_expression | @swift_for_statement | @swift_global_declaration | @swift_guard_statement | @swift_repeat_while_statement | @swift_token_shebang_line | @swift_token_statement_label | @swift_token_throw_keyword | @swift_while_statement
#keyset[swift_source_file, index]
swift_source_file_child(
@@ -2127,7 +1655,7 @@ swift_source_file_def(
unique int id: @swift_source_file
);
-@swift_statements_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_class_declaration | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_control_transfer_statement | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_do_statement | @swift_equality_expression | @swift_for_statement | @swift_function_declaration | @swift_guard_statement | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_property_declaration | @swift_range_expression | @swift_raw_string_literal | @swift_repeat_while_statement | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_statement_label | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_typealias_declaration | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_while_statement
+@swift_statements_child_type = @swift_control_transfer_statement | @swift_do_statement | @swift_expression | @swift_for_statement | @swift_guard_statement | @swift_local_declaration | @swift_repeat_while_statement | @swift_token_statement_label | @swift_while_statement
#keyset[swift_statements, index]
swift_statements_child(
@@ -2140,28 +1668,17 @@ swift_statements_def(
unique int id: @swift_statements
);
-@swift_subscript_declaration_default_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
#keyset[swift_subscript_declaration, index]
swift_subscript_declaration_default_value(
int swift_subscript_declaration: @swift_subscript_declaration ref,
int index: int ref,
- unique int default_value: @swift_subscript_declaration_default_value_type ref
-);
-
-@swift_subscript_declaration_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-swift_subscript_declaration_name(
- unique int swift_subscript_declaration: @swift_subscript_declaration ref,
- unique int name: @swift_subscript_declaration_name_type ref
+ unique int default_value: @swift_expression ref
);
-@swift_subscript_declaration_return_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
+@swift_subscript_declaration_return_type_type = @swift_implicitly_unwrapped_type | @swift_type__
-#keyset[swift_subscript_declaration, index]
swift_subscript_declaration_return_type(
- int swift_subscript_declaration: @swift_subscript_declaration ref,
- int index: int ref,
+ unique int swift_subscript_declaration: @swift_subscript_declaration ref,
unique int return_type: @swift_subscript_declaration_return_type_type ref
);
@@ -2183,7 +1700,7 @@ swift_suppressed_constraint_def(
int suppressed: @swift_token_type_identifier ref
);
-@swift_switch_entry_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_modifiers | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_statements | @swift_switch_pattern | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_default_keyword | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_where_keyword | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
+@swift_switch_entry_child_type = @swift_expression | @swift_modifiers | @swift_statements | @swift_switch_pattern | @swift_token_default_keyword | @swift_token_where_keyword
#keyset[swift_switch_entry, index]
swift_switch_entry_child(
@@ -2201,15 +1718,6 @@ swift_switch_pattern_def(
int child: @swift_pattern ref
);
-@swift_switch_statement_expr_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_switch_statement, index]
-swift_switch_statement_expr(
- int swift_switch_statement: @swift_switch_statement ref,
- int index: int ref,
- unique int expr: @swift_switch_statement_expr_type ref
-);
-
#keyset[swift_switch_statement, index]
swift_switch_statement_child(
int swift_switch_statement: @swift_switch_statement ref,
@@ -2218,58 +1726,25 @@ swift_switch_statement_child(
);
swift_switch_statement_def(
- unique int id: @swift_switch_statement
-);
-
-@swift_ternary_expression_condition_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_ternary_expression, index]
-swift_ternary_expression_condition(
- int swift_ternary_expression: @swift_ternary_expression ref,
- int index: int ref,
- unique int condition: @swift_ternary_expression_condition_type ref
-);
-
-@swift_ternary_expression_if_false_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_ternary_expression, index]
-swift_ternary_expression_if_false(
- int swift_ternary_expression: @swift_ternary_expression ref,
- int index: int ref,
- unique int if_false: @swift_ternary_expression_if_false_type ref
-);
-
-@swift_ternary_expression_if_true_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_ternary_expression, index]
-swift_ternary_expression_if_true(
- int swift_ternary_expression: @swift_ternary_expression ref,
- int index: int ref,
- unique int if_true: @swift_ternary_expression_if_true_type ref
+ unique int id: @swift_switch_statement,
+ int expr: @swift_expression ref
);
swift_ternary_expression_def(
- unique int id: @swift_ternary_expression
+ unique int id: @swift_ternary_expression,
+ int condition: @swift_expression ref,
+ int if_false: @swift_expression ref,
+ int if_true: @swift_expression ref
);
-@swift_throws_clause_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
swift_throws_clause_def(
unique int id: @swift_throws_clause,
- int type__: @swift_throws_clause_type_type ref
-);
-
-@swift_try_expression_expr_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_try_expression, index]
-swift_try_expression_expr(
- int swift_try_expression: @swift_try_expression ref,
- int index: int ref,
- unique int expr: @swift_try_expression_expr_type ref
+ int type__: @swift_unannotated_type ref
);
swift_try_expression_def(
unique int id: @swift_try_expression,
+ int expr: @swift_expression ref,
int child: @swift_token_try_operator ref
);
@@ -2280,13 +1755,11 @@ swift_tuple_expression_name(
unique int name: @swift_token_simple_identifier ref
);
-@swift_tuple_expression_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
#keyset[swift_tuple_expression, index]
swift_tuple_expression_value(
int swift_tuple_expression: @swift_tuple_expression ref,
int index: int ref,
- unique int value: @swift_tuple_expression_value_type ref
+ unique int value: @swift_expression ref
);
swift_tuple_expression_def(
@@ -2309,32 +1782,17 @@ swift_tuple_type_def(
unique int id: @swift_tuple_type
);
-@swift_tuple_type_item_element_type = @swift_dictionary_type | @swift_existential_type | @swift_opaque_type
-
-swift_tuple_type_item_element(
- unique int swift_tuple_type_item: @swift_tuple_type_item ref,
- unique int element: @swift_tuple_type_item_element_type ref
-);
-
-@swift_tuple_type_item_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_tuple_type_item, index]
swift_tuple_type_item_name(
- int swift_tuple_type_item: @swift_tuple_type_item ref,
- int index: int ref,
- unique int name: @swift_tuple_type_item_name_type ref
+ unique int swift_tuple_type_item: @swift_tuple_type_item ref,
+ unique int name: @swift_token_simple_identifier ref
);
-@swift_tuple_type_item_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_tuple_type_item, index]
swift_tuple_type_item_type(
- int swift_tuple_type_item: @swift_tuple_type_item ref,
- int index: int ref,
- unique int type__: @swift_tuple_type_item_type_type ref
+ unique int swift_tuple_type_item: @swift_tuple_type_item ref,
+ unique int type__: @swift_type__ ref
);
-@swift_tuple_type_item_child_type = @swift_parameter_modifiers | @swift_token_wildcard_pattern
+@swift_tuple_type_item_child_type = @swift_dictionary_type | @swift_existential_type | @swift_opaque_type | @swift_parameter_modifiers | @swift_token_wildcard_pattern
#keyset[swift_tuple_type_item, index]
swift_tuple_type_item_child(
@@ -2347,36 +1805,28 @@ swift_tuple_type_item_def(
unique int id: @swift_tuple_type_item
);
-@swift_type_annotation_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-@swift_type_annotation_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_type_annotation, index]
-swift_type_annotation_type(
- int swift_type_annotation: @swift_type_annotation ref,
- int index: int ref,
- unique int type__: @swift_type_annotation_type_type ref
+swift_type_modifiers(
+ unique int swift_type__: @swift_type__ ref,
+ unique int modifiers: @swift_type_modifiers ref
);
-swift_type_annotation_def(
- unique int id: @swift_type_annotation,
- int name: @swift_type_annotation_name_type ref
+swift_type_def(
+ unique int id: @swift_type__,
+ int name: @swift_unannotated_type ref
);
-@swift_type_arguments_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
+@swift_type_annotation_type_type = @swift_implicitly_unwrapped_type | @swift_type__
-#keyset[swift_type_arguments, index]
-swift_type_arguments_name(
- int swift_type_arguments: @swift_type_arguments ref,
- int index: int ref,
- unique int name: @swift_type_arguments_name_type ref
+swift_type_annotation_def(
+ unique int id: @swift_type_annotation,
+ int type__: @swift_type_annotation_type_type ref
);
#keyset[swift_type_arguments, index]
swift_type_arguments_child(
int swift_type_arguments: @swift_type_arguments ref,
int index: int ref,
- unique int child: @swift_type_modifiers ref
+ unique int child: @swift_type__ ref
);
swift_type_arguments_def(
@@ -2403,6 +1853,8 @@ swift_type_constraints_def(
unique int id: @swift_type_constraints
);
+@swift_type_level_declaration = @swift_associatedtype_declaration | @swift_class_declaration | @swift_deinit_declaration | @swift_function_declaration | @swift_import_declaration | @swift_init_declaration | @swift_operator_declaration | @swift_precedence_group_declaration | @swift_property_declaration | @swift_protocol_declaration | @swift_subscript_declaration | @swift_typealias_declaration
+
#keyset[swift_type_modifiers, index]
swift_type_modifiers_child(
int swift_type_modifiers: @swift_type_modifiers ref,
@@ -2414,21 +1866,12 @@ swift_type_modifiers_def(
unique int id: @swift_type_modifiers
);
-@swift_type_pack_expansion_child_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
swift_type_pack_expansion_def(
unique int id: @swift_type_pack_expansion,
- int child: @swift_type_pack_expansion_child_type ref
-);
-
-@swift_type_parameter_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-swift_type_parameter_name(
- unique int swift_type_parameter: @swift_type_parameter ref,
- unique int name: @swift_type_parameter_name_type ref
+ int child: @swift_unannotated_type ref
);
-@swift_type_parameter_child_type = @swift_token_type_identifier | @swift_type_modifiers | @swift_type_parameter_modifiers | @swift_type_parameter_pack
+@swift_type_parameter_child_type = @swift_token_type_identifier | @swift_type__ | @swift_type_parameter_modifiers | @swift_type_parameter_pack
#keyset[swift_type_parameter, index]
swift_type_parameter_child(
@@ -2452,11 +1895,9 @@ swift_type_parameter_modifiers_def(
unique int id: @swift_type_parameter_modifiers
);
-@swift_type_parameter_pack_child_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
swift_type_parameter_pack_def(
unique int id: @swift_type_parameter_pack,
- int child: @swift_type_parameter_pack_child_type ref
+ int child: @swift_unannotated_type ref
);
@swift_type_parameters_child_type = @swift_type_constraints | @swift_type_parameter
@@ -2472,24 +1913,6 @@ swift_type_parameters_def(
unique int id: @swift_type_parameters
);
-@swift_typealias_declaration_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_token_type_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_typealias_declaration, index]
-swift_typealias_declaration_name(
- int swift_typealias_declaration: @swift_typealias_declaration ref,
- int index: int ref,
- unique int name: @swift_typealias_declaration_name_type ref
-);
-
-@swift_typealias_declaration_value_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_typealias_declaration, index]
-swift_typealias_declaration_value(
- int swift_typealias_declaration: @swift_typealias_declaration ref,
- int index: int ref,
- unique int value: @swift_typealias_declaration_value_type ref
-);
-
@swift_typealias_declaration_child_type = @swift_attribute | @swift_modifiers | @swift_token_inheritance_modifier | @swift_token_ownership_modifier | @swift_token_property_behavior_modifier | @swift_type_parameters
#keyset[swift_typealias_declaration, index]
@@ -2500,9 +1923,13 @@ swift_typealias_declaration_child(
);
swift_typealias_declaration_def(
- unique int id: @swift_typealias_declaration
+ unique int id: @swift_typealias_declaration,
+ int name: @swift_token_type_identifier ref,
+ int value: @swift_type__ ref
);
+@swift_unannotated_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
+
@swift_user_type_child_type = @swift_token_type_identifier | @swift_type_arguments
#keyset[swift_user_type, index]
@@ -2528,13 +1955,9 @@ swift_value_argument_reference_specifier(
unique int reference_specifier: @swift_value_argument_label ref
);
-@swift_value_argument_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-#keyset[swift_value_argument, index]
swift_value_argument_value(
- int swift_value_argument: @swift_value_argument ref,
- int index: int ref,
- unique int value: @swift_value_argument_value_type ref
+ unique int swift_value_argument: @swift_value_argument ref,
+ unique int value: @swift_expression ref
);
swift_value_argument_child(
@@ -2573,29 +1996,17 @@ swift_value_binding_pattern_def(
int mutability: int ref
);
-@swift_value_pack_expansion_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-swift_value_pack_expansion_child(
- unique int swift_value_pack_expansion: @swift_value_pack_expansion ref,
- unique int child: @swift_value_pack_expansion_child_type ref
-);
-
swift_value_pack_expansion_def(
- unique int id: @swift_value_pack_expansion
-);
-
-@swift_value_parameter_pack_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
-
-swift_value_parameter_pack_child(
- unique int swift_value_parameter_pack: @swift_value_parameter_pack ref,
- unique int child: @swift_value_parameter_pack_child_type ref
+ unique int id: @swift_value_pack_expansion,
+ int child: @swift_expression ref
);
swift_value_parameter_pack_def(
- unique int id: @swift_value_parameter_pack
+ unique int id: @swift_value_parameter_pack,
+ int child: @swift_expression ref
);
-@swift_where_clause_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_where_keyword | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack
+@swift_where_clause_child_type = @swift_expression | @swift_token_where_keyword
#keyset[swift_where_clause, index]
swift_where_clause_child(
@@ -2608,29 +2019,11 @@ swift_where_clause_def(
unique int id: @swift_where_clause
);
-#keyset[swift_while_statement, index]
-swift_while_statement_bound_identifier(
- int swift_while_statement: @swift_while_statement ref,
- int index: int ref,
- unique int bound_identifier: @swift_token_simple_identifier ref
-);
-
-@swift_while_statement_condition_type = @swift_additive_expression | @swift_array_literal | @swift_array_type | @swift_as_expression | @swift_assignment | @swift_availability_condition | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_dictionary_type | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_existential_type | @swift_function_type | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_metatype | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_opaque_type | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_optional_type | @swift_pattern | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_protocol_composition_type | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_suppressed_constraint | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_wildcard_pattern | @swift_try_expression | @swift_tuple_expression | @swift_tuple_type | @swift_type_annotation | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type | @swift_value_binding_pattern | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_where_clause
-
#keyset[swift_while_statement, index]
swift_while_statement_condition(
int swift_while_statement: @swift_while_statement ref,
int index: int ref,
- unique int condition: @swift_while_statement_condition_type ref
-);
-
-@swift_while_statement_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type
-
-#keyset[swift_while_statement, index]
-swift_while_statement_name(
- int swift_while_statement: @swift_while_statement ref,
- int index: int ref,
- unique int name: @swift_while_statement_name_type ref
+ unique int condition: @swift_if_condition ref
);
swift_while_statement_child(
@@ -2676,56 +2069,55 @@ swift_tokeninfo(
case @swift_token.kind of
0 = @swift_reserved_word
-| 1 = @swift_token__expression
-| 2 = @swift_token_as_operator
-| 3 = @swift_token_bang
-| 4 = @swift_token_bin_literal
-| 5 = @swift_token_boolean_literal
-| 6 = @swift_token_catch_keyword
-| 7 = @swift_token_comment
-| 8 = @swift_token_custom_operator
-| 9 = @swift_token_default_keyword
-| 10 = @swift_token_diagnostic
-| 11 = @swift_token_else
-| 12 = @swift_token_fully_open_range
-| 13 = @swift_token_function_modifier
-| 14 = @swift_token_hex_literal
-| 15 = @swift_token_inheritance_modifier
-| 16 = @swift_token_integer_literal
-| 17 = @swift_token_line_str_text
-| 18 = @swift_token_member_modifier
-| 19 = @swift_token_multi_line_str_text
-| 20 = @swift_token_multiline_comment
-| 21 = @swift_token_mutation_modifier
-| 22 = @swift_token_oct_literal
-| 23 = @swift_token_ownership_modifier
-| 24 = @swift_token_parameter_modifier
-| 25 = @swift_token_property_behavior_modifier
-| 26 = @swift_token_property_modifier
-| 27 = @swift_token_raw_str_continuing_indicator
-| 28 = @swift_token_raw_str_end_part
-| 29 = @swift_token_raw_str_interpolation_start
-| 30 = @swift_token_raw_str_part
-| 31 = @swift_token_real_literal
-| 32 = @swift_token_regex_literal
-| 33 = @swift_token_self_expression
-| 34 = @swift_token_shebang_line
-| 35 = @swift_token_simple_identifier
-| 36 = @swift_token_special_literal
-| 37 = @swift_token_statement_label
-| 38 = @swift_token_str_escaped_char
-| 39 = @swift_token_super_expression
-| 40 = @swift_token_throw_keyword
-| 41 = @swift_token_throws
-| 42 = @swift_token_try_operator
-| 43 = @swift_token_type_identifier
-| 44 = @swift_token_visibility_modifier
-| 45 = @swift_token_where_keyword
-| 46 = @swift_token_wildcard_pattern
+| 1 = @swift_token_as_operator
+| 2 = @swift_token_bang
+| 3 = @swift_token_bin_literal
+| 4 = @swift_token_boolean_literal
+| 5 = @swift_token_catch_keyword
+| 6 = @swift_token_comment
+| 7 = @swift_token_custom_operator
+| 8 = @swift_token_default_keyword
+| 9 = @swift_token_diagnostic
+| 10 = @swift_token_else
+| 11 = @swift_token_fully_open_range
+| 12 = @swift_token_function_modifier
+| 13 = @swift_token_hex_literal
+| 14 = @swift_token_inheritance_modifier
+| 15 = @swift_token_integer_literal
+| 16 = @swift_token_line_str_text
+| 17 = @swift_token_member_modifier
+| 18 = @swift_token_multi_line_str_text
+| 19 = @swift_token_multiline_comment
+| 20 = @swift_token_mutation_modifier
+| 21 = @swift_token_oct_literal
+| 22 = @swift_token_ownership_modifier
+| 23 = @swift_token_parameter_modifier
+| 24 = @swift_token_property_behavior_modifier
+| 25 = @swift_token_property_modifier
+| 26 = @swift_token_raw_str_continuing_indicator
+| 27 = @swift_token_raw_str_end_part
+| 28 = @swift_token_raw_str_interpolation_start
+| 29 = @swift_token_raw_str_part
+| 30 = @swift_token_real_literal
+| 31 = @swift_token_regex_literal
+| 32 = @swift_token_self_expression
+| 33 = @swift_token_shebang_line
+| 34 = @swift_token_simple_identifier
+| 35 = @swift_token_special_literal
+| 36 = @swift_token_statement_label
+| 37 = @swift_token_str_escaped_char
+| 38 = @swift_token_super_expression
+| 39 = @swift_token_throw_keyword
+| 40 = @swift_token_throws
+| 41 = @swift_token_try_operator
+| 42 = @swift_token_type_identifier
+| 43 = @swift_token_visibility_modifier
+| 44 = @swift_token_where_keyword
+| 45 = @swift_token_wildcard_pattern
;
-@swift_ast_node = @swift_additive_expression | @swift_array_literal | @swift_array_type | @swift_as_expression | @swift_assignment | @swift_associatedtype_declaration | @swift_attribute | @swift_availability_condition | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_call_suffix | @swift_capture_list | @swift_capture_list_item | @swift_catch_block | @swift_check_expression | @swift_class_body | @swift_class_declaration | @swift_comparison_expression | @swift_computed_getter | @swift_computed_modify | @swift_computed_property | @swift_computed_setter | @swift_conjunction_expression | @swift_constructor_expression | @swift_constructor_suffix | @swift_control_transfer_statement | @swift_deinit_declaration | @swift_deprecated_operator_declaration_body | @swift_dictionary_literal | @swift_dictionary_type | @swift_didset_clause | @swift_directive | @swift_directly_assignable_expression | @swift_disjunction_expression | @swift_do_statement | @swift_enum_class_body | @swift_enum_entry | @swift_enum_type_parameters | @swift_equality_constraint | @swift_equality_expression | @swift_existential_type | @swift_external_macro_definition | @swift_for_statement | @swift_function_body | @swift_function_declaration | @swift_function_type | @swift_getter_specifier | @swift_guard_statement | @swift_identifier | @swift_if_statement | @swift_import_declaration | @swift_infix_expression | @swift_inheritance_constraint | @swift_inheritance_specifier | @swift_init_declaration | @swift_interpolated_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_function_type | @swift_lambda_function_type_parameters | @swift_lambda_literal | @swift_lambda_parameter | @swift_line_string_literal | @swift_macro_declaration | @swift_macro_definition | @swift_macro_invocation | @swift_metatype | @swift_modifiers | @swift_modify_specifier | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_navigation_suffix | @swift_nil_coalescing_expression | @swift_opaque_type | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_operator_declaration | @swift_optional_type | @swift_parameter | @swift_parameter_modifiers | @swift_pattern | @swift_playground_literal | @swift_postfix_expression | @swift_precedence_group_attribute | @swift_precedence_group_attributes | @swift_precedence_group_declaration | @swift_prefix_expression | @swift_property_declaration | @swift_protocol_body | @swift_protocol_composition_type | @swift_protocol_declaration | @swift_protocol_function_declaration | @swift_protocol_property_declaration | @swift_protocol_property_requirements | @swift_range_expression | @swift_raw_str_interpolation | @swift_raw_string_literal | @swift_repeat_while_statement | @swift_selector_expression | @swift_setter_specifier | @swift_source_file | @swift_statements | @swift_subscript_declaration | @swift_suppressed_constraint | @swift_switch_entry | @swift_switch_pattern | @swift_switch_statement | @swift_ternary_expression | @swift_throws_clause | @swift_token | @swift_try_expression | @swift_tuple_expression | @swift_tuple_type | @swift_tuple_type_item | @swift_type_annotation | @swift_type_arguments | @swift_type_constraint | @swift_type_constraints | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter | @swift_type_parameter_modifiers | @swift_type_parameter_pack | @swift_type_parameters | @swift_typealias_declaration | @swift_user_type | @swift_value_argument | @swift_value_argument_label | @swift_value_arguments | @swift_value_binding_pattern | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_where_clause | @swift_while_statement | @swift_willset_clause | @swift_willset_didset_block
+@swift_ast_node = @swift_additive_expression | @swift_array_literal | @swift_array_type | @swift_as_expression | @swift_assignment | @swift_associatedtype_declaration | @swift_attribute | @swift_availability_condition | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_call_suffix | @swift_capture_list | @swift_capture_list_item | @swift_catch_block | @swift_check_expression | @swift_class_body | @swift_class_declaration | @swift_comparison_expression | @swift_computed_getter | @swift_computed_modify | @swift_computed_property | @swift_computed_setter | @swift_conjunction_expression | @swift_constructor_expression | @swift_constructor_suffix | @swift_control_transfer_statement | @swift_deinit_declaration | @swift_deprecated_operator_declaration_body | @swift_dictionary_literal | @swift_dictionary_type | @swift_didset_clause | @swift_directive | @swift_directly_assignable_expression | @swift_disjunction_expression | @swift_do_statement | @swift_enum_class_body | @swift_enum_entry | @swift_enum_type_parameters | @swift_equality_constraint | @swift_equality_expression | @swift_existential_type | @swift_external_macro_definition | @swift_for_statement | @swift_function_body | @swift_function_declaration | @swift_function_type | @swift_getter_specifier | @swift_guard_statement | @swift_identifier | @swift_if_condition | @swift_if_let_binding | @swift_if_statement | @swift_implicitly_unwrapped_type | @swift_import_declaration | @swift_infix_expression | @swift_inheritance_constraint | @swift_inheritance_specifier | @swift_init_declaration | @swift_interpolated_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_function_type | @swift_lambda_function_type_parameters | @swift_lambda_literal | @swift_lambda_parameter | @swift_line_string_literal | @swift_macro_declaration | @swift_macro_definition | @swift_macro_invocation | @swift_metatype | @swift_modifiers | @swift_modify_specifier | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_navigation_suffix | @swift_nested_type_identifier | @swift_nil_coalescing_expression | @swift_opaque_type | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_operator_declaration | @swift_optional_chain_marker | @swift_optional_type | @swift_parameter | @swift_parameter_modifiers | @swift_pattern | @swift_playground_literal | @swift_postfix_expression | @swift_precedence_group_attribute | @swift_precedence_group_attributes | @swift_precedence_group_declaration | @swift_prefix_expression | @swift_property_declaration | @swift_protocol_body | @swift_protocol_composition_type | @swift_protocol_declaration | @swift_protocol_function_declaration | @swift_protocol_property_declaration | @swift_protocol_property_requirements | @swift_range_expression | @swift_raw_str_interpolation | @swift_raw_string_literal | @swift_referenceable_operator | @swift_repeat_while_statement | @swift_selector_expression | @swift_setter_specifier | @swift_source_file | @swift_statements | @swift_subscript_declaration | @swift_suppressed_constraint | @swift_switch_entry | @swift_switch_pattern | @swift_switch_statement | @swift_ternary_expression | @swift_throws_clause | @swift_token | @swift_try_expression | @swift_tuple_expression | @swift_tuple_type | @swift_tuple_type_item | @swift_type__ | @swift_type_annotation | @swift_type_arguments | @swift_type_constraint | @swift_type_constraints | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter | @swift_type_parameter_modifiers | @swift_type_parameter_pack | @swift_type_parameters | @swift_typealias_declaration | @swift_user_type | @swift_value_argument | @swift_value_argument_label | @swift_value_arguments | @swift_value_binding_pattern | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_where_clause | @swift_while_statement | @swift_willset_clause | @swift_willset_didset_block
swift_ast_node_location(
unique int node: @swift_ast_node ref,
diff --git a/unified/scripts/regenerate-grammar.sh b/unified/scripts/regenerate-grammar.sh
new file mode 100755
index 000000000000..b7a5ce263fb8
--- /dev/null
+++ b/unified/scripts/regenerate-grammar.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# Regenerate the vendored tree-sitter-swift parser tables from grammar.js,
+# then refresh the human-readable node-types.yml companion file.
+#
+# Run this after editing
+# unified/extractor/tree-sitter-swift/grammar.js so that:
+# * src/parser.c, src/grammar.json, src/node-types.json (and the
+# src/tree_sitter/*.h headers) reflect the current grammar; and
+# * node-types.yml shows the same information in a form that's
+# pleasant to review in PR diffs.
+#
+# Requirements: tree-sitter CLI on PATH, and a working cargo toolchain.
+set -euo pipefail
+
+cd "$(dirname "$0")/.."
+SWIFT_DIR="extractor/tree-sitter-swift"
+
+(
+ cd "$SWIFT_DIR"
+ tree-sitter generate
+)
+
+# Build yeast's node_types_yaml binary and use it to convert the freshly
+# generated src/node-types.json into the human-readable node-types.yml.
+cargo run --release --quiet -p yeast --bin node_types_yaml -- \
+ --from-json "$SWIFT_DIR/src/node-types.json" > "$SWIFT_DIR/node-types.yml"
+
+echo "Regenerated $SWIFT_DIR/{src/parser.c,src/grammar.json,src/node-types.json,node-types.yml}"