diff --git a/unified/ql/lib/codeql/unified/Ast.qll b/unified/ql/lib/codeql/unified/Ast.qll index 8fd4e61ed32..b71c807a2ab 100644 --- a/unified/ql/lib/codeql/unified/Ast.qll +++ b/unified/ql/lib/codeql/unified/Ast.qll @@ -899,24 +899,22 @@ 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 UnannotatedType getName() { swift_equality_constraint_def(this, result) } + final UnannotatedType getName() { 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_def(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_child(this, _, result) } } @@ -1229,9 +1227,7 @@ 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) { @@ -1246,7 +1242,7 @@ module Swift { /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_inheritance_constraint_constrained_type(this, _, result) or + swift_inheritance_constraint_def(this, result) or swift_inheritance_constraint_inherits_from(this, _, result) or swift_inheritance_constraint_name(this, result) or swift_inheritance_constraint_child(this, _, result) @@ -1661,6 +1657,20 @@ 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. */ diff --git a/unified/ql/lib/unified.dbscheme b/unified/ql/lib/unified.dbscheme index 748a2dfc4a5..3b9cf0815d9 100644 --- a/unified/ql/lib/unified.dbscheme +++ b/unified/ql/lib/unified.dbscheme @@ -755,14 +755,7 @@ swift_enum_type_parameters_def( unique int id: @swift_enum_type_parameters ); -@swift_equality_constraint_constrained_type_type = @swift_identifier | @swift_reserved_word | @swift_token_simple_identifier | @swift_unannotated_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_constrained_type_type = @swift_identifier | @swift_nested_type_identifier @swift_equality_constraint_must_equal_type = @swift_type_modifiers | @swift_unannotated_type @@ -782,6 +775,7 @@ swift_equality_constraint_child( swift_equality_constraint_def( unique int id: @swift_equality_constraint, + int constrained_type: @swift_equality_constraint_constrained_type_type ref, int name: @swift_unannotated_type ref ); @@ -1014,14 +1008,7 @@ swift_infix_expression_def( int rhs: @swift_expression ref ); -@swift_inheritance_constraint_constrained_type_type = @swift_identifier | @swift_reserved_word | @swift_token_simple_identifier | @swift_unannotated_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 -); +@swift_inheritance_constraint_constrained_type_type = @swift_identifier | @swift_nested_type_identifier @swift_inheritance_constraint_inherits_from_type = @swift_implicitly_unwrapped_type | @swift_type_modifiers | @swift_unannotated_type @@ -1045,7 +1032,8 @@ swift_inheritance_constraint_child( ); swift_inheritance_constraint_def( - unique int id: @swift_inheritance_constraint + unique int id: @swift_inheritance_constraint, + int constrained_type: @swift_inheritance_constraint_constrained_type_type ref ); @swift_inheritance_specifier_inherits_from_type = @swift_function_type | @swift_suppressed_constraint | @swift_user_type @@ -1379,6 +1367,19 @@ swift_navigation_suffix_def( int suffix: @swift_navigation_suffix_suffix_type ref ); +@swift_nested_type_identifier_child_type = @swift_token_simple_identifier | @swift_unannotated_type + +#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 child: @swift_nested_type_identifier_child_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, int if_nil: @swift_expression ref, @@ -2323,7 +2324,7 @@ case @swift_token.kind of ; -@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_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_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_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_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_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,