diff --git a/ql/extractor/src/generator.rs b/ql/extractor/src/generator.rs index 96ce5319dd19..7f8ca718344c 100644 --- a/ql/extractor/src/generator.rs +++ b/ql/extractor/src/generator.rs @@ -44,6 +44,7 @@ pub fn run(options: Options) -> std::io::Result<()> { languages, options.dbscheme, options.library, + false, // do not use facade AST "run 'scripts/create-extractor-pack.sh' in ql/", ) } diff --git a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll index e2aedc401f7a..51424106719d 100644 --- a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll +++ b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll @@ -25,8 +25,10 @@ private predicate discardLocation(@location_default loc) { overlay[local] module QL { + private module F = QL; + /** The base class for all AST nodes */ - private class AstNodeImpl extends @ql_ast_node { + class AstNode extends @ql_ast_node { /** Gets a string representation of this element. */ string toString() { result = this.getAPrimaryQlClass() } @@ -34,13 +36,13 @@ module QL { final L::Location getLocation() { ql_ast_node_location(this, result) } /** Gets the parent of this element. */ - final AstNode getParent() { ql_ast_node_parent(this, result, _) } + final F::AstNode getParent() { ql_ast_node_parent(this, result, _) } /** Gets the index of this node among the children of its parent. */ final int getParentIndex() { ql_ast_node_parent(this, _, result) } /** Gets a field or child node of this node. */ - AstNode getAFieldOrChild() { none() } + F::AstNode getAFieldOrChild() { none() } /** Gets the name of the primary QL class for this element. */ string getAPrimaryQlClass() { result = "???" } @@ -49,10 +51,8 @@ module QL { string getPrimaryQlClasses() { result = concat(this.getAPrimaryQlClass(), ",") } } - final class AstNode = AstNodeImpl; - /** A token. */ - private class TokenImpl extends @ql_token, AstNodeImpl { + class Token extends @ql_token, F::AstNode { /** Gets the value of this token. */ final string getValue() { ql_tokeninfo(this, _, result) } @@ -63,10 +63,8 @@ module QL { override string getAPrimaryQlClass() { result = "Token" } } - final class Token = TokenImpl; - /** A reserved word. */ - final class ReservedWord extends @ql_reserved_word, TokenImpl { + class ReservedWord extends @ql_reserved_word, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ReservedWord" } } @@ -92,21 +90,21 @@ module QL { } /** A class representing `add_expr` nodes. */ - final class AddExpr extends @ql_add_expr, AstNodeImpl { + class AddExpr extends @ql_add_expr, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AddExpr" } /** Gets the node corresponding to the field `left`. */ - final AstNode getLeft() { ql_add_expr_def(this, result, _, _) } + final F::AstNode getLeft() { ql_add_expr_def(this, result, _, _) } /** Gets the node corresponding to the field `right`. */ - final AstNode getRight() { ql_add_expr_def(this, _, result, _) } + final F::AstNode getRight() { ql_add_expr_def(this, _, result, _) } /** Gets the child of this node. */ - final Addop getChild() { ql_add_expr_def(this, _, _, result) } + final F::Addop getChild() { ql_add_expr_def(this, _, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_add_expr_def(this, result, _, _) or ql_add_expr_def(this, _, result, _) or ql_add_expr_def(this, _, _, result) @@ -114,211 +112,237 @@ module QL { } /** A class representing `addop` tokens. */ - final class Addop extends @ql_token_addop, TokenImpl { + class Addop extends @ql_token_addop, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Addop" } } /** A class representing `aggId` tokens. */ - final class AggId extends @ql_token_agg_id, TokenImpl { + class AggId extends @ql_token_agg_id, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AggId" } } /** A class representing `aggregate` nodes. */ - final class Aggregate extends @ql_aggregate, AstNodeImpl { + class Aggregate extends @ql_aggregate, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Aggregate" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_aggregate_child(this, i, result) } + final F::AstNode getChild(int i) { ql_aggregate_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_aggregate_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_aggregate_child(this, _, result) } } /** A class representing `annotArg` nodes. */ - final class AnnotArg extends @ql_annot_arg, AstNodeImpl { + class AnnotArg extends @ql_annot_arg, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AnnotArg" } /** Gets the child of this node. */ - final AstNode getChild() { ql_annot_arg_def(this, result) } + final F::AstNode getChild() { ql_annot_arg_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_annot_arg_def(this, result) } + final override F::AstNode getAFieldOrChild() { ql_annot_arg_def(this, result) } } /** A class representing `annotName` tokens. */ - final class AnnotName extends @ql_token_annot_name, TokenImpl { + class AnnotName extends @ql_token_annot_name, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AnnotName" } } /** A class representing `annotation` nodes. */ - final class Annotation extends @ql_annotation, AstNodeImpl { + class Annotation extends @ql_annotation, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Annotation" } /** Gets the node corresponding to the field `args`. */ - final AstNode getArgs(int i) { ql_annotation_args(this, i, result) } + final F::AstNode getArgs(int i) { ql_annotation_args(this, i, result) } + + /** Gets the node corresponding to the field `args`. */ + final F::AstNode getAnArgs() { result = this.getArgs(_) } /** Gets the node corresponding to the field `name`. */ - final AnnotName getName() { ql_annotation_def(this, result) } + final F::AnnotName getName() { ql_annotation_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_annotation_args(this, _, result) or ql_annotation_def(this, result) } } /** A class representing `aritylessPredicateExpr` nodes. */ - final class AritylessPredicateExpr extends @ql_arityless_predicate_expr, AstNodeImpl { + class AritylessPredicateExpr extends @ql_arityless_predicate_expr, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AritylessPredicateExpr" } /** Gets the node corresponding to the field `name`. */ - final LiteralId getName() { ql_arityless_predicate_expr_def(this, result) } + final F::LiteralId getName() { ql_arityless_predicate_expr_def(this, result) } /** Gets the node corresponding to the field `qualifier`. */ - final ModuleExpr getQualifier() { ql_arityless_predicate_expr_qualifier(this, result) } + final F::ModuleExpr getQualifier() { ql_arityless_predicate_expr_qualifier(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_arityless_predicate_expr_def(this, result) or ql_arityless_predicate_expr_qualifier(this, result) } } /** A class representing `asExpr` nodes. */ - final class AsExpr extends @ql_as_expr, AstNodeImpl { + class AsExpr extends @ql_as_expr, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AsExpr" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_as_expr_child(this, i, result) } + final F::AstNode getChild(int i) { ql_as_expr_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_as_expr_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_as_expr_child(this, _, result) } } /** A class representing `asExprs` nodes. */ - final class AsExprs extends @ql_as_exprs, AstNodeImpl { + class AsExprs extends @ql_as_exprs, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AsExprs" } /** Gets the `i`th child of this node. */ - final AsExpr getChild(int i) { ql_as_exprs_child(this, i, result) } + final F::AsExpr getChild(int i) { ql_as_exprs_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AsExpr getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_as_exprs_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_as_exprs_child(this, _, result) } } /** A class representing `block_comment` tokens. */ - final class BlockComment extends @ql_token_block_comment, TokenImpl { + class BlockComment extends @ql_token_block_comment, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BlockComment" } } /** A class representing `body` nodes. */ - final class Body extends @ql_body, AstNodeImpl { + class Body extends @ql_body, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Body" } /** Gets the child of this node. */ - final AstNode getChild() { ql_body_def(this, result) } + final F::AstNode getChild() { ql_body_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_body_def(this, result) } + final override F::AstNode getAFieldOrChild() { ql_body_def(this, result) } } /** A class representing `bool` nodes. */ - final class Bool extends @ql_bool, AstNodeImpl { + class Bool extends @ql_bool, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Bool" } /** Gets the child of this node. */ - final AstNode getChild() { ql_bool_def(this, result) } + final F::AstNode getChild() { ql_bool_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_bool_def(this, result) } + final override F::AstNode getAFieldOrChild() { ql_bool_def(this, result) } } /** A class representing `call_body` nodes. */ - final class CallBody extends @ql_call_body, AstNodeImpl { + class CallBody extends @ql_call_body, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CallBody" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_call_body_child(this, i, result) } + final F::AstNode getChild(int i) { ql_call_body_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_call_body_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_call_body_child(this, _, result) } } /** A class representing `call_or_unqual_agg_expr` nodes. */ - final class CallOrUnqualAggExpr extends @ql_call_or_unqual_agg_expr, AstNodeImpl { + class CallOrUnqualAggExpr extends @ql_call_or_unqual_agg_expr, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CallOrUnqualAggExpr" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_call_or_unqual_agg_expr_child(this, i, result) } + final F::AstNode getChild(int i) { ql_call_or_unqual_agg_expr_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_call_or_unqual_agg_expr_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { + ql_call_or_unqual_agg_expr_child(this, _, result) + } } /** A class representing `charpred` nodes. */ - final class Charpred extends @ql_charpred, AstNodeImpl { + class Charpred extends @ql_charpred, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Charpred" } /** Gets the node corresponding to the field `body`. */ - final AstNode getBody() { ql_charpred_def(this, result, _) } + final F::AstNode getBody() { ql_charpred_def(this, result, _) } /** Gets the child of this node. */ - final ClassName getChild() { ql_charpred_def(this, _, result) } + final F::ClassName getChild() { ql_charpred_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_charpred_def(this, result, _) or ql_charpred_def(this, _, result) } } /** A class representing `classMember` nodes. */ - final class ClassMember extends @ql_class_member, AstNodeImpl { + class ClassMember extends @ql_class_member, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ClassMember" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_class_member_child(this, i, result) } + final F::AstNode getChild(int i) { ql_class_member_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_class_member_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_class_member_child(this, _, result) } } /** A class representing `className` tokens. */ - final class ClassName extends @ql_token_class_name, TokenImpl { + class ClassName extends @ql_token_class_name, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ClassName" } } /** A class representing `classlessPredicate` nodes. */ - final class ClasslessPredicate extends @ql_classless_predicate, AstNodeImpl { + class ClasslessPredicate extends @ql_classless_predicate, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ClasslessPredicate" } /** Gets the node corresponding to the field `name`. */ - final PredicateName getName() { ql_classless_predicate_def(this, result, _) } + final F::PredicateName getName() { ql_classless_predicate_def(this, result, _) } /** Gets the node corresponding to the field `returnType`. */ - final AstNode getReturnType() { ql_classless_predicate_def(this, _, result) } + final F::AstNode getReturnType() { ql_classless_predicate_def(this, _, result) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_classless_predicate_child(this, i, result) } + final F::AstNode getChild(int i) { ql_classless_predicate_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_classless_predicate_def(this, result, _) or ql_classless_predicate_def(this, _, result) or ql_classless_predicate_child(this, _, result) @@ -326,27 +350,27 @@ module QL { } /** A class representing `closure` tokens. */ - final class Closure extends @ql_token_closure, TokenImpl { + class Closure extends @ql_token_closure, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Closure" } } /** A class representing `comp_term` nodes. */ - final class CompTerm extends @ql_comp_term, AstNodeImpl { + class CompTerm extends @ql_comp_term, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CompTerm" } /** Gets the node corresponding to the field `left`. */ - final AstNode getLeft() { ql_comp_term_def(this, result, _, _) } + final F::AstNode getLeft() { ql_comp_term_def(this, result, _, _) } /** Gets the node corresponding to the field `right`. */ - final AstNode getRight() { ql_comp_term_def(this, _, result, _) } + final F::AstNode getRight() { ql_comp_term_def(this, _, result, _) } /** Gets the child of this node. */ - final Compop getChild() { ql_comp_term_def(this, _, _, result) } + final F::Compop getChild() { ql_comp_term_def(this, _, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_comp_term_def(this, result, _, _) or ql_comp_term_def(this, _, result, _) or ql_comp_term_def(this, _, _, result) @@ -354,47 +378,56 @@ module QL { } /** A class representing `compop` tokens. */ - final class Compop extends @ql_token_compop, TokenImpl { + class Compop extends @ql_token_compop, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Compop" } } /** A class representing `conjunction` nodes. */ - final class Conjunction extends @ql_conjunction, AstNodeImpl { + class Conjunction extends @ql_conjunction, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Conjunction" } /** Gets the node corresponding to the field `left`. */ - final AstNode getLeft() { ql_conjunction_def(this, result, _) } + final F::AstNode getLeft() { ql_conjunction_def(this, result, _) } /** Gets the node corresponding to the field `right`. */ - final AstNode getRight() { ql_conjunction_def(this, _, result) } + final F::AstNode getRight() { ql_conjunction_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_conjunction_def(this, result, _) or ql_conjunction_def(this, _, result) } } /** A class representing `dataclass` nodes. */ - final class Dataclass extends @ql_dataclass, AstNodeImpl { + class Dataclass extends @ql_dataclass, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Dataclass" } /** Gets the node corresponding to the field `extends`. */ - final AstNode getExtends(int i) { ql_dataclass_extends(this, i, result) } + final F::AstNode getExtends(int i) { ql_dataclass_extends(this, i, result) } + + /** Gets the node corresponding to the field `extends`. */ + final F::AstNode getAnExtends() { result = this.getExtends(_) } + + /** Gets the node corresponding to the field `instanceof`. */ + final F::AstNode getInstanceof(int i) { ql_dataclass_instanceof(this, i, result) } /** Gets the node corresponding to the field `instanceof`. */ - final AstNode getInstanceof(int i) { ql_dataclass_instanceof(this, i, result) } + final F::AstNode getAnInstanceof() { result = this.getInstanceof(_) } /** Gets the node corresponding to the field `name`. */ - final ClassName getName() { ql_dataclass_def(this, result) } + final F::ClassName getName() { ql_dataclass_def(this, result) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_dataclass_child(this, i, result) } + final F::AstNode getChild(int i) { ql_dataclass_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_dataclass_extends(this, _, result) or ql_dataclass_instanceof(this, _, result) or ql_dataclass_def(this, result) or @@ -403,119 +436,125 @@ module QL { } /** A class representing `datatype` nodes. */ - final class Datatype extends @ql_datatype, AstNodeImpl { + class Datatype extends @ql_datatype, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Datatype" } /** Gets the node corresponding to the field `name`. */ - final ClassName getName() { ql_datatype_def(this, result, _) } + final F::ClassName getName() { ql_datatype_def(this, result, _) } /** Gets the child of this node. */ - final DatatypeBranches getChild() { ql_datatype_def(this, _, result) } + final F::DatatypeBranches getChild() { ql_datatype_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_datatype_def(this, result, _) or ql_datatype_def(this, _, result) } } /** A class representing `datatypeBranch` nodes. */ - final class DatatypeBranch extends @ql_datatype_branch, AstNodeImpl { + class DatatypeBranch extends @ql_datatype_branch, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "DatatypeBranch" } /** Gets the node corresponding to the field `name`. */ - final ClassName getName() { ql_datatype_branch_def(this, result) } + final F::ClassName getName() { ql_datatype_branch_def(this, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getChild(int i) { ql_datatype_branch_child(this, i, result) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_datatype_branch_child(this, i, result) } + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_datatype_branch_def(this, result) or ql_datatype_branch_child(this, _, result) } } /** A class representing `datatypeBranches` nodes. */ - final class DatatypeBranches extends @ql_datatype_branches, AstNodeImpl { + class DatatypeBranches extends @ql_datatype_branches, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "DatatypeBranches" } /** Gets the `i`th child of this node. */ - final DatatypeBranch getChild(int i) { ql_datatype_branches_child(this, i, result) } + final F::DatatypeBranch getChild(int i) { ql_datatype_branches_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::DatatypeBranch getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_datatype_branches_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_datatype_branches_child(this, _, result) } } /** A class representing `dbtype` tokens. */ - final class Dbtype extends @ql_token_dbtype, TokenImpl { + class Dbtype extends @ql_token_dbtype, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Dbtype" } } /** A class representing `direction` tokens. */ - final class Direction extends @ql_token_direction, TokenImpl { + class Direction extends @ql_token_direction, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Direction" } } /** A class representing `disjunction` nodes. */ - final class Disjunction extends @ql_disjunction, AstNodeImpl { + class Disjunction extends @ql_disjunction, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Disjunction" } /** Gets the node corresponding to the field `left`. */ - final AstNode getLeft() { ql_disjunction_def(this, result, _) } + final F::AstNode getLeft() { ql_disjunction_def(this, result, _) } /** Gets the node corresponding to the field `right`. */ - final AstNode getRight() { ql_disjunction_def(this, _, result) } + final F::AstNode getRight() { ql_disjunction_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_disjunction_def(this, result, _) or ql_disjunction_def(this, _, result) } } /** A class representing `empty` tokens. */ - final class Empty extends @ql_token_empty, TokenImpl { + class Empty extends @ql_token_empty, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Empty" } } /** A class representing `expr_aggregate_body` nodes. */ - final class ExprAggregateBody extends @ql_expr_aggregate_body, AstNodeImpl { + class ExprAggregateBody extends @ql_expr_aggregate_body, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ExprAggregateBody" } /** Gets the node corresponding to the field `asExprs`. */ - final AsExprs getAsExprs() { ql_expr_aggregate_body_def(this, result) } + final F::AsExprs getAsExprs() { ql_expr_aggregate_body_def(this, result) } /** Gets the node corresponding to the field `orderBys`. */ - final OrderBys getOrderBys() { ql_expr_aggregate_body_order_bys(this, result) } + final F::OrderBys getOrderBys() { ql_expr_aggregate_body_order_bys(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_expr_aggregate_body_def(this, result) or ql_expr_aggregate_body_order_bys(this, result) } } /** A class representing `expr_annotation` nodes. */ - final class ExprAnnotation extends @ql_expr_annotation, AstNodeImpl { + class ExprAnnotation extends @ql_expr_annotation, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ExprAnnotation" } /** Gets the node corresponding to the field `annot_arg`. */ - final AnnotName getAnnotArg() { ql_expr_annotation_def(this, result, _, _) } + final F::AnnotName getAnnotArg() { ql_expr_annotation_def(this, result, _, _) } /** Gets the node corresponding to the field `name`. */ - final AnnotName getName() { ql_expr_annotation_def(this, _, result, _) } + final F::AnnotName getName() { ql_expr_annotation_def(this, _, result, _) } /** Gets the child of this node. */ - final AstNode getChild() { ql_expr_annotation_def(this, _, _, result) } + final F::AstNode getChild() { ql_expr_annotation_def(this, _, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_expr_annotation_def(this, result, _, _) or ql_expr_annotation_def(this, _, result, _) or ql_expr_annotation_def(this, _, _, result) @@ -523,48 +562,51 @@ module QL { } /** A class representing `false` tokens. */ - final class False extends @ql_token_false, TokenImpl { + class False extends @ql_token_false, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "False" } } /** A class representing `field` nodes. */ - final class Field extends @ql_field, AstNodeImpl { + class Field extends @ql_field, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Field" } /** Gets the child of this node. */ - final VarDecl getChild() { ql_field_def(this, result) } + final F::VarDecl getChild() { ql_field_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_field_def(this, result) } + final override F::AstNode getAFieldOrChild() { ql_field_def(this, result) } } /** A class representing `float` tokens. */ - final class Float extends @ql_token_float, TokenImpl { + class Float extends @ql_token_float, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Float" } } /** A class representing `full_aggregate_body` nodes. */ - final class FullAggregateBody extends @ql_full_aggregate_body, AstNodeImpl { + class FullAggregateBody extends @ql_full_aggregate_body, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "FullAggregateBody" } /** Gets the node corresponding to the field `asExprs`. */ - final AsExprs getAsExprs() { ql_full_aggregate_body_as_exprs(this, result) } + final F::AsExprs getAsExprs() { ql_full_aggregate_body_as_exprs(this, result) } /** Gets the node corresponding to the field `guard`. */ - final AstNode getGuard() { ql_full_aggregate_body_guard(this, result) } + final F::AstNode getGuard() { ql_full_aggregate_body_guard(this, result) } /** Gets the node corresponding to the field `orderBys`. */ - final OrderBys getOrderBys() { ql_full_aggregate_body_order_bys(this, result) } + final F::OrderBys getOrderBys() { ql_full_aggregate_body_order_bys(this, result) } /** Gets the `i`th child of this node. */ - final VarDecl getChild(int i) { ql_full_aggregate_body_child(this, i, result) } + final F::VarDecl getChild(int i) { ql_full_aggregate_body_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::VarDecl getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_full_aggregate_body_as_exprs(this, result) or ql_full_aggregate_body_guard(this, result) or ql_full_aggregate_body_order_bys(this, result) or @@ -573,38 +615,41 @@ module QL { } /** A class representing `higherOrderTerm` nodes. */ - final class HigherOrderTerm extends @ql_higher_order_term, AstNodeImpl { + class HigherOrderTerm extends @ql_higher_order_term, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "HigherOrderTerm" } /** Gets the node corresponding to the field `name`. */ - final LiteralId getName() { ql_higher_order_term_def(this, result) } + final F::LiteralId getName() { ql_higher_order_term_def(this, result) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_higher_order_term_child(this, i, result) } + final F::AstNode getChild(int i) { ql_higher_order_term_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_higher_order_term_def(this, result) or ql_higher_order_term_child(this, _, result) } } /** A class representing `if_term` nodes. */ - final class IfTerm extends @ql_if_term, AstNodeImpl { + class IfTerm extends @ql_if_term, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "IfTerm" } /** Gets the node corresponding to the field `cond`. */ - final AstNode getCond() { ql_if_term_def(this, result, _, _) } + final F::AstNode getCond() { ql_if_term_def(this, result, _, _) } /** Gets the node corresponding to the field `first`. */ - final AstNode getFirst() { ql_if_term_def(this, _, result, _) } + final F::AstNode getFirst() { ql_if_term_def(this, _, result, _) } /** Gets the node corresponding to the field `second`. */ - final AstNode getSecond() { ql_if_term_def(this, _, _, result) } + final F::AstNode getSecond() { ql_if_term_def(this, _, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_if_term_def(this, result, _, _) or ql_if_term_def(this, _, result, _) or ql_if_term_def(this, _, _, result) @@ -612,126 +657,138 @@ module QL { } /** A class representing `implication` nodes. */ - final class Implication extends @ql_implication, AstNodeImpl { + class Implication extends @ql_implication, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Implication" } /** Gets the node corresponding to the field `left`. */ - final AstNode getLeft() { ql_implication_def(this, result, _) } + final F::AstNode getLeft() { ql_implication_def(this, result, _) } /** Gets the node corresponding to the field `right`. */ - final AstNode getRight() { ql_implication_def(this, _, result) } + final F::AstNode getRight() { ql_implication_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_implication_def(this, result, _) or ql_implication_def(this, _, result) } } /** A class representing `importDirective` nodes. */ - final class ImportDirective extends @ql_import_directive, AstNodeImpl { + class ImportDirective extends @ql_import_directive, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ImportDirective" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_import_directive_child(this, i, result) } + final F::AstNode getChild(int i) { ql_import_directive_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_import_directive_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_import_directive_child(this, _, result) } } /** A class representing `importModuleExpr` nodes. */ - final class ImportModuleExpr extends @ql_import_module_expr, AstNodeImpl { + class ImportModuleExpr extends @ql_import_module_expr, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ImportModuleExpr" } /** Gets the node corresponding to the field `qualName`. */ - final SimpleId getQualName(int i) { ql_import_module_expr_qual_name(this, i, result) } + final F::SimpleId getQualName(int i) { ql_import_module_expr_qual_name(this, i, result) } + + /** Gets the node corresponding to the field `qualName`. */ + final F::SimpleId getAQualName() { result = this.getQualName(_) } /** Gets the child of this node. */ - final ModuleExpr getChild() { ql_import_module_expr_def(this, result) } + final F::ModuleExpr getChild() { ql_import_module_expr_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_import_module_expr_qual_name(this, _, result) or ql_import_module_expr_def(this, result) } } /** A class representing `in_expr` nodes. */ - final class InExpr extends @ql_in_expr, AstNodeImpl { + class InExpr extends @ql_in_expr, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "InExpr" } /** Gets the node corresponding to the field `left`. */ - final AstNode getLeft() { ql_in_expr_def(this, result, _) } + final F::AstNode getLeft() { ql_in_expr_def(this, result, _) } /** Gets the node corresponding to the field `right`. */ - final AstNode getRight() { ql_in_expr_def(this, _, result) } + final F::AstNode getRight() { ql_in_expr_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_in_expr_def(this, result, _) or ql_in_expr_def(this, _, result) } } /** A class representing `instance_of` nodes. */ - final class InstanceOf extends @ql_instance_of, AstNodeImpl { + class InstanceOf extends @ql_instance_of, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "InstanceOf" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_instance_of_child(this, i, result) } + final F::AstNode getChild(int i) { ql_instance_of_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_instance_of_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_instance_of_child(this, _, result) } } /** A class representing `integer` tokens. */ - final class Integer extends @ql_token_integer, TokenImpl { + class Integer extends @ql_token_integer, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Integer" } } /** A class representing `line_comment` tokens. */ - final class LineComment extends @ql_token_line_comment, TokenImpl { + class LineComment extends @ql_token_line_comment, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "LineComment" } } /** A class representing `literal` nodes. */ - final class Literal extends @ql_literal, AstNodeImpl { + class Literal extends @ql_literal, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Literal" } /** Gets the child of this node. */ - final AstNode getChild() { ql_literal_def(this, result) } + final F::AstNode getChild() { ql_literal_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_literal_def(this, result) } + final override F::AstNode getAFieldOrChild() { ql_literal_def(this, result) } } /** A class representing `literalId` tokens. */ - final class LiteralId extends @ql_token_literal_id, TokenImpl { + class LiteralId extends @ql_token_literal_id, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "LiteralId" } } /** A class representing `memberPredicate` nodes. */ - final class MemberPredicate extends @ql_member_predicate, AstNodeImpl { + class MemberPredicate extends @ql_member_predicate, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "MemberPredicate" } /** Gets the node corresponding to the field `name`. */ - final PredicateName getName() { ql_member_predicate_def(this, result, _) } + final F::PredicateName getName() { ql_member_predicate_def(this, result, _) } /** Gets the node corresponding to the field `returnType`. */ - final AstNode getReturnType() { ql_member_predicate_def(this, _, result) } + final F::AstNode getReturnType() { ql_member_predicate_def(this, _, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getChild(int i) { ql_member_predicate_child(this, i, result) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_member_predicate_child(this, i, result) } + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_member_predicate_def(this, result, _) or ql_member_predicate_def(this, _, result) or ql_member_predicate_child(this, _, result) @@ -739,24 +796,33 @@ module QL { } /** A class representing `module` nodes. */ - final class Module extends @ql_module, AstNodeImpl { + class Module extends @ql_module, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Module" } /** Gets the node corresponding to the field `implements`. */ - final SignatureExpr getImplements(int i) { ql_module_implements(this, i, result) } + final F::SignatureExpr getImplements(int i) { ql_module_implements(this, i, result) } + + /** Gets the node corresponding to the field `implements`. */ + final F::SignatureExpr getAnImplements() { result = this.getImplements(_) } /** Gets the node corresponding to the field `name`. */ - final ModuleName getName() { ql_module_def(this, result) } + final F::ModuleName getName() { ql_module_def(this, result) } + + /** Gets the node corresponding to the field `parameter`. */ + final F::ModuleParam getParameter(int i) { ql_module_parameter(this, i, result) } /** Gets the node corresponding to the field `parameter`. */ - final ModuleParam getParameter(int i) { ql_module_parameter(this, i, result) } + final F::ModuleParam getAParameter() { result = this.getParameter(_) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_module_child(this, i, result) } + final F::AstNode getChild(int i) { ql_module_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_module_implements(this, _, result) or ql_module_def(this, result) or ql_module_parameter(this, _, result) or @@ -765,108 +831,114 @@ module QL { } /** A class representing `moduleAliasBody` nodes. */ - final class ModuleAliasBody extends @ql_module_alias_body, AstNodeImpl { + class ModuleAliasBody extends @ql_module_alias_body, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ModuleAliasBody" } /** Gets the child of this node. */ - final ModuleExpr getChild() { ql_module_alias_body_def(this, result) } + final F::ModuleExpr getChild() { ql_module_alias_body_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_module_alias_body_def(this, result) } + final override F::AstNode getAFieldOrChild() { ql_module_alias_body_def(this, result) } } /** A class representing `moduleExpr` nodes. */ - final class ModuleExpr extends @ql_module_expr, AstNodeImpl { + class ModuleExpr extends @ql_module_expr, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ModuleExpr" } /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { ql_module_expr_name(this, result) } + final F::AstNode getName() { ql_module_expr_name(this, result) } /** Gets the child of this node. */ - final AstNode getChild() { ql_module_expr_def(this, result) } + final F::AstNode getChild() { ql_module_expr_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_module_expr_name(this, result) or ql_module_expr_def(this, result) } } /** A class representing `moduleInstantiation` nodes. */ - final class ModuleInstantiation extends @ql_module_instantiation, AstNodeImpl { + class ModuleInstantiation extends @ql_module_instantiation, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ModuleInstantiation" } /** Gets the node corresponding to the field `name`. */ - final ModuleName getName() { ql_module_instantiation_def(this, result) } + final F::ModuleName getName() { ql_module_instantiation_def(this, result) } /** Gets the `i`th child of this node. */ - final SignatureExpr getChild(int i) { ql_module_instantiation_child(this, i, result) } + final F::SignatureExpr getChild(int i) { ql_module_instantiation_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::SignatureExpr getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_module_instantiation_def(this, result) or ql_module_instantiation_child(this, _, result) } } /** A class representing `moduleMember` nodes. */ - final class ModuleMember extends @ql_module_member, AstNodeImpl { + class ModuleMember extends @ql_module_member, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ModuleMember" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_module_member_child(this, i, result) } + final F::AstNode getChild(int i) { ql_module_member_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_module_member_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_module_member_child(this, _, result) } } /** A class representing `moduleName` nodes. */ - final class ModuleName extends @ql_module_name, AstNodeImpl { + class ModuleName extends @ql_module_name, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ModuleName" } /** Gets the child of this node. */ - final SimpleId getChild() { ql_module_name_def(this, result) } + final F::SimpleId getChild() { ql_module_name_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_module_name_def(this, result) } + final override F::AstNode getAFieldOrChild() { ql_module_name_def(this, result) } } /** A class representing `moduleParam` nodes. */ - final class ModuleParam extends @ql_module_param, AstNodeImpl { + class ModuleParam extends @ql_module_param, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ModuleParam" } /** Gets the node corresponding to the field `parameter`. */ - final SimpleId getParameter() { ql_module_param_def(this, result, _) } + final F::SimpleId getParameter() { ql_module_param_def(this, result, _) } /** Gets the node corresponding to the field `signature`. */ - final SignatureExpr getSignature() { ql_module_param_def(this, _, result) } + final F::SignatureExpr getSignature() { ql_module_param_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_module_param_def(this, result, _) or ql_module_param_def(this, _, result) } } /** A class representing `mul_expr` nodes. */ - final class MulExpr extends @ql_mul_expr, AstNodeImpl { + class MulExpr extends @ql_mul_expr, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "MulExpr" } /** Gets the node corresponding to the field `left`. */ - final AstNode getLeft() { ql_mul_expr_def(this, result, _, _) } + final F::AstNode getLeft() { ql_mul_expr_def(this, result, _, _) } /** Gets the node corresponding to the field `right`. */ - final AstNode getRight() { ql_mul_expr_def(this, _, result, _) } + final F::AstNode getRight() { ql_mul_expr_def(this, _, result, _) } /** Gets the child of this node. */ - final Mulop getChild() { ql_mul_expr_def(this, _, _, result) } + final F::Mulop getChild() { ql_mul_expr_def(this, _, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_mul_expr_def(this, result, _, _) or ql_mul_expr_def(this, _, result, _) or ql_mul_expr_def(this, _, _, result) @@ -874,179 +946,203 @@ module QL { } /** A class representing `mulop` tokens. */ - final class Mulop extends @ql_token_mulop, TokenImpl { + class Mulop extends @ql_token_mulop, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Mulop" } } /** A class representing `negation` nodes. */ - final class Negation extends @ql_negation, AstNodeImpl { + class Negation extends @ql_negation, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Negation" } /** Gets the child of this node. */ - final AstNode getChild() { ql_negation_def(this, result) } + final F::AstNode getChild() { ql_negation_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_negation_def(this, result) } + final override F::AstNode getAFieldOrChild() { ql_negation_def(this, result) } } /** A class representing `orderBy` nodes. */ - final class OrderBy extends @ql_order_by, AstNodeImpl { + class OrderBy extends @ql_order_by, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "OrderBy" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_order_by_child(this, i, result) } + final F::AstNode getChild(int i) { ql_order_by_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_order_by_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_order_by_child(this, _, result) } } /** A class representing `orderBys` nodes. */ - final class OrderBys extends @ql_order_bys, AstNodeImpl { + class OrderBys extends @ql_order_bys, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "OrderBys" } /** Gets the `i`th child of this node. */ - final OrderBy getChild(int i) { ql_order_bys_child(this, i, result) } + final F::OrderBy getChild(int i) { ql_order_bys_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::OrderBy getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_order_bys_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_order_bys_child(this, _, result) } } /** A class representing `par_expr` nodes. */ - final class ParExpr extends @ql_par_expr, AstNodeImpl { + class ParExpr extends @ql_par_expr, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ParExpr" } /** Gets the child of this node. */ - final AstNode getChild() { ql_par_expr_def(this, result) } + final F::AstNode getChild() { ql_par_expr_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_par_expr_def(this, result) } + final override F::AstNode getAFieldOrChild() { ql_par_expr_def(this, result) } } /** A class representing `predicate` tokens. */ - final class Predicate extends @ql_token_predicate, TokenImpl { + class Predicate extends @ql_token_predicate, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Predicate" } } /** A class representing `predicateAliasBody` nodes. */ - final class PredicateAliasBody extends @ql_predicate_alias_body, AstNodeImpl { + class PredicateAliasBody extends @ql_predicate_alias_body, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PredicateAliasBody" } /** Gets the child of this node. */ - final PredicateExpr getChild() { ql_predicate_alias_body_def(this, result) } + final F::PredicateExpr getChild() { ql_predicate_alias_body_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_predicate_alias_body_def(this, result) } + final override F::AstNode getAFieldOrChild() { ql_predicate_alias_body_def(this, result) } } /** A class representing `predicateExpr` nodes. */ - final class PredicateExpr extends @ql_predicate_expr, AstNodeImpl { + class PredicateExpr extends @ql_predicate_expr, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PredicateExpr" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_predicate_expr_child(this, i, result) } + final F::AstNode getChild(int i) { ql_predicate_expr_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_predicate_expr_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_predicate_expr_child(this, _, result) } } /** A class representing `predicateName` tokens. */ - final class PredicateName extends @ql_token_predicate_name, TokenImpl { + class PredicateName extends @ql_token_predicate_name, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PredicateName" } } /** A class representing `prefix_cast` nodes. */ - final class PrefixCast extends @ql_prefix_cast, AstNodeImpl { + class PrefixCast extends @ql_prefix_cast, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PrefixCast" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_prefix_cast_child(this, i, result) } + final F::AstNode getChild(int i) { ql_prefix_cast_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_prefix_cast_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_prefix_cast_child(this, _, result) } } /** A class representing `primitiveType` tokens. */ - final class PrimitiveType extends @ql_token_primitive_type, TokenImpl { + class PrimitiveType extends @ql_token_primitive_type, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PrimitiveType" } } /** A class representing `ql` nodes. */ - final class Ql extends @ql_ql, AstNodeImpl { + class Ql extends @ql_ql, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Ql" } /** Gets the `i`th child of this node. */ - final ModuleMember getChild(int i) { ql_ql_child(this, i, result) } + final F::ModuleMember getChild(int i) { ql_ql_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::ModuleMember getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_ql_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_ql_child(this, _, result) } } /** A class representing `qldoc` tokens. */ - final class Qldoc extends @ql_token_qldoc, TokenImpl { + class Qldoc extends @ql_token_qldoc, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Qldoc" } } /** A class representing `qualifiedRhs` nodes. */ - final class QualifiedRhs extends @ql_qualified_rhs, AstNodeImpl { + class QualifiedRhs extends @ql_qualified_rhs, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "QualifiedRhs" } /** Gets the node corresponding to the field `name`. */ - final PredicateName getName() { ql_qualified_rhs_name(this, result) } + final F::PredicateName getName() { ql_qualified_rhs_name(this, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getChild(int i) { ql_qualified_rhs_child(this, i, result) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_qualified_rhs_child(this, i, result) } + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_qualified_rhs_name(this, result) or ql_qualified_rhs_child(this, _, result) } } /** A class representing `qualified_expr` nodes. */ - final class QualifiedExpr extends @ql_qualified_expr, AstNodeImpl { + class QualifiedExpr extends @ql_qualified_expr, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "QualifiedExpr" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_qualified_expr_child(this, i, result) } + final F::AstNode getChild(int i) { ql_qualified_expr_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_qualified_expr_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_qualified_expr_child(this, _, result) } } /** A class representing `quantified` nodes. */ - final class Quantified extends @ql_quantified, AstNodeImpl { + class Quantified extends @ql_quantified, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Quantified" } /** Gets the node corresponding to the field `expr`. */ - final AstNode getExpr() { ql_quantified_expr(this, result) } + final F::AstNode getExpr() { ql_quantified_expr(this, result) } /** Gets the node corresponding to the field `formula`. */ - final AstNode getFormula() { ql_quantified_formula(this, result) } + final F::AstNode getFormula() { ql_quantified_formula(this, result) } /** Gets the node corresponding to the field `range`. */ - final AstNode getRange() { ql_quantified_range(this, result) } + final F::AstNode getRange() { ql_quantified_range(this, result) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_quantified_child(this, i, result) } + final F::AstNode getChild(int i) { ql_quantified_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_quantified_expr(this, result) or ql_quantified_formula(this, result) or ql_quantified_range(this, result) or @@ -1055,74 +1151,80 @@ module QL { } /** A class representing `quantifier` tokens. */ - final class Quantifier extends @ql_token_quantifier, TokenImpl { + class Quantifier extends @ql_token_quantifier, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Quantifier" } } /** A class representing `range` nodes. */ - final class Range extends @ql_range, AstNodeImpl { + class Range extends @ql_range, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Range" } /** Gets the node corresponding to the field `lower`. */ - final AstNode getLower() { ql_range_def(this, result, _) } + final F::AstNode getLower() { ql_range_def(this, result, _) } /** Gets the node corresponding to the field `upper`. */ - final AstNode getUpper() { ql_range_def(this, _, result) } + final F::AstNode getUpper() { ql_range_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_range_def(this, result, _) or ql_range_def(this, _, result) } } /** A class representing `result` tokens. */ - final class Result extends @ql_token_result, TokenImpl { + class Result extends @ql_token_result, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Result" } } /** A class representing `select` nodes. */ - final class Select extends @ql_select, AstNodeImpl { + class Select extends @ql_select, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Select" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_select_child(this, i, result) } + final F::AstNode getChild(int i) { ql_select_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_select_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_select_child(this, _, result) } } /** A class representing `set_literal` nodes. */ - final class SetLiteral extends @ql_set_literal, AstNodeImpl { + class SetLiteral extends @ql_set_literal, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SetLiteral" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_set_literal_child(this, i, result) } + final F::AstNode getChild(int i) { ql_set_literal_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_set_literal_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_set_literal_child(this, _, result) } } /** A class representing `signatureExpr` nodes. */ - final class SignatureExpr extends @ql_signature_expr, AstNodeImpl { + class SignatureExpr extends @ql_signature_expr, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SignatureExpr" } /** Gets the node corresponding to the field `mod_expr`. */ - final ModuleExpr getModExpr() { ql_signature_expr_mod_expr(this, result) } + final F::ModuleExpr getModExpr() { ql_signature_expr_mod_expr(this, result) } /** Gets the node corresponding to the field `predicate`. */ - final PredicateExpr getPredicate() { ql_signature_expr_predicate(this, result) } + final F::PredicateExpr getPredicate() { ql_signature_expr_predicate(this, result) } /** Gets the node corresponding to the field `type_expr`. */ - final TypeExpr getTypeExpr() { ql_signature_expr_type_expr(this, result) } + final F::TypeExpr getTypeExpr() { ql_signature_expr_type_expr(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_signature_expr_mod_expr(this, result) or ql_signature_expr_predicate(this, result) or ql_signature_expr_type_expr(this, result) @@ -1130,93 +1232,96 @@ module QL { } /** A class representing `simpleId` tokens. */ - final class SimpleId extends @ql_token_simple_id, TokenImpl { + class SimpleId extends @ql_token_simple_id, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SimpleId" } } /** A class representing `specialId` tokens. */ - final class SpecialId extends @ql_token_special_id, TokenImpl { + class SpecialId extends @ql_token_special_id, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SpecialId" } } /** A class representing `special_call` nodes. */ - final class SpecialCall extends @ql_special_call, AstNodeImpl { + class SpecialCall extends @ql_special_call, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SpecialCall" } /** Gets the child of this node. */ - final SpecialId getChild() { ql_special_call_def(this, result) } + final F::SpecialId getChild() { ql_special_call_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_special_call_def(this, result) } + final override F::AstNode getAFieldOrChild() { ql_special_call_def(this, result) } } /** A class representing `string` tokens. */ - final class String extends @ql_token_string, TokenImpl { + class String extends @ql_token_string, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "String" } } /** A class representing `super` tokens. */ - final class Super extends @ql_token_super, TokenImpl { + class Super extends @ql_token_super, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Super" } } /** A class representing `super_ref` nodes. */ - final class SuperRef extends @ql_super_ref, AstNodeImpl { + class SuperRef extends @ql_super_ref, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SuperRef" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_super_ref_child(this, i, result) } + final F::AstNode getChild(int i) { ql_super_ref_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_super_ref_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_super_ref_child(this, _, result) } } /** A class representing `this` tokens. */ - final class This extends @ql_token_this, TokenImpl { + class This extends @ql_token_this, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "This" } } /** A class representing `true` tokens. */ - final class True extends @ql_token_true, TokenImpl { + class True extends @ql_token_true, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "True" } } /** A class representing `typeAliasBody` nodes. */ - final class TypeAliasBody extends @ql_type_alias_body, AstNodeImpl { + class TypeAliasBody extends @ql_type_alias_body, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeAliasBody" } /** Gets the child of this node. */ - final TypeExpr getChild() { ql_type_alias_body_def(this, result) } + final F::TypeExpr getChild() { ql_type_alias_body_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_type_alias_body_def(this, result) } + final override F::AstNode getAFieldOrChild() { ql_type_alias_body_def(this, result) } } /** A class representing `typeExpr` nodes. */ - final class TypeExpr extends @ql_type_expr, AstNodeImpl { + class TypeExpr extends @ql_type_expr, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeExpr" } /** Gets the node corresponding to the field `name`. */ - final ClassName getName() { ql_type_expr_name(this, result) } + final F::ClassName getName() { ql_type_expr_name(this, result) } /** Gets the node corresponding to the field `qualifier`. */ - final ModuleExpr getQualifier() { ql_type_expr_qualifier(this, result) } + final F::ModuleExpr getQualifier() { ql_type_expr_qualifier(this, result) } /** Gets the child of this node. */ - final AstNode getChild() { ql_type_expr_child(this, result) } + final F::AstNode getChild() { ql_type_expr_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_type_expr_name(this, result) or ql_type_expr_qualifier(this, result) or ql_type_expr_child(this, result) @@ -1224,57 +1329,69 @@ module QL { } /** A class representing `typeUnionBody` nodes. */ - final class TypeUnionBody extends @ql_type_union_body, AstNodeImpl { + class TypeUnionBody extends @ql_type_union_body, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeUnionBody" } /** Gets the `i`th child of this node. */ - final TypeExpr getChild(int i) { ql_type_union_body_child(this, i, result) } + final F::TypeExpr getChild(int i) { ql_type_union_body_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::TypeExpr getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_type_union_body_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_type_union_body_child(this, _, result) } } /** A class representing `unary_expr` nodes. */ - final class UnaryExpr extends @ql_unary_expr, AstNodeImpl { + class UnaryExpr extends @ql_unary_expr, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "UnaryExpr" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_unary_expr_child(this, i, result) } + final F::AstNode getChild(int i) { ql_unary_expr_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_unary_expr_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_unary_expr_child(this, _, result) } } /** A class representing `underscore` tokens. */ - final class Underscore extends @ql_token_underscore, TokenImpl { + class Underscore extends @ql_token_underscore, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Underscore" } } /** A class representing `unop` tokens. */ - final class Unop extends @ql_token_unop, TokenImpl { + class Unop extends @ql_token_unop, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Unop" } } /** A class representing `unqual_agg_body` nodes. */ - final class UnqualAggBody extends @ql_unqual_agg_body, AstNodeImpl { + class UnqualAggBody extends @ql_unqual_agg_body, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "UnqualAggBody" } /** Gets the node corresponding to the field `asExprs`. */ - final AstNode getAsExprs(int i) { ql_unqual_agg_body_as_exprs(this, i, result) } + final F::AstNode getAsExprs(int i) { ql_unqual_agg_body_as_exprs(this, i, result) } + + /** Gets the node corresponding to the field `asExprs`. */ + final F::AstNode getAnAsExprs() { result = this.getAsExprs(_) } /** Gets the node corresponding to the field `guard`. */ - final AstNode getGuard() { ql_unqual_agg_body_guard(this, result) } + final F::AstNode getGuard() { ql_unqual_agg_body_guard(this, result) } + + /** Gets the `i`th child of this node. */ + final F::VarDecl getChild(int i) { ql_unqual_agg_body_child(this, i, result) } /** Gets the `i`th child of this node. */ - final VarDecl getChild(int i) { ql_unqual_agg_body_child(this, i, result) } + final F::VarDecl getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ql_unqual_agg_body_as_exprs(this, _, result) or ql_unqual_agg_body_guard(this, result) or ql_unqual_agg_body_child(this, _, result) @@ -1282,45 +1399,48 @@ module QL { } /** A class representing `varDecl` nodes. */ - final class VarDecl extends @ql_var_decl, AstNodeImpl { + class VarDecl extends @ql_var_decl, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "VarDecl" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_var_decl_child(this, i, result) } + final F::AstNode getChild(int i) { ql_var_decl_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_var_decl_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ql_var_decl_child(this, _, result) } } /** A class representing `varName` nodes. */ - final class VarName extends @ql_var_name, AstNodeImpl { + class VarName extends @ql_var_name, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "VarName" } /** Gets the child of this node. */ - final SimpleId getChild() { ql_var_name_def(this, result) } + final F::SimpleId getChild() { ql_var_name_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_var_name_def(this, result) } + final override F::AstNode getAFieldOrChild() { ql_var_name_def(this, result) } } /** A class representing `variable` nodes. */ - final class Variable extends @ql_variable, AstNodeImpl { + class Variable extends @ql_variable, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Variable" } /** Gets the child of this node. */ - final AstNode getChild() { ql_variable_def(this, result) } + final F::AstNode getChild() { ql_variable_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_variable_def(this, result) } + final override F::AstNode getAFieldOrChild() { ql_variable_def(this, result) } } /** Provides predicates for mapping AST nodes to their named children. */ module PrintAst { /** Gets a child of `node` returned by the member predicate with the given `name`. If the predicate takes an index argument, `i` is bound to that index, otherwise `i` is `-1` (which is never a valid index). */ - AstNode getChild(AstNode node, string name, int i) { + F::AstNode getChild(F::AstNode node, string name, int i) { result = node.(AddExpr).getLeft() and i = -1 and name = "getLeft" or result = node.(AddExpr).getRight() and i = -1 and name = "getRight" @@ -1556,10 +1676,218 @@ module QL { } } +module QLFinal { + private module F = QL; + + import F + + final class AstNode = F::AstNode; + + final class Token = F::Token; + + final class ReservedWord = F::ReservedWord; + + final class AddExpr = F::AddExpr; + + final class Addop = F::Addop; + + final class AggId = F::AggId; + + final class Aggregate = F::Aggregate; + + final class AnnotArg = F::AnnotArg; + + final class AnnotName = F::AnnotName; + + final class Annotation = F::Annotation; + + final class AritylessPredicateExpr = F::AritylessPredicateExpr; + + final class AsExpr = F::AsExpr; + + final class AsExprs = F::AsExprs; + + final class BlockComment = F::BlockComment; + + final class Body = F::Body; + + final class Bool = F::Bool; + + final class CallBody = F::CallBody; + + final class CallOrUnqualAggExpr = F::CallOrUnqualAggExpr; + + final class Charpred = F::Charpred; + + final class ClassMember = F::ClassMember; + + final class ClassName = F::ClassName; + + final class ClasslessPredicate = F::ClasslessPredicate; + + final class Closure = F::Closure; + + final class CompTerm = F::CompTerm; + + final class Compop = F::Compop; + + final class Conjunction = F::Conjunction; + + final class Dataclass = F::Dataclass; + + final class Datatype = F::Datatype; + + final class DatatypeBranch = F::DatatypeBranch; + + final class DatatypeBranches = F::DatatypeBranches; + + final class Dbtype = F::Dbtype; + + final class Direction = F::Direction; + + final class Disjunction = F::Disjunction; + + final class Empty = F::Empty; + + final class ExprAggregateBody = F::ExprAggregateBody; + + final class ExprAnnotation = F::ExprAnnotation; + + final class False = F::False; + + final class Field = F::Field; + + final class Float = F::Float; + + final class FullAggregateBody = F::FullAggregateBody; + + final class HigherOrderTerm = F::HigherOrderTerm; + + final class IfTerm = F::IfTerm; + + final class Implication = F::Implication; + + final class ImportDirective = F::ImportDirective; + + final class ImportModuleExpr = F::ImportModuleExpr; + + final class InExpr = F::InExpr; + + final class InstanceOf = F::InstanceOf; + + final class Integer = F::Integer; + + final class LineComment = F::LineComment; + + final class Literal = F::Literal; + + final class LiteralId = F::LiteralId; + + final class MemberPredicate = F::MemberPredicate; + + final class Module = F::Module; + + final class ModuleAliasBody = F::ModuleAliasBody; + + final class ModuleExpr = F::ModuleExpr; + + final class ModuleInstantiation = F::ModuleInstantiation; + + final class ModuleMember = F::ModuleMember; + + final class ModuleName = F::ModuleName; + + final class ModuleParam = F::ModuleParam; + + final class MulExpr = F::MulExpr; + + final class Mulop = F::Mulop; + + final class Negation = F::Negation; + + final class OrderBy = F::OrderBy; + + final class OrderBys = F::OrderBys; + + final class ParExpr = F::ParExpr; + + final class Predicate = F::Predicate; + + final class PredicateAliasBody = F::PredicateAliasBody; + + final class PredicateExpr = F::PredicateExpr; + + final class PredicateName = F::PredicateName; + + final class PrefixCast = F::PrefixCast; + + final class PrimitiveType = F::PrimitiveType; + + final class Ql = F::Ql; + + final class Qldoc = F::Qldoc; + + final class QualifiedRhs = F::QualifiedRhs; + + final class QualifiedExpr = F::QualifiedExpr; + + final class Quantified = F::Quantified; + + final class Quantifier = F::Quantifier; + + final class Range = F::Range; + + final class Result = F::Result; + + final class Select = F::Select; + + final class SetLiteral = F::SetLiteral; + + final class SignatureExpr = F::SignatureExpr; + + final class SimpleId = F::SimpleId; + + final class SpecialId = F::SpecialId; + + final class SpecialCall = F::SpecialCall; + + final class String = F::String; + + final class Super = F::Super; + + final class SuperRef = F::SuperRef; + + final class This = F::This; + + final class True = F::True; + + final class TypeAliasBody = F::TypeAliasBody; + + final class TypeExpr = F::TypeExpr; + + final class TypeUnionBody = F::TypeUnionBody; + + final class UnaryExpr = F::UnaryExpr; + + final class Underscore = F::Underscore; + + final class Unop = F::Unop; + + final class UnqualAggBody = F::UnqualAggBody; + + final class VarDecl = F::VarDecl; + + final class VarName = F::VarName; + + final class Variable = F::Variable; +} + overlay[local] module Dbscheme { + private module F = Dbscheme; + /** The base class for all AST nodes */ - private class AstNodeImpl extends @dbscheme_ast_node { + class AstNode extends @dbscheme_ast_node { /** Gets a string representation of this element. */ string toString() { result = this.getAPrimaryQlClass() } @@ -1567,13 +1895,13 @@ module Dbscheme { final L::Location getLocation() { dbscheme_ast_node_location(this, result) } /** Gets the parent of this element. */ - final AstNode getParent() { dbscheme_ast_node_parent(this, result, _) } + final F::AstNode getParent() { dbscheme_ast_node_parent(this, result, _) } /** Gets the index of this node among the children of its parent. */ final int getParentIndex() { dbscheme_ast_node_parent(this, _, result) } /** Gets a field or child node of this node. */ - AstNode getAFieldOrChild() { none() } + F::AstNode getAFieldOrChild() { none() } /** Gets the name of the primary QL class for this element. */ string getAPrimaryQlClass() { result = "???" } @@ -1582,10 +1910,8 @@ module Dbscheme { string getPrimaryQlClasses() { result = concat(this.getAPrimaryQlClass(), ",") } } - final class AstNode = AstNodeImpl; - /** A token. */ - private class TokenImpl extends @dbscheme_token, AstNodeImpl { + class Token extends @dbscheme_token, F::AstNode { /** Gets the value of this token. */ final string getValue() { dbscheme_tokeninfo(this, _, result) } @@ -1596,10 +1922,8 @@ module Dbscheme { override string getAPrimaryQlClass() { result = "Token" } } - final class Token = TokenImpl; - /** A reserved word. */ - final class ReservedWord extends @dbscheme_reserved_word, TokenImpl { + class ReservedWord extends @dbscheme_reserved_word, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ReservedWord" } } @@ -1625,91 +1949,102 @@ module Dbscheme { } /** A class representing `annotName` tokens. */ - final class AnnotName extends @dbscheme_token_annot_name, TokenImpl { + class AnnotName extends @dbscheme_token_annot_name, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AnnotName" } } /** A class representing `annotation` nodes. */ - final class Annotation extends @dbscheme_annotation, AstNodeImpl { + class Annotation extends @dbscheme_annotation, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Annotation" } /** Gets the node corresponding to the field `argsAnnotation`. */ - final ArgsAnnotation getArgsAnnotation() { dbscheme_annotation_args_annotation(this, result) } + final F::ArgsAnnotation getArgsAnnotation() { + dbscheme_annotation_args_annotation(this, result) + } /** Gets the node corresponding to the field `simpleAnnotation`. */ - final AnnotName getSimpleAnnotation() { dbscheme_annotation_simple_annotation(this, result) } + final F::AnnotName getSimpleAnnotation() { dbscheme_annotation_simple_annotation(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { dbscheme_annotation_args_annotation(this, result) or dbscheme_annotation_simple_annotation(this, result) } } /** A class representing `argsAnnotation` nodes. */ - final class ArgsAnnotation extends @dbscheme_args_annotation, AstNodeImpl { + class ArgsAnnotation extends @dbscheme_args_annotation, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ArgsAnnotation" } /** Gets the node corresponding to the field `name`. */ - final AnnotName getName() { dbscheme_args_annotation_def(this, result) } + final F::AnnotName getName() { dbscheme_args_annotation_def(this, result) } + + /** Gets the `i`th child of this node. */ + final F::SimpleId getChild(int i) { dbscheme_args_annotation_child(this, i, result) } /** Gets the `i`th child of this node. */ - final SimpleId getChild(int i) { dbscheme_args_annotation_child(this, i, result) } + final F::SimpleId getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { dbscheme_args_annotation_def(this, result) or dbscheme_args_annotation_child(this, _, result) } } /** A class representing `block_comment` tokens. */ - final class BlockComment extends @dbscheme_token_block_comment, TokenImpl { + class BlockComment extends @dbscheme_token_block_comment, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BlockComment" } } /** A class representing `boolean` tokens. */ - final class Boolean extends @dbscheme_token_boolean, TokenImpl { + class Boolean extends @dbscheme_token_boolean, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Boolean" } } /** A class representing `branch` nodes. */ - final class Branch extends @dbscheme_branch, AstNodeImpl { + class Branch extends @dbscheme_branch, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Branch" } /** Gets the node corresponding to the field `qldoc`. */ - final Qldoc getQldoc() { dbscheme_branch_qldoc(this, result) } + final F::Qldoc getQldoc() { dbscheme_branch_qldoc(this, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getChild(int i) { dbscheme_branch_child(this, i, result) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { dbscheme_branch_child(this, i, result) } + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { dbscheme_branch_qldoc(this, result) or dbscheme_branch_child(this, _, result) } } /** A class representing `caseDecl` nodes. */ - final class CaseDecl extends @dbscheme_case_decl, AstNodeImpl { + class CaseDecl extends @dbscheme_case_decl, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CaseDecl" } /** Gets the node corresponding to the field `base`. */ - final Dbtype getBase() { dbscheme_case_decl_def(this, result, _) } + final F::Dbtype getBase() { dbscheme_case_decl_def(this, result, _) } /** Gets the node corresponding to the field `discriminator`. */ - final SimpleId getDiscriminator() { dbscheme_case_decl_def(this, _, result) } + final F::SimpleId getDiscriminator() { dbscheme_case_decl_def(this, _, result) } /** Gets the `i`th child of this node. */ - final Branch getChild(int i) { dbscheme_case_decl_child(this, i, result) } + final F::Branch getChild(int i) { dbscheme_case_decl_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::Branch getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { dbscheme_case_decl_def(this, result, _) or dbscheme_case_decl_def(this, _, result) or dbscheme_case_decl_child(this, _, result) @@ -1717,42 +2052,42 @@ module Dbscheme { } /** A class representing `colType` nodes. */ - final class ColType extends @dbscheme_col_type, AstNodeImpl { + class ColType extends @dbscheme_col_type, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ColType" } /** Gets the child of this node. */ - final AstNode getChild() { dbscheme_col_type_def(this, result) } + final F::AstNode getChild() { dbscheme_col_type_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { dbscheme_col_type_def(this, result) } + final override F::AstNode getAFieldOrChild() { dbscheme_col_type_def(this, result) } } /** A class representing `column` nodes. */ - final class Column extends @dbscheme_column, AstNodeImpl { + class Column extends @dbscheme_column, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Column" } /** Gets the node corresponding to the field `colName`. */ - final SimpleId getColName() { dbscheme_column_def(this, result, _, _) } + final F::SimpleId getColName() { dbscheme_column_def(this, result, _, _) } /** Gets the node corresponding to the field `colType`. */ - final ColType getColType() { dbscheme_column_def(this, _, result, _) } + final F::ColType getColType() { dbscheme_column_def(this, _, result, _) } /** Gets the node corresponding to the field `isRef`. */ - final Ref getIsRef() { dbscheme_column_is_ref(this, result) } + final F::Ref getIsRef() { dbscheme_column_is_ref(this, result) } /** Gets the node corresponding to the field `isUnique`. */ - final Unique getIsUnique() { dbscheme_column_is_unique(this, result) } + final F::Unique getIsUnique() { dbscheme_column_is_unique(this, result) } /** Gets the node corresponding to the field `qldoc`. */ - final Qldoc getQldoc() { dbscheme_column_qldoc(this, result) } + final F::Qldoc getQldoc() { dbscheme_column_qldoc(this, result) } /** Gets the node corresponding to the field `reprType`. */ - final ReprType getReprType() { dbscheme_column_def(this, _, _, result) } + final F::ReprType getReprType() { dbscheme_column_def(this, _, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { dbscheme_column_def(this, result, _, _) or dbscheme_column_def(this, _, result, _) or dbscheme_column_is_ref(this, result) or @@ -1763,155 +2098,167 @@ module Dbscheme { } /** A class representing `date` tokens. */ - final class Date extends @dbscheme_token_date, TokenImpl { + class Date extends @dbscheme_token_date, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Date" } } /** A class representing `dbscheme` nodes. */ - final class Dbscheme extends @dbscheme_dbscheme, AstNodeImpl { + class Dbscheme extends @dbscheme_dbscheme, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Dbscheme" } /** Gets the `i`th child of this node. */ - final Entry getChild(int i) { dbscheme_dbscheme_child(this, i, result) } + final F::Entry getChild(int i) { dbscheme_dbscheme_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::Entry getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { dbscheme_dbscheme_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { dbscheme_dbscheme_child(this, _, result) } } /** A class representing `dbtype` tokens. */ - final class Dbtype extends @dbscheme_token_dbtype, TokenImpl { + class Dbtype extends @dbscheme_token_dbtype, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Dbtype" } } /** A class representing `entry` nodes. */ - final class Entry extends @dbscheme_entry, AstNodeImpl { + class Entry extends @dbscheme_entry, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Entry" } /** Gets the child of this node. */ - final AstNode getChild() { dbscheme_entry_def(this, result) } + final F::AstNode getChild() { dbscheme_entry_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { dbscheme_entry_def(this, result) } + final override F::AstNode getAFieldOrChild() { dbscheme_entry_def(this, result) } } /** A class representing `float` tokens. */ - final class Float extends @dbscheme_token_float, TokenImpl { + class Float extends @dbscheme_token_float, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Float" } } /** A class representing `int` tokens. */ - final class Int extends @dbscheme_token_int, TokenImpl { + class Int extends @dbscheme_token_int, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Int" } } /** A class representing `integer` tokens. */ - final class Integer extends @dbscheme_token_integer, TokenImpl { + class Integer extends @dbscheme_token_integer, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Integer" } } /** A class representing `line_comment` tokens. */ - final class LineComment extends @dbscheme_token_line_comment, TokenImpl { + class LineComment extends @dbscheme_token_line_comment, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "LineComment" } } /** A class representing `qldoc` tokens. */ - final class Qldoc extends @dbscheme_token_qldoc, TokenImpl { + class Qldoc extends @dbscheme_token_qldoc, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Qldoc" } } /** A class representing `ref` tokens. */ - final class Ref extends @dbscheme_token_ref, TokenImpl { + class Ref extends @dbscheme_token_ref, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Ref" } } /** A class representing `reprType` nodes. */ - final class ReprType extends @dbscheme_repr_type, AstNodeImpl { + class ReprType extends @dbscheme_repr_type, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ReprType" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { dbscheme_repr_type_child(this, i, result) } + final F::AstNode getChild(int i) { dbscheme_repr_type_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { dbscheme_repr_type_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { dbscheme_repr_type_child(this, _, result) } } /** A class representing `simpleId` tokens. */ - final class SimpleId extends @dbscheme_token_simple_id, TokenImpl { + class SimpleId extends @dbscheme_token_simple_id, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SimpleId" } } /** A class representing `string` tokens. */ - final class String extends @dbscheme_token_string, TokenImpl { + class String extends @dbscheme_token_string, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "String" } } /** A class representing `table` nodes. */ - final class Table extends @dbscheme_table, AstNodeImpl { + class Table extends @dbscheme_table, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Table" } /** Gets the node corresponding to the field `tableName`. */ - final TableName getTableName() { dbscheme_table_def(this, result) } + final F::TableName getTableName() { dbscheme_table_def(this, result) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { dbscheme_table_child(this, i, result) } + final F::AstNode getChild(int i) { dbscheme_table_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { dbscheme_table_def(this, result) or dbscheme_table_child(this, _, result) } } /** A class representing `tableName` nodes. */ - final class TableName extends @dbscheme_table_name, AstNodeImpl { + class TableName extends @dbscheme_table_name, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TableName" } /** Gets the child of this node. */ - final SimpleId getChild() { dbscheme_table_name_def(this, result) } + final F::SimpleId getChild() { dbscheme_table_name_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { dbscheme_table_name_def(this, result) } + final override F::AstNode getAFieldOrChild() { dbscheme_table_name_def(this, result) } } /** A class representing `unionDecl` nodes. */ - final class UnionDecl extends @dbscheme_union_decl, AstNodeImpl { + class UnionDecl extends @dbscheme_union_decl, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "UnionDecl" } /** Gets the node corresponding to the field `base`. */ - final Dbtype getBase() { dbscheme_union_decl_def(this, result) } + final F::Dbtype getBase() { dbscheme_union_decl_def(this, result) } /** Gets the `i`th child of this node. */ - final Dbtype getChild(int i) { dbscheme_union_decl_child(this, i, result) } + final F::Dbtype getChild(int i) { dbscheme_union_decl_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::Dbtype getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { dbscheme_union_decl_def(this, result) or dbscheme_union_decl_child(this, _, result) } } /** A class representing `unique` tokens. */ - final class Unique extends @dbscheme_token_unique, TokenImpl { + class Unique extends @dbscheme_token_unique, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Unique" } } /** A class representing `varchar` tokens. */ - final class Varchar extends @dbscheme_token_varchar, TokenImpl { + class Varchar extends @dbscheme_token_varchar, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Varchar" } } @@ -1919,7 +2266,7 @@ module Dbscheme { /** Provides predicates for mapping AST nodes to their named children. */ module PrintAst { /** Gets a child of `node` returned by the member predicate with the given `name`. If the predicate takes an index argument, `i` is bound to that index, otherwise `i` is `-1` (which is never a valid index). */ - AstNode getChild(AstNode node, string name, int i) { + F::AstNode getChild(F::AstNode node, string name, int i) { result = node.(Annotation).getArgsAnnotation() and i = -1 and name = "getArgsAnnotation" or result = node.(Annotation).getSimpleAnnotation() and i = -1 and name = "getSimpleAnnotation" @@ -1971,10 +2318,78 @@ module Dbscheme { } } +module DbschemeFinal { + private module F = Dbscheme; + + import F + + final class AstNode = F::AstNode; + + final class Token = F::Token; + + final class ReservedWord = F::ReservedWord; + + final class AnnotName = F::AnnotName; + + final class Annotation = F::Annotation; + + final class ArgsAnnotation = F::ArgsAnnotation; + + final class BlockComment = F::BlockComment; + + final class Boolean = F::Boolean; + + final class Branch = F::Branch; + + final class CaseDecl = F::CaseDecl; + + final class ColType = F::ColType; + + final class Column = F::Column; + + final class Date = F::Date; + + final class Dbscheme = F::Dbscheme; + + final class Dbtype = F::Dbtype; + + final class Entry = F::Entry; + + final class Float = F::Float; + + final class Int = F::Int; + + final class Integer = F::Integer; + + final class LineComment = F::LineComment; + + final class Qldoc = F::Qldoc; + + final class Ref = F::Ref; + + final class ReprType = F::ReprType; + + final class SimpleId = F::SimpleId; + + final class String = F::String; + + final class Table = F::Table; + + final class TableName = F::TableName; + + final class UnionDecl = F::UnionDecl; + + final class Unique = F::Unique; + + final class Varchar = F::Varchar; +} + overlay[local] module Blame { + private module F = Blame; + /** The base class for all AST nodes */ - private class AstNodeImpl extends @blame_ast_node { + class AstNode extends @blame_ast_node { /** Gets a string representation of this element. */ string toString() { result = this.getAPrimaryQlClass() } @@ -1982,13 +2397,13 @@ module Blame { final L::Location getLocation() { blame_ast_node_location(this, result) } /** Gets the parent of this element. */ - final AstNode getParent() { blame_ast_node_parent(this, result, _) } + final F::AstNode getParent() { blame_ast_node_parent(this, result, _) } /** Gets the index of this node among the children of its parent. */ final int getParentIndex() { blame_ast_node_parent(this, _, result) } /** Gets a field or child node of this node. */ - AstNode getAFieldOrChild() { none() } + F::AstNode getAFieldOrChild() { none() } /** Gets the name of the primary QL class for this element. */ string getAPrimaryQlClass() { result = "???" } @@ -1997,10 +2412,8 @@ module Blame { string getPrimaryQlClasses() { result = concat(this.getAPrimaryQlClass(), ",") } } - final class AstNode = AstNodeImpl; - /** A token. */ - private class TokenImpl extends @blame_token, AstNodeImpl { + class Token extends @blame_token, F::AstNode { /** Gets the value of this token. */ final string getValue() { blame_tokeninfo(this, _, result) } @@ -2011,10 +2424,8 @@ module Blame { override string getAPrimaryQlClass() { result = "Token" } } - final class Token = TokenImpl; - /** A reserved word. */ - final class ReservedWord extends @blame_reserved_word, TokenImpl { + class ReservedWord extends @blame_reserved_word, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ReservedWord" } } @@ -2040,70 +2451,79 @@ module Blame { } /** A class representing `blame_entry` nodes. */ - final class BlameEntry extends @blame_blame_entry, AstNodeImpl { + class BlameEntry extends @blame_blame_entry, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BlameEntry" } /** Gets the node corresponding to the field `date`. */ - final Date getDate() { blame_blame_entry_def(this, result) } + final F::Date getDate() { blame_blame_entry_def(this, result) } + + /** Gets the node corresponding to the field `line`. */ + final F::Number getLine(int i) { blame_blame_entry_line(this, i, result) } /** Gets the node corresponding to the field `line`. */ - final Number getLine(int i) { blame_blame_entry_line(this, i, result) } + final F::Number getALine() { result = this.getLine(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { blame_blame_entry_def(this, result) or blame_blame_entry_line(this, _, result) } } /** A class representing `blame_info` nodes. */ - final class BlameInfo extends @blame_blame_info, AstNodeImpl { + class BlameInfo extends @blame_blame_info, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BlameInfo" } /** Gets the node corresponding to the field `file_entry`. */ - final FileEntry getFileEntry(int i) { blame_blame_info_file_entry(this, i, result) } + final F::FileEntry getFileEntry(int i) { blame_blame_info_file_entry(this, i, result) } + + /** Gets the node corresponding to the field `file_entry`. */ + final F::FileEntry getAFileEntry() { result = this.getFileEntry(_) } /** Gets the node corresponding to the field `today`. */ - final Date getToday() { blame_blame_info_def(this, result) } + final F::Date getToday() { blame_blame_info_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { blame_blame_info_file_entry(this, _, result) or blame_blame_info_def(this, result) } } /** A class representing `date` tokens. */ - final class Date extends @blame_token_date, TokenImpl { + class Date extends @blame_token_date, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Date" } } /** A class representing `file_entry` nodes. */ - final class FileEntry extends @blame_file_entry, AstNodeImpl { + class FileEntry extends @blame_file_entry, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "FileEntry" } /** Gets the node corresponding to the field `blame_entry`. */ - final BlameEntry getBlameEntry(int i) { blame_file_entry_blame_entry(this, i, result) } + final F::BlameEntry getBlameEntry(int i) { blame_file_entry_blame_entry(this, i, result) } + + /** Gets the node corresponding to the field `blame_entry`. */ + final F::BlameEntry getABlameEntry() { result = this.getBlameEntry(_) } /** Gets the node corresponding to the field `file_name`. */ - final Filename getFileName() { blame_file_entry_def(this, result) } + final F::Filename getFileName() { blame_file_entry_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { blame_file_entry_blame_entry(this, _, result) or blame_file_entry_def(this, result) } } /** A class representing `filename` tokens. */ - final class Filename extends @blame_token_filename, TokenImpl { + class Filename extends @blame_token_filename, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Filename" } } /** A class representing `number` tokens. */ - final class Number extends @blame_token_number, TokenImpl { + class Number extends @blame_token_number, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Number" } } @@ -2111,7 +2531,7 @@ module Blame { /** Provides predicates for mapping AST nodes to their named children. */ module PrintAst { /** Gets a child of `node` returned by the member predicate with the given `name`. If the predicate takes an index argument, `i` is bound to that index, otherwise `i` is `-1` (which is never a valid index). */ - AstNode getChild(AstNode node, string name, int i) { + F::AstNode getChild(F::AstNode node, string name, int i) { result = node.(BlameEntry).getDate() and i = -1 and name = "getDate" or result = node.(BlameEntry).getLine(i) and name = "getLine" @@ -2127,10 +2547,36 @@ module Blame { } } +module BlameFinal { + private module F = Blame; + + import F + + final class AstNode = F::AstNode; + + final class Token = F::Token; + + final class ReservedWord = F::ReservedWord; + + final class BlameEntry = F::BlameEntry; + + final class BlameInfo = F::BlameInfo; + + final class Date = F::Date; + + final class FileEntry = F::FileEntry; + + final class Filename = F::Filename; + + final class Number = F::Number; +} + overlay[local] module JSON { + private module F = JSON; + /** The base class for all AST nodes */ - private class AstNodeImpl extends @json_ast_node { + class AstNode extends @json_ast_node { /** Gets a string representation of this element. */ string toString() { result = this.getAPrimaryQlClass() } @@ -2138,13 +2584,13 @@ module JSON { final L::Location getLocation() { json_ast_node_location(this, result) } /** Gets the parent of this element. */ - final AstNode getParent() { json_ast_node_parent(this, result, _) } + final F::AstNode getParent() { json_ast_node_parent(this, result, _) } /** Gets the index of this node among the children of its parent. */ final int getParentIndex() { json_ast_node_parent(this, _, result) } /** Gets a field or child node of this node. */ - AstNode getAFieldOrChild() { none() } + F::AstNode getAFieldOrChild() { none() } /** Gets the name of the primary QL class for this element. */ string getAPrimaryQlClass() { result = "???" } @@ -2153,10 +2599,8 @@ module JSON { string getPrimaryQlClasses() { result = concat(this.getAPrimaryQlClass(), ",") } } - final class AstNode = AstNodeImpl; - /** A token. */ - private class TokenImpl extends @json_token, AstNodeImpl { + class Token extends @json_token, F::AstNode { /** Gets the value of this token. */ final string getValue() { json_tokeninfo(this, _, result) } @@ -2167,10 +2611,8 @@ module JSON { override string getAPrimaryQlClass() { result = "Token" } } - final class Token = TokenImpl; - /** A reserved word. */ - final class ReservedWord extends @json_reserved_word, TokenImpl { + class ReservedWord extends @json_reserved_word, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ReservedWord" } } @@ -2195,111 +2637,123 @@ module JSON { ) } - final class UnderscoreValue extends @json_underscore_value, AstNodeImpl { } + class UnderscoreValue extends @json_underscore_value, F::AstNode { } /** A class representing `array` nodes. */ - final class Array extends @json_array, AstNodeImpl { + class Array extends @json_array, F::UnderscoreValue { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Array" } /** Gets the `i`th child of this node. */ - final UnderscoreValue getChild(int i) { json_array_child(this, i, result) } + final F::UnderscoreValue getChild(int i) { json_array_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::UnderscoreValue getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { json_array_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { json_array_child(this, _, result) } } /** A class representing `comment` tokens. */ - final class Comment extends @json_token_comment, TokenImpl { + class Comment extends @json_token_comment, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Comment" } } /** A class representing `document` nodes. */ - final class Document extends @json_document, AstNodeImpl { + class Document extends @json_document, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Document" } /** Gets the `i`th child of this node. */ - final UnderscoreValue getChild(int i) { json_document_child(this, i, result) } + final F::UnderscoreValue getChild(int i) { json_document_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::UnderscoreValue getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { json_document_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { json_document_child(this, _, result) } } /** A class representing `escape_sequence` tokens. */ - final class EscapeSequence extends @json_token_escape_sequence, TokenImpl { + class EscapeSequence extends @json_token_escape_sequence, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "EscapeSequence" } } /** A class representing `false` tokens. */ - final class False extends @json_token_false, TokenImpl { + class False extends @json_token_false, F::Token, F::UnderscoreValue { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "False" } } /** A class representing `null` tokens. */ - final class Null extends @json_token_null, TokenImpl { + class Null extends @json_token_null, F::Token, F::UnderscoreValue { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Null" } } /** A class representing `number` tokens. */ - final class Number extends @json_token_number, TokenImpl { + class Number extends @json_token_number, F::Token, F::UnderscoreValue { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Number" } } /** A class representing `object` nodes. */ - final class Object extends @json_object, AstNodeImpl { + class Object extends @json_object, F::UnderscoreValue { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Object" } /** Gets the `i`th child of this node. */ - final Pair getChild(int i) { json_object_child(this, i, result) } + final F::Pair getChild(int i) { json_object_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::Pair getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { json_object_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { json_object_child(this, _, result) } } /** A class representing `pair` nodes. */ - final class Pair extends @json_pair, AstNodeImpl { + class Pair extends @json_pair, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Pair" } /** Gets the node corresponding to the field `key`. */ - final String getKey() { json_pair_def(this, result, _) } + final F::String getKey() { json_pair_def(this, result, _) } /** Gets the node corresponding to the field `value`. */ - final UnderscoreValue getValue() { json_pair_def(this, _, result) } + final F::UnderscoreValue getValue() { json_pair_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { json_pair_def(this, result, _) or json_pair_def(this, _, result) } } /** A class representing `string` nodes. */ - final class String extends @json_string__, AstNodeImpl { + class String extends @json_string__, F::UnderscoreValue { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "String" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { json_string_child(this, i, result) } + final F::AstNode getChild(int i) { json_string_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { json_string_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { json_string_child(this, _, result) } } /** A class representing `string_content` tokens. */ - final class StringContent extends @json_token_string_content, TokenImpl { + class StringContent extends @json_token_string_content, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "StringContent" } } /** A class representing `true` tokens. */ - final class True extends @json_token_true, TokenImpl { + class True extends @json_token_true, F::Token, F::UnderscoreValue { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "True" } } @@ -2307,7 +2761,7 @@ module JSON { /** Provides predicates for mapping AST nodes to their named children. */ module PrintAst { /** Gets a child of `node` returned by the member predicate with the given `name`. If the predicate takes an index argument, `i` is bound to that index, otherwise `i` is `-1` (which is never a valid index). */ - AstNode getChild(AstNode node, string name, int i) { + F::AstNode getChild(F::AstNode node, string name, int i) { result = node.(Array).getChild(i) and name = "getChild" or result = node.(Document).getChild(i) and name = "getChild" @@ -2322,3 +2776,41 @@ module JSON { } } } + +module JSONFinal { + private module F = JSON; + + import F + + final class AstNode = F::AstNode; + + final class Token = F::Token; + + final class ReservedWord = F::ReservedWord; + + final class UnderscoreValue = F::UnderscoreValue; + + final class Array = F::Array; + + final class Comment = F::Comment; + + final class Document = F::Document; + + final class EscapeSequence = F::EscapeSequence; + + final class False = F::False; + + final class Null = F::Null; + + final class Number = F::Number; + + final class Object = F::Object; + + final class Pair = F::Pair; + + final class String = F::String; + + final class StringContent = F::StringContent; + + final class True = F::True; +} diff --git a/ruby/extractor/src/generator.rs b/ruby/extractor/src/generator.rs index 0430afd103e7..0fc6f9d5cc74 100644 --- a/ruby/extractor/src/generator.rs +++ b/ruby/extractor/src/generator.rs @@ -34,6 +34,7 @@ pub fn run(options: Options) -> std::io::Result<()> { languages, options.dbscheme, options.library, + false, // do not use facade AST "run 'make dbscheme' in ql/ruby/", ) } diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll b/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll index 13ae1923b105..0d442a5dda88 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll @@ -25,8 +25,10 @@ private predicate discardLocation(@location_default loc) { overlay[local] module Ruby { + private module F = Ruby; + /** The base class for all AST nodes */ - private class AstNodeImpl extends @ruby_ast_node { + class AstNode extends @ruby_ast_node { /** Gets a string representation of this element. */ string toString() { result = this.getAPrimaryQlClass() } @@ -34,13 +36,13 @@ module Ruby { final L::Location getLocation() { ruby_ast_node_location(this, result) } /** Gets the parent of this element. */ - final AstNode getParent() { ruby_ast_node_parent(this, result, _) } + final F::AstNode getParent() { ruby_ast_node_parent(this, result, _) } /** Gets the index of this node among the children of its parent. */ final int getParentIndex() { ruby_ast_node_parent(this, _, result) } /** Gets a field or child node of this node. */ - AstNode getAFieldOrChild() { none() } + F::AstNode getAFieldOrChild() { none() } /** Gets the name of the primary QL class for this element. */ string getAPrimaryQlClass() { result = "???" } @@ -49,10 +51,8 @@ module Ruby { string getPrimaryQlClasses() { result = concat(this.getAPrimaryQlClass(), ",") } } - final class AstNode = AstNodeImpl; - /** A token. */ - private class TokenImpl extends @ruby_token, AstNodeImpl { + class Token extends @ruby_token, F::AstNode { /** Gets the value of this token. */ final string getValue() { ruby_tokeninfo(this, _, result) } @@ -63,10 +63,8 @@ module Ruby { override string getAPrimaryQlClass() { result = "Token" } } - final class Token = TokenImpl; - /** A reserved word. */ - final class ReservedWord extends @ruby_reserved_word, TokenImpl { + class ReservedWord extends @ruby_reserved_word, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ReservedWord" } } @@ -91,202 +89,236 @@ module Ruby { ) } - final class UnderscoreArg extends @ruby_underscore_arg, AstNodeImpl { } + class UnderscoreArg extends @ruby_underscore_arg, F::UnderscoreExpression { } - final class UnderscoreCallOperator extends @ruby_underscore_call_operator, AstNodeImpl { } + class UnderscoreCallOperator extends @ruby_underscore_call_operator, F::AstNode { } - final class UnderscoreExpression extends @ruby_underscore_expression, AstNodeImpl { } + class UnderscoreExpression extends @ruby_underscore_expression, F::UnderscoreStatement { } - final class UnderscoreLhs extends @ruby_underscore_lhs, AstNodeImpl { } + class UnderscoreLhs extends @ruby_underscore_lhs, F::UnderscorePrimary { } - final class UnderscoreMethodName extends @ruby_underscore_method_name, AstNodeImpl { } + class UnderscoreMethodName extends @ruby_underscore_method_name, F::AstNode { } - final class UnderscoreNonlocalVariable extends @ruby_underscore_nonlocal_variable, AstNodeImpl { } - - final class UnderscorePatternConstant extends @ruby_underscore_pattern_constant, AstNodeImpl { } + class UnderscoreNonlocalVariable extends @ruby_underscore_nonlocal_variable, + F::UnderscoreMethodName, F::UnderscoreVariable + { } - final class UnderscorePatternExpr extends @ruby_underscore_pattern_expr, AstNodeImpl { } + class UnderscorePatternConstant extends @ruby_underscore_pattern_constant, + F::UnderscorePatternExprBasic + { } - final class UnderscorePatternExprBasic extends @ruby_underscore_pattern_expr_basic, AstNodeImpl { - } + class UnderscorePatternExpr extends @ruby_underscore_pattern_expr, F::UnderscorePatternTopExprBody + { } - final class UnderscorePatternPrimitive extends @ruby_underscore_pattern_primitive, AstNodeImpl { } + class UnderscorePatternExprBasic extends @ruby_underscore_pattern_expr_basic, + F::UnderscorePatternExpr + { } - final class UnderscorePatternTopExprBody extends @ruby_underscore_pattern_top_expr_body, - AstNodeImpl + class UnderscorePatternPrimitive extends @ruby_underscore_pattern_primitive, + F::UnderscorePatternExprBasic { } - final class UnderscorePrimary extends @ruby_underscore_primary, AstNodeImpl { } + class UnderscorePatternTopExprBody extends @ruby_underscore_pattern_top_expr_body, F::AstNode { } - final class UnderscoreSimpleNumeric extends @ruby_underscore_simple_numeric, AstNodeImpl { } + class UnderscorePrimary extends @ruby_underscore_primary, F::UnderscoreArg { } - final class UnderscoreStatement extends @ruby_underscore_statement, AstNodeImpl { } + class UnderscoreSimpleNumeric extends @ruby_underscore_simple_numeric, + F::UnderscorePatternPrimitive, F::UnderscorePrimary + { } + + class UnderscoreStatement extends @ruby_underscore_statement, F::AstNode { } - final class UnderscoreVariable extends @ruby_underscore_variable, AstNodeImpl { } + class UnderscoreVariable extends @ruby_underscore_variable, F::UnderscoreLhs { } /** A class representing `alias` nodes. */ - final class Alias extends @ruby_alias, AstNodeImpl { + class Alias extends @ruby_alias, F::UnderscoreStatement { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Alias" } /** Gets the node corresponding to the field `alias`. */ - final UnderscoreMethodName getAlias() { ruby_alias_def(this, result, _) } + final F::UnderscoreMethodName getAlias() { ruby_alias_def(this, result, _) } /** Gets the node corresponding to the field `name`. */ - final UnderscoreMethodName getName() { ruby_alias_def(this, _, result) } + final F::UnderscoreMethodName getName() { ruby_alias_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_alias_def(this, result, _) or ruby_alias_def(this, _, result) } } /** A class representing `alternative_pattern` nodes. */ - final class AlternativePattern extends @ruby_alternative_pattern, AstNodeImpl { + class AlternativePattern extends @ruby_alternative_pattern, F::UnderscorePatternExpr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AlternativePattern" } /** Gets the node corresponding to the field `alternatives`. */ - final UnderscorePatternExprBasic getAlternatives(int i) { + final F::UnderscorePatternExprBasic getAlternatives(int i) { ruby_alternative_pattern_alternatives(this, i, result) } + /** Gets the node corresponding to the field `alternatives`. */ + final F::UnderscorePatternExprBasic getAnAlternatives() { result = this.getAlternatives(_) } + /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_alternative_pattern_alternatives(this, _, result) } } /** A class representing `argument_list` nodes. */ - final class ArgumentList extends @ruby_argument_list, AstNodeImpl { + class ArgumentList extends @ruby_argument_list, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ArgumentList" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_argument_list_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_argument_list_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_argument_list_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_argument_list_child(this, _, result) } } /** A class representing `array` nodes. */ - final class Array extends @ruby_array, AstNodeImpl { + class Array extends @ruby_array, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Array" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_array_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_array_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_array_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_array_child(this, _, result) } } /** A class representing `array_pattern` nodes. */ - final class ArrayPattern extends @ruby_array_pattern, AstNodeImpl { + class ArrayPattern extends @ruby_array_pattern, F::UnderscorePatternExprBasic, + F::UnderscorePatternTopExprBody + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ArrayPattern" } /** Gets the node corresponding to the field `class`. */ - final UnderscorePatternConstant getClass() { ruby_array_pattern_class(this, result) } + final F::UnderscorePatternConstant getClass() { ruby_array_pattern_class(this, result) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_array_pattern_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_array_pattern_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_array_pattern_class(this, result) or ruby_array_pattern_child(this, _, result) } } /** A class representing `as_pattern` nodes. */ - final class AsPattern extends @ruby_as_pattern, AstNodeImpl { + class AsPattern extends @ruby_as_pattern, F::UnderscorePatternExpr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AsPattern" } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { ruby_as_pattern_def(this, result, _) } + final F::Identifier getName() { ruby_as_pattern_def(this, result, _) } /** Gets the node corresponding to the field `value`. */ - final UnderscorePatternExpr getValue() { ruby_as_pattern_def(this, _, result) } + final F::UnderscorePatternExpr getValue() { ruby_as_pattern_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_as_pattern_def(this, result, _) or ruby_as_pattern_def(this, _, result) } } /** A class representing `assignment` nodes. */ - final class Assignment extends @ruby_assignment, AstNodeImpl { + class Assignment extends @ruby_assignment, F::UnderscoreArg, F::UnderscoreExpression { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Assignment" } /** Gets the node corresponding to the field `left`. */ - final AstNode getLeft() { ruby_assignment_def(this, result, _) } + final F::AstNode getLeft() { ruby_assignment_def(this, result, _) } /** Gets the node corresponding to the field `right`. */ - final AstNode getRight() { ruby_assignment_def(this, _, result) } + final F::AstNode getRight() { ruby_assignment_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_assignment_def(this, result, _) or ruby_assignment_def(this, _, result) } } /** A class representing `bare_string` nodes. */ - final class BareString extends @ruby_bare_string, AstNodeImpl { + class BareString extends @ruby_bare_string, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BareString" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_bare_string_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_bare_string_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_bare_string_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_bare_string_child(this, _, result) } } /** A class representing `bare_symbol` nodes. */ - final class BareSymbol extends @ruby_bare_symbol, AstNodeImpl { + class BareSymbol extends @ruby_bare_symbol, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BareSymbol" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_bare_symbol_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_bare_symbol_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_bare_symbol_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_bare_symbol_child(this, _, result) } } /** A class representing `begin` nodes. */ - final class Begin extends @ruby_begin, AstNodeImpl { + class Begin extends @ruby_begin, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Begin" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_begin_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_begin_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_begin_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_begin_child(this, _, result) } } /** A class representing `begin_block` nodes. */ - final class BeginBlock extends @ruby_begin_block, AstNodeImpl { + class BeginBlock extends @ruby_begin_block, F::UnderscoreStatement { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BeginBlock" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_begin_block_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_begin_block_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_begin_block_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_begin_block_child(this, _, result) } } /** A class representing `binary` nodes. */ - final class Binary extends @ruby_binary, AstNodeImpl { + class Binary extends @ruby_binary, F::UnderscoreArg, F::UnderscoreExpression { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Binary" } /** Gets the node corresponding to the field `left`. */ - final AstNode getLeft() { ruby_binary_def(this, result, _, _) } + final F::AstNode getLeft() { ruby_binary_def(this, result, _, _) } /** Gets the node corresponding to the field `operator`. */ final string getOperator() { @@ -344,130 +376,142 @@ module Ruby { } /** Gets the node corresponding to the field `right`. */ - final UnderscoreExpression getRight() { ruby_binary_def(this, _, _, result) } + final F::UnderscoreExpression getRight() { ruby_binary_def(this, _, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_binary_def(this, result, _, _) or ruby_binary_def(this, _, _, result) } } /** A class representing `block` nodes. */ - final class Block extends @ruby_block, AstNodeImpl { + class Block extends @ruby_block, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Block" } /** Gets the node corresponding to the field `body`. */ - final BlockBody getBody() { ruby_block_body(this, result) } + final F::BlockBody getBody() { ruby_block_body(this, result) } /** Gets the node corresponding to the field `parameters`. */ - final BlockParameters getParameters() { ruby_block_parameters(this, result) } + final F::BlockParameters getParameters() { ruby_block_parameters(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_block_body(this, result) or ruby_block_parameters(this, result) } } /** A class representing `block_argument` nodes. */ - final class BlockArgument extends @ruby_block_argument, AstNodeImpl { + class BlockArgument extends @ruby_block_argument, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BlockArgument" } /** Gets the child of this node. */ - final UnderscoreArg getChild() { ruby_block_argument_child(this, result) } + final F::UnderscoreArg getChild() { ruby_block_argument_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_block_argument_child(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_block_argument_child(this, result) } } /** A class representing `block_body` nodes. */ - final class BlockBody extends @ruby_block_body, AstNodeImpl { + class BlockBody extends @ruby_block_body, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BlockBody" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_block_body_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_block_body_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_block_body_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_block_body_child(this, _, result) } } /** A class representing `block_parameter` nodes. */ - final class BlockParameter extends @ruby_block_parameter, AstNodeImpl { + class BlockParameter extends @ruby_block_parameter, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BlockParameter" } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { ruby_block_parameter_name(this, result) } + final F::Identifier getName() { ruby_block_parameter_name(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_block_parameter_name(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_block_parameter_name(this, result) } } /** A class representing `block_parameters` nodes. */ - final class BlockParameters extends @ruby_block_parameters, AstNodeImpl { + class BlockParameters extends @ruby_block_parameters, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BlockParameters" } /** Gets the node corresponding to the field `locals`. */ - final Identifier getLocals(int i) { ruby_block_parameters_locals(this, i, result) } + final F::Identifier getLocals(int i) { ruby_block_parameters_locals(this, i, result) } + + /** Gets the node corresponding to the field `locals`. */ + final F::Identifier getALocals() { result = this.getLocals(_) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_block_parameters_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_block_parameters_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_block_parameters_locals(this, _, result) or ruby_block_parameters_child(this, _, result) } } /** A class representing `body_statement` nodes. */ - final class BodyStatement extends @ruby_body_statement, AstNodeImpl { + class BodyStatement extends @ruby_body_statement, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BodyStatement" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_body_statement_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_body_statement_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_body_statement_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_body_statement_child(this, _, result) } } /** A class representing `break` nodes. */ - final class Break extends @ruby_break, AstNodeImpl { + class Break extends @ruby_break, F::UnderscoreExpression, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Break" } /** Gets the child of this node. */ - final ArgumentList getChild() { ruby_break_child(this, result) } + final F::ArgumentList getChild() { ruby_break_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_break_child(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_break_child(this, result) } } /** A class representing `call` nodes. */ - final class Call extends @ruby_call, AstNodeImpl { + class Call extends @ruby_call, F::UnderscoreExpression, F::UnderscoreLhs, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Call" } /** Gets the node corresponding to the field `arguments`. */ - final ArgumentList getArguments() { ruby_call_arguments(this, result) } + final F::ArgumentList getArguments() { ruby_call_arguments(this, result) } /** Gets the node corresponding to the field `block`. */ - final AstNode getBlock() { ruby_call_block(this, result) } + final F::AstNode getBlock() { ruby_call_block(this, result) } /** Gets the node corresponding to the field `method`. */ - final AstNode getMethod() { ruby_call_method(this, result) } + final F::AstNode getMethod() { ruby_call_method(this, result) } /** Gets the node corresponding to the field `operator`. */ - final UnderscoreCallOperator getOperator() { ruby_call_operator(this, result) } + final F::UnderscoreCallOperator getOperator() { ruby_call_operator(this, result) } /** Gets the node corresponding to the field `receiver`. */ - final UnderscorePrimary getReceiver() { ruby_call_receiver(this, result) } + final F::UnderscorePrimary getReceiver() { ruby_call_receiver(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_call_arguments(this, result) or ruby_call_block(this, result) or ruby_call_method(this, result) or @@ -477,38 +521,44 @@ module Ruby { } /** A class representing `case` nodes. */ - final class Case extends @ruby_case__, AstNodeImpl { + class Case extends @ruby_case__, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Case" } /** Gets the node corresponding to the field `value`. */ - final UnderscoreStatement getValue() { ruby_case_value(this, result) } + final F::UnderscoreStatement getValue() { ruby_case_value(this, result) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_case_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_case_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_case_value(this, result) or ruby_case_child(this, _, result) } } /** A class representing `case_match` nodes. */ - final class CaseMatch extends @ruby_case_match, AstNodeImpl { + class CaseMatch extends @ruby_case_match, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CaseMatch" } /** Gets the node corresponding to the field `clauses`. */ - final InClause getClauses(int i) { ruby_case_match_clauses(this, i, result) } + final F::InClause getClauses(int i) { ruby_case_match_clauses(this, i, result) } + + /** Gets the node corresponding to the field `clauses`. */ + final F::InClause getAClauses() { result = this.getClauses(_) } /** Gets the node corresponding to the field `else`. */ - final Else getElse() { ruby_case_match_else(this, result) } + final F::Else getElse() { ruby_case_match_else(this, result) } /** Gets the node corresponding to the field `value`. */ - final UnderscoreStatement getValue() { ruby_case_match_def(this, result) } + final F::UnderscoreStatement getValue() { ruby_case_match_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_case_match_clauses(this, _, result) or ruby_case_match_else(this, result) or ruby_case_match_def(this, result) @@ -516,39 +566,42 @@ module Ruby { } /** A class representing `chained_string` nodes. */ - final class ChainedString extends @ruby_chained_string, AstNodeImpl { + class ChainedString extends @ruby_chained_string, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ChainedString" } /** Gets the `i`th child of this node. */ - final String getChild(int i) { ruby_chained_string_child(this, i, result) } + final F::String getChild(int i) { ruby_chained_string_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::String getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_chained_string_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_chained_string_child(this, _, result) } } /** A class representing `character` tokens. */ - final class Character extends @ruby_token_character, TokenImpl { + class Character extends @ruby_token_character, F::Token, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Character" } } /** A class representing `class` nodes. */ - final class Class extends @ruby_class, AstNodeImpl { + class Class extends @ruby_class, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Class" } /** Gets the node corresponding to the field `body`. */ - final BodyStatement getBody() { ruby_class_body(this, result) } + final F::BodyStatement getBody() { ruby_class_body(this, result) } /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { ruby_class_def(this, result) } + final F::AstNode getName() { ruby_class_def(this, result) } /** Gets the node corresponding to the field `superclass`. */ - final Superclass getSuperclass() { ruby_class_superclass(this, result) } + final F::Superclass getSuperclass() { ruby_class_superclass(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_class_body(this, result) or ruby_class_def(this, result) or ruby_class_superclass(this, result) @@ -556,45 +609,45 @@ module Ruby { } /** A class representing `class_variable` tokens. */ - final class ClassVariable extends @ruby_token_class_variable, TokenImpl { + class ClassVariable extends @ruby_token_class_variable, F::Token, F::UnderscoreNonlocalVariable { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ClassVariable" } } /** A class representing `comment` tokens. */ - final class Comment extends @ruby_token_comment, TokenImpl { + class Comment extends @ruby_token_comment, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Comment" } } /** A class representing `complex` nodes. */ - final class Complex extends @ruby_complex, AstNodeImpl { + class Complex extends @ruby_complex, F::UnderscoreSimpleNumeric { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Complex" } /** Gets the child of this node. */ - final AstNode getChild() { ruby_complex_def(this, result) } + final F::AstNode getChild() { ruby_complex_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_complex_def(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_complex_def(this, result) } } /** A class representing `conditional` nodes. */ - final class Conditional extends @ruby_conditional, AstNodeImpl { + class Conditional extends @ruby_conditional, F::UnderscoreArg { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Conditional" } /** Gets the node corresponding to the field `alternative`. */ - final UnderscoreArg getAlternative() { ruby_conditional_def(this, result, _, _) } + final F::UnderscoreArg getAlternative() { ruby_conditional_def(this, result, _, _) } /** Gets the node corresponding to the field `condition`. */ - final UnderscoreArg getCondition() { ruby_conditional_def(this, _, result, _) } + final F::UnderscoreArg getCondition() { ruby_conditional_def(this, _, result, _) } /** Gets the node corresponding to the field `consequence`. */ - final UnderscoreArg getConsequence() { ruby_conditional_def(this, _, _, result) } + final F::UnderscoreArg getConsequence() { ruby_conditional_def(this, _, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_conditional_def(this, result, _, _) or ruby_conditional_def(this, _, result, _) or ruby_conditional_def(this, _, _, result) @@ -602,94 +655,115 @@ module Ruby { } /** A class representing `constant` tokens. */ - final class Constant extends @ruby_token_constant, TokenImpl { + class Constant extends @ruby_token_constant, F::Token, F::UnderscoreMethodName, + F::UnderscorePatternConstant, F::UnderscoreVariable + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Constant" } } /** A class representing `delimited_symbol` nodes. */ - final class DelimitedSymbol extends @ruby_delimited_symbol, AstNodeImpl { + class DelimitedSymbol extends @ruby_delimited_symbol, F::UnderscoreMethodName, + F::UnderscorePatternPrimitive, F::UnderscorePrimary + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "DelimitedSymbol" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_delimited_symbol_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_delimited_symbol_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_delimited_symbol_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_delimited_symbol_child(this, _, result) } } /** A class representing `destructured_left_assignment` nodes. */ - final class DestructuredLeftAssignment extends @ruby_destructured_left_assignment, AstNodeImpl { + class DestructuredLeftAssignment extends @ruby_destructured_left_assignment, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "DestructuredLeftAssignment" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_destructured_left_assignment_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_destructured_left_assignment_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_destructured_left_assignment_child(this, _, result) } } /** A class representing `destructured_parameter` nodes. */ - final class DestructuredParameter extends @ruby_destructured_parameter, AstNodeImpl { + class DestructuredParameter extends @ruby_destructured_parameter, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "DestructuredParameter" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_destructured_parameter_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_destructured_parameter_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_destructured_parameter_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { + ruby_destructured_parameter_child(this, _, result) + } } /** A class representing `do` nodes. */ - final class Do extends @ruby_do, AstNodeImpl { + class Do extends @ruby_do, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Do" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_do_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_do_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_do_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_do_child(this, _, result) } } /** A class representing `do_block` nodes. */ - final class DoBlock extends @ruby_do_block, AstNodeImpl { + class DoBlock extends @ruby_do_block, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "DoBlock" } /** Gets the node corresponding to the field `body`. */ - final BodyStatement getBody() { ruby_do_block_body(this, result) } + final F::BodyStatement getBody() { ruby_do_block_body(this, result) } /** Gets the node corresponding to the field `parameters`. */ - final BlockParameters getParameters() { ruby_do_block_parameters(this, result) } + final F::BlockParameters getParameters() { ruby_do_block_parameters(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_do_block_body(this, result) or ruby_do_block_parameters(this, result) } } /** A class representing `element_reference` nodes. */ - final class ElementReference extends @ruby_element_reference, AstNodeImpl { + class ElementReference extends @ruby_element_reference, F::UnderscoreLhs { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ElementReference" } /** Gets the node corresponding to the field `block`. */ - final AstNode getBlock() { ruby_element_reference_block(this, result) } + final F::AstNode getBlock() { ruby_element_reference_block(this, result) } /** Gets the node corresponding to the field `object`. */ - final UnderscorePrimary getObject() { ruby_element_reference_def(this, result) } + final F::UnderscorePrimary getObject() { ruby_element_reference_def(this, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getChild(int i) { ruby_element_reference_child(this, i, result) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_element_reference_child(this, i, result) } + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_element_reference_block(this, result) or ruby_element_reference_def(this, result) or ruby_element_reference_child(this, _, result) @@ -697,33 +771,36 @@ module Ruby { } /** A class representing `else` nodes. */ - final class Else extends @ruby_else, AstNodeImpl { + class Else extends @ruby_else, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Else" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_else_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_else_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_else_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_else_child(this, _, result) } } /** A class representing `elsif` nodes. */ - final class Elsif extends @ruby_elsif, AstNodeImpl { + class Elsif extends @ruby_elsif, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Elsif" } /** Gets the node corresponding to the field `alternative`. */ - final AstNode getAlternative() { ruby_elsif_alternative(this, result) } + final F::AstNode getAlternative() { ruby_elsif_alternative(this, result) } /** Gets the node corresponding to the field `condition`. */ - final UnderscoreStatement getCondition() { ruby_elsif_def(this, result) } + final F::UnderscoreStatement getCondition() { ruby_elsif_def(this, result) } /** Gets the node corresponding to the field `consequence`. */ - final Then getConsequence() { ruby_elsif_consequence(this, result) } + final F::Then getConsequence() { ruby_elsif_consequence(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_elsif_alternative(this, result) or ruby_elsif_def(this, result) or ruby_elsif_consequence(this, result) @@ -731,136 +808,152 @@ module Ruby { } /** A class representing `empty_statement` tokens. */ - final class EmptyStatement extends @ruby_token_empty_statement, TokenImpl { + class EmptyStatement extends @ruby_token_empty_statement, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "EmptyStatement" } } /** A class representing `encoding` tokens. */ - final class Encoding extends @ruby_token_encoding, TokenImpl { + class Encoding extends @ruby_token_encoding, F::Token, F::UnderscorePatternPrimitive { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Encoding" } } /** A class representing `end_block` nodes. */ - final class EndBlock extends @ruby_end_block, AstNodeImpl { + class EndBlock extends @ruby_end_block, F::UnderscoreStatement { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "EndBlock" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_end_block_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_end_block_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_end_block_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_end_block_child(this, _, result) } } /** A class representing `ensure` nodes. */ - final class Ensure extends @ruby_ensure, AstNodeImpl { + class Ensure extends @ruby_ensure, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Ensure" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_ensure_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_ensure_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_ensure_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_ensure_child(this, _, result) } } /** A class representing `escape_sequence` tokens. */ - final class EscapeSequence extends @ruby_token_escape_sequence, TokenImpl { + class EscapeSequence extends @ruby_token_escape_sequence, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "EscapeSequence" } } /** A class representing `exception_variable` nodes. */ - final class ExceptionVariable extends @ruby_exception_variable, AstNodeImpl { + class ExceptionVariable extends @ruby_exception_variable, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ExceptionVariable" } /** Gets the child of this node. */ - final UnderscoreLhs getChild() { ruby_exception_variable_def(this, result) } + final F::UnderscoreLhs getChild() { ruby_exception_variable_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_exception_variable_def(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_exception_variable_def(this, result) } } /** A class representing `exceptions` nodes. */ - final class Exceptions extends @ruby_exceptions, AstNodeImpl { + class Exceptions extends @ruby_exceptions, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Exceptions" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_exceptions_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_exceptions_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_exceptions_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_exceptions_child(this, _, result) } } /** A class representing `expression_reference_pattern` nodes. */ - final class ExpressionReferencePattern extends @ruby_expression_reference_pattern, AstNodeImpl { + class ExpressionReferencePattern extends @ruby_expression_reference_pattern, + F::UnderscorePatternExprBasic + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ExpressionReferencePattern" } /** Gets the node corresponding to the field `value`. */ - final UnderscoreExpression getValue() { ruby_expression_reference_pattern_def(this, result) } + final F::UnderscoreExpression getValue() { ruby_expression_reference_pattern_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_expression_reference_pattern_def(this, result) } } /** A class representing `false` tokens. */ - final class False extends @ruby_token_false, TokenImpl { + class False extends @ruby_token_false, F::Token, F::UnderscoreLhs, F::UnderscorePatternPrimitive { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "False" } } /** A class representing `file` tokens. */ - final class File extends @ruby_token_file, TokenImpl { + class File extends @ruby_token_file, F::Token, F::UnderscorePatternPrimitive { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "File" } } /** A class representing `find_pattern` nodes. */ - final class FindPattern extends @ruby_find_pattern, AstNodeImpl { + class FindPattern extends @ruby_find_pattern, F::UnderscorePatternExprBasic, + F::UnderscorePatternTopExprBody + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "FindPattern" } /** Gets the node corresponding to the field `class`. */ - final UnderscorePatternConstant getClass() { ruby_find_pattern_class(this, result) } + final F::UnderscorePatternConstant getClass() { ruby_find_pattern_class(this, result) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_find_pattern_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_find_pattern_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_find_pattern_class(this, result) or ruby_find_pattern_child(this, _, result) } } /** A class representing `float` tokens. */ - final class Float extends @ruby_token_float, TokenImpl { + class Float extends @ruby_token_float, F::Token, F::UnderscoreSimpleNumeric { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Float" } } /** A class representing `for` nodes. */ - final class For extends @ruby_for, AstNodeImpl { + class For extends @ruby_for, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "For" } /** Gets the node corresponding to the field `body`. */ - final Do getBody() { ruby_for_def(this, result, _, _) } + final F::Do getBody() { ruby_for_def(this, result, _, _) } /** Gets the node corresponding to the field `pattern`. */ - final AstNode getPattern() { ruby_for_def(this, _, result, _) } + final F::AstNode getPattern() { ruby_for_def(this, _, result, _) } /** Gets the node corresponding to the field `value`. */ - final In getValue() { ruby_for_def(this, _, _, result) } + final F::In getValue() { ruby_for_def(this, _, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_for_def(this, result, _, _) or ruby_for_def(this, _, result, _) or ruby_for_def(this, _, _, result) @@ -868,140 +961,155 @@ module Ruby { } /** A class representing `forward_argument` tokens. */ - final class ForwardArgument extends @ruby_token_forward_argument, TokenImpl { + class ForwardArgument extends @ruby_token_forward_argument, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ForwardArgument" } } /** A class representing `forward_parameter` tokens. */ - final class ForwardParameter extends @ruby_token_forward_parameter, TokenImpl { + class ForwardParameter extends @ruby_token_forward_parameter, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ForwardParameter" } } /** A class representing `global_variable` tokens. */ - final class GlobalVariable extends @ruby_token_global_variable, TokenImpl { + class GlobalVariable extends @ruby_token_global_variable, F::Token, F::UnderscoreNonlocalVariable { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "GlobalVariable" } } /** A class representing `hash` nodes. */ - final class Hash extends @ruby_hash, AstNodeImpl { + class Hash extends @ruby_hash, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Hash" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_hash_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_hash_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_hash_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_hash_child(this, _, result) } } /** A class representing `hash_key_symbol` tokens. */ - final class HashKeySymbol extends @ruby_token_hash_key_symbol, TokenImpl { + class HashKeySymbol extends @ruby_token_hash_key_symbol, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "HashKeySymbol" } } /** A class representing `hash_pattern` nodes. */ - final class HashPattern extends @ruby_hash_pattern, AstNodeImpl { + class HashPattern extends @ruby_hash_pattern, F::UnderscorePatternExprBasic, + F::UnderscorePatternTopExprBody + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "HashPattern" } /** Gets the node corresponding to the field `class`. */ - final UnderscorePatternConstant getClass() { ruby_hash_pattern_class(this, result) } + final F::UnderscorePatternConstant getClass() { ruby_hash_pattern_class(this, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getChild(int i) { ruby_hash_pattern_child(this, i, result) } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_hash_pattern_child(this, i, result) } + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_hash_pattern_class(this, result) or ruby_hash_pattern_child(this, _, result) } } /** A class representing `hash_splat_argument` nodes. */ - final class HashSplatArgument extends @ruby_hash_splat_argument, AstNodeImpl { + class HashSplatArgument extends @ruby_hash_splat_argument, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "HashSplatArgument" } /** Gets the child of this node. */ - final UnderscoreArg getChild() { ruby_hash_splat_argument_child(this, result) } + final F::UnderscoreArg getChild() { ruby_hash_splat_argument_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_hash_splat_argument_child(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_hash_splat_argument_child(this, result) } } /** A class representing `hash_splat_nil` tokens. */ - final class HashSplatNil extends @ruby_token_hash_splat_nil, TokenImpl { + class HashSplatNil extends @ruby_token_hash_splat_nil, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "HashSplatNil" } } /** A class representing `hash_splat_parameter` nodes. */ - final class HashSplatParameter extends @ruby_hash_splat_parameter, AstNodeImpl { + class HashSplatParameter extends @ruby_hash_splat_parameter, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "HashSplatParameter" } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { ruby_hash_splat_parameter_name(this, result) } + final F::Identifier getName() { ruby_hash_splat_parameter_name(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_hash_splat_parameter_name(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_hash_splat_parameter_name(this, result) } } /** A class representing `heredoc_beginning` tokens. */ - final class HeredocBeginning extends @ruby_token_heredoc_beginning, TokenImpl { + class HeredocBeginning extends @ruby_token_heredoc_beginning, F::Token, + F::UnderscorePatternPrimitive, F::UnderscorePrimary + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "HeredocBeginning" } } /** A class representing `heredoc_body` nodes. */ - final class HeredocBody extends @ruby_heredoc_body, AstNodeImpl { + class HeredocBody extends @ruby_heredoc_body, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "HeredocBody" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_heredoc_body_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_heredoc_body_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_heredoc_body_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_heredoc_body_child(this, _, result) } } /** A class representing `heredoc_content` tokens. */ - final class HeredocContent extends @ruby_token_heredoc_content, TokenImpl { + class HeredocContent extends @ruby_token_heredoc_content, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "HeredocContent" } } /** A class representing `heredoc_end` tokens. */ - final class HeredocEnd extends @ruby_token_heredoc_end, TokenImpl { + class HeredocEnd extends @ruby_token_heredoc_end, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "HeredocEnd" } } /** A class representing `identifier` tokens. */ - final class Identifier extends @ruby_token_identifier, TokenImpl { + class Identifier extends @ruby_token_identifier, F::Token, F::UnderscoreMethodName, + F::UnderscorePatternExprBasic, F::UnderscoreVariable + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Identifier" } } /** A class representing `if` nodes. */ - final class If extends @ruby_if, AstNodeImpl { + class If extends @ruby_if, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "If" } /** Gets the node corresponding to the field `alternative`. */ - final AstNode getAlternative() { ruby_if_alternative(this, result) } + final F::AstNode getAlternative() { ruby_if_alternative(this, result) } /** Gets the node corresponding to the field `condition`. */ - final UnderscoreStatement getCondition() { ruby_if_def(this, result) } + final F::UnderscoreStatement getCondition() { ruby_if_def(this, result) } /** Gets the node corresponding to the field `consequence`. */ - final Then getConsequence() { ruby_if_consequence(this, result) } + final F::Then getConsequence() { ruby_if_consequence(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_if_alternative(this, result) or ruby_if_def(this, result) or ruby_if_consequence(this, result) @@ -1009,62 +1117,62 @@ module Ruby { } /** A class representing `if_guard` nodes. */ - final class IfGuard extends @ruby_if_guard, AstNodeImpl { + class IfGuard extends @ruby_if_guard, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "IfGuard" } /** Gets the node corresponding to the field `condition`. */ - final UnderscoreExpression getCondition() { ruby_if_guard_def(this, result) } + final F::UnderscoreExpression getCondition() { ruby_if_guard_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_if_guard_def(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_if_guard_def(this, result) } } /** A class representing `if_modifier` nodes. */ - final class IfModifier extends @ruby_if_modifier, AstNodeImpl { + class IfModifier extends @ruby_if_modifier, F::UnderscoreStatement { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "IfModifier" } /** Gets the node corresponding to the field `body`. */ - final UnderscoreStatement getBody() { ruby_if_modifier_def(this, result, _) } + final F::UnderscoreStatement getBody() { ruby_if_modifier_def(this, result, _) } /** Gets the node corresponding to the field `condition`. */ - final UnderscoreExpression getCondition() { ruby_if_modifier_def(this, _, result) } + final F::UnderscoreExpression getCondition() { ruby_if_modifier_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_if_modifier_def(this, result, _) or ruby_if_modifier_def(this, _, result) } } /** A class representing `in` nodes. */ - final class In extends @ruby_in, AstNodeImpl { + class In extends @ruby_in, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "In" } /** Gets the child of this node. */ - final UnderscoreArg getChild() { ruby_in_def(this, result) } + final F::UnderscoreArg getChild() { ruby_in_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_in_def(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_in_def(this, result) } } /** A class representing `in_clause` nodes. */ - final class InClause extends @ruby_in_clause, AstNodeImpl { + class InClause extends @ruby_in_clause, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "InClause" } /** Gets the node corresponding to the field `body`. */ - final Then getBody() { ruby_in_clause_body(this, result) } + final F::Then getBody() { ruby_in_clause_body(this, result) } /** Gets the node corresponding to the field `guard`. */ - final AstNode getGuard() { ruby_in_clause_guard(this, result) } + final F::AstNode getGuard() { ruby_in_clause_guard(this, result) } /** Gets the node corresponding to the field `pattern`. */ - final UnderscorePatternTopExprBody getPattern() { ruby_in_clause_def(this, result) } + final F::UnderscorePatternTopExprBody getPattern() { ruby_in_clause_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_in_clause_body(this, result) or ruby_in_clause_guard(this, result) or ruby_in_clause_def(this, result) @@ -1072,143 +1180,156 @@ module Ruby { } /** A class representing `instance_variable` tokens. */ - final class InstanceVariable extends @ruby_token_instance_variable, TokenImpl { + class InstanceVariable extends @ruby_token_instance_variable, F::Token, + F::UnderscoreNonlocalVariable + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "InstanceVariable" } } /** A class representing `integer` tokens. */ - final class Integer extends @ruby_token_integer, TokenImpl { + class Integer extends @ruby_token_integer, F::Token, F::UnderscoreSimpleNumeric { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Integer" } } /** A class representing `interpolation` nodes. */ - final class Interpolation extends @ruby_interpolation, AstNodeImpl { + class Interpolation extends @ruby_interpolation, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Interpolation" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_interpolation_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_interpolation_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_interpolation_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_interpolation_child(this, _, result) } } /** A class representing `keyword_parameter` nodes. */ - final class KeywordParameter extends @ruby_keyword_parameter, AstNodeImpl { + class KeywordParameter extends @ruby_keyword_parameter, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "KeywordParameter" } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { ruby_keyword_parameter_def(this, result) } + final F::Identifier getName() { ruby_keyword_parameter_def(this, result) } /** Gets the node corresponding to the field `value`. */ - final UnderscoreArg getValue() { ruby_keyword_parameter_value(this, result) } + final F::UnderscoreArg getValue() { ruby_keyword_parameter_value(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_keyword_parameter_def(this, result) or ruby_keyword_parameter_value(this, result) } } /** A class representing `keyword_pattern` nodes. */ - final class KeywordPattern extends @ruby_keyword_pattern, AstNodeImpl { + class KeywordPattern extends @ruby_keyword_pattern, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "KeywordPattern" } /** Gets the node corresponding to the field `key`. */ - final AstNode getKey() { ruby_keyword_pattern_def(this, result) } + final F::AstNode getKey() { ruby_keyword_pattern_def(this, result) } /** Gets the node corresponding to the field `value`. */ - final UnderscorePatternExpr getValue() { ruby_keyword_pattern_value(this, result) } + final F::UnderscorePatternExpr getValue() { ruby_keyword_pattern_value(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_keyword_pattern_def(this, result) or ruby_keyword_pattern_value(this, result) } } /** A class representing `lambda` nodes. */ - final class Lambda extends @ruby_lambda, AstNodeImpl { + class Lambda extends @ruby_lambda, F::UnderscorePatternPrimitive, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Lambda" } /** Gets the node corresponding to the field `body`. */ - final AstNode getBody() { ruby_lambda_def(this, result) } + final F::AstNode getBody() { ruby_lambda_def(this, result) } /** Gets the node corresponding to the field `parameters`. */ - final LambdaParameters getParameters() { ruby_lambda_parameters(this, result) } + final F::LambdaParameters getParameters() { ruby_lambda_parameters(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_lambda_def(this, result) or ruby_lambda_parameters(this, result) } } /** A class representing `lambda_parameters` nodes. */ - final class LambdaParameters extends @ruby_lambda_parameters, AstNodeImpl { + class LambdaParameters extends @ruby_lambda_parameters, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "LambdaParameters" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_lambda_parameters_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_lambda_parameters_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_lambda_parameters_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_lambda_parameters_child(this, _, result) } } /** A class representing `left_assignment_list` nodes. */ - final class LeftAssignmentList extends @ruby_left_assignment_list, AstNodeImpl { + class LeftAssignmentList extends @ruby_left_assignment_list, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "LeftAssignmentList" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_left_assignment_list_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_left_assignment_list_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_left_assignment_list_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { + ruby_left_assignment_list_child(this, _, result) + } } /** A class representing `line` tokens. */ - final class Line extends @ruby_token_line, TokenImpl { + class Line extends @ruby_token_line, F::Token, F::UnderscorePatternPrimitive { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Line" } } /** A class representing `match_pattern` nodes. */ - final class MatchPattern extends @ruby_match_pattern, AstNodeImpl { + class MatchPattern extends @ruby_match_pattern, F::UnderscoreExpression { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "MatchPattern" } /** Gets the node corresponding to the field `pattern`. */ - final UnderscorePatternTopExprBody getPattern() { ruby_match_pattern_def(this, result, _) } + final F::UnderscorePatternTopExprBody getPattern() { ruby_match_pattern_def(this, result, _) } /** Gets the node corresponding to the field `value`. */ - final UnderscoreArg getValue() { ruby_match_pattern_def(this, _, result) } + final F::UnderscoreArg getValue() { ruby_match_pattern_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_match_pattern_def(this, result, _) or ruby_match_pattern_def(this, _, result) } } /** A class representing `method` nodes. */ - final class Method extends @ruby_method, AstNodeImpl { + class Method extends @ruby_method, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Method" } /** Gets the node corresponding to the field `body`. */ - final AstNode getBody() { ruby_method_body(this, result) } + final F::AstNode getBody() { ruby_method_body(this, result) } /** Gets the node corresponding to the field `name`. */ - final UnderscoreMethodName getName() { ruby_method_def(this, result) } + final F::UnderscoreMethodName getName() { ruby_method_def(this, result) } /** Gets the node corresponding to the field `parameters`. */ - final MethodParameters getParameters() { ruby_method_parameters(this, result) } + final F::MethodParameters getParameters() { ruby_method_parameters(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_method_body(this, result) or ruby_method_def(this, result) or ruby_method_parameters(this, result) @@ -1216,65 +1337,70 @@ module Ruby { } /** A class representing `method_parameters` nodes. */ - final class MethodParameters extends @ruby_method_parameters, AstNodeImpl { + class MethodParameters extends @ruby_method_parameters, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "MethodParameters" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_method_parameters_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_method_parameters_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_method_parameters_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_method_parameters_child(this, _, result) } } /** A class representing `module` nodes. */ - final class Module extends @ruby_module, AstNodeImpl { + class Module extends @ruby_module, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Module" } /** Gets the node corresponding to the field `body`. */ - final BodyStatement getBody() { ruby_module_body(this, result) } + final F::BodyStatement getBody() { ruby_module_body(this, result) } /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { ruby_module_def(this, result) } + final F::AstNode getName() { ruby_module_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_module_body(this, result) or ruby_module_def(this, result) } } /** A class representing `next` nodes. */ - final class Next extends @ruby_next, AstNodeImpl { + class Next extends @ruby_next, F::UnderscoreExpression, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Next" } /** Gets the child of this node. */ - final ArgumentList getChild() { ruby_next_child(this, result) } + final F::ArgumentList getChild() { ruby_next_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_next_child(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_next_child(this, result) } } /** A class representing `nil` tokens. */ - final class Nil extends @ruby_token_nil, TokenImpl { + class Nil extends @ruby_token_nil, F::Token, F::UnderscoreLhs, F::UnderscorePatternPrimitive { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Nil" } } /** A class representing `operator` tokens. */ - final class Operator extends @ruby_token_operator, TokenImpl { + class Operator extends @ruby_token_operator, F::Token, F::UnderscoreMethodName { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Operator" } } /** A class representing `operator_assignment` nodes. */ - final class OperatorAssignment extends @ruby_operator_assignment, AstNodeImpl { + class OperatorAssignment extends @ruby_operator_assignment, F::UnderscoreArg, + F::UnderscoreExpression + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "OperatorAssignment" } /** Gets the node corresponding to the field `left`. */ - final UnderscoreLhs getLeft() { ruby_operator_assignment_def(this, result, _, _) } + final F::UnderscoreLhs getLeft() { ruby_operator_assignment_def(this, result, _, _) } /** Gets the node corresponding to the field `operator`. */ final string getOperator() { @@ -1308,109 +1434,115 @@ module Ruby { } /** Gets the node corresponding to the field `right`. */ - final AstNode getRight() { ruby_operator_assignment_def(this, _, _, result) } + final F::AstNode getRight() { ruby_operator_assignment_def(this, _, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_operator_assignment_def(this, result, _, _) or ruby_operator_assignment_def(this, _, _, result) } } /** A class representing `optional_parameter` nodes. */ - final class OptionalParameter extends @ruby_optional_parameter, AstNodeImpl { + class OptionalParameter extends @ruby_optional_parameter, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "OptionalParameter" } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { ruby_optional_parameter_def(this, result, _) } + final F::Identifier getName() { ruby_optional_parameter_def(this, result, _) } /** Gets the node corresponding to the field `value`. */ - final UnderscoreArg getValue() { ruby_optional_parameter_def(this, _, result) } + final F::UnderscoreArg getValue() { ruby_optional_parameter_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_optional_parameter_def(this, result, _) or ruby_optional_parameter_def(this, _, result) } } /** A class representing `pair` nodes. */ - final class Pair extends @ruby_pair, AstNodeImpl { + class Pair extends @ruby_pair, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Pair" } /** Gets the node corresponding to the field `key`. */ - final AstNode getKey() { ruby_pair_def(this, result) } + final F::AstNode getKey() { ruby_pair_def(this, result) } /** Gets the node corresponding to the field `value`. */ - final UnderscoreArg getValue() { ruby_pair_value(this, result) } + final F::UnderscoreArg getValue() { ruby_pair_value(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_pair_def(this, result) or ruby_pair_value(this, result) } } /** A class representing `parenthesized_pattern` nodes. */ - final class ParenthesizedPattern extends @ruby_parenthesized_pattern, AstNodeImpl { + class ParenthesizedPattern extends @ruby_parenthesized_pattern, F::UnderscorePatternExprBasic { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ParenthesizedPattern" } /** Gets the child of this node. */ - final UnderscorePatternExpr getChild() { ruby_parenthesized_pattern_def(this, result) } + final F::UnderscorePatternExpr getChild() { ruby_parenthesized_pattern_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_parenthesized_pattern_def(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_parenthesized_pattern_def(this, result) } } /** A class representing `parenthesized_statements` nodes. */ - final class ParenthesizedStatements extends @ruby_parenthesized_statements, AstNodeImpl { + class ParenthesizedStatements extends @ruby_parenthesized_statements, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ParenthesizedStatements" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_parenthesized_statements_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_parenthesized_statements_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_parenthesized_statements_child(this, _, result) } } /** A class representing `pattern` nodes. */ - final class Pattern extends @ruby_pattern, AstNodeImpl { + class Pattern extends @ruby_pattern, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Pattern" } /** Gets the child of this node. */ - final AstNode getChild() { ruby_pattern_def(this, result) } + final F::AstNode getChild() { ruby_pattern_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_pattern_def(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_pattern_def(this, result) } } /** A class representing `program` nodes. */ - final class Program extends @ruby_program, AstNodeImpl { + class Program extends @ruby_program, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Program" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_program_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_program_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_program_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_program_child(this, _, result) } } /** A class representing `range` nodes. */ - final class Range extends @ruby_range, AstNodeImpl { + class Range extends @ruby_range, F::UnderscoreArg, F::UnderscorePatternExprBasic { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Range" } /** Gets the node corresponding to the field `begin`. */ - final AstNode getBegin() { ruby_range_begin(this, result) } + final F::AstNode getBegin() { ruby_range_begin(this, result) } /** Gets the node corresponding to the field `end`. */ - final AstNode getEnd() { ruby_range_end(this, result) } + final F::AstNode getEnd() { ruby_range_end(this, result) } /** Gets the node corresponding to the field `operator`. */ final string getOperator() { @@ -1422,63 +1554,66 @@ module Ruby { } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_range_begin(this, result) or ruby_range_end(this, result) } } /** A class representing `rational` nodes. */ - final class Rational extends @ruby_rational, AstNodeImpl { + class Rational extends @ruby_rational, F::UnderscoreSimpleNumeric { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Rational" } /** Gets the child of this node. */ - final AstNode getChild() { ruby_rational_def(this, result) } + final F::AstNode getChild() { ruby_rational_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_rational_def(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_rational_def(this, result) } } /** A class representing `redo` nodes. */ - final class Redo extends @ruby_redo, AstNodeImpl { + class Redo extends @ruby_redo, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Redo" } /** Gets the child of this node. */ - final ArgumentList getChild() { ruby_redo_child(this, result) } + final F::ArgumentList getChild() { ruby_redo_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_redo_child(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_redo_child(this, result) } } /** A class representing `regex` nodes. */ - final class Regex extends @ruby_regex, AstNodeImpl { + class Regex extends @ruby_regex, F::UnderscorePatternPrimitive, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Regex" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_regex_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_regex_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_regex_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_regex_child(this, _, result) } } /** A class representing `rescue` nodes. */ - final class Rescue extends @ruby_rescue, AstNodeImpl { + class Rescue extends @ruby_rescue, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Rescue" } /** Gets the node corresponding to the field `body`. */ - final Then getBody() { ruby_rescue_body(this, result) } + final F::Then getBody() { ruby_rescue_body(this, result) } /** Gets the node corresponding to the field `exceptions`. */ - final Exceptions getExceptions() { ruby_rescue_exceptions(this, result) } + final F::Exceptions getExceptions() { ruby_rescue_exceptions(this, result) } /** Gets the node corresponding to the field `variable`. */ - final ExceptionVariable getVariable() { ruby_rescue_variable(this, result) } + final F::ExceptionVariable getVariable() { ruby_rescue_variable(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_rescue_body(this, result) or ruby_rescue_exceptions(this, result) or ruby_rescue_variable(this, result) @@ -1486,147 +1621,158 @@ module Ruby { } /** A class representing `rescue_modifier` nodes. */ - final class RescueModifier extends @ruby_rescue_modifier, AstNodeImpl { + class RescueModifier extends @ruby_rescue_modifier, F::UnderscoreStatement { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "RescueModifier" } /** Gets the node corresponding to the field `body`. */ - final AstNode getBody() { ruby_rescue_modifier_def(this, result, _) } + final F::AstNode getBody() { ruby_rescue_modifier_def(this, result, _) } /** Gets the node corresponding to the field `handler`. */ - final UnderscoreExpression getHandler() { ruby_rescue_modifier_def(this, _, result) } + final F::UnderscoreExpression getHandler() { ruby_rescue_modifier_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_rescue_modifier_def(this, result, _) or ruby_rescue_modifier_def(this, _, result) } } /** A class representing `rest_assignment` nodes. */ - final class RestAssignment extends @ruby_rest_assignment, AstNodeImpl { + class RestAssignment extends @ruby_rest_assignment, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "RestAssignment" } /** Gets the child of this node. */ - final UnderscoreLhs getChild() { ruby_rest_assignment_child(this, result) } + final F::UnderscoreLhs getChild() { ruby_rest_assignment_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_rest_assignment_child(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_rest_assignment_child(this, result) } } /** A class representing `retry` nodes. */ - final class Retry extends @ruby_retry, AstNodeImpl { + class Retry extends @ruby_retry, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Retry" } /** Gets the child of this node. */ - final ArgumentList getChild() { ruby_retry_child(this, result) } + final F::ArgumentList getChild() { ruby_retry_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_retry_child(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_retry_child(this, result) } } /** A class representing `return` nodes. */ - final class Return extends @ruby_return, AstNodeImpl { + class Return extends @ruby_return, F::UnderscoreExpression, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Return" } /** Gets the child of this node. */ - final ArgumentList getChild() { ruby_return_child(this, result) } + final F::ArgumentList getChild() { ruby_return_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_return_child(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_return_child(this, result) } } /** A class representing `right_assignment_list` nodes. */ - final class RightAssignmentList extends @ruby_right_assignment_list, AstNodeImpl { + class RightAssignmentList extends @ruby_right_assignment_list, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "RightAssignmentList" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_right_assignment_list_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_right_assignment_list_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_right_assignment_list_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { + ruby_right_assignment_list_child(this, _, result) + } } /** A class representing `scope_resolution` nodes. */ - final class ScopeResolution extends @ruby_scope_resolution, AstNodeImpl { + class ScopeResolution extends @ruby_scope_resolution, F::UnderscoreLhs, + F::UnderscorePatternConstant + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ScopeResolution" } /** Gets the node corresponding to the field `name`. */ - final Constant getName() { ruby_scope_resolution_def(this, result) } + final F::Constant getName() { ruby_scope_resolution_def(this, result) } /** Gets the node corresponding to the field `scope`. */ - final AstNode getScope() { ruby_scope_resolution_scope(this, result) } + final F::AstNode getScope() { ruby_scope_resolution_scope(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_scope_resolution_def(this, result) or ruby_scope_resolution_scope(this, result) } } /** A class representing `self` tokens. */ - final class Self extends @ruby_token_self, TokenImpl { + class Self extends @ruby_token_self, F::Token, F::UnderscorePatternPrimitive, + F::UnderscoreVariable + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Self" } } /** A class representing `setter` nodes. */ - final class Setter extends @ruby_setter, AstNodeImpl { + class Setter extends @ruby_setter, F::UnderscoreMethodName { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Setter" } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { ruby_setter_def(this, result) } + final F::Identifier getName() { ruby_setter_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_setter_def(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_setter_def(this, result) } } /** A class representing `simple_symbol` tokens. */ - final class SimpleSymbol extends @ruby_token_simple_symbol, TokenImpl { + class SimpleSymbol extends @ruby_token_simple_symbol, F::Token, F::UnderscoreMethodName, + F::UnderscorePatternPrimitive, F::UnderscorePrimary + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SimpleSymbol" } } /** A class representing `singleton_class` nodes. */ - final class SingletonClass extends @ruby_singleton_class, AstNodeImpl { + class SingletonClass extends @ruby_singleton_class, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SingletonClass" } /** Gets the node corresponding to the field `body`. */ - final BodyStatement getBody() { ruby_singleton_class_body(this, result) } + final F::BodyStatement getBody() { ruby_singleton_class_body(this, result) } /** Gets the node corresponding to the field `value`. */ - final UnderscoreArg getValue() { ruby_singleton_class_def(this, result) } + final F::UnderscoreArg getValue() { ruby_singleton_class_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_singleton_class_body(this, result) or ruby_singleton_class_def(this, result) } } /** A class representing `singleton_method` nodes. */ - final class SingletonMethod extends @ruby_singleton_method, AstNodeImpl { + class SingletonMethod extends @ruby_singleton_method, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SingletonMethod" } /** Gets the node corresponding to the field `body`. */ - final AstNode getBody() { ruby_singleton_method_body(this, result) } + final F::AstNode getBody() { ruby_singleton_method_body(this, result) } /** Gets the node corresponding to the field `name`. */ - final UnderscoreMethodName getName() { ruby_singleton_method_def(this, result, _) } + final F::UnderscoreMethodName getName() { ruby_singleton_method_def(this, result, _) } /** Gets the node corresponding to the field `object`. */ - final AstNode getObject() { ruby_singleton_method_def(this, _, result) } + final F::AstNode getObject() { ruby_singleton_method_def(this, _, result) } /** Gets the node corresponding to the field `parameters`. */ - final MethodParameters getParameters() { ruby_singleton_method_parameters(this, result) } + final F::MethodParameters getParameters() { ruby_singleton_method_parameters(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_singleton_method_body(this, result) or ruby_singleton_method_def(this, result, _) or ruby_singleton_method_def(this, _, result) or @@ -1635,143 +1781,160 @@ module Ruby { } /** A class representing `splat_argument` nodes. */ - final class SplatArgument extends @ruby_splat_argument, AstNodeImpl { + class SplatArgument extends @ruby_splat_argument, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SplatArgument" } /** Gets the child of this node. */ - final UnderscoreArg getChild() { ruby_splat_argument_child(this, result) } + final F::UnderscoreArg getChild() { ruby_splat_argument_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_splat_argument_child(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_splat_argument_child(this, result) } } /** A class representing `splat_parameter` nodes. */ - final class SplatParameter extends @ruby_splat_parameter, AstNodeImpl { + class SplatParameter extends @ruby_splat_parameter, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SplatParameter" } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { ruby_splat_parameter_name(this, result) } + final F::Identifier getName() { ruby_splat_parameter_name(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_splat_parameter_name(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_splat_parameter_name(this, result) } } /** A class representing `string` nodes. */ - final class String extends @ruby_string__, AstNodeImpl { + class String extends @ruby_string__, F::UnderscorePatternPrimitive, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "String" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_string_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_string_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_string_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_string_child(this, _, result) } } /** A class representing `string_array` nodes. */ - final class StringArray extends @ruby_string_array, AstNodeImpl { + class StringArray extends @ruby_string_array, F::UnderscorePatternPrimitive, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "StringArray" } /** Gets the `i`th child of this node. */ - final BareString getChild(int i) { ruby_string_array_child(this, i, result) } + final F::BareString getChild(int i) { ruby_string_array_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::BareString getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_string_array_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_string_array_child(this, _, result) } } /** A class representing `string_content` tokens. */ - final class StringContent extends @ruby_token_string_content, TokenImpl { + class StringContent extends @ruby_token_string_content, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "StringContent" } } /** A class representing `subshell` nodes. */ - final class Subshell extends @ruby_subshell, AstNodeImpl { + class Subshell extends @ruby_subshell, F::UnderscorePatternPrimitive, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Subshell" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_subshell_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_subshell_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_subshell_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_subshell_child(this, _, result) } } /** A class representing `super` tokens. */ - final class Super extends @ruby_token_super, TokenImpl { + class Super extends @ruby_token_super, F::Token, F::UnderscoreVariable { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Super" } } /** A class representing `superclass` nodes. */ - final class Superclass extends @ruby_superclass, AstNodeImpl { + class Superclass extends @ruby_superclass, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Superclass" } /** Gets the child of this node. */ - final UnderscoreExpression getChild() { ruby_superclass_def(this, result) } + final F::UnderscoreExpression getChild() { ruby_superclass_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_superclass_def(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_superclass_def(this, result) } } /** A class representing `symbol_array` nodes. */ - final class SymbolArray extends @ruby_symbol_array, AstNodeImpl { + class SymbolArray extends @ruby_symbol_array, F::UnderscorePatternPrimitive, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SymbolArray" } /** Gets the `i`th child of this node. */ - final BareSymbol getChild(int i) { ruby_symbol_array_child(this, i, result) } + final F::BareSymbol getChild(int i) { ruby_symbol_array_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::BareSymbol getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_symbol_array_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_symbol_array_child(this, _, result) } } /** A class representing `test_pattern` nodes. */ - final class TestPattern extends @ruby_test_pattern, AstNodeImpl { + class TestPattern extends @ruby_test_pattern, F::UnderscoreExpression { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TestPattern" } /** Gets the node corresponding to the field `pattern`. */ - final UnderscorePatternTopExprBody getPattern() { ruby_test_pattern_def(this, result, _) } + final F::UnderscorePatternTopExprBody getPattern() { ruby_test_pattern_def(this, result, _) } /** Gets the node corresponding to the field `value`. */ - final UnderscoreArg getValue() { ruby_test_pattern_def(this, _, result) } + final F::UnderscoreArg getValue() { ruby_test_pattern_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_test_pattern_def(this, result, _) or ruby_test_pattern_def(this, _, result) } } /** A class representing `then` nodes. */ - final class Then extends @ruby_then, AstNodeImpl { + class Then extends @ruby_then, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Then" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ruby_then_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_then_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_then_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_then_child(this, _, result) } } /** A class representing `true` tokens. */ - final class True extends @ruby_token_true, TokenImpl { + class True extends @ruby_token_true, F::Token, F::UnderscoreLhs, F::UnderscorePatternPrimitive { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "True" } } /** A class representing `unary` nodes. */ - final class Unary extends @ruby_unary, AstNodeImpl { + class Unary extends @ruby_unary, F::UnderscoreArg, F::UnderscoreExpression, + F::UnderscorePatternPrimitive, F::UnderscorePrimary + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Unary" } /** Gets the node corresponding to the field `operand`. */ - final AstNode getOperand() { ruby_unary_def(this, result, _) } + final F::AstNode getOperand() { ruby_unary_def(this, result, _) } /** Gets the node corresponding to the field `operator`. */ final string getOperator() { @@ -1791,43 +1954,46 @@ module Ruby { } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_unary_def(this, result, _) } + final override F::AstNode getAFieldOrChild() { ruby_unary_def(this, result, _) } } /** A class representing `undef` nodes. */ - final class Undef extends @ruby_undef, AstNodeImpl { + class Undef extends @ruby_undef, F::UnderscoreStatement { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Undef" } /** Gets the `i`th child of this node. */ - final UnderscoreMethodName getChild(int i) { ruby_undef_child(this, i, result) } + final F::UnderscoreMethodName getChild(int i) { ruby_undef_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::UnderscoreMethodName getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_undef_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { ruby_undef_child(this, _, result) } } /** A class representing `uninterpreted` tokens. */ - final class Uninterpreted extends @ruby_token_uninterpreted, TokenImpl { + class Uninterpreted extends @ruby_token_uninterpreted, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Uninterpreted" } } /** A class representing `unless` nodes. */ - final class Unless extends @ruby_unless, AstNodeImpl { + class Unless extends @ruby_unless, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Unless" } /** Gets the node corresponding to the field `alternative`. */ - final AstNode getAlternative() { ruby_unless_alternative(this, result) } + final F::AstNode getAlternative() { ruby_unless_alternative(this, result) } /** Gets the node corresponding to the field `condition`. */ - final UnderscoreStatement getCondition() { ruby_unless_def(this, result) } + final F::UnderscoreStatement getCondition() { ruby_unless_def(this, result) } /** Gets the node corresponding to the field `consequence`. */ - final Then getConsequence() { ruby_unless_consequence(this, result) } + final F::Then getConsequence() { ruby_unless_consequence(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_unless_alternative(this, result) or ruby_unless_def(this, result) or ruby_unless_consequence(this, result) @@ -1835,147 +2001,154 @@ module Ruby { } /** A class representing `unless_guard` nodes. */ - final class UnlessGuard extends @ruby_unless_guard, AstNodeImpl { + class UnlessGuard extends @ruby_unless_guard, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "UnlessGuard" } /** Gets the node corresponding to the field `condition`. */ - final UnderscoreExpression getCondition() { ruby_unless_guard_def(this, result) } + final F::UnderscoreExpression getCondition() { ruby_unless_guard_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_unless_guard_def(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_unless_guard_def(this, result) } } /** A class representing `unless_modifier` nodes. */ - final class UnlessModifier extends @ruby_unless_modifier, AstNodeImpl { + class UnlessModifier extends @ruby_unless_modifier, F::UnderscoreStatement { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "UnlessModifier" } /** Gets the node corresponding to the field `body`. */ - final UnderscoreStatement getBody() { ruby_unless_modifier_def(this, result, _) } + final F::UnderscoreStatement getBody() { ruby_unless_modifier_def(this, result, _) } /** Gets the node corresponding to the field `condition`. */ - final UnderscoreExpression getCondition() { ruby_unless_modifier_def(this, _, result) } + final F::UnderscoreExpression getCondition() { ruby_unless_modifier_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_unless_modifier_def(this, result, _) or ruby_unless_modifier_def(this, _, result) } } /** A class representing `until` nodes. */ - final class Until extends @ruby_until, AstNodeImpl { + class Until extends @ruby_until, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Until" } /** Gets the node corresponding to the field `body`. */ - final Do getBody() { ruby_until_def(this, result, _) } + final F::Do getBody() { ruby_until_def(this, result, _) } /** Gets the node corresponding to the field `condition`. */ - final UnderscoreStatement getCondition() { ruby_until_def(this, _, result) } + final F::UnderscoreStatement getCondition() { ruby_until_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_until_def(this, result, _) or ruby_until_def(this, _, result) } } /** A class representing `until_modifier` nodes. */ - final class UntilModifier extends @ruby_until_modifier, AstNodeImpl { + class UntilModifier extends @ruby_until_modifier, F::UnderscoreStatement { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "UntilModifier" } /** Gets the node corresponding to the field `body`. */ - final UnderscoreStatement getBody() { ruby_until_modifier_def(this, result, _) } + final F::UnderscoreStatement getBody() { ruby_until_modifier_def(this, result, _) } /** Gets the node corresponding to the field `condition`. */ - final UnderscoreExpression getCondition() { ruby_until_modifier_def(this, _, result) } + final F::UnderscoreExpression getCondition() { ruby_until_modifier_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_until_modifier_def(this, result, _) or ruby_until_modifier_def(this, _, result) } } /** A class representing `variable_reference_pattern` nodes. */ - final class VariableReferencePattern extends @ruby_variable_reference_pattern, AstNodeImpl { + class VariableReferencePattern extends @ruby_variable_reference_pattern, + F::UnderscorePatternExprBasic + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "VariableReferencePattern" } /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { ruby_variable_reference_pattern_def(this, result) } + final F::AstNode getName() { ruby_variable_reference_pattern_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_variable_reference_pattern_def(this, result) } + final override F::AstNode getAFieldOrChild() { + ruby_variable_reference_pattern_def(this, result) + } } /** A class representing `when` nodes. */ - final class When extends @ruby_when, AstNodeImpl { + class When extends @ruby_when, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "When" } /** Gets the node corresponding to the field `body`. */ - final Then getBody() { ruby_when_body(this, result) } + final F::Then getBody() { ruby_when_body(this, result) } + + /** Gets the node corresponding to the field `pattern`. */ + final F::Pattern getPattern(int i) { ruby_when_pattern(this, i, result) } /** Gets the node corresponding to the field `pattern`. */ - final Pattern getPattern(int i) { ruby_when_pattern(this, i, result) } + final F::Pattern getAPattern() { result = this.getPattern(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_when_body(this, result) or ruby_when_pattern(this, _, result) } } /** A class representing `while` nodes. */ - final class While extends @ruby_while, AstNodeImpl { + class While extends @ruby_while, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "While" } /** Gets the node corresponding to the field `body`. */ - final Do getBody() { ruby_while_def(this, result, _) } + final F::Do getBody() { ruby_while_def(this, result, _) } /** Gets the node corresponding to the field `condition`. */ - final UnderscoreStatement getCondition() { ruby_while_def(this, _, result) } + final F::UnderscoreStatement getCondition() { ruby_while_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_while_def(this, result, _) or ruby_while_def(this, _, result) } } /** A class representing `while_modifier` nodes. */ - final class WhileModifier extends @ruby_while_modifier, AstNodeImpl { + class WhileModifier extends @ruby_while_modifier, F::UnderscoreStatement { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "WhileModifier" } /** Gets the node corresponding to the field `body`. */ - final UnderscoreStatement getBody() { ruby_while_modifier_def(this, result, _) } + final F::UnderscoreStatement getBody() { ruby_while_modifier_def(this, result, _) } /** Gets the node corresponding to the field `condition`. */ - final UnderscoreExpression getCondition() { ruby_while_modifier_def(this, _, result) } + final F::UnderscoreExpression getCondition() { ruby_while_modifier_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_while_modifier_def(this, result, _) or ruby_while_modifier_def(this, _, result) } } /** A class representing `yield` nodes. */ - final class Yield extends @ruby_yield, AstNodeImpl { + class Yield extends @ruby_yield, F::UnderscoreExpression, F::UnderscorePrimary { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Yield" } /** Gets the child of this node. */ - final ArgumentList getChild() { ruby_yield_child(this, result) } + final F::ArgumentList getChild() { ruby_yield_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ruby_yield_child(this, result) } + final override F::AstNode getAFieldOrChild() { ruby_yield_child(this, result) } } /** Provides predicates for mapping AST nodes to their named children. */ module PrintAst { /** Gets a child of `node` returned by the member predicate with the given `name`. If the predicate takes an index argument, `i` is bound to that index, otherwise `i` is `-1` (which is never a valid index). */ - AstNode getChild(AstNode node, string name, int i) { + F::AstNode getChild(F::AstNode node, string name, int i) { result = node.(Alias).getAlias() and i = -1 and name = "getAlias" or result = node.(Alias).getName() and i = -1 and name = "getName" @@ -2307,10 +2480,322 @@ module Ruby { } } +module RubyFinal { + private module F = Ruby; + + import F + + final class AstNode = F::AstNode; + + final class Token = F::Token; + + final class ReservedWord = F::ReservedWord; + + final class UnderscoreArg = F::UnderscoreArg; + + final class UnderscoreCallOperator = F::UnderscoreCallOperator; + + final class UnderscoreExpression = F::UnderscoreExpression; + + final class UnderscoreLhs = F::UnderscoreLhs; + + final class UnderscoreMethodName = F::UnderscoreMethodName; + + final class UnderscoreNonlocalVariable = F::UnderscoreNonlocalVariable; + + final class UnderscorePatternConstant = F::UnderscorePatternConstant; + + final class UnderscorePatternExpr = F::UnderscorePatternExpr; + + final class UnderscorePatternExprBasic = F::UnderscorePatternExprBasic; + + final class UnderscorePatternPrimitive = F::UnderscorePatternPrimitive; + + final class UnderscorePatternTopExprBody = F::UnderscorePatternTopExprBody; + + final class UnderscorePrimary = F::UnderscorePrimary; + + final class UnderscoreSimpleNumeric = F::UnderscoreSimpleNumeric; + + final class UnderscoreStatement = F::UnderscoreStatement; + + final class UnderscoreVariable = F::UnderscoreVariable; + + final class Alias = F::Alias; + + final class AlternativePattern = F::AlternativePattern; + + final class ArgumentList = F::ArgumentList; + + final class Array = F::Array; + + final class ArrayPattern = F::ArrayPattern; + + final class AsPattern = F::AsPattern; + + final class Assignment = F::Assignment; + + final class BareString = F::BareString; + + final class BareSymbol = F::BareSymbol; + + final class Begin = F::Begin; + + final class BeginBlock = F::BeginBlock; + + final class Binary = F::Binary; + + final class Block = F::Block; + + final class BlockArgument = F::BlockArgument; + + final class BlockBody = F::BlockBody; + + final class BlockParameter = F::BlockParameter; + + final class BlockParameters = F::BlockParameters; + + final class BodyStatement = F::BodyStatement; + + final class Break = F::Break; + + final class Call = F::Call; + + final class Case = F::Case; + + final class CaseMatch = F::CaseMatch; + + final class ChainedString = F::ChainedString; + + final class Character = F::Character; + + final class Class = F::Class; + + final class ClassVariable = F::ClassVariable; + + final class Comment = F::Comment; + + final class Complex = F::Complex; + + final class Conditional = F::Conditional; + + final class Constant = F::Constant; + + final class DelimitedSymbol = F::DelimitedSymbol; + + final class DestructuredLeftAssignment = F::DestructuredLeftAssignment; + + final class DestructuredParameter = F::DestructuredParameter; + + final class Do = F::Do; + + final class DoBlock = F::DoBlock; + + final class ElementReference = F::ElementReference; + + final class Else = F::Else; + + final class Elsif = F::Elsif; + + final class EmptyStatement = F::EmptyStatement; + + final class Encoding = F::Encoding; + + final class EndBlock = F::EndBlock; + + final class Ensure = F::Ensure; + + final class EscapeSequence = F::EscapeSequence; + + final class ExceptionVariable = F::ExceptionVariable; + + final class Exceptions = F::Exceptions; + + final class ExpressionReferencePattern = F::ExpressionReferencePattern; + + final class False = F::False; + + final class File = F::File; + + final class FindPattern = F::FindPattern; + + final class Float = F::Float; + + final class For = F::For; + + final class ForwardArgument = F::ForwardArgument; + + final class ForwardParameter = F::ForwardParameter; + + final class GlobalVariable = F::GlobalVariable; + + final class Hash = F::Hash; + + final class HashKeySymbol = F::HashKeySymbol; + + final class HashPattern = F::HashPattern; + + final class HashSplatArgument = F::HashSplatArgument; + + final class HashSplatNil = F::HashSplatNil; + + final class HashSplatParameter = F::HashSplatParameter; + + final class HeredocBeginning = F::HeredocBeginning; + + final class HeredocBody = F::HeredocBody; + + final class HeredocContent = F::HeredocContent; + + final class HeredocEnd = F::HeredocEnd; + + final class Identifier = F::Identifier; + + final class If = F::If; + + final class IfGuard = F::IfGuard; + + final class IfModifier = F::IfModifier; + + final class In = F::In; + + final class InClause = F::InClause; + + final class InstanceVariable = F::InstanceVariable; + + final class Integer = F::Integer; + + final class Interpolation = F::Interpolation; + + final class KeywordParameter = F::KeywordParameter; + + final class KeywordPattern = F::KeywordPattern; + + final class Lambda = F::Lambda; + + final class LambdaParameters = F::LambdaParameters; + + final class LeftAssignmentList = F::LeftAssignmentList; + + final class Line = F::Line; + + final class MatchPattern = F::MatchPattern; + + final class Method = F::Method; + + final class MethodParameters = F::MethodParameters; + + final class Module = F::Module; + + final class Next = F::Next; + + final class Nil = F::Nil; + + final class Operator = F::Operator; + + final class OperatorAssignment = F::OperatorAssignment; + + final class OptionalParameter = F::OptionalParameter; + + final class Pair = F::Pair; + + final class ParenthesizedPattern = F::ParenthesizedPattern; + + final class ParenthesizedStatements = F::ParenthesizedStatements; + + final class Pattern = F::Pattern; + + final class Program = F::Program; + + final class Range = F::Range; + + final class Rational = F::Rational; + + final class Redo = F::Redo; + + final class Regex = F::Regex; + + final class Rescue = F::Rescue; + + final class RescueModifier = F::RescueModifier; + + final class RestAssignment = F::RestAssignment; + + final class Retry = F::Retry; + + final class Return = F::Return; + + final class RightAssignmentList = F::RightAssignmentList; + + final class ScopeResolution = F::ScopeResolution; + + final class Self = F::Self; + + final class Setter = F::Setter; + + final class SimpleSymbol = F::SimpleSymbol; + + final class SingletonClass = F::SingletonClass; + + final class SingletonMethod = F::SingletonMethod; + + final class SplatArgument = F::SplatArgument; + + final class SplatParameter = F::SplatParameter; + + final class String = F::String; + + final class StringArray = F::StringArray; + + final class StringContent = F::StringContent; + + final class Subshell = F::Subshell; + + final class Super = F::Super; + + final class Superclass = F::Superclass; + + final class SymbolArray = F::SymbolArray; + + final class TestPattern = F::TestPattern; + + final class Then = F::Then; + + final class True = F::True; + + final class Unary = F::Unary; + + final class Undef = F::Undef; + + final class Uninterpreted = F::Uninterpreted; + + final class Unless = F::Unless; + + final class UnlessGuard = F::UnlessGuard; + + final class UnlessModifier = F::UnlessModifier; + + final class Until = F::Until; + + final class UntilModifier = F::UntilModifier; + + final class VariableReferencePattern = F::VariableReferencePattern; + + final class When = F::When; + + final class While = F::While; + + final class WhileModifier = F::WhileModifier; + + final class Yield = F::Yield; +} + overlay[local] module Erb { + private module F = Erb; + /** The base class for all AST nodes */ - private class AstNodeImpl extends @erb_ast_node { + class AstNode extends @erb_ast_node { /** Gets a string representation of this element. */ string toString() { result = this.getAPrimaryQlClass() } @@ -2318,13 +2803,13 @@ module Erb { final L::Location getLocation() { erb_ast_node_location(this, result) } /** Gets the parent of this element. */ - final AstNode getParent() { erb_ast_node_parent(this, result, _) } + final F::AstNode getParent() { erb_ast_node_parent(this, result, _) } /** Gets the index of this node among the children of its parent. */ final int getParentIndex() { erb_ast_node_parent(this, _, result) } /** Gets a field or child node of this node. */ - AstNode getAFieldOrChild() { none() } + F::AstNode getAFieldOrChild() { none() } /** Gets the name of the primary QL class for this element. */ string getAPrimaryQlClass() { result = "???" } @@ -2333,10 +2818,8 @@ module Erb { string getPrimaryQlClasses() { result = concat(this.getAPrimaryQlClass(), ",") } } - final class AstNode = AstNodeImpl; - /** A token. */ - private class TokenImpl extends @erb_token, AstNodeImpl { + class Token extends @erb_token, F::AstNode { /** Gets the value of this token. */ final string getValue() { erb_tokeninfo(this, _, result) } @@ -2347,10 +2830,8 @@ module Erb { override string getAPrimaryQlClass() { result = "Token" } } - final class Token = TokenImpl; - /** A reserved word. */ - final class ReservedWord extends @erb_reserved_word, TokenImpl { + class ReservedWord extends @erb_reserved_word, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ReservedWord" } } @@ -2376,87 +2857,90 @@ module Erb { } /** A class representing `code` tokens. */ - final class Code extends @erb_token_code, TokenImpl { + class Code extends @erb_token_code, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Code" } } /** A class representing `comment` tokens. */ - final class Comment extends @erb_token_comment, TokenImpl { + class Comment extends @erb_token_comment, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Comment" } } /** A class representing `comment_directive` nodes. */ - final class CommentDirective extends @erb_comment_directive, AstNodeImpl { + class CommentDirective extends @erb_comment_directive, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CommentDirective" } /** Gets the child of this node. */ - final Comment getChild() { erb_comment_directive_child(this, result) } + final F::Comment getChild() { erb_comment_directive_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { erb_comment_directive_child(this, result) } + final override F::AstNode getAFieldOrChild() { erb_comment_directive_child(this, result) } } /** A class representing `content` tokens. */ - final class Content extends @erb_token_content, TokenImpl { + class Content extends @erb_token_content, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Content" } } /** A class representing `directive` nodes. */ - final class Directive extends @erb_directive, AstNodeImpl { + class Directive extends @erb_directive, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Directive" } /** Gets the child of this node. */ - final Code getChild() { erb_directive_child(this, result) } + final F::Code getChild() { erb_directive_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { erb_directive_child(this, result) } + final override F::AstNode getAFieldOrChild() { erb_directive_child(this, result) } } /** A class representing `graphql_directive` nodes. */ - final class GraphqlDirective extends @erb_graphql_directive, AstNodeImpl { + class GraphqlDirective extends @erb_graphql_directive, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "GraphqlDirective" } /** Gets the child of this node. */ - final Code getChild() { erb_graphql_directive_child(this, result) } + final F::Code getChild() { erb_graphql_directive_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { erb_graphql_directive_child(this, result) } + final override F::AstNode getAFieldOrChild() { erb_graphql_directive_child(this, result) } } /** A class representing `output_directive` nodes. */ - final class OutputDirective extends @erb_output_directive, AstNodeImpl { + class OutputDirective extends @erb_output_directive, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "OutputDirective" } /** Gets the child of this node. */ - final Code getChild() { erb_output_directive_child(this, result) } + final F::Code getChild() { erb_output_directive_child(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { erb_output_directive_child(this, result) } + final override F::AstNode getAFieldOrChild() { erb_output_directive_child(this, result) } } /** A class representing `template` nodes. */ - final class Template extends @erb_template, AstNodeImpl { + class Template extends @erb_template, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Template" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { erb_template_child(this, i, result) } + final F::AstNode getChild(int i) { erb_template_child(this, i, result) } + + /** Gets the `i`th child of this node. */ + final F::AstNode getAChild() { result = this.getChild(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { erb_template_child(this, _, result) } + final override F::AstNode getAFieldOrChild() { erb_template_child(this, _, result) } } /** Provides predicates for mapping AST nodes to their named children. */ module PrintAst { /** Gets a child of `node` returned by the member predicate with the given `name`. If the predicate takes an index argument, `i` is bound to that index, otherwise `i` is `-1` (which is never a valid index). */ - AstNode getChild(AstNode node, string name, int i) { + F::AstNode getChild(F::AstNode node, string name, int i) { result = node.(CommentDirective).getChild() and i = -1 and name = "getChild" or result = node.(Directive).getChild() and i = -1 and name = "getChild" @@ -2469,3 +2953,31 @@ module Erb { } } } + +module ErbFinal { + private module F = Erb; + + import F + + final class AstNode = F::AstNode; + + final class Token = F::Token; + + final class ReservedWord = F::ReservedWord; + + final class Code = F::Code; + + final class Comment = F::Comment; + + final class CommentDirective = F::CommentDirective; + + final class Content = F::Content; + + final class Directive = F::Directive; + + final class GraphqlDirective = F::GraphqlDirective; + + final class OutputDirective = F::OutputDirective; + + final class Template = F::Template; +} diff --git a/shared/tree-sitter-extractor/src/generator/mod.rs b/shared/tree-sitter-extractor/src/generator/mod.rs index dbecf62569af..cf445aaaac7f 100644 --- a/shared/tree-sitter-extractor/src/generator/mod.rs +++ b/shared/tree-sitter-extractor/src/generator/mod.rs @@ -18,6 +18,7 @@ pub fn generate( languages: Vec, dbscheme_path: PathBuf, ql_library_path: PathBuf, + use_facade_ast: bool, regenerate_instructions: &str, ) -> std::io::Result<()> { let dbscheme_file = File::create(dbscheme_path).map_err(|e| { @@ -47,6 +48,7 @@ pub fn generate( ql::write( &mut ql_writer, &[ql::TopLevel::Import(ql::Import { + is_private: false, module: "codeql.Locations", alias: Some("L"), })], @@ -122,17 +124,35 @@ pub fn generate( let mut body = vec![]; - for c in ql_gen::create_ast_node_class( + let facade_import_name = if use_facade_ast { + format!("FacadeAst::{}", &language.name) + } else { + language.name.clone() // If not using a facade AST, treat the module itself as the facade module. + }; + if use_facade_ast { + body.push(ql::TopLevel::Import(ql::Import { + is_private: true, + module: &facade_import_name, + alias: Some("F"), + })); + } else { + body.push(ql::TopLevel::ModuleAlias(ql::ModuleAlias { + is_private: true, + name: "F", + target: &language.name, + })); + } + + body.push(ql::TopLevel::Class(ql_gen::create_ast_node_class( &ast_node_name, &node_location_table_name, &node_parent_table_name, - ) { - body.push(ql::TopLevel::Class(c)); - } + ))); - for c in ql_gen::create_token_class(&token_name, &tokeninfo_name) { - body.push(ql::TopLevel::Class(c)); - } + body.push(ql::TopLevel::Class(ql_gen::create_token_class( + &token_name, + &tokeninfo_name, + ))); if has_trivia_tokens { body.push(ql::TopLevel::Class(ql_gen::create_trivia_token_class( @@ -166,14 +186,68 @@ pub fn generate( body.append(&mut ql_gen::convert_nodes(&nodes)); body.push(ql_gen::create_print_ast_module(&nodes)); + let mut final_body = if use_facade_ast { + vec![ + ql::TopLevel::Import(ql::Import { + is_private: true, + module: &facade_import_name, + alias: Some("F"), + }), + ql::TopLevel::Import(ql::Import { + is_private: false, + module: "F", + alias: None, + }), + ] + } else { + vec![ + ql::TopLevel::ModuleAlias(ql::ModuleAlias { + is_private: true, + name: "F", + target: &language.name, + }), + ql::TopLevel::Import(ql::Import { + is_private: false, + module: "F", + alias: None, + }), + ] + }; + let final_aliases = body + .iter() + .filter_map(|decl| match decl { + ql::TopLevel::Class(c) => Some(ql::TopLevel::Class(ql::Class { + qldoc: None, + name: c.name, + is_abstract: false, + is_final: true, + is_private: false, + supertypes: Set::new(), + characteristic_predicate: None, + predicates: vec![], + alias: Some(format!("F::{}", c.name)), + })), + _ => None, + }) + .collect::>(); + final_body.extend(final_aliases); + let final_module_name = format!("{}Final", language.name); ql::write( &mut ql_writer, - &[ql::TopLevel::Module(ql::Module { - qldoc: None, - name: &language.name, - body, - overlay: Some(ql::OverlayAnnotation::Local), - })], + &[ + ql::TopLevel::Module(ql::Module { + qldoc: None, + name: &language.name, + body, + overlay: Some(ql::OverlayAnnotation::Local), + }), + ql::TopLevel::Module(ql::Module { + qldoc: None, + name: &final_module_name, + body: final_body, + overlay: None, + }), + ], )?; } Ok(()) diff --git a/shared/tree-sitter-extractor/src/generator/ql.rs b/shared/tree-sitter-extractor/src/generator/ql.rs index 6a78a4f95f09..f114e251af21 100644 --- a/shared/tree-sitter-extractor/src/generator/ql.rs +++ b/shared/tree-sitter-extractor/src/generator/ql.rs @@ -5,6 +5,7 @@ use std::fmt; pub enum TopLevel<'a> { Class(Class<'a>), Import(Import<'a>), + ModuleAlias(ModuleAlias<'a>), Module(Module<'a>), Predicate(Predicate<'a>), } @@ -14,20 +15,41 @@ impl fmt::Display for TopLevel<'_> { match self { TopLevel::Import(imp) => write!(f, "{imp}"), TopLevel::Class(cls) => write!(f, "{cls}"), + TopLevel::ModuleAlias(alias) => write!(f, "{alias}"), TopLevel::Module(m) => write!(f, "{m}"), TopLevel::Predicate(pred) => write!(f, "{pred}"), } } } +#[derive(Clone, Eq, PartialEq, Hash)] +pub struct ModuleAlias<'a> { + pub is_private: bool, + pub name: &'a str, + pub target: &'a str, +} + +impl fmt::Display for ModuleAlias<'_> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + if self.is_private { + write!(f, "private ")?; + } + write!(f, "module {} = {};", self.name, self.target) + } +} + #[derive(Clone, Eq, PartialEq, Hash)] pub struct Import<'a> { + pub is_private: bool, pub module: &'a str, pub alias: Option<&'a str>, } impl fmt::Display for Import<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + if self.is_private { + write!(f, "private ")?; + } write!(f, "import {}", &self.module)?; if let Some(name) = &self.alias { write!(f, " as {name}")?; @@ -146,6 +168,9 @@ pub enum Type<'a> { /// A user-defined type. Normal(&'a str), + + /// A normal type with an `F::` prefix. + Facade(&'a str), } impl fmt::Display for Type<'_> { @@ -155,6 +180,7 @@ impl fmt::Display for Type<'_> { Type::String => write!(f, "string"), Type::Normal(name) => write!(f, "{name}"), Type::At(name) => write!(f, "@{name}"), + Type::Facade(name) => write!(f, "F::{name}"), } } } diff --git a/shared/tree-sitter-extractor/src/generator/ql_gen.rs b/shared/tree-sitter-extractor/src/generator/ql_gen.rs index 8f37bf5dff45..fe6f9a2a828b 100644 --- a/shared/tree-sitter-extractor/src/generator/ql_gen.rs +++ b/shared/tree-sitter-extractor/src/generator/ql_gen.rs @@ -8,7 +8,7 @@ pub fn create_ast_node_class<'a>( ast_node: &'a str, node_location_table: &'a str, node_parent_table: &'a str, -) -> [ql::Class<'a>; 2] { +) -> ql::Class<'a> { // Default implementation of `toString` calls `this.getAPrimaryQlClass()` let to_string = ql::Predicate { qldoc: Some(String::from( @@ -48,7 +48,7 @@ pub fn create_ast_node_class<'a>( Some(String::from("Gets a field or child node of this node.")), "getAFieldOrChild", false, - Some(ql::Type::Normal("AstNode")), + Some(ql::Type::Facade("AstNode")), ); let get_parent = ql::Predicate { qldoc: Some(String::from("Gets the parent of this element.")), @@ -56,7 +56,7 @@ pub fn create_ast_node_class<'a>( overridden: false, is_private: false, is_final: true, - return_type: Some(ql::Type::Normal("AstNode")), + return_type: Some(ql::Type::Facade("AstNode")), formal_parameters: vec![], body: ql::Expression::Pred( node_parent_table, @@ -132,41 +132,28 @@ pub fn create_ast_node_class<'a>( ), overlay: None, }; - [ - ql::Class { - qldoc: Some(String::from("The base class for all AST nodes")), - name: "AstNodeImpl", - is_abstract: false, - is_final: false, - is_private: true, - alias: None, - supertypes: vec![ql::Type::At(ast_node)].into_iter().collect(), - characteristic_predicate: None, - predicates: vec![ - to_string, - get_location, - get_parent, - get_parent_index, - get_a_field_or_child, - get_a_primary_ql_class, - get_primary_ql_classes, - ], - }, - ql::Class { - qldoc: None, - name: "AstNode", - is_abstract: false, - is_final: true, - is_private: false, - alias: Some("AstNodeImpl".to_string()), - supertypes: vec![].into_iter().collect(), - characteristic_predicate: None, - predicates: vec![], - }, - ] + ql::Class { + qldoc: Some(String::from("The base class for all AST nodes")), + name: "AstNode", + is_abstract: false, + is_final: false, + is_private: false, + alias: None, + supertypes: vec![ql::Type::At(ast_node)].into_iter().collect(), + characteristic_predicate: None, + predicates: vec![ + to_string, + get_location, + get_parent, + get_parent_index, + get_a_field_or_child, + get_a_primary_ql_class, + get_primary_ql_classes, + ], + } } -pub fn create_token_class<'a>(token_type: &'a str, tokeninfo: &'a str) -> [ql::Class<'a>; 2] { +pub fn create_token_class<'a>(token_type: &'a str, tokeninfo: &'a str) -> ql::Class<'a> { let tokeninfo_arity = 3; // id, kind, value let get_value = ql::Predicate { qldoc: Some(String::from("Gets the value of this token.")), @@ -199,36 +186,23 @@ pub fn create_token_class<'a>(token_type: &'a str, tokeninfo: &'a str) -> [ql::C ), overlay: None, }; - [ - ql::Class { - qldoc: Some(String::from("A token.")), - name: "TokenImpl", - is_abstract: false, - is_final: false, - is_private: true, - alias: None, - supertypes: vec![ql::Type::At(token_type), ql::Type::Normal("AstNodeImpl")] - .into_iter() - .collect(), - characteristic_predicate: None, - predicates: vec![ - get_value, - to_string, - create_get_a_primary_ql_class("Token", false), - ], - }, - ql::Class { - qldoc: None, - name: "Token", - is_abstract: false, - is_final: true, - is_private: false, - alias: Some("TokenImpl".to_string()), - supertypes: vec![].into_iter().collect(), - characteristic_predicate: None, - predicates: vec![], - }, - ] + ql::Class { + qldoc: Some(String::from("A token.")), + name: "Token", + is_abstract: false, + is_final: false, + is_private: false, + alias: None, + supertypes: vec![ql::Type::At(token_type), ql::Type::Facade("AstNode")] + .into_iter() + .collect(), + characteristic_predicate: None, + predicates: vec![ + get_value, + to_string, + create_get_a_primary_ql_class("Token", false), + ], + } } /// Creates the `TriviaToken` class. Trivia tokens (e.g. comments) are @@ -283,15 +257,12 @@ pub fn create_trivia_token_class<'a>( )), name: "TriviaToken", is_abstract: false, - is_final: true, + is_final: false, is_private: false, alias: None, - supertypes: vec![ - ql::Type::At(trivia_token_type), - ql::Type::Normal("AstNodeImpl"), - ] - .into_iter() - .collect(), + supertypes: vec![ql::Type::At(trivia_token_type), ql::Type::Facade("AstNode")] + .into_iter() + .collect(), characteristic_predicate: None, predicates: vec![ get_value, @@ -309,10 +280,10 @@ pub fn create_reserved_word_class(db_name: &str) -> ql::Class<'_> { qldoc: Some(String::from("A reserved word.")), name: class_name, is_abstract: false, - is_final: true, + is_final: false, is_private: false, alias: None, - supertypes: vec![ql::Type::At(db_name), ql::Type::Normal("TokenImpl")] + supertypes: vec![ql::Type::At(db_name), ql::Type::Facade("Token")] .into_iter() .collect(), characteristic_predicate: None, @@ -635,10 +606,11 @@ fn create_get_field_expr_for_table_storage<'a>( ) } -/// Creates a pair consisting of a predicate to get the given field, and an -/// optional expression that will get the same field. When the field can occur -/// multiple times, the predicate will take an index argument, while the -/// expression will use the "don't care" expression to hold for all occurrences. +/// Creates a list of predicates to get the given field, and an optional +/// expression that will get the same field. When the field can occur multiple +/// times, this includes an indexed getter and a convenience getter that returns +/// any member; the expression uses the "don't care" expression to hold for all +/// occurrences. /// /// # Arguments /// @@ -656,16 +628,16 @@ fn create_field_getters<'a>( main_table_column_index: &mut usize, field: &'a node_types::Field, nodes: &'a node_types::NodeTypeMap, -) -> (ql::Predicate<'a>, Option>) { +) -> (Vec>, Option>) { let return_type = match &field.type_info { node_types::FieldTypeInfo::Single(t) => { - Some(ql::Type::Normal(&nodes.get(t).unwrap().ql_class_name)) + Some(ql::Type::Facade(&nodes.get(t).unwrap().ql_class_name)) } node_types::FieldTypeInfo::Multiple { types: _, dbscheme_union: _, ql_class, - } => Some(ql::Type::Normal(ql_class)), + } => Some(ql::Type::Facade(ql_class)), node_types::FieldTypeInfo::ReservedWordInt(_) => Some(ql::Type::String), }; let formal_parameters = match &field.storage { @@ -780,26 +752,87 @@ fn create_field_getters<'a>( } } }; - ( - ql::Predicate { - qldoc: Some(qldoc), - name: &field.getter_name, + let mut predicates = vec![ql::Predicate { + qldoc: Some(qldoc.clone()), + name: &field.getter_name, + overridden: false, + is_private: false, + is_final: true, + return_type: return_type.clone(), + formal_parameters, + body, + overlay: None, + }]; + + if let Some(any_getter_name) = &field.any_getter_name { + predicates.push(ql::Predicate { + qldoc: Some(qldoc.clone()), + name: any_getter_name, overridden: false, is_private: false, is_final: true, return_type, - formal_parameters, - body, + formal_parameters: vec![], + body: ql::Expression::Equals( + Box::new(ql::Expression::Var("result")), + Box::new(ql::Expression::Dot( + Box::new(ql::Expression::Var("this")), + &field.getter_name, + vec![ql::Expression::Var("_")], + )), + ), overlay: None, - }, - optional_expr, - ) + }); + } + + (predicates, optional_expr) +} + +fn compute_direct_supertypes( + nodes: &node_types::NodeTypeMap, +) -> std::collections::BTreeMap> { + let mut supertypes = std::collections::BTreeMap::new(); + for node in nodes.values() { + if let node_types::EntryKind::Union { members } = &node.kind { + for member in members { + supertypes + .entry(member.clone()) + .or_insert_with(BTreeSet::new) + .insert(node.ql_class_name.as_str()); + } + } + } + supertypes +} + +fn ast_base_types<'a>( + type_name: &node_types::TypeName, + direct_supertypes: &std::collections::BTreeMap>, +) -> BTreeSet> { + match direct_supertypes.get(type_name) { + Some(supertypes) if !supertypes.is_empty() => supertypes + .iter() + .map(|name| ql::Type::Facade(name)) + .collect(), + _ => vec![ql::Type::Facade("AstNode")].into_iter().collect(), + } +} + +fn class_supertypes<'a>( + type_name: &node_types::TypeName, + dbscheme_name: &'a str, + direct_supertypes: &std::collections::BTreeMap>, +) -> BTreeSet> { + let mut supertypes = ast_base_types(type_name, direct_supertypes); + supertypes.insert(ql::Type::At(dbscheme_name)); + supertypes } /// Converts the given node types into CodeQL classes wrapping the dbscheme. pub fn convert_nodes(nodes: &node_types::NodeTypeMap) -> Vec> { let mut classes = Vec::new(); let mut token_kinds = BTreeSet::new(); + let direct_supertypes = compute_direct_supertypes(nodes); for (type_name, node) in nodes { if let node_types::EntryKind::Token { .. } = &node.kind { if type_name.named { @@ -814,14 +847,14 @@ pub fn convert_nodes(nodes: &node_types::NodeTypeMap) -> Vec> { if type_name.named { let get_a_primary_ql_class = create_get_a_primary_ql_class(&node.ql_class_name, true); - let mut supertypes: BTreeSet = BTreeSet::new(); - supertypes.insert(ql::Type::At(&node.dbscheme_name)); - supertypes.insert(ql::Type::Normal("TokenImpl")); + let mut supertypes = + class_supertypes(type_name, &node.dbscheme_name, &direct_supertypes); + supertypes.insert(ql::Type::Facade("Token")); classes.push(ql::TopLevel::Class(ql::Class { qldoc: Some(format!("A class representing `{}` tokens.", type_name.kind)), name: &node.ql_class_name, is_abstract: false, - is_final: true, + is_final: false, is_private: false, alias: None, supertypes, @@ -837,15 +870,14 @@ pub fn convert_nodes(nodes: &node_types::NodeTypeMap) -> Vec> { qldoc: None, name: &node.ql_class_name, is_abstract: false, - is_final: true, + is_final: false, is_private: false, alias: None, - supertypes: vec![ - ql::Type::At(&node.dbscheme_name), - ql::Type::Normal("AstNodeImpl"), - ] - .into_iter() - .collect(), + supertypes: class_supertypes( + type_name, + &node.dbscheme_name, + &direct_supertypes, + ), characteristic_predicate: None, predicates: vec![], })); @@ -871,15 +903,14 @@ pub fn convert_nodes(nodes: &node_types::NodeTypeMap) -> Vec> { qldoc: Some(format!("A class representing `{}` nodes.", type_name.kind)), name: main_class_name, is_abstract: false, - is_final: true, + is_final: false, is_private: false, alias: None, - supertypes: vec![ - ql::Type::At(&node.dbscheme_name), - ql::Type::Normal("AstNodeImpl"), - ] - .into_iter() - .collect(), + supertypes: class_supertypes( + type_name, + &node.dbscheme_name, + &direct_supertypes, + ), characteristic_predicate: None, predicates: vec![create_get_a_primary_ql_class(main_class_name, true)], }; @@ -892,14 +923,14 @@ pub fn convert_nodes(nodes: &node_types::NodeTypeMap) -> Vec> { // - predicates to access the fields, // - the QL expressions to access the fields that will be part of getAFieldOrChild. for field in fields { - let (get_pred, get_child_expr) = create_field_getters( + let (get_preds, get_child_expr) = create_field_getters( main_table_name, main_table_arity, &mut main_table_column_index, field, nodes, ); - main_class.predicates.push(get_pred); + main_class.predicates.extend(get_preds); if let Some(get_child_expr) = get_child_expr { get_child_exprs.push(get_child_expr) } @@ -911,7 +942,7 @@ pub fn convert_nodes(nodes: &node_types::NodeTypeMap) -> Vec> { overridden: true, is_private: false, is_final: true, - return_type: Some(ql::Type::Normal("AstNode")), + return_type: Some(ql::Type::Facade("AstNode")), formal_parameters: vec![], body: ql::Expression::Or(get_child_exprs), overlay: None, @@ -992,11 +1023,11 @@ pub fn create_print_ast_module(nodes: &node_types::NodeTypeMap) -> ql::TopLevel< overridden: false, is_private: false, is_final: false, - return_type: Some(ql::Type::Normal("AstNode")), + return_type: Some(ql::Type::Facade("AstNode")), formal_parameters: vec![ ql::FormalParameter { name: "node", - param_type: ql::Type::Normal("AstNode"), + param_type: ql::Type::Facade("AstNode"), }, ql::FormalParameter { name: "name", diff --git a/shared/tree-sitter-extractor/src/node_types.rs b/shared/tree-sitter-extractor/src/node_types.rs index 7a457fa73f0d..4c67c2e4f20e 100644 --- a/shared/tree-sitter-extractor/src/node_types.rs +++ b/shared/tree-sitter-extractor/src/node_types.rs @@ -22,7 +22,7 @@ pub enum EntryKind { Token { kind_id: usize }, } -#[derive(Debug, Ord, PartialOrd, Eq, PartialEq)] +#[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq)] pub struct TypeName { pub kind: String, pub named: bool, @@ -56,6 +56,9 @@ pub struct Field { pub name: Option, /// The name of the predicate to get this field. pub getter_name: String, + /// For plural fields, the name of a convenience getter that returns + /// any member (for example `getAnArgument` for `getArgument(i)`). + pub any_getter_name: Option, pub storage: Storage, } @@ -281,6 +284,16 @@ fn add_field( "get{}", dbscheme_name_to_class_name(&escape_name(&name_for_field_or_child(&field_name))) ); + let getter_suffix = getter_name.strip_prefix("get").unwrap_or(&getter_name); + let article = match getter_suffix.chars().next().map(|c| c.to_ascii_lowercase()) { + Some('a' | 'e' | 'i' | 'o' | 'u') => "An", + _ => "A", + }; + let any_getter_name = if field_info.multiple { + Some(format!("get{article}{getter_suffix}")) + } else { + None + }; fields.push(Field { parent: TypeName { kind: parent_type_name.kind.to_string(), @@ -289,6 +302,7 @@ fn add_field( type_info, name: field_name, getter_name, + any_getter_name, storage, }); } diff --git a/shared/yeast-macros/src/parse.rs b/shared/yeast-macros/src/parse.rs index 40f9dbce61c8..34e859c912e9 100644 --- a/shared/yeast-macros/src/parse.rs +++ b/shared/yeast-macros/src/parse.rs @@ -157,11 +157,14 @@ fn parse_query_fields(tokens: &mut Tokens) -> Result> { map: &mut std::collections::HashMap>, name: String, elem: TokenStream| { - if !map.contains_key(&name) { - order.push(name.clone()); - map.insert(name, vec![elem]); - } else { - map.get_mut(&name).unwrap().push(elem); + match map.entry(name) { + std::collections::hash_map::Entry::Occupied(mut entry) => { + entry.get_mut().push(elem); + } + std::collections::hash_map::Entry::Vacant(entry) => { + order.push(entry.key().clone()); + entry.insert(vec![elem]); + } } }; while tokens.peek().is_some() { diff --git a/shared/yeast/src/dump.rs b/shared/yeast/src/dump.rs index dc348f8789b6..0e2e57e6f82a 100644 --- a/shared/yeast/src/dump.rs +++ b/shared/yeast/src/dump.rs @@ -2,6 +2,13 @@ use std::fmt::Write; use crate::{schema::Schema, Ast, Id, Node, NodeContent, CHILD_FIELD}; +#[derive(Clone, Copy)] +struct TypeCheckContext<'a> { + schema: &'a Schema, + expected: Option<&'a [crate::schema::NodeType]>, + parent_field: Option<(&'a str, &'a str)>, +} + /// Options for controlling AST dump output. pub struct DumpOptions { /// Whether to include source locations in the output. @@ -70,7 +77,11 @@ pub fn dump_ast_with_type_errors_and_options( source, options, 0, - Some((schema, None, None)), + Some(TypeCheckContext { + schema, + expected: None, + parent_field: None, + }), &mut out, ); out @@ -179,11 +190,7 @@ fn dump_node( source: &str, options: &DumpOptions, indent: usize, - type_check: Option<( - &Schema, - Option<&[crate::schema::NodeType]>, - Option<(&str, &str)>, - )>, + type_check: Option>, out: &mut String, ) { let node = match ast.get_node(id) { @@ -219,8 +226,10 @@ fn dump_node( } } - if let Some((schema, expected, parent_field)) = type_check { - if let Some(err) = type_error_for_node(schema, node, expected, parent_field) { + if let Some(context) = type_check { + if let Some(err) = + type_error_for_node(context.schema, node, context.expected, context.parent_field) + { write!(out, " <-- ERROR: {err}").unwrap(); } } @@ -242,10 +251,11 @@ fn dump_node( .copied() .filter(|&f| f != CHILD_FIELD) .collect(); - match type_check.and_then(|(schema, _, _)| { - schema + match type_check.and_then(|context| { + context + .schema .field_order(node.kind_name()) - .map(|order| (schema, order)) + .map(|order| (context.schema, order)) }) { Some((schema, order)) => { let mut result: Vec = order @@ -267,11 +277,15 @@ fn dump_node( for field_id in named_field_ids { let children = &node.fields[&field_id]; let field_name = ast.field_name_for_id(field_id).unwrap_or("?"); - let child_type_check = type_check.map(|(schema, _, _)| { - let expected = expected_for_field(schema, node.kind_name(), field_name) + let child_type_check = type_check.map(|context| { + let expected = expected_for_field(context.schema, node.kind_name(), field_name) .or(Some(EMPTY_NODE_TYPES)); let parent_field = Some((node.kind_name(), field_name)); - (schema, expected, parent_field) + TypeCheckContext { + schema: context.schema, + expected, + parent_field, + } }); if children.len() == 1 { @@ -310,8 +324,8 @@ fn dump_node( } // Check for required fields that are absent - if let Some((schema, _, _)) = type_check { - for (_field_id, field_name) in schema.required_fields_for_kind(node.kind_name()) { + if let Some(context) = type_check { + for (_field_id, field_name) in context.schema.required_fields_for_kind(node.kind_name()) { let present = match field_name { Some(n) => ast .field_id_for_name(n) @@ -327,13 +341,18 @@ fn dump_node( // Unnamed children — skip unnamed tokens (keywords, punctuation) if let Some(children) = node.fields.get(&CHILD_FIELD) { - let child_type_check = type_check.map(|(schema, _, _)| { - let expected = schema + let child_type_check = type_check.map(|context| { + let expected = context + .schema .field_types(node.kind_name(), CHILD_FIELD) .map(|v| v.as_slice()) .or(Some(EMPTY_NODE_TYPES)); let parent_field = Some((node.kind_name(), "children")); - (schema, expected, parent_field) + TypeCheckContext { + schema: context.schema, + expected, + parent_field, + } }); for &child_id in children { if let Some(child) = ast.get_node(child_id) { @@ -359,11 +378,7 @@ fn dump_node_inline( id: Id, source: &str, options: &DumpOptions, - type_check: Option<( - &Schema, - Option<&[crate::schema::NodeType]>, - Option<(&str, &str)>, - )>, + type_check: Option>, out: &mut String, ) { let node = match ast.get_node(id) { @@ -394,8 +409,10 @@ fn dump_node_inline( } } - if let Some((schema, expected, parent_field)) = type_check { - if let Some(err) = type_error_for_node(schema, node, expected, parent_field) { + if let Some(context) = type_check { + if let Some(err) = + type_error_for_node(context.schema, node, context.expected, context.parent_field) + { write!(out, " <-- ERROR: {err}").unwrap(); } } diff --git a/unified/extractor/src/generator.rs b/unified/extractor/src/generator.rs index 974de5dbca97..f1f8a34ca84d 100644 --- a/unified/extractor/src/generator.rs +++ b/unified/extractor/src/generator.rs @@ -35,6 +35,7 @@ pub fn run(options: Options) -> std::io::Result<()> { languages, options.dbscheme, options.library, + true, // use facade AST "run unified/scripts/create-extractor-pack.sh", ) } diff --git a/unified/ql/lib/codeql/unified/Ast.qll b/unified/ql/lib/codeql/unified/internal/Ast.qll similarity index 62% rename from unified/ql/lib/codeql/unified/Ast.qll rename to unified/ql/lib/codeql/unified/internal/Ast.qll index 4ad61ff353bf..20ff74e6eaf7 100644 --- a/unified/ql/lib/codeql/unified/Ast.qll +++ b/unified/ql/lib/codeql/unified/internal/Ast.qll @@ -25,8 +25,10 @@ private predicate discardLocation(@location_default loc) { overlay[local] module Unified { + private import FacadeAst::Unified as F + /** The base class for all AST nodes */ - private class AstNodeImpl extends @unified_ast_node { + class AstNode extends @unified_ast_node { /** Gets a string representation of this element. */ string toString() { result = this.getAPrimaryQlClass() } @@ -34,13 +36,13 @@ module Unified { final L::Location getLocation() { unified_ast_node_location(this, result) } /** Gets the parent of this element. */ - final AstNode getParent() { unified_ast_node_parent(this, result, _) } + final F::AstNode getParent() { unified_ast_node_parent(this, result, _) } /** Gets the index of this node among the children of its parent. */ final int getParentIndex() { unified_ast_node_parent(this, _, result) } /** Gets a field or child node of this node. */ - AstNode getAFieldOrChild() { none() } + F::AstNode getAFieldOrChild() { none() } /** Gets the name of the primary QL class for this element. */ string getAPrimaryQlClass() { result = "???" } @@ -49,10 +51,8 @@ module Unified { string getPrimaryQlClasses() { result = concat(this.getAPrimaryQlClass(), ",") } } - final class AstNode = AstNodeImpl; - /** A token. */ - private class TokenImpl extends @unified_token, AstNodeImpl { + class Token extends @unified_token, F::AstNode { /** Gets the value of this token. */ final string getValue() { unified_tokeninfo(this, _, result) } @@ -63,10 +63,8 @@ module Unified { override string getAPrimaryQlClass() { result = "Token" } } - final class Token = TokenImpl; - /** A trivia token, such as a comment, preserved from the original parse tree. */ - final class TriviaToken extends @unified_trivia_token, AstNodeImpl { + class TriviaToken extends @unified_trivia_token, F::AstNode { /** Gets the source text of this trivia token. */ final string getValue() { unified_trivia_tokeninfo(this, _, result) } @@ -98,30 +96,38 @@ module Unified { } /** A class representing `accessor_declaration` nodes. */ - final class AccessorDeclaration extends @unified_accessor_declaration, AstNodeImpl { + class AccessorDeclaration extends @unified_accessor_declaration, F::Member, F::Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AccessorDeclaration" } /** Gets the node corresponding to the field `accessor_kind`. */ - final AccessorKind getAccessorKind() { unified_accessor_declaration_def(this, result, _) } + final F::AccessorKind getAccessorKind() { unified_accessor_declaration_def(this, result, _) } /** Gets the node corresponding to the field `body`. */ - final Block getBody() { unified_accessor_declaration_body(this, result) } + final F::Block getBody() { unified_accessor_declaration_body(this, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getModifier(int i) { unified_accessor_declaration_modifier(this, i, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_accessor_declaration_modifier(this, i, result) } + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { unified_accessor_declaration_def(this, _, result) } + final F::Identifier getName() { unified_accessor_declaration_def(this, _, result) } + + /** Gets the node corresponding to the field `parameter`. */ + final F::Parameter getParameter(int i) { + unified_accessor_declaration_parameter(this, i, result) + } /** Gets the node corresponding to the field `parameter`. */ - final Parameter getParameter(int i) { unified_accessor_declaration_parameter(this, i, result) } + final F::Parameter getAParameter() { result = this.getParameter(_) } /** Gets the node corresponding to the field `type`. */ - final TypeExpr getType() { unified_accessor_declaration_type(this, result) } + final F::TypeExpr getType() { unified_accessor_declaration_type(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_accessor_declaration_def(this, result, _) or unified_accessor_declaration_body(this, result) or unified_accessor_declaration_modifier(this, _, result) or @@ -132,27 +138,30 @@ module Unified { } /** A class representing `accessor_kind` tokens. */ - final class AccessorKind extends @unified_token_accessor_kind, TokenImpl { + class AccessorKind extends @unified_token_accessor_kind, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AccessorKind" } } /** A class representing `argument` nodes. */ - final class Argument extends @unified_argument, AstNodeImpl { + class Argument extends @unified_argument, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Argument" } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_argument_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_argument_modifier(this, i, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { unified_argument_name(this, result) } + final F::Identifier getName() { unified_argument_name(this, result) } /** Gets the node corresponding to the field `value`. */ - final Expr getValue() { unified_argument_def(this, result) } + final F::Expr getValue() { unified_argument_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_argument_modifier(this, _, result) or unified_argument_name(this, result) or unified_argument_def(this, result) @@ -160,52 +169,58 @@ module Unified { } /** A class representing `array_literal` nodes. */ - final class ArrayLiteral extends @unified_array_literal, AstNodeImpl { + class ArrayLiteral extends @unified_array_literal, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ArrayLiteral" } /** Gets the node corresponding to the field `element`. */ - final Expr getElement(int i) { unified_array_literal_element(this, i, result) } + final F::Expr getElement(int i) { unified_array_literal_element(this, i, result) } + + /** Gets the node corresponding to the field `element`. */ + final F::Expr getAnElement() { result = this.getElement(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { unified_array_literal_element(this, _, result) } + final override F::AstNode getAFieldOrChild() { unified_array_literal_element(this, _, result) } } /** A class representing `assign_expr` nodes. */ - final class AssignExpr extends @unified_assign_expr, AstNodeImpl { + class AssignExpr extends @unified_assign_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AssignExpr" } /** Gets the node corresponding to the field `target`. */ - final ExprOrPattern getTarget() { unified_assign_expr_def(this, result, _) } + final F::ExprOrPattern getTarget() { unified_assign_expr_def(this, result, _) } /** Gets the node corresponding to the field `value`. */ - final Expr getValue() { unified_assign_expr_def(this, _, result) } + final F::Expr getValue() { unified_assign_expr_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_assign_expr_def(this, result, _) or unified_assign_expr_def(this, _, result) } } /** A class representing `associated_type_declaration` nodes. */ - final class AssociatedTypeDeclaration extends @unified_associated_type_declaration, AstNodeImpl { + class AssociatedTypeDeclaration extends @unified_associated_type_declaration, F::Member { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AssociatedTypeDeclaration" } /** Gets the node corresponding to the field `bound`. */ - final TypeExpr getBound() { unified_associated_type_declaration_bound(this, result) } + final F::TypeExpr getBound() { unified_associated_type_declaration_bound(this, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { + final F::Modifier getModifier(int i) { unified_associated_type_declaration_modifier(this, i, result) } + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } + /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { unified_associated_type_declaration_def(this, result) } + final F::Identifier getName() { unified_associated_type_declaration_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_associated_type_declaration_bound(this, result) or unified_associated_type_declaration_modifier(this, _, result) or unified_associated_type_declaration_def(this, result) @@ -213,38 +228,41 @@ module Unified { } /** A class representing `base_type` nodes. */ - final class BaseType extends @unified_base_type, AstNodeImpl { + class BaseType extends @unified_base_type, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BaseType" } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_base_type_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_base_type_modifier(this, i, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `type`. */ - final TypeExpr getType() { unified_base_type_def(this, result) } + final F::TypeExpr getType() { unified_base_type_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_base_type_modifier(this, _, result) or unified_base_type_def(this, result) } } /** A class representing `binary_expr` nodes. */ - final class BinaryExpr extends @unified_binary_expr, AstNodeImpl { + class BinaryExpr extends @unified_binary_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BinaryExpr" } /** Gets the node corresponding to the field `left`. */ - final Expr getLeft() { unified_binary_expr_def(this, result, _, _) } + final F::Expr getLeft() { unified_binary_expr_def(this, result, _, _) } /** Gets the node corresponding to the field `operator`. */ - final InfixOperator getOperator() { unified_binary_expr_def(this, _, result, _) } + final F::InfixOperator getOperator() { unified_binary_expr_def(this, _, result, _) } /** Gets the node corresponding to the field `right`. */ - final Expr getRight() { unified_binary_expr_def(this, _, _, result) } + final F::Expr getRight() { unified_binary_expr_def(this, _, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_binary_expr_def(this, result, _, _) or unified_binary_expr_def(this, _, result, _) or unified_binary_expr_def(this, _, _, result) @@ -252,89 +270,103 @@ module Unified { } /** A class representing `block` nodes. */ - final class Block extends @unified_block, AstNodeImpl { + class Block extends @unified_block, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Block" } /** Gets the node corresponding to the field `stmt`. */ - final Stmt getStmt(int i) { unified_block_stmt(this, i, result) } + final F::Stmt getStmt(int i) { unified_block_stmt(this, i, result) } + + /** Gets the node corresponding to the field `stmt`. */ + final F::Stmt getAStmt() { result = this.getStmt(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { unified_block_stmt(this, _, result) } + final override F::AstNode getAFieldOrChild() { unified_block_stmt(this, _, result) } } /** A class representing `boolean_literal` tokens. */ - final class BooleanLiteral extends @unified_token_boolean_literal, TokenImpl { + class BooleanLiteral extends @unified_token_boolean_literal, F::Expr, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BooleanLiteral" } } /** A class representing `bound_type_constraint` nodes. */ - final class BoundTypeConstraint extends @unified_bound_type_constraint, AstNodeImpl { + class BoundTypeConstraint extends @unified_bound_type_constraint, F::TypeConstraint { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BoundTypeConstraint" } /** Gets the node corresponding to the field `bound`. */ - final TypeExpr getBound() { unified_bound_type_constraint_def(this, result, _) } + final F::TypeExpr getBound() { unified_bound_type_constraint_def(this, result, _) } /** Gets the node corresponding to the field `type`. */ - final TypeExpr getType() { unified_bound_type_constraint_def(this, _, result) } + final F::TypeExpr getType() { unified_bound_type_constraint_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_bound_type_constraint_def(this, result, _) or unified_bound_type_constraint_def(this, _, result) } } /** A class representing `break_expr` nodes. */ - final class BreakExpr extends @unified_break_expr, AstNodeImpl { + class BreakExpr extends @unified_break_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BreakExpr" } /** Gets the node corresponding to the field `label`. */ - final Identifier getLabel() { unified_break_expr_label(this, result) } + final F::Identifier getLabel() { unified_break_expr_label(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { unified_break_expr_label(this, result) } + final override F::AstNode getAFieldOrChild() { unified_break_expr_label(this, result) } } /** A class representing `builtin_expr` tokens. */ - final class BuiltinExpr extends @unified_token_builtin_expr, TokenImpl { + class BuiltinExpr extends @unified_token_builtin_expr, F::Expr, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BuiltinExpr" } } /** A class representing `bulk_importing_pattern` nodes. */ - final class BulkImportingPattern extends @unified_bulk_importing_pattern, AstNodeImpl { + class BulkImportingPattern extends @unified_bulk_importing_pattern, F::Pattern { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BulkImportingPattern" } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_bulk_importing_pattern_modifier(this, i, result) } + final F::Modifier getModifier(int i) { + unified_bulk_importing_pattern_modifier(this, i, result) + } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_bulk_importing_pattern_modifier(this, _, result) } } /** A class representing `call_expr` nodes. */ - final class CallExpr extends @unified_call_expr, AstNodeImpl { + class CallExpr extends @unified_call_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CallExpr" } /** Gets the node corresponding to the field `argument`. */ - final Argument getArgument(int i) { unified_call_expr_argument(this, i, result) } + final F::Argument getArgument(int i) { unified_call_expr_argument(this, i, result) } + + /** Gets the node corresponding to the field `argument`. */ + final F::Argument getAnArgument() { result = this.getArgument(_) } /** Gets the node corresponding to the field `callee`. */ - final ExprOrType getCallee() { unified_call_expr_def(this, result) } + final F::ExprOrType getCallee() { unified_call_expr_def(this, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getModifier(int i) { unified_call_expr_modifier(this, i, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_call_expr_modifier(this, i, result) } + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_call_expr_argument(this, _, result) or unified_call_expr_def(this, result) or unified_call_expr_modifier(this, _, result) @@ -342,21 +374,24 @@ module Unified { } /** A class representing `catch_clause` nodes. */ - final class CatchClause extends @unified_catch_clause, AstNodeImpl { + class CatchClause extends @unified_catch_clause, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CatchClause" } /** Gets the node corresponding to the field `body`. */ - final Block getBody() { unified_catch_clause_def(this, result) } + final F::Block getBody() { unified_catch_clause_def(this, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_catch_clause_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_catch_clause_modifier(this, i, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `pattern`. */ - final Pattern getPattern() { unified_catch_clause_pattern(this, result) } + final F::Pattern getPattern() { unified_catch_clause_pattern(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_catch_clause_def(this, result) or unified_catch_clause_modifier(this, _, result) or unified_catch_clause_pattern(this, result) @@ -364,34 +399,53 @@ module Unified { } /** A class representing `class_like_declaration` nodes. */ - final class ClassLikeDeclaration extends @unified_class_like_declaration, AstNodeImpl { + class ClassLikeDeclaration extends @unified_class_like_declaration, F::Member, F::Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ClassLikeDeclaration" } /** Gets the node corresponding to the field `base_type`. */ - final BaseType getBaseType(int i) { unified_class_like_declaration_base_type(this, i, result) } + final F::BaseType getBaseType(int i) { + unified_class_like_declaration_base_type(this, i, result) + } + + /** Gets the node corresponding to the field `base_type`. */ + final F::BaseType getABaseType() { result = this.getBaseType(_) } + + /** Gets the node corresponding to the field `member`. */ + final F::Member getMember(int i) { unified_class_like_declaration_member(this, i, result) } /** Gets the node corresponding to the field `member`. */ - final Member getMember(int i) { unified_class_like_declaration_member(this, i, result) } + final F::Member getAMember() { result = this.getMember(_) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_class_like_declaration_modifier(this, i, result) } + final F::Modifier getModifier(int i) { + unified_class_like_declaration_modifier(this, i, result) + } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { unified_class_like_declaration_name(this, result) } + final F::Identifier getName() { unified_class_like_declaration_name(this, result) } /** Gets the node corresponding to the field `type_constraint`. */ - final TypeConstraint getTypeConstraint(int i) { + final F::TypeConstraint getTypeConstraint(int i) { unified_class_like_declaration_type_constraint(this, i, result) } + /** Gets the node corresponding to the field `type_constraint`. */ + final F::TypeConstraint getATypeConstraint() { result = this.getTypeConstraint(_) } + /** Gets the node corresponding to the field `type_parameter`. */ - final TypeParameter getTypeParameter(int i) { + final F::TypeParameter getTypeParameter(int i) { unified_class_like_declaration_type_parameter(this, i, result) } + /** Gets the node corresponding to the field `type_parameter`. */ + final F::TypeParameter getATypeParameter() { result = this.getTypeParameter(_) } + /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_class_like_declaration_base_type(this, _, result) or unified_class_like_declaration_member(this, _, result) or unified_class_like_declaration_modifier(this, _, result) or @@ -402,21 +456,21 @@ module Unified { } /** A class representing `compound_assign_expr` nodes. */ - final class CompoundAssignExpr extends @unified_compound_assign_expr, AstNodeImpl { + class CompoundAssignExpr extends @unified_compound_assign_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CompoundAssignExpr" } /** Gets the node corresponding to the field `operator`. */ - final InfixOperator getOperator() { unified_compound_assign_expr_def(this, result, _, _) } + final F::InfixOperator getOperator() { unified_compound_assign_expr_def(this, result, _, _) } /** Gets the node corresponding to the field `target`. */ - final Expr getTarget() { unified_compound_assign_expr_def(this, _, result, _) } + final F::Expr getTarget() { unified_compound_assign_expr_def(this, _, result, _) } /** Gets the node corresponding to the field `value`. */ - final Expr getValue() { unified_compound_assign_expr_def(this, _, _, result) } + final F::Expr getValue() { unified_compound_assign_expr_def(this, _, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_compound_assign_expr_def(this, result, _, _) or unified_compound_assign_expr_def(this, _, result, _) or unified_compound_assign_expr_def(this, _, _, result) @@ -424,21 +478,24 @@ module Unified { } /** A class representing `conditional_pattern` nodes. */ - final class ConditionalPattern extends @unified_conditional_pattern, AstNodeImpl { + class ConditionalPattern extends @unified_conditional_pattern, F::Pattern { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ConditionalPattern" } /** Gets the node corresponding to the field `condition`. */ - final Expr getCondition() { unified_conditional_pattern_def(this, result, _) } + final F::Expr getCondition() { unified_conditional_pattern_def(this, result, _) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_conditional_pattern_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_conditional_pattern_modifier(this, i, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `pattern`. */ - final Pattern getPattern() { unified_conditional_pattern_def(this, _, result) } + final F::Pattern getPattern() { unified_conditional_pattern_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_conditional_pattern_def(this, result, _) or unified_conditional_pattern_modifier(this, _, result) or unified_conditional_pattern_def(this, _, result) @@ -446,26 +503,34 @@ module Unified { } /** A class representing `constructor_declaration` nodes. */ - final class ConstructorDeclaration extends @unified_constructor_declaration, AstNodeImpl { + class ConstructorDeclaration extends @unified_constructor_declaration, F::Member, F::Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ConstructorDeclaration" } /** Gets the node corresponding to the field `body`. */ - final Block getBody() { unified_constructor_declaration_def(this, result) } + final F::Block getBody() { unified_constructor_declaration_def(this, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getModifier(int i) { + unified_constructor_declaration_modifier(this, i, result) + } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_constructor_declaration_modifier(this, i, result) } + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { unified_constructor_declaration_name(this, result) } + final F::Identifier getName() { unified_constructor_declaration_name(this, result) } /** Gets the node corresponding to the field `parameter`. */ - final Parameter getParameter(int i) { + final F::Parameter getParameter(int i) { unified_constructor_declaration_parameter(this, i, result) } + /** Gets the node corresponding to the field `parameter`. */ + final F::Parameter getAParameter() { result = this.getParameter(_) } + /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_constructor_declaration_def(this, result) or unified_constructor_declaration_modifier(this, _, result) or unified_constructor_declaration_name(this, result) or @@ -474,21 +539,29 @@ module Unified { } /** A class representing `constructor_pattern` nodes. */ - final class ConstructorPattern extends @unified_constructor_pattern, AstNodeImpl { + class ConstructorPattern extends @unified_constructor_pattern, F::Pattern { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ConstructorPattern" } /** Gets the node corresponding to the field `constructor`. */ - final ExprOrType getConstructor() { unified_constructor_pattern_def(this, result) } + final F::ExprOrType getConstructor() { unified_constructor_pattern_def(this, result) } /** Gets the node corresponding to the field `element`. */ - final PatternElement getElement(int i) { unified_constructor_pattern_element(this, i, result) } + final F::PatternElement getElement(int i) { + unified_constructor_pattern_element(this, i, result) + } + + /** Gets the node corresponding to the field `element`. */ + final F::PatternElement getAnElement() { result = this.getElement(_) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getModifier(int i) { unified_constructor_pattern_modifier(this, i, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_constructor_pattern_modifier(this, i, result) } + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_constructor_pattern_def(this, result) or unified_constructor_pattern_element(this, _, result) or unified_constructor_pattern_modifier(this, _, result) @@ -496,51 +569,59 @@ module Unified { } /** A class representing `continue_expr` nodes. */ - final class ContinueExpr extends @unified_continue_expr, AstNodeImpl { + class ContinueExpr extends @unified_continue_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ContinueExpr" } /** Gets the node corresponding to the field `label`. */ - final Identifier getLabel() { unified_continue_expr_label(this, result) } + final F::Identifier getLabel() { unified_continue_expr_label(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { unified_continue_expr_label(this, result) } + final override F::AstNode getAFieldOrChild() { unified_continue_expr_label(this, result) } } /** A class representing `destructor_declaration` nodes. */ - final class DestructorDeclaration extends @unified_destructor_declaration, AstNodeImpl { + class DestructorDeclaration extends @unified_destructor_declaration, F::Member, F::Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "DestructorDeclaration" } /** Gets the node corresponding to the field `body`. */ - final Block getBody() { unified_destructor_declaration_def(this, result) } + final F::Block getBody() { unified_destructor_declaration_def(this, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getModifier(int i) { + unified_destructor_declaration_modifier(this, i, result) + } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_destructor_declaration_modifier(this, i, result) } + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_destructor_declaration_def(this, result) or unified_destructor_declaration_modifier(this, _, result) } } /** A class representing `do_while_stmt` nodes. */ - final class DoWhileStmt extends @unified_do_while_stmt, AstNodeImpl { + class DoWhileStmt extends @unified_do_while_stmt, F::Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "DoWhileStmt" } /** Gets the node corresponding to the field `body`. */ - final Block getBody() { unified_do_while_stmt_body(this, result) } + final F::Block getBody() { unified_do_while_stmt_body(this, result) } /** Gets the node corresponding to the field `condition`. */ - final Expr getCondition() { unified_do_while_stmt_def(this, result) } + final F::Expr getCondition() { unified_do_while_stmt_def(this, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_do_while_stmt_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_do_while_stmt_modifier(this, i, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_do_while_stmt_body(this, result) or unified_do_while_stmt_def(this, result) or unified_do_while_stmt_modifier(this, _, result) @@ -548,83 +629,86 @@ module Unified { } /** A class representing `empty_expr` tokens. */ - final class EmptyExpr extends @unified_token_empty_expr, TokenImpl { + class EmptyExpr extends @unified_token_empty_expr, F::Expr, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "EmptyExpr" } } /** A class representing `equality_type_constraint` nodes. */ - final class EqualityTypeConstraint extends @unified_equality_type_constraint, AstNodeImpl { + class EqualityTypeConstraint extends @unified_equality_type_constraint, F::TypeConstraint { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "EqualityTypeConstraint" } /** Gets the node corresponding to the field `left`. */ - final TypeExpr getLeft() { unified_equality_type_constraint_def(this, result, _) } + final F::TypeExpr getLeft() { unified_equality_type_constraint_def(this, result, _) } /** Gets the node corresponding to the field `right`. */ - final TypeExpr getRight() { unified_equality_type_constraint_def(this, _, result) } + final F::TypeExpr getRight() { unified_equality_type_constraint_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_equality_type_constraint_def(this, result, _) or unified_equality_type_constraint_def(this, _, result) } } - final class Expr extends @unified_expr, AstNodeImpl { } + class Expr extends @unified_expr, F::ExprOrOperator, F::ExprOrPattern, F::ExprOrType, F::Stmt { } /** A class representing `expr_equality_pattern` nodes. */ - final class ExprEqualityPattern extends @unified_expr_equality_pattern, AstNodeImpl { + class ExprEqualityPattern extends @unified_expr_equality_pattern, F::Pattern { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ExprEqualityPattern" } /** Gets the node corresponding to the field `expr`. */ - final Expr getExpr() { unified_expr_equality_pattern_def(this, result) } + final F::Expr getExpr() { unified_expr_equality_pattern_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { unified_expr_equality_pattern_def(this, result) } + final override F::AstNode getAFieldOrChild() { unified_expr_equality_pattern_def(this, result) } } - final class ExprOrOperator extends @unified_expr_or_operator, AstNodeImpl { } + class ExprOrOperator extends @unified_expr_or_operator, F::AstNode { } - final class ExprOrPattern extends @unified_expr_or_pattern, AstNodeImpl { } + class ExprOrPattern extends @unified_expr_or_pattern, F::AstNode { } - final class ExprOrType extends @unified_expr_or_type, AstNodeImpl { } + class ExprOrType extends @unified_expr_or_type, F::AstNode { } /** A class representing `fixity` tokens. */ - final class Fixity extends @unified_token_fixity, TokenImpl { + class Fixity extends @unified_token_fixity, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Fixity" } } /** A class representing `float_literal` tokens. */ - final class FloatLiteral extends @unified_token_float_literal, TokenImpl { + class FloatLiteral extends @unified_token_float_literal, F::Expr, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "FloatLiteral" } } /** A class representing `for_each_stmt` nodes. */ - final class ForEachStmt extends @unified_for_each_stmt, AstNodeImpl { + class ForEachStmt extends @unified_for_each_stmt, F::Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ForEachStmt" } /** Gets the node corresponding to the field `body`. */ - final Block getBody() { unified_for_each_stmt_body(this, result) } + final F::Block getBody() { unified_for_each_stmt_body(this, result) } /** Gets the node corresponding to the field `guard`. */ - final Expr getGuard() { unified_for_each_stmt_guard(this, result) } + final F::Expr getGuard() { unified_for_each_stmt_guard(this, result) } /** Gets the node corresponding to the field `iterable`. */ - final Expr getIterable() { unified_for_each_stmt_def(this, result, _) } + final F::Expr getIterable() { unified_for_each_stmt_def(this, result, _) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_for_each_stmt_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_for_each_stmt_modifier(this, i, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `pattern`. */ - final Pattern getPattern() { unified_for_each_stmt_def(this, _, result) } + final F::Pattern getPattern() { unified_for_each_stmt_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_for_each_stmt_body(this, result) or unified_for_each_stmt_guard(this, result) or unified_for_each_stmt_def(this, result, _) or @@ -634,37 +718,51 @@ module Unified { } /** A class representing `function_declaration` nodes. */ - final class FunctionDeclaration extends @unified_function_declaration, AstNodeImpl { + class FunctionDeclaration extends @unified_function_declaration, F::Member, F::Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "FunctionDeclaration" } /** Gets the node corresponding to the field `body`. */ - final Block getBody() { unified_function_declaration_body(this, result) } + final F::Block getBody() { unified_function_declaration_body(this, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getModifier(int i) { unified_function_declaration_modifier(this, i, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_function_declaration_modifier(this, i, result) } + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { unified_function_declaration_def(this, result) } + final F::Identifier getName() { unified_function_declaration_def(this, result) } /** Gets the node corresponding to the field `parameter`. */ - final Parameter getParameter(int i) { unified_function_declaration_parameter(this, i, result) } + final F::Parameter getParameter(int i) { + unified_function_declaration_parameter(this, i, result) + } + + /** Gets the node corresponding to the field `parameter`. */ + final F::Parameter getAParameter() { result = this.getParameter(_) } /** Gets the node corresponding to the field `return_type`. */ - final TypeExpr getReturnType() { unified_function_declaration_return_type(this, result) } + final F::TypeExpr getReturnType() { unified_function_declaration_return_type(this, result) } /** Gets the node corresponding to the field `type_constraint`. */ - final TypeConstraint getTypeConstraint(int i) { + final F::TypeConstraint getTypeConstraint(int i) { unified_function_declaration_type_constraint(this, i, result) } + /** Gets the node corresponding to the field `type_constraint`. */ + final F::TypeConstraint getATypeConstraint() { result = this.getTypeConstraint(_) } + /** Gets the node corresponding to the field `type_parameter`. */ - final TypeParameter getTypeParameter(int i) { + final F::TypeParameter getTypeParameter(int i) { unified_function_declaration_type_parameter(this, i, result) } + /** Gets the node corresponding to the field `type_parameter`. */ + final F::TypeParameter getATypeParameter() { result = this.getTypeParameter(_) } + /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_function_declaration_body(this, result) or unified_function_declaration_modifier(this, _, result) or unified_function_declaration_def(this, result) or @@ -676,29 +774,38 @@ module Unified { } /** A class representing `function_expr` nodes. */ - final class FunctionExpr extends @unified_function_expr, AstNodeImpl { + class FunctionExpr extends @unified_function_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "FunctionExpr" } /** Gets the node corresponding to the field `body`. */ - final Block getBody() { unified_function_expr_def(this, result) } + final F::Block getBody() { unified_function_expr_def(this, result) } /** Gets the node corresponding to the field `capture_declaration`. */ - final VariableDeclaration getCaptureDeclaration(int i) { + final F::VariableDeclaration getCaptureDeclaration(int i) { unified_function_expr_capture_declaration(this, i, result) } + /** Gets the node corresponding to the field `capture_declaration`. */ + final F::VariableDeclaration getACaptureDeclaration() { result = this.getCaptureDeclaration(_) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getModifier(int i) { unified_function_expr_modifier(this, i, result) } + /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_function_expr_modifier(this, i, result) } + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `parameter`. */ - final Parameter getParameter(int i) { unified_function_expr_parameter(this, i, result) } + final F::Parameter getParameter(int i) { unified_function_expr_parameter(this, i, result) } + + /** Gets the node corresponding to the field `parameter`. */ + final F::Parameter getAParameter() { result = this.getParameter(_) } /** Gets the node corresponding to the field `return_type`. */ - final TypeExpr getReturnType() { unified_function_expr_return_type(this, result) } + final F::TypeExpr getReturnType() { unified_function_expr_return_type(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_function_expr_def(this, result) or unified_function_expr_capture_declaration(this, _, result) or unified_function_expr_modifier(this, _, result) or @@ -708,82 +815,88 @@ module Unified { } /** A class representing `function_type_expr` nodes. */ - final class FunctionTypeExpr extends @unified_function_type_expr, AstNodeImpl { + class FunctionTypeExpr extends @unified_function_type_expr, F::TypeExpr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "FunctionTypeExpr" } /** Gets the node corresponding to the field `parameter`. */ - final Parameter getParameter(int i) { unified_function_type_expr_parameter(this, i, result) } + final F::Parameter getParameter(int i) { unified_function_type_expr_parameter(this, i, result) } + + /** Gets the node corresponding to the field `parameter`. */ + final F::Parameter getAParameter() { result = this.getParameter(_) } /** Gets the node corresponding to the field `return_type`. */ - final TypeExpr getReturnType() { unified_function_type_expr_def(this, result) } + final F::TypeExpr getReturnType() { unified_function_type_expr_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_function_type_expr_parameter(this, _, result) or unified_function_type_expr_def(this, result) } } /** A class representing `generic_type_expr` nodes. */ - final class GenericTypeExpr extends @unified_generic_type_expr, AstNodeImpl { + class GenericTypeExpr extends @unified_generic_type_expr, F::TypeExpr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "GenericTypeExpr" } /** Gets the node corresponding to the field `base`. */ - final TypeExpr getBase() { unified_generic_type_expr_def(this, result) } + final F::TypeExpr getBase() { unified_generic_type_expr_def(this, result) } /** Gets the node corresponding to the field `type_argument`. */ - final TypeExpr getTypeArgument(int i) { + final F::TypeExpr getTypeArgument(int i) { unified_generic_type_expr_type_argument(this, i, result) } + /** Gets the node corresponding to the field `type_argument`. */ + final F::TypeExpr getATypeArgument() { result = this.getTypeArgument(_) } + /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_generic_type_expr_def(this, result) or unified_generic_type_expr_type_argument(this, _, result) } } /** A class representing `guard_if_stmt` nodes. */ - final class GuardIfStmt extends @unified_guard_if_stmt, AstNodeImpl { + class GuardIfStmt extends @unified_guard_if_stmt, F::Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "GuardIfStmt" } /** Gets the node corresponding to the field `condition`. */ - final Expr getCondition() { unified_guard_if_stmt_def(this, result, _) } + final F::Expr getCondition() { unified_guard_if_stmt_def(this, result, _) } /** Gets the node corresponding to the field `else`. */ - final Block getElse() { unified_guard_if_stmt_def(this, _, result) } + final F::Block getElse() { unified_guard_if_stmt_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_guard_if_stmt_def(this, result, _) or unified_guard_if_stmt_def(this, _, result) } } /** A class representing `identifier` tokens. */ - final class Identifier extends @unified_token_identifier, TokenImpl { + class Identifier extends @unified_token_identifier, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Identifier" } } /** A class representing `if_expr` nodes. */ - final class IfExpr extends @unified_if_expr, AstNodeImpl { + class IfExpr extends @unified_if_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "IfExpr" } /** Gets the node corresponding to the field `condition`. */ - final Expr getCondition() { unified_if_expr_def(this, result) } + final F::Expr getCondition() { unified_if_expr_def(this, result) } /** Gets the node corresponding to the field `else`. */ - final Expr getElse() { unified_if_expr_else(this, result) } + final F::Expr getElse() { unified_if_expr_else(this, result) } /** Gets the node corresponding to the field `then`. */ - final Expr getThen() { unified_if_expr_then(this, result) } + final F::Expr getThen() { unified_if_expr_then(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_if_expr_def(this, result) or unified_if_expr_else(this, result) or unified_if_expr_then(this, result) @@ -791,27 +904,30 @@ module Unified { } /** A class representing `ignore_pattern` tokens. */ - final class IgnorePattern extends @unified_token_ignore_pattern, TokenImpl { + class IgnorePattern extends @unified_token_ignore_pattern, F::Pattern, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "IgnorePattern" } } /** A class representing `import_declaration` nodes. */ - final class ImportDeclaration extends @unified_import_declaration, AstNodeImpl { + class ImportDeclaration extends @unified_import_declaration, F::Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ImportDeclaration" } /** Gets the node corresponding to the field `imported_expr`. */ - final Expr getImportedExpr() { unified_import_declaration_def(this, result) } + final F::Expr getImportedExpr() { unified_import_declaration_def(this, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getModifier(int i) { unified_import_declaration_modifier(this, i, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_import_declaration_modifier(this, i, result) } + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `pattern`. */ - final Pattern getPattern() { unified_import_declaration_pattern(this, result) } + final F::Pattern getPattern() { unified_import_declaration_pattern(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_import_declaration_def(this, result) or unified_import_declaration_modifier(this, _, result) or unified_import_declaration_pattern(this, result) @@ -819,182 +935,198 @@ module Unified { } /** A class representing `inferred_type_expr` tokens. */ - final class InferredTypeExpr extends @unified_token_inferred_type_expr, TokenImpl { + class InferredTypeExpr extends @unified_token_inferred_type_expr, F::Token, F::TypeExpr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "InferredTypeExpr" } } /** A class representing `infix_operator` tokens. */ - final class InfixOperator extends @unified_token_infix_operator, TokenImpl { + class InfixOperator extends @unified_token_infix_operator, F::ExprOrOperator, F::Operator, + F::Token + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "InfixOperator" } } /** A class representing `initializer_declaration` nodes. */ - final class InitializerDeclaration extends @unified_initializer_declaration, AstNodeImpl { + class InitializerDeclaration extends @unified_initializer_declaration, F::Member { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "InitializerDeclaration" } /** Gets the node corresponding to the field `body`. */ - final Block getBody() { unified_initializer_declaration_def(this, result) } + final F::Block getBody() { unified_initializer_declaration_def(this, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getModifier(int i) { + unified_initializer_declaration_modifier(this, i, result) + } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_initializer_declaration_modifier(this, i, result) } + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_initializer_declaration_def(this, result) or unified_initializer_declaration_modifier(this, _, result) } } /** A class representing `int_literal` tokens. */ - final class IntLiteral extends @unified_token_int_literal, TokenImpl { + class IntLiteral extends @unified_token_int_literal, F::Expr, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "IntLiteral" } } /** A class representing `key_value_pair` nodes. */ - final class KeyValuePair extends @unified_key_value_pair, AstNodeImpl { + class KeyValuePair extends @unified_key_value_pair, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "KeyValuePair" } /** Gets the node corresponding to the field `key`. */ - final Expr getKey() { unified_key_value_pair_def(this, result, _) } + final F::Expr getKey() { unified_key_value_pair_def(this, result, _) } /** Gets the node corresponding to the field `value`. */ - final Expr getValue() { unified_key_value_pair_def(this, _, result) } + final F::Expr getValue() { unified_key_value_pair_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_key_value_pair_def(this, result, _) or unified_key_value_pair_def(this, _, result) } } /** A class representing `labeled_stmt` nodes. */ - final class LabeledStmt extends @unified_labeled_stmt, AstNodeImpl { + class LabeledStmt extends @unified_labeled_stmt, F::Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "LabeledStmt" } /** Gets the node corresponding to the field `label`. */ - final Identifier getLabel() { unified_labeled_stmt_def(this, result, _) } + final F::Identifier getLabel() { unified_labeled_stmt_def(this, result, _) } /** Gets the node corresponding to the field `stmt`. */ - final Stmt getStmt() { unified_labeled_stmt_def(this, _, result) } + final F::Stmt getStmt() { unified_labeled_stmt_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_labeled_stmt_def(this, result, _) or unified_labeled_stmt_def(this, _, result) } } /** A class representing `map_literal` nodes. */ - final class MapLiteral extends @unified_map_literal, AstNodeImpl { + class MapLiteral extends @unified_map_literal, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "MapLiteral" } /** Gets the node corresponding to the field `element`. */ - final Expr getElement(int i) { unified_map_literal_element(this, i, result) } + final F::Expr getElement(int i) { unified_map_literal_element(this, i, result) } + + /** Gets the node corresponding to the field `element`. */ + final F::Expr getAnElement() { result = this.getElement(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { unified_map_literal_element(this, _, result) } + final override F::AstNode getAFieldOrChild() { unified_map_literal_element(this, _, result) } } - final class Member extends @unified_member, AstNodeImpl { } + class Member extends @unified_member, F::AstNode { } /** A class representing `member_access_expr` nodes. */ - final class MemberAccessExpr extends @unified_member_access_expr, AstNodeImpl { + class MemberAccessExpr extends @unified_member_access_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "MemberAccessExpr" } /** Gets the node corresponding to the field `base`. */ - final ExprOrType getBase() { unified_member_access_expr_def(this, result, _) } + final F::ExprOrType getBase() { unified_member_access_expr_def(this, result, _) } /** Gets the node corresponding to the field `member`. */ - final Identifier getMember() { unified_member_access_expr_def(this, _, result) } + final F::Identifier getMember() { unified_member_access_expr_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_member_access_expr_def(this, result, _) or unified_member_access_expr_def(this, _, result) } } /** A class representing `modifier` tokens. */ - final class Modifier extends @unified_token_modifier, TokenImpl { + class Modifier extends @unified_token_modifier, F::AstNode, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Modifier" } } /** A class representing `name_expr` nodes. */ - final class NameExpr extends @unified_name_expr, AstNodeImpl { + class NameExpr extends @unified_name_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "NameExpr" } /** Gets the node corresponding to the field `identifier`. */ - final Identifier getIdentifier() { unified_name_expr_def(this, result) } + final F::Identifier getIdentifier() { unified_name_expr_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { unified_name_expr_def(this, result) } + final override F::AstNode getAFieldOrChild() { unified_name_expr_def(this, result) } } /** A class representing `name_pattern` nodes. */ - final class NamePattern extends @unified_name_pattern, AstNodeImpl { + class NamePattern extends @unified_name_pattern, F::Pattern { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "NamePattern" } /** Gets the node corresponding to the field `identifier`. */ - final Identifier getIdentifier() { unified_name_pattern_def(this, result) } + final F::Identifier getIdentifier() { unified_name_pattern_def(this, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getModifier(int i) { unified_name_pattern_modifier(this, i, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_name_pattern_modifier(this, i, result) } + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_name_pattern_def(this, result) or unified_name_pattern_modifier(this, _, result) } } /** A class representing `named_type_expr` nodes. */ - final class NamedTypeExpr extends @unified_named_type_expr, AstNodeImpl { + class NamedTypeExpr extends @unified_named_type_expr, F::TypeExpr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "NamedTypeExpr" } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { unified_named_type_expr_def(this, result) } + final F::Identifier getName() { unified_named_type_expr_def(this, result) } /** Gets the node corresponding to the field `qualifier`. */ - final TypeExpr getQualifier() { unified_named_type_expr_qualifier(this, result) } + final F::TypeExpr getQualifier() { unified_named_type_expr_qualifier(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_named_type_expr_def(this, result) or unified_named_type_expr_qualifier(this, result) } } - final class Operator extends @unified_operator, AstNodeImpl { } + class Operator extends @unified_operator, F::AstNode { } /** A class representing `operator_syntax_declaration` nodes. */ - final class OperatorSyntaxDeclaration extends @unified_operator_syntax_declaration, AstNodeImpl { + class OperatorSyntaxDeclaration extends @unified_operator_syntax_declaration, F::Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "OperatorSyntaxDeclaration" } /** Gets the node corresponding to the field `fixity`. */ - final Fixity getFixity() { unified_operator_syntax_declaration_fixity(this, result) } + final F::Fixity getFixity() { unified_operator_syntax_declaration_fixity(this, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { + final F::Modifier getModifier(int i) { unified_operator_syntax_declaration_modifier(this, i, result) } + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } + /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { unified_operator_syntax_declaration_def(this, result) } + final F::Identifier getName() { unified_operator_syntax_declaration_def(this, result) } /** Gets the node corresponding to the field `precedence`. */ - final Expr getPrecedence() { unified_operator_syntax_declaration_precedence(this, result) } + final F::Expr getPrecedence() { unified_operator_syntax_declaration_precedence(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_operator_syntax_declaration_fixity(this, result) or unified_operator_syntax_declaration_modifier(this, _, result) or unified_operator_syntax_declaration_def(this, result) or @@ -1003,44 +1135,53 @@ module Unified { } /** A class representing `or_pattern` nodes. */ - final class OrPattern extends @unified_or_pattern, AstNodeImpl { + class OrPattern extends @unified_or_pattern, F::Pattern { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "OrPattern" } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_or_pattern_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_or_pattern_modifier(this, i, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } + + /** Gets the node corresponding to the field `pattern`. */ + final F::Pattern getPattern(int i) { unified_or_pattern_pattern(this, i, result) } /** Gets the node corresponding to the field `pattern`. */ - final Pattern getPattern(int i) { unified_or_pattern_pattern(this, i, result) } + final F::Pattern getAPattern() { result = this.getPattern(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_or_pattern_modifier(this, _, result) or unified_or_pattern_pattern(this, _, result) } } /** A class representing `parameter` nodes. */ - final class Parameter extends @unified_parameter, AstNodeImpl { + class Parameter extends @unified_parameter, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Parameter" } /** Gets the node corresponding to the field `default`. */ - final Expr getDefault() { unified_parameter_default(this, result) } + final F::Expr getDefault() { unified_parameter_default(this, result) } /** Gets the node corresponding to the field `external_name`. */ - final Identifier getExternalName() { unified_parameter_external_name(this, result) } + final F::Identifier getExternalName() { unified_parameter_external_name(this, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_parameter_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_parameter_modifier(this, i, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `pattern`. */ - final Pattern getPattern() { unified_parameter_pattern(this, result) } + final F::Pattern getPattern() { unified_parameter_pattern(this, result) } /** Gets the node corresponding to the field `type`. */ - final TypeExpr getType() { unified_parameter_type(this, result) } + final F::TypeExpr getType() { unified_parameter_type(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_parameter_default(this, result) or unified_parameter_external_name(this, result) or unified_parameter_modifier(this, _, result) or @@ -1049,24 +1190,27 @@ module Unified { } } - final class Pattern extends @unified_pattern, AstNodeImpl { } + class Pattern extends @unified_pattern, F::ExprOrPattern { } /** A class representing `pattern_element` nodes. */ - final class PatternElement extends @unified_pattern_element, AstNodeImpl { + class PatternElement extends @unified_pattern_element, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PatternElement" } /** Gets the node corresponding to the field `key`. */ - final Identifier getKey() { unified_pattern_element_key(this, result) } + final F::Identifier getKey() { unified_pattern_element_key(this, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getModifier(int i) { unified_pattern_element_modifier(this, i, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_pattern_element_modifier(this, i, result) } + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `pattern`. */ - final Pattern getPattern() { unified_pattern_element_def(this, result) } + final F::Pattern getPattern() { unified_pattern_element_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_pattern_element_key(this, result) or unified_pattern_element_modifier(this, _, result) or unified_pattern_element_def(this, result) @@ -1074,83 +1218,86 @@ module Unified { } /** A class representing `pattern_guard_expr` nodes. */ - final class PatternGuardExpr extends @unified_pattern_guard_expr, AstNodeImpl { + class PatternGuardExpr extends @unified_pattern_guard_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PatternGuardExpr" } /** Gets the node corresponding to the field `pattern`. */ - final Pattern getPattern() { unified_pattern_guard_expr_def(this, result, _) } + final F::Pattern getPattern() { unified_pattern_guard_expr_def(this, result, _) } /** Gets the node corresponding to the field `value`. */ - final Expr getValue() { unified_pattern_guard_expr_def(this, _, result) } + final F::Expr getValue() { unified_pattern_guard_expr_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_pattern_guard_expr_def(this, result, _) or unified_pattern_guard_expr_def(this, _, result) } } /** A class representing `postfix_operator` tokens. */ - final class PostfixOperator extends @unified_token_postfix_operator, TokenImpl { + class PostfixOperator extends @unified_token_postfix_operator, F::Operator, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PostfixOperator" } } /** A class representing `prefix_operator` tokens. */ - final class PrefixOperator extends @unified_token_prefix_operator, TokenImpl { + class PrefixOperator extends @unified_token_prefix_operator, F::Operator, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PrefixOperator" } } /** A class representing `regex_literal` tokens. */ - final class RegexLiteral extends @unified_token_regex_literal, TokenImpl { + class RegexLiteral extends @unified_token_regex_literal, F::Expr, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "RegexLiteral" } } /** A class representing `return_expr` nodes. */ - final class ReturnExpr extends @unified_return_expr, AstNodeImpl { + class ReturnExpr extends @unified_return_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ReturnExpr" } /** Gets the node corresponding to the field `value`. */ - final Expr getValue() { unified_return_expr_value(this, result) } + final F::Expr getValue() { unified_return_expr_value(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { unified_return_expr_value(this, result) } + final override F::AstNode getAFieldOrChild() { unified_return_expr_value(this, result) } } - final class Stmt extends @unified_stmt, AstNodeImpl { } + class Stmt extends @unified_stmt, F::AstNode { } /** A class representing `string_literal` tokens. */ - final class StringLiteral extends @unified_token_string_literal, TokenImpl { + class StringLiteral extends @unified_token_string_literal, F::Expr, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "StringLiteral" } } /** A class representing `super_expr` tokens. */ - final class SuperExpr extends @unified_token_super_expr, TokenImpl { + class SuperExpr extends @unified_token_super_expr, F::Expr, F::Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SuperExpr" } } /** A class representing `switch_case` nodes. */ - final class SwitchCase extends @unified_switch_case, AstNodeImpl { + class SwitchCase extends @unified_switch_case, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SwitchCase" } /** Gets the node corresponding to the field `body`. */ - final Block getBody() { unified_switch_case_def(this, result) } + final F::Block getBody() { unified_switch_case_def(this, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_switch_case_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_switch_case_modifier(this, i, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `pattern`. */ - final Pattern getPattern() { unified_switch_case_pattern(this, result) } + final F::Pattern getPattern() { unified_switch_case_pattern(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_switch_case_def(this, result) or unified_switch_case_modifier(this, _, result) or unified_switch_case_pattern(this, result) @@ -1158,21 +1305,27 @@ module Unified { } /** A class representing `switch_expr` nodes. */ - final class SwitchExpr extends @unified_switch_expr, AstNodeImpl { + class SwitchExpr extends @unified_switch_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SwitchExpr" } /** Gets the node corresponding to the field `case`. */ - final SwitchCase getCase(int i) { unified_switch_expr_case(this, i, result) } + final F::SwitchCase getCase(int i) { unified_switch_expr_case(this, i, result) } + + /** Gets the node corresponding to the field `case`. */ + final F::SwitchCase getACase() { result = this.getCase(_) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getModifier(int i) { unified_switch_expr_modifier(this, i, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_switch_expr_modifier(this, i, result) } + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `value`. */ - final Expr getValue() { unified_switch_expr_def(this, result) } + final F::Expr getValue() { unified_switch_expr_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_switch_expr_case(this, _, result) or unified_switch_expr_modifier(this, _, result) or unified_switch_expr_def(this, result) @@ -1180,45 +1333,51 @@ module Unified { } /** A class representing `throw_expr` nodes. */ - final class ThrowExpr extends @unified_throw_expr, AstNodeImpl { + class ThrowExpr extends @unified_throw_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ThrowExpr" } /** Gets the node corresponding to the field `value`. */ - final Expr getValue() { unified_throw_expr_value(this, result) } + final F::Expr getValue() { unified_throw_expr_value(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { unified_throw_expr_value(this, result) } + final override F::AstNode getAFieldOrChild() { unified_throw_expr_value(this, result) } } /** A class representing `top_level` nodes. */ - final class TopLevel extends @unified_top_level, AstNodeImpl { + class TopLevel extends @unified_top_level, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TopLevel" } /** Gets the node corresponding to the field `body`. */ - final Block getBody() { unified_top_level_def(this, result) } + final F::Block getBody() { unified_top_level_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { unified_top_level_def(this, result) } + final override F::AstNode getAFieldOrChild() { unified_top_level_def(this, result) } } /** A class representing `try_expr` nodes. */ - final class TryExpr extends @unified_try_expr, AstNodeImpl { + class TryExpr extends @unified_try_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TryExpr" } /** Gets the node corresponding to the field `body`. */ - final Block getBody() { unified_try_expr_def(this, result) } + final F::Block getBody() { unified_try_expr_def(this, result) } /** Gets the node corresponding to the field `catch_clause`. */ - final CatchClause getCatchClause(int i) { unified_try_expr_catch_clause(this, i, result) } + final F::CatchClause getCatchClause(int i) { unified_try_expr_catch_clause(this, i, result) } + + /** Gets the node corresponding to the field `catch_clause`. */ + final F::CatchClause getACatchClause() { result = this.getCatchClause(_) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getModifier(int i) { unified_try_expr_modifier(this, i, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_try_expr_modifier(this, i, result) } + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_try_expr_def(this, result) or unified_try_expr_catch_clause(this, _, result) or unified_try_expr_modifier(this, _, result) @@ -1226,90 +1385,115 @@ module Unified { } /** A class representing `tuple_expr` nodes. */ - final class TupleExpr extends @unified_tuple_expr, AstNodeImpl { + class TupleExpr extends @unified_tuple_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TupleExpr" } /** Gets the node corresponding to the field `element`. */ - final Expr getElement(int i) { unified_tuple_expr_element(this, i, result) } + final F::Expr getElement(int i) { unified_tuple_expr_element(this, i, result) } + + /** Gets the node corresponding to the field `element`. */ + final F::Expr getAnElement() { result = this.getElement(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { unified_tuple_expr_element(this, _, result) } + final override F::AstNode getAFieldOrChild() { unified_tuple_expr_element(this, _, result) } } /** A class representing `tuple_pattern` nodes. */ - final class TuplePattern extends @unified_tuple_pattern, AstNodeImpl { + class TuplePattern extends @unified_tuple_pattern, F::Pattern { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TuplePattern" } /** Gets the node corresponding to the field `element`. */ - final PatternElement getElement(int i) { unified_tuple_pattern_element(this, i, result) } + final F::PatternElement getElement(int i) { unified_tuple_pattern_element(this, i, result) } + + /** Gets the node corresponding to the field `element`. */ + final F::PatternElement getAnElement() { result = this.getElement(_) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_tuple_pattern_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_tuple_pattern_modifier(this, i, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_tuple_pattern_element(this, _, result) or unified_tuple_pattern_modifier(this, _, result) } } /** A class representing `tuple_type_element` nodes. */ - final class TupleTypeElement extends @unified_tuple_type_element, AstNodeImpl { + class TupleTypeElement extends @unified_tuple_type_element, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TupleTypeElement" } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { unified_tuple_type_element_name(this, result) } + final F::Identifier getName() { unified_tuple_type_element_name(this, result) } /** Gets the node corresponding to the field `type`. */ - final TypeExpr getType() { unified_tuple_type_element_def(this, result) } + final F::TypeExpr getType() { unified_tuple_type_element_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_tuple_type_element_name(this, result) or unified_tuple_type_element_def(this, result) } } /** A class representing `tuple_type_expr` nodes. */ - final class TupleTypeExpr extends @unified_tuple_type_expr, AstNodeImpl { + class TupleTypeExpr extends @unified_tuple_type_expr, F::TypeExpr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TupleTypeExpr" } /** Gets the node corresponding to the field `element`. */ - final TupleTypeElement getElement(int i) { unified_tuple_type_expr_element(this, i, result) } + final F::TupleTypeElement getElement(int i) { unified_tuple_type_expr_element(this, i, result) } + + /** Gets the node corresponding to the field `element`. */ + final F::TupleTypeElement getAnElement() { result = this.getElement(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { unified_tuple_type_expr_element(this, _, result) } + final override F::AstNode getAFieldOrChild() { + unified_tuple_type_expr_element(this, _, result) + } } /** A class representing `type_alias_declaration` nodes. */ - final class TypeAliasDeclaration extends @unified_type_alias_declaration, AstNodeImpl { + class TypeAliasDeclaration extends @unified_type_alias_declaration, F::Member, F::Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeAliasDeclaration" } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_type_alias_declaration_modifier(this, i, result) } + final F::Modifier getModifier(int i) { + unified_type_alias_declaration_modifier(this, i, result) + } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { unified_type_alias_declaration_def(this, result, _) } + final F::Identifier getName() { unified_type_alias_declaration_def(this, result, _) } /** Gets the node corresponding to the field `type`. */ - final TypeExpr getType() { unified_type_alias_declaration_def(this, _, result) } + final F::TypeExpr getType() { unified_type_alias_declaration_def(this, _, result) } /** Gets the node corresponding to the field `type_constraint`. */ - final TypeConstraint getTypeConstraint(int i) { + final F::TypeConstraint getTypeConstraint(int i) { unified_type_alias_declaration_type_constraint(this, i, result) } + /** Gets the node corresponding to the field `type_constraint`. */ + final F::TypeConstraint getATypeConstraint() { result = this.getTypeConstraint(_) } + /** Gets the node corresponding to the field `type_parameter`. */ - final TypeParameter getTypeParameter(int i) { + final F::TypeParameter getTypeParameter(int i) { unified_type_alias_declaration_type_parameter(this, i, result) } + /** Gets the node corresponding to the field `type_parameter`. */ + final F::TypeParameter getATypeParameter() { result = this.getTypeParameter(_) } + /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_type_alias_declaration_modifier(this, _, result) or unified_type_alias_declaration_def(this, result, _) or unified_type_alias_declaration_def(this, _, result) or @@ -1319,47 +1503,50 @@ module Unified { } /** A class representing `type_cast_expr` nodes. */ - final class TypeCastExpr extends @unified_type_cast_expr, AstNodeImpl { + class TypeCastExpr extends @unified_type_cast_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeCastExpr" } /** Gets the node corresponding to the field `expr`. */ - final Expr getExpr() { unified_type_cast_expr_def(this, result, _, _) } + final F::Expr getExpr() { unified_type_cast_expr_def(this, result, _, _) } /** Gets the node corresponding to the field `operator`. */ - final InfixOperator getOperator() { unified_type_cast_expr_def(this, _, result, _) } + final F::InfixOperator getOperator() { unified_type_cast_expr_def(this, _, result, _) } /** Gets the node corresponding to the field `type`. */ - final TypeExpr getType() { unified_type_cast_expr_def(this, _, _, result) } + final F::TypeExpr getType() { unified_type_cast_expr_def(this, _, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_type_cast_expr_def(this, result, _, _) or unified_type_cast_expr_def(this, _, result, _) or unified_type_cast_expr_def(this, _, _, result) } } - final class TypeConstraint extends @unified_type_constraint, AstNodeImpl { } + class TypeConstraint extends @unified_type_constraint, F::AstNode { } - final class TypeExpr extends @unified_type_expr, AstNodeImpl { } + class TypeExpr extends @unified_type_expr, F::ExprOrType { } /** A class representing `type_parameter` nodes. */ - final class TypeParameter extends @unified_type_parameter, AstNodeImpl { + class TypeParameter extends @unified_type_parameter, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeParameter" } /** Gets the node corresponding to the field `bound`. */ - final TypeExpr getBound() { unified_type_parameter_bound(this, result) } + final F::TypeExpr getBound() { unified_type_parameter_bound(this, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getModifier(int i) { unified_type_parameter_modifier(this, i, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_type_parameter_modifier(this, i, result) } + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `name`. */ - final Identifier getName() { unified_type_parameter_def(this, result) } + final F::Identifier getName() { unified_type_parameter_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_type_parameter_bound(this, result) or unified_type_parameter_modifier(this, _, result) or unified_type_parameter_def(this, result) @@ -1367,21 +1554,21 @@ module Unified { } /** A class representing `type_test_expr` nodes. */ - final class TypeTestExpr extends @unified_type_test_expr, AstNodeImpl { + class TypeTestExpr extends @unified_type_test_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeTestExpr" } /** Gets the node corresponding to the field `expr`. */ - final Expr getExpr() { unified_type_test_expr_def(this, result, _, _) } + final F::Expr getExpr() { unified_type_test_expr_def(this, result, _, _) } /** Gets the node corresponding to the field `operator`. */ - final InfixOperator getOperator() { unified_type_test_expr_def(this, _, result, _) } + final F::InfixOperator getOperator() { unified_type_test_expr_def(this, _, result, _) } /** Gets the node corresponding to the field `type`. */ - final TypeExpr getType() { unified_type_test_expr_def(this, _, _, result) } + final F::TypeExpr getType() { unified_type_test_expr_def(this, _, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_type_test_expr_def(this, result, _, _) or unified_type_test_expr_def(this, _, result, _) or unified_type_test_expr_def(this, _, _, result) @@ -1389,81 +1576,89 @@ module Unified { } /** A class representing `type_test_pattern` nodes. */ - final class TypeTestPattern extends @unified_type_test_pattern, AstNodeImpl { + class TypeTestPattern extends @unified_type_test_pattern, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeTestPattern" } /** Gets the node corresponding to the field `pattern`. */ - final Pattern getPattern() { unified_type_test_pattern_def(this, result, _) } + final F::Pattern getPattern() { unified_type_test_pattern_def(this, result, _) } /** Gets the node corresponding to the field `type`. */ - final TypeExpr getType() { unified_type_test_pattern_def(this, _, result) } + final F::TypeExpr getType() { unified_type_test_pattern_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_type_test_pattern_def(this, result, _) or unified_type_test_pattern_def(this, _, result) } } /** A class representing `unary_expr` nodes. */ - final class UnaryExpr extends @unified_unary_expr, AstNodeImpl { + class UnaryExpr extends @unified_unary_expr, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "UnaryExpr" } /** Gets the node corresponding to the field `operand`. */ - final Expr getOperand() { unified_unary_expr_def(this, result, _) } + final F::Expr getOperand() { unified_unary_expr_def(this, result, _) } /** Gets the node corresponding to the field `operator`. */ - final Operator getOperator() { unified_unary_expr_def(this, _, result) } + final F::Operator getOperator() { unified_unary_expr_def(this, _, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_unary_expr_def(this, result, _) or unified_unary_expr_def(this, _, result) } } /** A class representing `unresolved_operator_sequence` nodes. */ - final class UnresolvedOperatorSequence extends @unified_unresolved_operator_sequence, AstNodeImpl { + class UnresolvedOperatorSequence extends @unified_unresolved_operator_sequence, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "UnresolvedOperatorSequence" } /** Gets the node corresponding to the field `element`. */ - final ExprOrOperator getElement(int i) { + final F::ExprOrOperator getElement(int i) { unified_unresolved_operator_sequence_element(this, i, result) } + /** Gets the node corresponding to the field `element`. */ + final F::ExprOrOperator getAnElement() { result = this.getElement(_) } + /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_unresolved_operator_sequence_element(this, _, result) } } /** A class representing `unsupported_node` tokens. */ - final class UnsupportedNode extends @unified_token_unsupported_node, TokenImpl { + class UnsupportedNode extends @unified_token_unsupported_node, F::Expr, F::Member, F::Pattern, + F::Token, F::TypeExpr + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "UnsupportedNode" } } /** A class representing `variable_declaration` nodes. */ - final class VariableDeclaration extends @unified_variable_declaration, AstNodeImpl { + class VariableDeclaration extends @unified_variable_declaration, F::Member, F::Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "VariableDeclaration" } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_variable_declaration_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_variable_declaration_modifier(this, i, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets the node corresponding to the field `pattern`. */ - final Pattern getPattern() { unified_variable_declaration_def(this, result) } + final F::Pattern getPattern() { unified_variable_declaration_def(this, result) } /** Gets the node corresponding to the field `type`. */ - final TypeExpr getType() { unified_variable_declaration_type(this, result) } + final F::TypeExpr getType() { unified_variable_declaration_type(this, result) } /** Gets the node corresponding to the field `value`. */ - final Expr getValue() { unified_variable_declaration_value(this, result) } + final F::Expr getValue() { unified_variable_declaration_value(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_variable_declaration_modifier(this, _, result) or unified_variable_declaration_def(this, result) or unified_variable_declaration_type(this, result) or @@ -1472,21 +1667,24 @@ module Unified { } /** A class representing `while_stmt` nodes. */ - final class WhileStmt extends @unified_while_stmt, AstNodeImpl { + class WhileStmt extends @unified_while_stmt, F::Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "WhileStmt" } /** Gets the node corresponding to the field `body`. */ - final Block getBody() { unified_while_stmt_body(this, result) } + final F::Block getBody() { unified_while_stmt_body(this, result) } /** Gets the node corresponding to the field `condition`. */ - final Expr getCondition() { unified_while_stmt_def(this, result) } + final F::Expr getCondition() { unified_while_stmt_def(this, result) } /** Gets the node corresponding to the field `modifier`. */ - final Modifier getModifier(int i) { unified_while_stmt_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_while_stmt_modifier(this, i, result) } + + /** Gets the node corresponding to the field `modifier`. */ + final F::Modifier getAModifier() { result = this.getModifier(_) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_while_stmt_body(this, result) or unified_while_stmt_def(this, result) or unified_while_stmt_modifier(this, _, result) @@ -1496,7 +1694,7 @@ module Unified { /** Provides predicates for mapping AST nodes to their named children. */ module PrintAst { /** Gets a child of `node` returned by the member predicate with the given `name`. If the predicate takes an index argument, `i` is bound to that index, otherwise `i` is `-1` (which is never a valid index). */ - AstNode getChild(AstNode node, string name, int i) { + F::AstNode getChild(F::AstNode node, string name, int i) { result = node.(AccessorDeclaration).getAccessorKind() and i = -1 and name = "getAccessorKind" or result = node.(AccessorDeclaration).getBody() and i = -1 and name = "getBody" @@ -1825,3 +2023,196 @@ module Unified { } } } + +module UnifiedFinal { + private import FacadeAst::Unified as F + import F + + final class AstNode = F::AstNode; + + final class Token = F::Token; + + final class TriviaToken = F::TriviaToken; + + final class AccessorDeclaration = F::AccessorDeclaration; + + final class AccessorKind = F::AccessorKind; + + final class Argument = F::Argument; + + final class ArrayLiteral = F::ArrayLiteral; + + final class AssignExpr = F::AssignExpr; + + final class AssociatedTypeDeclaration = F::AssociatedTypeDeclaration; + + final class BaseType = F::BaseType; + + final class BinaryExpr = F::BinaryExpr; + + final class Block = F::Block; + + final class BooleanLiteral = F::BooleanLiteral; + + final class BoundTypeConstraint = F::BoundTypeConstraint; + + final class BreakExpr = F::BreakExpr; + + final class BuiltinExpr = F::BuiltinExpr; + + final class BulkImportingPattern = F::BulkImportingPattern; + + final class CallExpr = F::CallExpr; + + final class CatchClause = F::CatchClause; + + final class ClassLikeDeclaration = F::ClassLikeDeclaration; + + final class CompoundAssignExpr = F::CompoundAssignExpr; + + final class ConditionalPattern = F::ConditionalPattern; + + final class ConstructorDeclaration = F::ConstructorDeclaration; + + final class ConstructorPattern = F::ConstructorPattern; + + final class ContinueExpr = F::ContinueExpr; + + final class DestructorDeclaration = F::DestructorDeclaration; + + final class DoWhileStmt = F::DoWhileStmt; + + final class EmptyExpr = F::EmptyExpr; + + final class EqualityTypeConstraint = F::EqualityTypeConstraint; + + final class Expr = F::Expr; + + final class ExprEqualityPattern = F::ExprEqualityPattern; + + final class ExprOrOperator = F::ExprOrOperator; + + final class ExprOrPattern = F::ExprOrPattern; + + final class ExprOrType = F::ExprOrType; + + final class Fixity = F::Fixity; + + final class FloatLiteral = F::FloatLiteral; + + final class ForEachStmt = F::ForEachStmt; + + final class FunctionDeclaration = F::FunctionDeclaration; + + final class FunctionExpr = F::FunctionExpr; + + final class FunctionTypeExpr = F::FunctionTypeExpr; + + final class GenericTypeExpr = F::GenericTypeExpr; + + final class GuardIfStmt = F::GuardIfStmt; + + final class Identifier = F::Identifier; + + final class IfExpr = F::IfExpr; + + final class IgnorePattern = F::IgnorePattern; + + final class ImportDeclaration = F::ImportDeclaration; + + final class InferredTypeExpr = F::InferredTypeExpr; + + final class InfixOperator = F::InfixOperator; + + final class InitializerDeclaration = F::InitializerDeclaration; + + final class IntLiteral = F::IntLiteral; + + final class KeyValuePair = F::KeyValuePair; + + final class LabeledStmt = F::LabeledStmt; + + final class MapLiteral = F::MapLiteral; + + final class Member = F::Member; + + final class MemberAccessExpr = F::MemberAccessExpr; + + final class Modifier = F::Modifier; + + final class NameExpr = F::NameExpr; + + final class NamePattern = F::NamePattern; + + final class NamedTypeExpr = F::NamedTypeExpr; + + final class Operator = F::Operator; + + final class OperatorSyntaxDeclaration = F::OperatorSyntaxDeclaration; + + final class OrPattern = F::OrPattern; + + final class Parameter = F::Parameter; + + final class Pattern = F::Pattern; + + final class PatternElement = F::PatternElement; + + final class PatternGuardExpr = F::PatternGuardExpr; + + final class PostfixOperator = F::PostfixOperator; + + final class PrefixOperator = F::PrefixOperator; + + final class RegexLiteral = F::RegexLiteral; + + final class ReturnExpr = F::ReturnExpr; + + final class Stmt = F::Stmt; + + final class StringLiteral = F::StringLiteral; + + final class SuperExpr = F::SuperExpr; + + final class SwitchCase = F::SwitchCase; + + final class SwitchExpr = F::SwitchExpr; + + final class ThrowExpr = F::ThrowExpr; + + final class TopLevel = F::TopLevel; + + final class TryExpr = F::TryExpr; + + final class TupleExpr = F::TupleExpr; + + final class TuplePattern = F::TuplePattern; + + final class TupleTypeElement = F::TupleTypeElement; + + final class TupleTypeExpr = F::TupleTypeExpr; + + final class TypeAliasDeclaration = F::TypeAliasDeclaration; + + final class TypeCastExpr = F::TypeCastExpr; + + final class TypeConstraint = F::TypeConstraint; + + final class TypeExpr = F::TypeExpr; + + final class TypeParameter = F::TypeParameter; + + final class TypeTestExpr = F::TypeTestExpr; + + final class TypeTestPattern = F::TypeTestPattern; + + final class UnaryExpr = F::UnaryExpr; + + final class UnresolvedOperatorSequence = F::UnresolvedOperatorSequence; + + final class UnsupportedNode = F::UnsupportedNode; + + final class VariableDeclaration = F::VariableDeclaration; + + final class WhileStmt = F::WhileStmt; +} diff --git a/unified/ql/lib/codeql/unified/internal/FacadeAst.qll b/unified/ql/lib/codeql/unified/internal/FacadeAst.qll new file mode 100644 index 000000000000..a25fb3447c1e --- /dev/null +++ b/unified/ql/lib/codeql/unified/internal/FacadeAst.qll @@ -0,0 +1,31 @@ +/** + * Provides facade AST classes, with additional hand-written members on top of the generated ones. + */ +overlay[local?] +module; + +module Unified { + private import Ast::Unified as G + import G + + /** The base class for all AST nodes. */ + class AstNode extends G::AstNode { + /** Holds if this AST node has a modifier with the given text. */ + predicate hasModifier(string text) { + exists(Modifier mod | + mod.getParent() = this and + mod.getValue() = text + ) + } + } + + /** The base class for all patterns. */ + class Pattern extends G::Pattern { + /** Gets the immediately-enclosing pattern in which this is a nested pattern. */ + Pattern getEnclosingPattern() { + result = this.getParent() + or + result = this.getParent().(PatternElement).getParent() + } + } +} diff --git a/unified/ql/lib/codeql/unified/internal/Variables.qll b/unified/ql/lib/codeql/unified/internal/Variables.qll index 539f19930dc6..49cad56d05db 100644 --- a/unified/ql/lib/codeql/unified/internal/Variables.qll +++ b/unified/ql/lib/codeql/unified/internal/Variables.qll @@ -192,25 +192,7 @@ private module LocalNameBindingInput implements LocalNameBindingInputSig + +private Variable getVariableAt(string name, string filepath, int line) { + VariableAccessTest::declAt(result, filepath, line) and + result.getName() = name +} + +query predicate ambiguousVariable(Variable v, string name, string filepath, int line) { + v = getVariableAt(name, filepath, line) and + strictcount(getVariableAt(name, filepath, line)) >= 2 +} diff --git a/unified/scripts/create-extractor-pack.sh b/unified/scripts/create-extractor-pack.sh index 7a41092e4a74..3c22b0e6cbfd 100755 --- a/unified/scripts/create-extractor-pack.sh +++ b/unified/scripts/create-extractor-pack.sh @@ -14,9 +14,9 @@ cd "$(dirname "$0")/.." # we are in a cargo workspace rooted at the git checkout BIN_DIR=../target/release -"$BIN_DIR/codeql-extractor-unified" generate --dbscheme ql/lib/unified.dbscheme --library ql/lib/codeql/unified/Ast.qll +"$BIN_DIR/codeql-extractor-unified" generate --dbscheme ql/lib/unified.dbscheme --library ql/lib/codeql/unified/internal/Ast.qll -codeql query format -i ql/lib/codeql/unified/Ast.qll +codeql query format -i ql/lib/codeql/unified/internal/Ast.qll rm -rf extractor-pack mkdir -p extractor-pack