diff --git a/unified/ql/lib/codeql/unified/Ast.qll b/unified/ql/lib/codeql/unified/Ast.qll index bf3b98f582e..db2e73df01b 100644 --- a/unified/ql/lib/codeql/unified/Ast.qll +++ b/unified/ql/lib/codeql/unified/Ast.qll @@ -277,12 +277,16 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AvailabilityCondition" } - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { swift_availability_condition_child(this, i, result) } + /** Gets the node corresponding to the field `platform`. */ + final Identifier getPlatform(int i) { swift_availability_condition_platform(this, i, result) } + + /** Gets the node corresponding to the field `version`. */ + final IntegerLiteral getVersion(int i) { swift_availability_condition_version(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_availability_condition_child(this, _, result) + swift_availability_condition_platform(this, _, result) or + swift_availability_condition_version(this, _, result) } } @@ -292,15 +296,10 @@ module Swift { final override string getAPrimaryQlClass() { result = "AwaitExpression" } /** Gets the node corresponding to the field `expr`. */ - final Expression getExpr() { swift_await_expression_expr(this, result) } - - /** Gets the child of this node. */ - final Expression getChild() { swift_await_expression_child(this, result) } + final Expression getExpr() { swift_await_expression_def(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) - } + final override AstNode getAFieldOrChild() { swift_await_expression_def(this, result) } } /** A class representing `bang` tokens. */ @@ -315,6 +314,23 @@ module Swift { final override string getAPrimaryQlClass() { result = "BinLiteral" } } + /** A class representing `binding_pattern` nodes. */ + class BindingPattern extends @swift_binding_pattern, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "BindingPattern" } + + /** Gets the node corresponding to the field `binding`. */ + final ValueBindingPattern getBinding() { swift_binding_pattern_def(this, result, _) } + + /** Gets the node corresponding to the field `pattern`. */ + final Pattern getPattern() { swift_binding_pattern_def(this, _, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { + swift_binding_pattern_def(this, result, _) or swift_binding_pattern_def(this, _, result) + } + } + /** A class representing `bitwise_operation` nodes. */ class BitwiseOperation extends @swift_bitwise_operation, AstNode { /** Gets the name of the primary QL class for this element. */ @@ -360,19 +376,14 @@ module Swift { final override string getAPrimaryQlClass() { result = "CallExpression" } /** Gets the node corresponding to the field `function`. */ - final Expression getFunction() { swift_call_expression_function(this, result) } + final Expression getFunction() { swift_call_expression_def(this, result, _) } /** Gets the node corresponding to the field `suffix`. */ - final CallSuffix getSuffix() { swift_call_expression_suffix(this, result) } - - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { swift_call_expression_child(this, i, result) } + final CallSuffix getSuffix() { swift_call_expression_def(this, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_call_expression_function(this, result) or - swift_call_expression_suffix(this, result) or - swift_call_expression_child(this, _, result) + swift_call_expression_def(this, result, _) or swift_call_expression_def(this, _, result) } } @@ -381,15 +392,20 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CallSuffix" } + /** Gets the node corresponding to the field `arguments`. */ + final ValueArguments getArguments() { swift_call_suffix_arguments(this, result) } + + /** Gets the node corresponding to the field `lambda`. */ + final LambdaLiteral getLambda(int i) { swift_call_suffix_lambda(this, i, result) } + /** Gets the node corresponding to the field `name`. */ final SimpleIdentifier getName(int i) { swift_call_suffix_name(this, i, result) } - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { swift_call_suffix_child(this, i, result) } - /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_call_suffix_name(this, _, result) or swift_call_suffix_child(this, _, result) + swift_call_suffix_arguments(this, result) or + swift_call_suffix_lambda(this, _, result) or + swift_call_suffix_name(this, _, result) } } @@ -427,6 +443,28 @@ module Swift { } } + /** A class representing `case_pattern` nodes. */ + class CasePattern extends @swift_case_pattern, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "CasePattern" } + + /** Gets the node corresponding to the field `arguments`. */ + final TuplePattern getArguments() { swift_case_pattern_arguments(this, result) } + + /** Gets the node corresponding to the field `name`. */ + final SimpleIdentifier getName() { swift_case_pattern_def(this, result) } + + /** Gets the node corresponding to the field `type`. */ + final UserType getType() { swift_case_pattern_type(this, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { + swift_case_pattern_arguments(this, result) or + swift_case_pattern_def(this, result) or + swift_case_pattern_type(this, result) + } + } + /** A class representing `catch_block` nodes. */ class CatchBlock extends @swift_catch_block, AstNode { /** Gets the name of the primary QL class for this element. */ @@ -492,13 +530,8 @@ module Swift { /** Gets the node corresponding to the field `member`. */ final TypeLevelDeclaration getMember(int i) { swift_class_body_member(this, i, result) } - /** Gets the `i`th child of this node. */ - final MultilineComment getChild(int i) { swift_class_body_child(this, i, result) } - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - swift_class_body_member(this, _, result) or swift_class_body_child(this, _, result) - } + final override AstNode getAFieldOrChild() { swift_class_body_member(this, _, result) } } /** A class representing `class_declaration` nodes. */ @@ -527,6 +560,11 @@ module Swift { ) } + /** Gets the node corresponding to the field `inherits`. */ + final InheritanceSpecifier getInherits(int i) { + swift_class_declaration_inherits(this, i, result) + } + /** Gets the node corresponding to the field `modifiers`. */ final AstNode getModifiers(int i) { swift_class_declaration_modifiers(this, i, result) } @@ -543,18 +581,15 @@ module Swift { swift_class_declaration_type_parameters(this, result) } - /** Gets the `i`th child of this node. */ - final InheritanceSpecifier getChild(int i) { swift_class_declaration_child(this, i, result) } - /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_class_declaration_attribute(this, _, result) or swift_class_declaration_def(this, result, _, _) or + swift_class_declaration_inherits(this, _, result) or swift_class_declaration_modifiers(this, _, result) or swift_class_declaration_def(this, _, _, result) or swift_class_declaration_type_constraints(this, result) or - swift_class_declaration_type_parameters(this, result) or - swift_class_declaration_child(this, _, result) + swift_class_declaration_type_parameters(this, result) } } @@ -595,6 +630,44 @@ module Swift { } } + /** A class representing `compilation_condition` nodes. */ + class CompilationCondition extends @swift_compilation_condition, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "CompilationCondition" } + + /** Gets the node corresponding to the field `inner`. */ + final CompilationCondition getInner() { swift_compilation_condition_inner(this, result) } + + /** Gets the node corresponding to the field `lhs`. */ + final CompilationCondition getLhs() { swift_compilation_condition_lhs(this, result) } + + /** Gets the node corresponding to the field `name`. */ + final SimpleIdentifier getName(int i) { swift_compilation_condition_name(this, i, result) } + + /** Gets the node corresponding to the field `operand`. */ + final CompilationCondition getOperand() { swift_compilation_condition_operand(this, result) } + + /** Gets the node corresponding to the field `rhs`. */ + final CompilationCondition getRhs() { swift_compilation_condition_rhs(this, result) } + + /** Gets the node corresponding to the field `value`. */ + final BooleanLiteral getValue() { swift_compilation_condition_value(this, result) } + + /** Gets the node corresponding to the field `version`. */ + final IntegerLiteral getVersion(int i) { swift_compilation_condition_version(this, i, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { + swift_compilation_condition_inner(this, result) or + swift_compilation_condition_lhs(this, result) or + swift_compilation_condition_name(this, _, result) or + swift_compilation_condition_operand(this, result) or + swift_compilation_condition_rhs(this, result) or + swift_compilation_condition_value(this, result) or + swift_compilation_condition_version(this, _, result) + } + } + /** A class representing `computed_getter` nodes. */ class ComputedGetter extends @swift_computed_getter, AstNode { /** Gets the name of the primary QL class for this element. */ @@ -731,16 +804,20 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ConstructorSuffix" } + /** Gets the node corresponding to the field `arguments`. */ + final ValueArguments getArguments() { swift_constructor_suffix_arguments(this, result) } + + /** Gets the node corresponding to the field `lambda`. */ + final LambdaLiteral getLambda(int i) { swift_constructor_suffix_lambda(this, i, result) } + /** Gets the node corresponding to the field `name`. */ final SimpleIdentifier getName(int i) { swift_constructor_suffix_name(this, i, result) } - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { swift_constructor_suffix_child(this, i, result) } - /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_constructor_suffix_name(this, _, result) or - swift_constructor_suffix_child(this, _, result) + swift_constructor_suffix_arguments(this, result) or + swift_constructor_suffix_lambda(this, _, result) or + swift_constructor_suffix_name(this, _, result) } } @@ -750,19 +827,15 @@ module Swift { final override string getAPrimaryQlClass() { result = "ControlTransferStatement" } /** Gets the node corresponding to the field `kind`. */ - final AstNode getKind() { swift_control_transfer_statement_kind(this, result) } + final AstNode getKind() { swift_control_transfer_statement_def(this, result) } /** Gets the node corresponding to the field `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_kind(this, result) or - swift_control_transfer_statement_result(this, result) or - swift_control_transfer_statement_child(this, _, result) + swift_control_transfer_statement_def(this, result) or + swift_control_transfer_statement_result(this, result) } } @@ -802,14 +875,14 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "DeprecatedOperatorDeclarationBody" } - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { - swift_deprecated_operator_declaration_body_child(this, i, result) + /** Gets the node corresponding to the field `entry`. */ + final AstNode getEntry(int i) { + swift_deprecated_operator_declaration_body_entry(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_deprecated_operator_declaration_body_child(this, _, result) + swift_deprecated_operator_declaration_body_entry(this, _, result) } } @@ -881,11 +954,11 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Directive" } - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { swift_directive_child(this, i, result) } + /** Gets the node corresponding to the field `condition`. */ + final CompilationCondition getCondition() { swift_directive_condition(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { swift_directive_child(this, _, result) } + final override AstNode getAFieldOrChild() { swift_directive_condition(this, result) } } /** A class representing `directly_assignable_expression` nodes. */ @@ -990,16 +1063,48 @@ module Swift { } } + /** A class representing `enum_type_parameter` nodes. */ + class EnumTypeParameter extends @swift_enum_type_parameter, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "EnumTypeParameter" } + + /** Gets the node corresponding to the field `default_value`. */ + final Expression getDefaultValue() { swift_enum_type_parameter_default_value(this, result) } + + /** Gets the node corresponding to the field `external_name`. */ + final WildcardPattern getExternalName() { + swift_enum_type_parameter_external_name(this, result) + } + + /** Gets the node corresponding to the field `name`. */ + final SimpleIdentifier getName() { swift_enum_type_parameter_name(this, result) } + + /** Gets the node corresponding to the field `type`. */ + final Type getType() { swift_enum_type_parameter_def(this, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { + swift_enum_type_parameter_default_value(this, result) or + swift_enum_type_parameter_external_name(this, result) or + swift_enum_type_parameter_name(this, result) or + swift_enum_type_parameter_def(this, result) + } + } + /** A class representing `enum_type_parameters` nodes. */ class EnumTypeParameters extends @swift_enum_type_parameters, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "EnumTypeParameters" } - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { swift_enum_type_parameters_child(this, i, result) } + /** Gets the node corresponding to the field `parameter`. */ + final EnumTypeParameter getParameter(int i) { + swift_enum_type_parameters_parameter(this, i, result) + } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { swift_enum_type_parameters_child(this, _, result) } + final override AstNode getAFieldOrChild() { + swift_enum_type_parameters_parameter(this, _, result) + } } /** A class representing `equality_constraint` nodes. */ @@ -1139,7 +1244,7 @@ module Swift { final override string getAPrimaryQlClass() { result = "FunctionDeclaration" } /** Gets the node corresponding to the field `async`. */ - final AsyncKeyword getAsync() { swift_function_declaration_async(this, result) } + final ReservedWord getAsync() { swift_function_declaration_async(this, result) } /** Gets the node corresponding to the field `attribute`. */ final Attribute getAttribute(int i) { swift_function_declaration_attribute(this, i, result) } @@ -1205,7 +1310,7 @@ module Swift { final override string getAPrimaryQlClass() { result = "FunctionType" } /** Gets the node corresponding to the field `async`. */ - final AsyncKeyword getAsync() { swift_function_type_async(this, result) } + final ReservedWord getAsync() { swift_function_type_async(this, result) } /** Gets the node corresponding to the field `params`. */ final UnannotatedType getParams() { swift_function_type_def(this, result, _) } @@ -1302,10 +1407,11 @@ module Swift { /** 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() { - swift_if_let_binding_bound_identifier(this, result) - } + /** Gets the node corresponding to the field `pattern`. */ + final Pattern getPattern() { swift_if_let_binding_def(this, result) } + + /** Gets the node corresponding to the field `type`. */ + final TypeAnnotation getType() { swift_if_let_binding_type(this, result) } /** Gets the node corresponding to the field `value`. */ final Expression getValue() { swift_if_let_binding_value(this, result) } @@ -1313,15 +1419,12 @@ module Swift { /** Gets the node corresponding to the field `where`. */ final WhereClause getWhere() { swift_if_let_binding_where(this, result) } - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { swift_if_let_binding_child(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_def(this, result) or + swift_if_let_binding_type(this, result) or swift_if_let_binding_value(this, result) or - swift_if_let_binding_where(this, result) or - swift_if_let_binding_child(this, _, result) + swift_if_let_binding_where(this, result) } } @@ -1448,7 +1551,7 @@ module Swift { final override string getAPrimaryQlClass() { result = "InitDeclaration" } /** Gets the node corresponding to the field `async`. */ - final AsyncKeyword getAsync() { swift_init_declaration_async(this, result) } + final ReservedWord getAsync() { swift_init_declaration_async(this, result) } /** Gets the node corresponding to the field `attribute`. */ final Attribute getAttribute(int i) { swift_init_declaration_attribute(this, i, result) } @@ -1539,16 +1642,60 @@ module Swift { } } + /** A class representing `key_path_component` nodes. */ + class KeyPathComponent extends @swift_key_path_component, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "KeyPathComponent" } + + /** Gets the node corresponding to the field `name`. */ + final SimpleIdentifier getName() { swift_key_path_component_name(this, result) } + + /** Gets the node corresponding to the field `postfix`. */ + final KeyPathPostfix getPostfix(int i) { swift_key_path_component_postfix(this, i, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { + swift_key_path_component_name(this, result) or + swift_key_path_component_postfix(this, _, result) + } + } + /** A class representing `key_path_expression` nodes. */ class KeyPathExpression extends @swift_key_path_expression, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "KeyPathExpression" } - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { swift_key_path_expression_child(this, i, result) } + /** Gets the node corresponding to the field `component`. */ + final KeyPathComponent getComponent(int i) { + swift_key_path_expression_component(this, i, result) + } + + /** Gets the node corresponding to the field `type`. */ + final AstNode getType() { swift_key_path_expression_type(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { swift_key_path_expression_child(this, _, result) } + final override AstNode getAFieldOrChild() { + swift_key_path_expression_component(this, _, result) or + swift_key_path_expression_type(this, result) + } + } + + /** A class representing `key_path_postfix` nodes. */ + class KeyPathPostfix extends @swift_key_path_postfix, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "KeyPathPostfix" } + + /** Gets the node corresponding to the field `argument`. */ + final ValueArgument getArgument(int i) { swift_key_path_postfix_argument(this, i, result) } + + /** Gets the node corresponding to the field `force_unwrap`. */ + final Bang getForceUnwrap() { swift_key_path_postfix_force_unwrap(this, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { + swift_key_path_postfix_argument(this, _, result) or + swift_key_path_postfix_force_unwrap(this, result) + } } /** A class representing `key_path_string_expression` nodes. */ @@ -1569,7 +1716,7 @@ module Swift { final override string getAPrimaryQlClass() { result = "LambdaFunctionType" } /** Gets the node corresponding to the field `async`. */ - final AsyncKeyword getAsync() { swift_lambda_function_type_async(this, result) } + final ReservedWord getAsync() { swift_lambda_function_type_async(this, result) } /** Gets the node corresponding to the field `params`. */ final LambdaFunctionTypeParameters getParams() { @@ -1703,19 +1850,39 @@ module Swift { /** Gets the node corresponding to the field `definition`. */ final MacroDefinition getDefinition() { swift_macro_declaration_definition(this, result) } + /** Gets the node corresponding to the field `modifiers`. */ + final Modifiers getModifiers() { swift_macro_declaration_modifiers(this, result) } + + /** Gets the node corresponding to the field `name`. */ + final SimpleIdentifier getName() { swift_macro_declaration_def(this, result) } + /** Gets the node corresponding to the field `parameter`. */ final Parameter getParameter(int i) { swift_macro_declaration_parameter(this, i, result) } - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { swift_macro_declaration_child(this, i, result) } + /** Gets the node corresponding to the field `return_type`. */ + final UnannotatedType getReturnType() { swift_macro_declaration_return_type(this, result) } + + /** Gets the node corresponding to the field `type_constraints`. */ + final TypeConstraints getTypeConstraints() { + swift_macro_declaration_type_constraints(this, result) + } + + /** Gets the node corresponding to the field `type_parameters`. */ + final TypeParameters getTypeParameters() { + swift_macro_declaration_type_parameters(this, result) + } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_macro_declaration_attribute(this, _, result) or swift_macro_declaration_default_value(this, _, result) or swift_macro_declaration_definition(this, result) or + swift_macro_declaration_modifiers(this, result) or + swift_macro_declaration_def(this, result) or swift_macro_declaration_parameter(this, _, result) or - swift_macro_declaration_child(this, _, result) + swift_macro_declaration_return_type(this, result) or + swift_macro_declaration_type_constraints(this, result) or + swift_macro_declaration_type_parameters(this, result) } } @@ -1870,15 +2037,15 @@ module Swift { final override string getAPrimaryQlClass() { result = "NavigationExpression" } /** Gets the node corresponding to the field `suffix`. */ - final NavigationSuffix getSuffix() { swift_navigation_expression_def(this, result) } + final NavigationSuffix getSuffix() { swift_navigation_expression_def(this, result, _) } /** Gets the node corresponding to the field `target`. */ - final AstNode getTarget(int i) { swift_navigation_expression_target(this, i, result) } + final AstNode getTarget() { swift_navigation_expression_def(this, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_navigation_expression_def(this, result) or - swift_navigation_expression_target(this, _, result) + swift_navigation_expression_def(this, result, _) or + swift_navigation_expression_def(this, _, result) } } @@ -2089,20 +2256,37 @@ module Swift { } } + /** A class representing `parenthesized_type` nodes. */ + class ParenthesizedType extends @swift_parenthesized_type, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "ParenthesizedType" } + + /** Gets the node corresponding to the field `type`. */ + final AstNode getType() { swift_parenthesized_type_def(this, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { swift_parenthesized_type_def(this, result) } + } + /** A class representing `pattern` nodes. */ class Pattern extends @swift_pattern, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Pattern" } + /** Gets the node corresponding to the field `binding`. */ + final ValueBindingPattern getBinding() { swift_pattern_binding(this, result) } + /** Gets the node corresponding to the field `bound_identifier`. */ final SimpleIdentifier getBoundIdentifier() { swift_pattern_bound_identifier(this, result) } - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { swift_pattern_child(this, i, result) } + /** Gets the node corresponding to the field `kind`. */ + final AstNode getKind() { swift_pattern_def(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_pattern_bound_identifier(this, result) or swift_pattern_child(this, _, result) + swift_pattern_binding(this, result) or + swift_pattern_bound_identifier(this, result) or + swift_pattern_def(this, result) } } @@ -2223,6 +2407,9 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PropertyDeclaration" } + /** Gets the node corresponding to the field `binding`. */ + final ValueBindingPattern getBinding() { swift_property_declaration_def(this, result) } + /** Gets the node corresponding to the field `computed_value`. */ final ComputedProperty getComputedValue(int i) { swift_property_declaration_computed_value(this, i, result) @@ -2234,19 +2421,32 @@ module Swift { /** Gets the node corresponding to the field `name`. */ final Pattern getName(int i) { swift_property_declaration_name(this, i, result) } + /** Gets the node corresponding to the field `observers`. */ + final WillsetDidsetBlock getObservers(int i) { + swift_property_declaration_observers(this, i, result) + } + + /** Gets the node corresponding to the field `type`. */ + final TypeAnnotation getType(int i) { swift_property_declaration_type(this, i, result) } + + /** Gets the node corresponding to the field `type_constraints`. */ + final TypeConstraints getTypeConstraints(int i) { + swift_property_declaration_type_constraints(this, i, result) + } + /** Gets the node corresponding to the field `value`. */ 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) } - /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { + swift_property_declaration_def(this, result) or swift_property_declaration_computed_value(this, _, result) or swift_property_declaration_modifiers(this, _, result) or swift_property_declaration_name(this, _, result) or - swift_property_declaration_value(this, _, result) or - swift_property_declaration_child(this, _, result) + swift_property_declaration_observers(this, _, result) or + swift_property_declaration_type(this, _, result) or + swift_property_declaration_type_constraints(this, _, result) or + swift_property_declaration_value(this, _, result) } } @@ -2300,6 +2500,11 @@ module Swift { ) } + /** Gets the node corresponding to the field `inherits`. */ + final InheritanceSpecifier getInherits(int i) { + swift_protocol_declaration_inherits(this, i, result) + } + /** Gets the node corresponding to the field `modifiers`. */ final Modifiers getModifiers() { swift_protocol_declaration_modifiers(this, result) } @@ -2316,18 +2521,15 @@ module Swift { swift_protocol_declaration_type_parameters(this, result) } - /** Gets the `i`th child of this node. */ - final InheritanceSpecifier getChild(int i) { swift_protocol_declaration_child(this, i, result) } - /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_protocol_declaration_attribute(this, _, result) or swift_protocol_declaration_def(this, result, _, _) or + swift_protocol_declaration_inherits(this, _, result) or swift_protocol_declaration_modifiers(this, result) or swift_protocol_declaration_def(this, _, _, result) or swift_protocol_declaration_type_constraints(this, result) or - swift_protocol_declaration_type_parameters(this, result) or - swift_protocol_declaration_child(this, _, result) + swift_protocol_declaration_type_parameters(this, result) } } @@ -2337,7 +2539,7 @@ module Swift { final override string getAPrimaryQlClass() { result = "ProtocolFunctionDeclaration" } /** Gets the node corresponding to the field `async`. */ - final AsyncKeyword getAsync() { swift_protocol_function_declaration_async(this, result) } + final ReservedWord getAsync() { swift_protocol_function_declaration_async(this, result) } /** Gets the node corresponding to the field `attribute`. */ final Attribute getAttribute(int i) { @@ -2630,6 +2832,23 @@ module Swift { final override string getAPrimaryQlClass() { result = "SimpleIdentifier" } } + /** A class representing `simple_user_type` nodes. */ + class SimpleUserType extends @swift_simple_user_type, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "SimpleUserType" } + + /** Gets the node corresponding to the field `arguments`. */ + final TypeArguments getArguments() { swift_simple_user_type_arguments(this, result) } + + /** Gets the node corresponding to the field `name`. */ + final TypeIdentifier getName() { swift_simple_user_type_def(this, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { + swift_simple_user_type_arguments(this, result) or swift_simple_user_type_def(this, result) + } + } + /** A class representing `source_file` nodes. */ class SourceFile extends @swift_source_file, AstNode { /** Gets the name of the primary QL class for this element. */ @@ -2748,11 +2967,29 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SwitchEntry" } - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { swift_switch_entry_child(this, i, result) } + /** Gets the node corresponding to the field `body`. */ + final Statements getBody() { swift_switch_entry_def(this, result) } + + /** Gets the node corresponding to the field `default`. */ + final DefaultKeyword getDefault() { swift_switch_entry_default(this, result) } + + /** Gets the node corresponding to the field `modifiers`. */ + final Modifiers getModifiers() { swift_switch_entry_modifiers(this, result) } + + /** Gets the node corresponding to the field `pattern`. */ + final SwitchPattern getPattern(int i) { swift_switch_entry_pattern(this, i, result) } + + /** Gets the node corresponding to the field `where`. */ + final WhereClause getWhere() { swift_switch_entry_where(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { swift_switch_entry_child(this, _, result) } + final override AstNode getAFieldOrChild() { + swift_switch_entry_def(this, result) or + swift_switch_entry_default(this, result) or + swift_switch_entry_modifiers(this, result) or + swift_switch_entry_pattern(this, _, result) or + swift_switch_entry_where(this, result) + } } /** A class representing `switch_pattern` nodes. */ @@ -2760,8 +2997,8 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SwitchPattern" } - /** Gets the child of this node. */ - final Pattern getChild() { swift_switch_pattern_def(this, result) } + /** Gets the node corresponding to the field `pattern`. */ + final Pattern getPattern() { swift_switch_pattern_def(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_switch_pattern_def(this, result) } @@ -2870,6 +3107,35 @@ module Swift { } } + /** A class representing `tuple_pattern` nodes. */ + class TuplePattern extends @swift_tuple_pattern, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "TuplePattern" } + + /** Gets the node corresponding to the field `item`. */ + final TuplePatternItem getItem(int i) { swift_tuple_pattern_item(this, i, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { swift_tuple_pattern_item(this, _, result) } + } + + /** A class representing `tuple_pattern_item` nodes. */ + class TuplePatternItem extends @swift_tuple_pattern_item, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "TuplePatternItem" } + + /** Gets the node corresponding to the field `name`. */ + final SimpleIdentifier getName() { swift_tuple_pattern_item_name(this, result) } + + /** Gets the node corresponding to the field `pattern`. */ + final Pattern getPattern() { swift_tuple_pattern_item_def(this, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { + swift_tuple_pattern_item_name(this, result) or swift_tuple_pattern_item_def(this, result) + } + } + /** A class representing `tuple_type` nodes. */ class TupleType extends @swift_tuple_type, AstNode { /** Gets the name of the primary QL class for this element. */ @@ -2878,13 +3144,8 @@ module Swift { /** Gets the node corresponding to the field `element`. */ final TupleTypeItem getElement(int i) { swift_tuple_type_element(this, i, result) } - /** Gets the child of this node. */ - final TupleTypeItem getChild() { swift_tuple_type_child(this, result) } - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - swift_tuple_type_element(this, _, result) or swift_tuple_type_child(this, result) - } + final override AstNode getAFieldOrChild() { swift_tuple_type_element(this, _, result) } } /** A class representing `tuple_type_item` nodes. */ @@ -2892,6 +3153,9 @@ 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 `external_name`. */ + final WildcardPattern getExternalName() { swift_tuple_type_item_external_name(this, result) } + /** Gets the node corresponding to the field `modifiers`. */ final ParameterModifiers getModifiers() { swift_tuple_type_item_modifiers(this, result) } @@ -2899,17 +3163,14 @@ module Swift { final SimpleIdentifier getName() { swift_tuple_type_item_name(this, result) } /** Gets the node corresponding to the field `type`. */ - final Type getType() { swift_tuple_type_item_type(this, result) } - - /** Gets the child of this node. */ - final AstNode getChild() { swift_tuple_type_item_child(this, result) } + final AstNode getType() { swift_tuple_type_item_def(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { + swift_tuple_type_item_external_name(this, result) or swift_tuple_type_item_modifiers(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) + swift_tuple_type_item_def(this, result) } } @@ -2954,6 +3215,24 @@ module Swift { final override AstNode getAFieldOrChild() { swift_type_arguments_argument(this, _, result) } } + /** A class representing `type_casting_pattern` nodes. */ + class TypeCastingPattern extends @swift_type_casting_pattern, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "TypeCastingPattern" } + + /** Gets the node corresponding to the field `pattern`. */ + final Pattern getPattern() { swift_type_casting_pattern_pattern(this, result) } + + /** Gets the node corresponding to the field `type`. */ + final Type getType() { swift_type_casting_pattern_def(this, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { + swift_type_casting_pattern_pattern(this, result) or + swift_type_casting_pattern_def(this, result) + } + } + /** A class representing `type_constraint` nodes. */ class TypeConstraint extends @swift_type_constraint, AstNode { /** Gets the name of the primary QL class for this element. */ @@ -3119,7 +3398,7 @@ module Swift { final override string getAPrimaryQlClass() { result = "UserType" } /** Gets the node corresponding to the field `part`. */ - final AstNode getPart(int i) { swift_user_type_part(this, i, result) } + final SimpleUserType getPart(int i) { swift_user_type_part(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_user_type_part(this, _, result) } @@ -3158,8 +3437,8 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ValueArgumentLabel" } - /** Gets the child of this node. */ - final SimpleIdentifier getChild() { swift_value_argument_label_def(this, result) } + /** Gets the node corresponding to the field `name`. */ + final SimpleIdentifier getName() { swift_value_argument_label_def(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_value_argument_label_def(this, result) } diff --git a/unified/ql/lib/unified.dbscheme b/unified/ql/lib/unified.dbscheme index 1dfd0395e21..0c3f023b001 100644 --- a/unified/ql/lib/unified.dbscheme +++ b/unified/ql/lib/unified.dbscheme @@ -250,31 +250,33 @@ swift_attribute_def( int name: @swift_user_type ref ); -@swift_availability_condition_child_type = @swift_identifier | @swift_token_integer_literal - #keyset[swift_availability_condition, index] -swift_availability_condition_child( +swift_availability_condition_platform( int swift_availability_condition: @swift_availability_condition ref, int index: int ref, - unique int child: @swift_availability_condition_child_type ref + unique int platform: @swift_identifier ref +); + +#keyset[swift_availability_condition, index] +swift_availability_condition_version( + int swift_availability_condition: @swift_availability_condition ref, + int index: int ref, + unique int version: @swift_token_integer_literal ref ); swift_availability_condition_def( unique int id: @swift_availability_condition ); -swift_await_expression_expr( - unique int swift_await_expression: @swift_await_expression ref, - unique int expr: @swift_expression ref -); - -swift_await_expression_child( - unique int swift_await_expression: @swift_await_expression ref, - unique int child: @swift_expression ref -); - swift_await_expression_def( - unique int id: @swift_await_expression + unique int id: @swift_await_expression, + int expr: @swift_expression ref +); + +swift_binding_pattern_def( + unique int id: @swift_binding_pattern, + int binding: @swift_value_binding_pattern ref, + int pattern: @swift_pattern ref ); case @swift_bitwise_operation.op of @@ -293,27 +295,22 @@ swift_bitwise_operation_def( int rhs: @swift_expression ref ); -swift_call_expression_function( - unique int swift_call_expression: @swift_call_expression ref, - unique int function: @swift_expression ref -); - -swift_call_expression_suffix( - unique int swift_call_expression: @swift_call_expression ref, - unique int suffix: @swift_call_suffix ref -); - -@swift_call_expression_child_type = @swift_call_suffix | @swift_expression - -#keyset[swift_call_expression, index] -swift_call_expression_child( - int swift_call_expression: @swift_call_expression ref, - int index: int ref, - unique int child: @swift_call_expression_child_type ref -); - swift_call_expression_def( - unique int id: @swift_call_expression + unique int id: @swift_call_expression, + int function: @swift_expression ref, + int suffix: @swift_call_suffix ref +); + +swift_call_suffix_arguments( + unique int swift_call_suffix: @swift_call_suffix ref, + unique int arguments: @swift_value_arguments ref +); + +#keyset[swift_call_suffix, index] +swift_call_suffix_lambda( + int swift_call_suffix: @swift_call_suffix ref, + int index: int ref, + unique int lambda: @swift_lambda_literal ref ); #keyset[swift_call_suffix, index] @@ -323,15 +320,6 @@ swift_call_suffix_name( unique int name: @swift_token_simple_identifier ref ); -@swift_call_suffix_child_type = @swift_lambda_literal | @swift_value_arguments - -#keyset[swift_call_suffix, index] -swift_call_suffix_child( - int swift_call_suffix: @swift_call_suffix ref, - int index: int ref, - unique int child: @swift_call_suffix_child_type ref -); - swift_call_suffix_def( unique int id: @swift_call_suffix ); @@ -364,6 +352,21 @@ swift_capture_list_item_def( int name: @swift_capture_list_item_name_type ref ); +swift_case_pattern_arguments( + unique int swift_case_pattern: @swift_case_pattern ref, + unique int arguments: @swift_tuple_pattern ref +); + +swift_case_pattern_type( + unique int swift_case_pattern: @swift_case_pattern ref, + unique int type__: @swift_user_type ref +); + +swift_case_pattern_def( + unique int id: @swift_case_pattern, + int name: @swift_token_simple_identifier ref +); + swift_catch_block_body( unique int swift_catch_block: @swift_catch_block ref, unique int body: @swift_statements ref @@ -403,13 +406,6 @@ swift_class_body_member( unique int member: @swift_type_level_declaration ref ); -#keyset[swift_class_body, index] -swift_class_body_child( - int swift_class_body: @swift_class_body ref, - int index: int ref, - unique int child: @swift_token_multiline_comment ref -); - swift_class_body_def( unique int id: @swift_class_body ); @@ -432,6 +428,13 @@ case @swift_class_declaration.declaration_kind of ; +#keyset[swift_class_declaration, index] +swift_class_declaration_inherits( + int swift_class_declaration: @swift_class_declaration ref, + int index: int ref, + unique int inherits: @swift_inheritance_specifier ref +); + @swift_class_declaration_modifiers_type = @swift_attribute | @swift_modifiers | @swift_token_inheritance_modifier | @swift_token_ownership_modifier | @swift_token_property_behavior_modifier #keyset[swift_class_declaration, index] @@ -453,13 +456,6 @@ swift_class_declaration_type_parameters( unique int type_parameters: @swift_type_parameters ref ); -#keyset[swift_class_declaration, index] -swift_class_declaration_child( - int swift_class_declaration: @swift_class_declaration ref, - int index: int ref, - unique int child: @swift_inheritance_specifier ref -); - swift_class_declaration_def( unique int id: @swift_class_declaration, int body: @swift_class_declaration_body_type ref, @@ -482,6 +478,49 @@ swift_comparison_expression_def( int rhs: @swift_expression ref ); +swift_compilation_condition_inner( + unique int swift_compilation_condition: @swift_compilation_condition ref, + unique int inner: @swift_compilation_condition ref +); + +swift_compilation_condition_lhs( + unique int swift_compilation_condition: @swift_compilation_condition ref, + unique int lhs: @swift_compilation_condition ref +); + +#keyset[swift_compilation_condition, index] +swift_compilation_condition_name( + int swift_compilation_condition: @swift_compilation_condition ref, + int index: int ref, + unique int name: @swift_token_simple_identifier ref +); + +swift_compilation_condition_operand( + unique int swift_compilation_condition: @swift_compilation_condition ref, + unique int operand: @swift_compilation_condition ref +); + +swift_compilation_condition_rhs( + unique int swift_compilation_condition: @swift_compilation_condition ref, + unique int rhs: @swift_compilation_condition ref +); + +swift_compilation_condition_value( + unique int swift_compilation_condition: @swift_compilation_condition ref, + unique int value: @swift_token_boolean_literal ref +); + +#keyset[swift_compilation_condition, index] +swift_compilation_condition_version( + int swift_compilation_condition: @swift_compilation_condition ref, + int index: int ref, + unique int version: @swift_token_integer_literal ref +); + +swift_compilation_condition_def( + unique int id: @swift_compilation_condition +); + #keyset[swift_computed_getter, index] swift_computed_getter_attribute( int swift_computed_getter: @swift_computed_getter ref, @@ -576,6 +615,18 @@ swift_constructor_expression_def( int suffix: @swift_constructor_suffix ref ); +swift_constructor_suffix_arguments( + unique int swift_constructor_suffix: @swift_constructor_suffix ref, + unique int arguments: @swift_value_arguments ref +); + +#keyset[swift_constructor_suffix, index] +swift_constructor_suffix_lambda( + int swift_constructor_suffix: @swift_constructor_suffix ref, + int index: int ref, + unique int lambda: @swift_lambda_literal ref +); + #keyset[swift_constructor_suffix, index] swift_constructor_suffix_name( int swift_constructor_suffix: @swift_constructor_suffix ref, @@ -583,42 +634,20 @@ swift_constructor_suffix_name( unique int name: @swift_token_simple_identifier ref ); -@swift_constructor_suffix_child_type = @swift_lambda_literal | @swift_value_arguments - -#keyset[swift_constructor_suffix, index] -swift_constructor_suffix_child( - int swift_constructor_suffix: @swift_constructor_suffix ref, - int index: int ref, - unique int child: @swift_constructor_suffix_child_type ref -); - swift_constructor_suffix_def( unique int id: @swift_constructor_suffix ); -@swift_control_transfer_statement_kind_type = @swift_reserved_word - -swift_control_transfer_statement_kind( - unique int swift_control_transfer_statement: @swift_control_transfer_statement ref, - unique int kind: @swift_control_transfer_statement_kind_type ref -); +@swift_control_transfer_statement_kind_type = @swift_reserved_word | @swift_token_throw_keyword swift_control_transfer_statement_result( unique int swift_control_transfer_statement: @swift_control_transfer_statement ref, unique int result: @swift_expression ref ); -@swift_control_transfer_statement_child_type = @swift_expression | @swift_token_throw_keyword - -#keyset[swift_control_transfer_statement, index] -swift_control_transfer_statement_child( - int swift_control_transfer_statement: @swift_control_transfer_statement ref, - int index: int ref, - unique int child: @swift_control_transfer_statement_child_type ref -); - swift_control_transfer_statement_def( - unique int id: @swift_control_transfer_statement + unique int id: @swift_control_transfer_statement, + int kind: @swift_control_transfer_statement_kind_type ref ); swift_deinit_declaration_modifiers( @@ -631,13 +660,13 @@ swift_deinit_declaration_def( int body: @swift_function_body ref ); -@swift_deprecated_operator_declaration_body_child_type = @swift_line_string_literal | @swift_multi_line_string_literal | @swift_raw_string_literal | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_simple_identifier +@swift_deprecated_operator_declaration_body_entry_type = @swift_line_string_literal | @swift_multi_line_string_literal | @swift_raw_string_literal | @swift_reserved_word | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_simple_identifier #keyset[swift_deprecated_operator_declaration_body, index] -swift_deprecated_operator_declaration_body_child( +swift_deprecated_operator_declaration_body_entry( int swift_deprecated_operator_declaration_body: @swift_deprecated_operator_declaration_body ref, int index: int ref, - unique int child: @swift_deprecated_operator_declaration_body_child_type ref + unique int entry: @swift_deprecated_operator_declaration_body_entry_type ref ); swift_deprecated_operator_declaration_body_def( @@ -687,13 +716,9 @@ swift_didset_clause_def( unique int id: @swift_didset_clause ); -@swift_directive_child_type = @swift_token_boolean_literal | @swift_token_integer_literal | @swift_token_simple_identifier - -#keyset[swift_directive, index] -swift_directive_child( - int swift_directive: @swift_directive ref, - int index: int ref, - unique int child: @swift_directive_child_type ref +swift_directive_condition( + unique int swift_directive: @swift_directive ref, + unique int condition: @swift_compilation_condition ref ); swift_directive_def( @@ -776,13 +801,31 @@ swift_enum_entry_def( unique int id: @swift_enum_entry ); -@swift_enum_type_parameters_child_type = @swift_expression | @swift_token_wildcard_pattern | @swift_type__ +swift_enum_type_parameter_default_value( + unique int swift_enum_type_parameter: @swift_enum_type_parameter ref, + unique int default_value: @swift_expression ref +); + +swift_enum_type_parameter_external_name( + unique int swift_enum_type_parameter: @swift_enum_type_parameter ref, + unique int external_name: @swift_token_wildcard_pattern ref +); + +swift_enum_type_parameter_name( + unique int swift_enum_type_parameter: @swift_enum_type_parameter ref, + unique int name: @swift_token_simple_identifier ref +); + +swift_enum_type_parameter_def( + unique int id: @swift_enum_type_parameter, + int type__: @swift_type__ ref +); #keyset[swift_enum_type_parameters, index] -swift_enum_type_parameters_child( +swift_enum_type_parameters_parameter( int swift_enum_type_parameters: @swift_enum_type_parameters ref, int index: int ref, - unique int child: @swift_enum_type_parameters_child_type ref + unique int parameter: @swift_enum_type_parameter ref ); swift_enum_type_parameters_def( @@ -868,7 +911,7 @@ swift_function_body_def( swift_function_declaration_async( unique int swift_function_declaration: @swift_function_declaration ref, - unique int async: @swift_token_async_keyword ref + unique int async: @swift_reserved_word ref ); #keyset[swift_function_declaration, index] @@ -935,7 +978,7 @@ swift_function_declaration_def( swift_function_type_async( unique int swift_function_type: @swift_function_type ref, - unique int async: @swift_token_async_keyword ref + unique int async: @swift_reserved_word ref ); @swift_function_type_throws_type = @swift_throws_clause | @swift_token_throws @@ -1006,9 +1049,9 @@ swift_if_condition_def( int kind: @swift_if_condition_kind_type ref ); -swift_if_let_binding_bound_identifier( +swift_if_let_binding_type( unique int swift_if_let_binding: @swift_if_let_binding ref, - unique int bound_identifier: @swift_token_simple_identifier ref + unique int type__: @swift_type_annotation ref ); swift_if_let_binding_value( @@ -1021,17 +1064,9 @@ swift_if_let_binding_where( unique int where: @swift_where_clause ref ); -@swift_if_let_binding_child_type = @swift_pattern | @swift_token_simple_identifier | @swift_token_wildcard_pattern | @swift_type__ | @swift_type_annotation | @swift_user_type | @swift_value_binding_pattern - -#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 child: @swift_if_let_binding_child_type ref -); - swift_if_let_binding_def( - unique int id: @swift_if_let_binding + unique int id: @swift_if_let_binding, + int pattern: @swift_pattern ref ); #keyset[swift_if_statement, index] @@ -1110,7 +1145,7 @@ swift_inheritance_specifier_def( swift_init_declaration_async( unique int swift_init_declaration: @swift_init_declaration ref, - unique int async: @swift_token_async_keyword ref + unique int async: @swift_reserved_word ref ); #keyset[swift_init_declaration, index] @@ -1202,19 +1237,56 @@ swift_interpolated_expression_def( unique int id: @swift_interpolated_expression ); -@swift_key_path_expression_child_type = @swift_array_type | @swift_dictionary_type | @swift_token_bang | @swift_token_simple_identifier | @swift_token_type_identifier | @swift_type_arguments | @swift_value_argument +swift_key_path_component_name( + unique int swift_key_path_component: @swift_key_path_component ref, + unique int name: @swift_token_simple_identifier ref +); + +#keyset[swift_key_path_component, index] +swift_key_path_component_postfix( + int swift_key_path_component: @swift_key_path_component ref, + int index: int ref, + unique int postfix: @swift_key_path_postfix ref +); + +swift_key_path_component_def( + unique int id: @swift_key_path_component +); #keyset[swift_key_path_expression, index] -swift_key_path_expression_child( +swift_key_path_expression_component( int swift_key_path_expression: @swift_key_path_expression ref, int index: int ref, - unique int child: @swift_key_path_expression_child_type ref + unique int component: @swift_key_path_component ref +); + +@swift_key_path_expression_type_type = @swift_array_type | @swift_dictionary_type | @swift_simple_user_type + +swift_key_path_expression_type( + unique int swift_key_path_expression: @swift_key_path_expression ref, + unique int type__: @swift_key_path_expression_type_type ref ); swift_key_path_expression_def( unique int id: @swift_key_path_expression ); +#keyset[swift_key_path_postfix, index] +swift_key_path_postfix_argument( + int swift_key_path_postfix: @swift_key_path_postfix ref, + int index: int ref, + unique int argument: @swift_value_argument ref +); + +swift_key_path_postfix_force_unwrap( + unique int swift_key_path_postfix: @swift_key_path_postfix ref, + unique int force_unwrap: @swift_token_bang ref +); + +swift_key_path_postfix_def( + unique int id: @swift_key_path_postfix +); + swift_key_path_string_expression_def( unique int id: @swift_key_path_string_expression, int expr: @swift_expression ref @@ -1222,7 +1294,7 @@ swift_key_path_string_expression_def( swift_lambda_function_type_async( unique int swift_lambda_function_type: @swift_lambda_function_type ref, - unique int async: @swift_token_async_keyword ref + unique int async: @swift_reserved_word ref ); swift_lambda_function_type_params( @@ -1350,6 +1422,11 @@ swift_macro_declaration_definition( unique int definition: @swift_macro_definition ref ); +swift_macro_declaration_modifiers( + unique int swift_macro_declaration: @swift_macro_declaration ref, + unique int modifiers: @swift_modifiers ref +); + #keyset[swift_macro_declaration, index] swift_macro_declaration_parameter( int swift_macro_declaration: @swift_macro_declaration ref, @@ -1357,17 +1434,24 @@ swift_macro_declaration_parameter( unique int parameter: @swift_parameter ref ); -@swift_macro_declaration_child_type = @swift_modifiers | @swift_token_simple_identifier | @swift_type_constraints | @swift_type_parameters | @swift_unannotated_type +swift_macro_declaration_return_type( + unique int swift_macro_declaration: @swift_macro_declaration ref, + unique int return_type: @swift_unannotated_type ref +); -#keyset[swift_macro_declaration, index] -swift_macro_declaration_child( - int swift_macro_declaration: @swift_macro_declaration ref, - int index: int ref, - unique int child: @swift_macro_declaration_child_type ref +swift_macro_declaration_type_constraints( + unique int swift_macro_declaration: @swift_macro_declaration ref, + unique int type_constraints: @swift_type_constraints ref +); + +swift_macro_declaration_type_parameters( + unique int swift_macro_declaration: @swift_macro_declaration ref, + unique int type_parameters: @swift_type_parameters ref ); swift_macro_declaration_def( - unique int id: @swift_macro_declaration + unique int id: @swift_macro_declaration, + int name: @swift_token_simple_identifier ref ); @swift_macro_definition_body_type = @swift_expression | @swift_external_macro_definition @@ -1449,18 +1533,12 @@ swift_multiplicative_expression_def( int rhs: @swift_expression ref ); -@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( - int swift_navigation_expression: @swift_navigation_expression ref, - int index: int ref, - unique int target: @swift_navigation_expression_target_type ref -); +@swift_navigation_expression_target_type = @swift_array_type | @swift_dictionary_type | @swift_expression | @swift_parenthesized_type | @swift_user_type swift_navigation_expression_def( unique int id: @swift_navigation_expression, - int suffix: @swift_navigation_suffix ref + int suffix: @swift_navigation_suffix ref, + int target: @swift_navigation_expression_target_type ref ); @swift_navigation_suffix_suffix_type = @swift_token_integer_literal | @swift_token_simple_identifier @@ -1567,22 +1645,28 @@ swift_parameter_modifiers_def( unique int id: @swift_parameter_modifiers ); +@swift_parenthesized_type_type_type = @swift_dictionary_type | @swift_existential_type | @swift_opaque_type + +swift_parenthesized_type_def( + unique int id: @swift_parenthesized_type, + int type__: @swift_parenthesized_type_type_type ref +); + +swift_pattern_binding( + unique int swift_pattern: @swift_pattern ref, + unique int binding: @swift_value_binding_pattern ref +); + swift_pattern_bound_identifier( unique int swift_pattern: @swift_pattern ref, unique int bound_identifier: @swift_token_simple_identifier ref ); -@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( - int swift_pattern: @swift_pattern ref, - int index: int ref, - unique int child: @swift_pattern_child_type ref -); +@swift_pattern_kind_type = @swift_binding_pattern | @swift_case_pattern | @swift_expression | @swift_token_wildcard_pattern | @swift_tuple_pattern | @swift_type_casting_pattern swift_pattern_def( - unique int id: @swift_pattern + unique int id: @swift_pattern, + int kind: @swift_pattern_kind_type ref ); #keyset[swift_playground_literal, index] @@ -1671,6 +1755,27 @@ swift_property_declaration_name( unique int name: @swift_pattern ref ); +#keyset[swift_property_declaration, index] +swift_property_declaration_observers( + int swift_property_declaration: @swift_property_declaration ref, + int index: int ref, + unique int observers: @swift_willset_didset_block ref +); + +#keyset[swift_property_declaration, index] +swift_property_declaration_type( + int swift_property_declaration: @swift_property_declaration ref, + int index: int ref, + unique int type__: @swift_type_annotation ref +); + +#keyset[swift_property_declaration, index] +swift_property_declaration_type_constraints( + int swift_property_declaration: @swift_property_declaration ref, + int index: int ref, + unique int type_constraints: @swift_type_constraints ref +); + #keyset[swift_property_declaration, index] swift_property_declaration_value( int swift_property_declaration: @swift_property_declaration ref, @@ -1678,17 +1783,9 @@ swift_property_declaration_value( unique int value: @swift_expression ref ); -@swift_property_declaration_child_type = @swift_type_annotation | @swift_type_constraints | @swift_value_binding_pattern | @swift_willset_didset_block - -#keyset[swift_property_declaration, index] -swift_property_declaration_child( - int swift_property_declaration: @swift_property_declaration ref, - int index: int ref, - unique int child: @swift_property_declaration_child_type ref -); - swift_property_declaration_def( - unique int id: @swift_property_declaration + unique int id: @swift_property_declaration, + int binding: @swift_value_binding_pattern ref ); #keyset[swift_protocol_body, index] @@ -1725,6 +1822,13 @@ case @swift_protocol_declaration.declaration_kind of ; +#keyset[swift_protocol_declaration, index] +swift_protocol_declaration_inherits( + int swift_protocol_declaration: @swift_protocol_declaration ref, + int index: int ref, + unique int inherits: @swift_inheritance_specifier ref +); + swift_protocol_declaration_modifiers( unique int swift_protocol_declaration: @swift_protocol_declaration ref, unique int modifiers: @swift_modifiers ref @@ -1740,13 +1844,6 @@ swift_protocol_declaration_type_parameters( unique int type_parameters: @swift_type_parameters ref ); -#keyset[swift_protocol_declaration, index] -swift_protocol_declaration_child( - int swift_protocol_declaration: @swift_protocol_declaration ref, - int index: int ref, - unique int child: @swift_inheritance_specifier ref -); - swift_protocol_declaration_def( unique int id: @swift_protocol_declaration, int body: @swift_protocol_body ref, @@ -1756,7 +1853,7 @@ swift_protocol_declaration_def( swift_protocol_function_declaration_async( unique int swift_protocol_function_declaration: @swift_protocol_function_declaration ref, - unique int async: @swift_token_async_keyword ref + unique int async: @swift_reserved_word ref ); #keyset[swift_protocol_function_declaration, index] @@ -1946,6 +2043,16 @@ swift_setter_specifier_def( unique int id: @swift_setter_specifier ); +swift_simple_user_type_arguments( + unique int swift_simple_user_type: @swift_simple_user_type ref, + unique int arguments: @swift_type_arguments ref +); + +swift_simple_user_type_def( + unique int id: @swift_simple_user_type, + int name: @swift_token_type_identifier ref +); + swift_source_file_shebang( unique int swift_source_file: @swift_source_file ref, unique int shebang: @swift_token_shebang_line ref @@ -2030,22 +2137,36 @@ swift_suppressed_constraint_def( int suppressed: @swift_token_type_identifier ref ); -@swift_switch_entry_child_type = @swift_expression | @swift_modifiers | @swift_statements | @swift_switch_pattern | @swift_token_default_keyword | @swift_token_where_keyword +swift_switch_entry_default( + unique int swift_switch_entry: @swift_switch_entry ref, + unique int default: @swift_token_default_keyword ref +); + +swift_switch_entry_modifiers( + unique int swift_switch_entry: @swift_switch_entry ref, + unique int modifiers: @swift_modifiers ref +); #keyset[swift_switch_entry, index] -swift_switch_entry_child( +swift_switch_entry_pattern( int swift_switch_entry: @swift_switch_entry ref, int index: int ref, - unique int child: @swift_switch_entry_child_type ref + unique int pattern: @swift_switch_pattern ref +); + +swift_switch_entry_where( + unique int swift_switch_entry: @swift_switch_entry ref, + unique int where: @swift_where_clause ref ); swift_switch_entry_def( - unique int id: @swift_switch_entry + unique int id: @swift_switch_entry, + int body: @swift_statements ref ); swift_switch_pattern_def( unique int id: @swift_switch_pattern, - int child: @swift_pattern ref + int pattern: @swift_pattern ref ); #keyset[swift_switch_statement, index] @@ -2096,6 +2217,27 @@ swift_tuple_expression_def( unique int id: @swift_tuple_expression ); +#keyset[swift_tuple_pattern, index] +swift_tuple_pattern_item( + int swift_tuple_pattern: @swift_tuple_pattern ref, + int index: int ref, + unique int item: @swift_tuple_pattern_item ref +); + +swift_tuple_pattern_def( + unique int id: @swift_tuple_pattern +); + +swift_tuple_pattern_item_name( + unique int swift_tuple_pattern_item: @swift_tuple_pattern_item ref, + unique int name: @swift_token_simple_identifier ref +); + +swift_tuple_pattern_item_def( + unique int id: @swift_tuple_pattern_item, + int pattern: @swift_pattern ref +); + #keyset[swift_tuple_type, index] swift_tuple_type_element( int swift_tuple_type: @swift_tuple_type ref, @@ -2103,15 +2245,15 @@ swift_tuple_type_element( unique int element: @swift_tuple_type_item ref ); -swift_tuple_type_child( - unique int swift_tuple_type: @swift_tuple_type ref, - unique int child: @swift_tuple_type_item ref -); - swift_tuple_type_def( unique int id: @swift_tuple_type ); +swift_tuple_type_item_external_name( + unique int swift_tuple_type_item: @swift_tuple_type_item ref, + unique int external_name: @swift_token_wildcard_pattern ref +); + swift_tuple_type_item_modifiers( unique int swift_tuple_type_item: @swift_tuple_type_item ref, unique int modifiers: @swift_parameter_modifiers ref @@ -2122,20 +2264,11 @@ swift_tuple_type_item_name( unique int name: @swift_token_simple_identifier ref ); -swift_tuple_type_item_type( - unique int swift_tuple_type_item: @swift_tuple_type_item ref, - unique int type__: @swift_type__ ref -); - -@swift_tuple_type_item_child_type = @swift_dictionary_type | @swift_existential_type | @swift_opaque_type | @swift_token_wildcard_pattern - -swift_tuple_type_item_child( - unique int swift_tuple_type_item: @swift_tuple_type_item ref, - unique int child: @swift_tuple_type_item_child_type ref -); +@swift_tuple_type_item_type_type = @swift_dictionary_type | @swift_existential_type | @swift_opaque_type | @swift_type__ swift_tuple_type_item_def( - unique int id: @swift_tuple_type_item + unique int id: @swift_tuple_type_item, + int type__: @swift_tuple_type_item_type_type ref ); swift_type_modifiers( @@ -2166,6 +2299,16 @@ swift_type_arguments_def( unique int id: @swift_type_arguments ); +swift_type_casting_pattern_pattern( + unique int swift_type_casting_pattern: @swift_type_casting_pattern ref, + unique int pattern: @swift_pattern ref +); + +swift_type_casting_pattern_def( + unique int id: @swift_type_casting_pattern, + int type__: @swift_type__ ref +); + @swift_type_constraint_constraint_type = @swift_equality_constraint | @swift_inheritance_constraint swift_type_constraint_def( @@ -2274,13 +2417,11 @@ swift_typealias_declaration_def( @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_part_type = @swift_token_type_identifier | @swift_type_arguments - #keyset[swift_user_type, index] swift_user_type_part( int swift_user_type: @swift_user_type ref, int index: int ref, - unique int part: @swift_user_type_part_type ref + unique int part: @swift_simple_user_type ref ); swift_user_type_def( @@ -2315,7 +2456,7 @@ swift_value_argument_def( swift_value_argument_label_def( unique int id: @swift_value_argument_label, - int child: @swift_token_simple_identifier ref + int name: @swift_token_simple_identifier ref ); #keyset[swift_value_arguments, index] @@ -2462,7 +2603,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_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 = @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_binding_pattern | @swift_bitwise_operation | @swift_call_expression | @swift_call_suffix | @swift_capture_list | @swift_capture_list_item | @swift_case_pattern | @swift_catch_block | @swift_check_expression | @swift_class_body | @swift_class_declaration | @swift_comparison_expression | @swift_compilation_condition | @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_parameter | @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_component | @swift_key_path_expression | @swift_key_path_postfix | @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_parenthesized_type | @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_simple_user_type | @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_pattern | @swift_tuple_pattern_item | @swift_tuple_type | @swift_tuple_type_item | @swift_type__ | @swift_type_annotation | @swift_type_arguments | @swift_type_casting_pattern | @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,