From 68f197335265abad546d2454f0f0540e555e4f8b Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 13:04:25 +0200 Subject: [PATCH 01/21] tree-sitter-extractor: Support facade AST --- ql/extractor/src/generator.rs | 1 + ruby/extractor/src/generator.rs | 1 + shared/tree-sitter-extractor/src/generator/mod.rs | 13 +++++++++++++ shared/tree-sitter-extractor/src/generator/ql.rs | 8 ++++++++ .../tree-sitter-extractor/src/generator/ql_gen.rs | 10 +++++----- unified/extractor/src/generator.rs | 1 + 6 files changed, 29 insertions(+), 5 deletions(-) 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/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/shared/tree-sitter-extractor/src/generator/mod.rs b/shared/tree-sitter-extractor/src/generator/mod.rs index dbecf62569af..bc1d6fc34aab 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,6 +124,17 @@ pub fn generate( let mut body = vec![]; + 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. + }; + body.push(ql::TopLevel::Import(ql::Import { + is_private: true, + module: &facade_import_name, + alias: Some("F"), + })); + for c in ql_gen::create_ast_node_class( &ast_node_name, &node_location_table_name, diff --git a/shared/tree-sitter-extractor/src/generator/ql.rs b/shared/tree-sitter-extractor/src/generator/ql.rs index 6a78a4f95f09..5991cab4a6c1 100644 --- a/shared/tree-sitter-extractor/src/generator/ql.rs +++ b/shared/tree-sitter-extractor/src/generator/ql.rs @@ -22,12 +22,16 @@ impl fmt::Display for TopLevel<'_> { #[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 +150,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 +162,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..73fc5bc0e975 100644 --- a/shared/tree-sitter-extractor/src/generator/ql_gen.rs +++ b/shared/tree-sitter-extractor/src/generator/ql_gen.rs @@ -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, @@ -659,13 +659,13 @@ fn create_field_getters<'a>( ) -> (ql::Predicate<'a>, 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 { @@ -911,7 +911,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, 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", ) } From eba3f20411a8614dccfff6250715dc3fa1e479e5 Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 13:05:51 +0200 Subject: [PATCH 02/21] Regenerate AST classes --- .../src/codeql_ql/ast/internal/TreeSitter.qll | 506 +++++++-------- .../codeql/ruby/ast/internal/TreeSitter.qll | 576 +++++++++--------- unified/ql/lib/codeql/unified/Ast.qll | 478 ++++++++------- 3 files changed, 804 insertions(+), 756 deletions(-) diff --git a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll index e2aedc401f7a..7452f7b290b2 100644 --- a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll +++ b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll @@ -25,6 +25,8 @@ private predicate discardLocation(@location_default loc) { overlay[local] module QL { + private import QL as F + /** The base class for all AST nodes */ private class AstNodeImpl extends @ql_ast_node { /** Gets a string representation of this element. */ @@ -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 = "???" } @@ -97,16 +99,16 @@ module QL { 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) @@ -131,10 +133,10 @@ module QL { 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 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. */ @@ -143,10 +145,10 @@ module QL { 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. */ @@ -161,13 +163,13 @@ module QL { 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 `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) } } @@ -178,13 +180,13 @@ module QL { 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) } @@ -196,10 +198,10 @@ module QL { 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 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. */ @@ -208,10 +210,10 @@ module QL { 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 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. */ @@ -226,10 +228,10 @@ module QL { 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. */ @@ -238,10 +240,10 @@ module QL { 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. */ @@ -250,10 +252,10 @@ module QL { 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 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. */ @@ -262,10 +264,12 @@ module QL { 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 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. */ @@ -274,13 +278,13 @@ module QL { 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) } } @@ -291,10 +295,10 @@ module QL { 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 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. */ @@ -309,16 +313,16 @@ module QL { 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 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) @@ -337,16 +341,16 @@ module QL { 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) @@ -365,13 +369,13 @@ module QL { 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) } } @@ -382,19 +386,19 @@ module QL { 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 `instanceof`. */ - final AstNode getInstanceof(int i) { ql_dataclass_instanceof(this, i, result) } + final F::AstNode getInstanceof(int i) { ql_dataclass_instanceof(this, i, result) } /** 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 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 @@ -408,13 +412,13 @@ module QL { 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) } } @@ -425,13 +429,13 @@ module QL { 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 AstNode getChild(int i) { ql_datatype_branch_child(this, i, result) } + final F::AstNode getChild(int i) { ql_datatype_branch_child(this, i, result) } /** 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) } } @@ -442,10 +446,10 @@ module QL { 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 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. */ @@ -466,13 +470,13 @@ module QL { 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) } } @@ -489,13 +493,13 @@ module QL { 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) } } @@ -506,16 +510,16 @@ module QL { 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) @@ -534,10 +538,10 @@ module QL { 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. */ @@ -552,19 +556,19 @@ module QL { 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 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 @@ -578,13 +582,13 @@ module QL { 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 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) } } @@ -595,16 +599,16 @@ module QL { 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) @@ -617,13 +621,13 @@ module QL { 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) } } @@ -634,10 +638,10 @@ module QL { 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 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. */ @@ -646,13 +650,13 @@ module QL { 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 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) } } @@ -663,13 +667,13 @@ module QL { 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) } } @@ -680,10 +684,10 @@ module QL { 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 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. */ @@ -704,10 +708,10 @@ module QL { 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. */ @@ -722,16 +726,16 @@ module QL { 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 AstNode getChild(int i) { ql_member_predicate_child(this, i, result) } + final F::AstNode getChild(int i) { ql_member_predicate_child(this, i, result) } /** 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) @@ -744,19 +748,19 @@ module QL { 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 `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 ModuleParam getParameter(int i) { ql_module_parameter(this, i, result) } + final F::ModuleParam getParameter(int i) { ql_module_parameter(this, i, result) } /** 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 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 @@ -770,10 +774,10 @@ module QL { 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. */ @@ -782,13 +786,13 @@ module QL { 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) } } @@ -799,13 +803,13 @@ module QL { 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 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) } } @@ -816,10 +820,10 @@ module QL { 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 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. */ @@ -828,10 +832,10 @@ module QL { 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. */ @@ -840,13 +844,13 @@ module QL { 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) } } @@ -857,16 +861,16 @@ module QL { 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) @@ -885,10 +889,10 @@ module QL { 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. */ @@ -897,10 +901,10 @@ module QL { 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 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. */ @@ -909,10 +913,10 @@ module QL { 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 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. */ @@ -921,10 +925,10 @@ module QL { 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. */ @@ -939,10 +943,10 @@ module QL { 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. */ @@ -951,10 +955,10 @@ module QL { 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 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. */ @@ -969,10 +973,10 @@ module QL { 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 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. */ @@ -987,10 +991,10 @@ module QL { 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 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. */ @@ -1005,13 +1009,13 @@ module QL { 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 AstNode getChild(int i) { ql_qualified_rhs_child(this, i, result) } + final F::AstNode getChild(int i) { ql_qualified_rhs_child(this, i, result) } /** 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) } } @@ -1022,10 +1026,10 @@ module QL { 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 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. */ @@ -1034,19 +1038,19 @@ module QL { 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 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 @@ -1066,13 +1070,13 @@ module QL { 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) } } @@ -1089,10 +1093,10 @@ module QL { 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 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. */ @@ -1101,10 +1105,10 @@ module QL { 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 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. */ @@ -1113,16 +1117,16 @@ module QL { 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) @@ -1147,10 +1151,10 @@ module QL { 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. */ @@ -1171,10 +1175,10 @@ module QL { 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 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. */ @@ -1195,10 +1199,10 @@ module QL { 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. */ @@ -1207,16 +1211,16 @@ module QL { 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) @@ -1229,10 +1233,10 @@ module QL { 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 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. */ @@ -1241,10 +1245,10 @@ module QL { 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 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. */ @@ -1265,16 +1269,16 @@ module QL { 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 `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 VarDecl getChild(int i) { ql_unqual_agg_body_child(this, i, result) } + final F::VarDecl getChild(int i) { ql_unqual_agg_body_child(this, i, result) } /** 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) @@ -1287,10 +1291,10 @@ module QL { 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 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. */ @@ -1299,10 +1303,10 @@ module QL { 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. */ @@ -1311,10 +1315,10 @@ module QL { 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. */ @@ -1558,6 +1562,8 @@ module QL { overlay[local] module Dbscheme { + private import Dbscheme as F + /** The base class for all AST nodes */ private class AstNodeImpl extends @dbscheme_ast_node { /** Gets a string representation of this element. */ @@ -1567,13 +1573,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 = "???" } @@ -1636,13 +1642,15 @@ module Dbscheme { 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) } @@ -1654,13 +1662,13 @@ module Dbscheme { 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 SimpleId getChild(int i) { dbscheme_args_annotation_child(this, i, result) } + final F::SimpleId getChild(int i) { dbscheme_args_annotation_child(this, i, result) } /** 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) } } @@ -1683,13 +1691,13 @@ module Dbscheme { 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 AstNode getChild(int i) { dbscheme_branch_child(this, i, result) } + final F::AstNode getChild(int i) { dbscheme_branch_child(this, i, result) } /** 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) } } @@ -1700,16 +1708,16 @@ module Dbscheme { 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 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) @@ -1722,10 +1730,10 @@ module Dbscheme { 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. */ @@ -1734,25 +1742,25 @@ module Dbscheme { 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 @@ -1774,10 +1782,10 @@ module Dbscheme { 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 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. */ @@ -1792,10 +1800,10 @@ module Dbscheme { 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. */ @@ -1840,10 +1848,10 @@ module Dbscheme { 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 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. */ @@ -1864,13 +1872,13 @@ module Dbscheme { 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 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) } } @@ -1881,10 +1889,10 @@ module Dbscheme { 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. */ @@ -1893,13 +1901,13 @@ module Dbscheme { 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 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) } } @@ -1973,6 +1981,8 @@ module Dbscheme { overlay[local] module Blame { + private import Blame as F + /** The base class for all AST nodes */ private class AstNodeImpl extends @blame_ast_node { /** Gets a string representation of this element. */ @@ -1982,13 +1992,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 = "???" } @@ -2045,13 +2055,13 @@ module Blame { 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 Number getLine(int i) { blame_blame_entry_line(this, i, result) } + final F::Number getLine(int i) { blame_blame_entry_line(this, i, result) } /** 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) } } @@ -2062,13 +2072,13 @@ module Blame { 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 `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) } } @@ -2085,13 +2095,13 @@ module Blame { 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 `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) } } @@ -2129,6 +2139,8 @@ module Blame { overlay[local] module JSON { + private import JSON as F + /** The base class for all AST nodes */ private class AstNodeImpl extends @json_ast_node { /** Gets a string representation of this element. */ @@ -2138,13 +2150,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 = "???" } @@ -2203,10 +2215,10 @@ module JSON { 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 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. */ @@ -2221,10 +2233,10 @@ module JSON { 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 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. */ @@ -2257,10 +2269,10 @@ module JSON { 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 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. */ @@ -2269,13 +2281,13 @@ module JSON { 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) } } @@ -2286,10 +2298,10 @@ module JSON { 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 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. */ diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll b/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll index 13ae1923b105..db5360ef5d58 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll @@ -25,6 +25,8 @@ private predicate discardLocation(@location_default loc) { overlay[local] module Ruby { + private import Ruby as F + /** The base class for all AST nodes */ private class AstNodeImpl extends @ruby_ast_node { /** Gets a string representation of this element. */ @@ -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 = "???" } @@ -130,13 +132,13 @@ module Ruby { 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) } } @@ -147,12 +149,12 @@ module Ruby { 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 a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_alternative_pattern_alternatives(this, _, result) } } @@ -163,10 +165,10 @@ module Ruby { 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 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. */ @@ -175,10 +177,10 @@ module Ruby { 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 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. */ @@ -187,13 +189,13 @@ module Ruby { 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 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) } } @@ -204,13 +206,13 @@ module Ruby { 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) } } @@ -221,13 +223,13 @@ module Ruby { 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) } } @@ -238,10 +240,10 @@ module Ruby { 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 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. */ @@ -250,10 +252,10 @@ module Ruby { 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 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. */ @@ -262,10 +264,10 @@ module Ruby { 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 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. */ @@ -274,10 +276,10 @@ module Ruby { 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 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. */ @@ -286,7 +288,7 @@ module Ruby { 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,10 +346,10 @@ 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) } } @@ -358,13 +360,13 @@ module Ruby { 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) } } @@ -375,10 +377,10 @@ module Ruby { 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. */ @@ -387,10 +389,10 @@ module Ruby { 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 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. */ @@ -399,10 +401,10 @@ module Ruby { 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. */ @@ -411,13 +413,13 @@ module Ruby { 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 `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 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) } } @@ -428,10 +430,10 @@ module Ruby { 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 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. */ @@ -440,10 +442,10 @@ module Ruby { 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. */ @@ -452,22 +454,22 @@ module Ruby { 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 @@ -482,13 +484,13 @@ module Ruby { 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 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) } } @@ -499,16 +501,16 @@ module Ruby { 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 `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) @@ -521,10 +523,10 @@ module Ruby { 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 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. */ @@ -539,16 +541,16 @@ module Ruby { 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) @@ -573,10 +575,10 @@ module Ruby { 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. */ @@ -585,16 +587,16 @@ module Ruby { 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) @@ -613,10 +615,10 @@ module Ruby { 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 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. */ @@ -625,10 +627,10 @@ module Ruby { 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 a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_destructured_left_assignment_child(this, _, result) } } @@ -639,10 +641,12 @@ module Ruby { 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 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. */ @@ -651,10 +655,10 @@ module Ruby { 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 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. */ @@ -663,13 +667,13 @@ module Ruby { 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) } } @@ -680,16 +684,16 @@ module Ruby { 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 AstNode getChild(int i) { ruby_element_reference_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_element_reference_child(this, i, result) } /** 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) @@ -702,10 +706,10 @@ module Ruby { 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 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. */ @@ -714,16 +718,16 @@ module Ruby { 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) @@ -748,10 +752,10 @@ module Ruby { 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 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. */ @@ -760,10 +764,10 @@ module Ruby { 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 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. */ @@ -778,10 +782,10 @@ module Ruby { 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. */ @@ -790,10 +794,10 @@ module Ruby { 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 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. */ @@ -802,10 +806,10 @@ module Ruby { 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) } } @@ -828,13 +832,13 @@ module Ruby { 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 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) } } @@ -851,16 +855,16 @@ module Ruby { 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) @@ -891,10 +895,10 @@ module Ruby { 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 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. */ @@ -909,13 +913,13 @@ module Ruby { 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 AstNode getChild(int i) { ruby_hash_pattern_child(this, i, result) } + final F::AstNode getChild(int i) { ruby_hash_pattern_child(this, i, result) } /** 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) } } @@ -926,10 +930,10 @@ module Ruby { 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. */ @@ -944,10 +948,10 @@ module Ruby { 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. */ @@ -962,10 +966,10 @@ module Ruby { 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 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. */ @@ -992,16 +996,16 @@ module Ruby { 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) @@ -1014,10 +1018,10 @@ module Ruby { 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. */ @@ -1026,13 +1030,13 @@ module Ruby { 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) } } @@ -1043,10 +1047,10 @@ module Ruby { 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. */ @@ -1055,16 +1059,16 @@ module Ruby { 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) @@ -1089,10 +1093,10 @@ module Ruby { 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 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. */ @@ -1101,13 +1105,13 @@ module Ruby { 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) } } @@ -1118,13 +1122,13 @@ module Ruby { 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) } } @@ -1135,13 +1139,13 @@ module Ruby { 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) } } @@ -1152,10 +1156,10 @@ module Ruby { 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 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. */ @@ -1164,10 +1168,12 @@ module Ruby { 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 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. */ @@ -1182,13 +1188,13 @@ module Ruby { 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) } } @@ -1199,16 +1205,16 @@ module Ruby { 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) @@ -1221,10 +1227,10 @@ module Ruby { 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 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. */ @@ -1233,13 +1239,13 @@ module Ruby { 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) } } @@ -1250,10 +1256,10 @@ module Ruby { 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. */ @@ -1274,7 +1280,7 @@ module Ruby { 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,10 +1314,10 @@ 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) } @@ -1323,13 +1329,13 @@ module Ruby { 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) } } @@ -1340,13 +1346,13 @@ module Ruby { 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) } } @@ -1357,10 +1363,10 @@ module Ruby { 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. */ @@ -1369,10 +1375,10 @@ module Ruby { 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 a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { ruby_parenthesized_statements_child(this, _, result) } } @@ -1383,10 +1389,10 @@ module Ruby { 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. */ @@ -1395,10 +1401,10 @@ module Ruby { 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 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. */ @@ -1407,10 +1413,10 @@ module Ruby { 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,7 +1428,7 @@ 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) } } @@ -1433,10 +1439,10 @@ module Ruby { 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. */ @@ -1445,10 +1451,10 @@ module Ruby { 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. */ @@ -1457,10 +1463,10 @@ module Ruby { 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 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. */ @@ -1469,16 +1475,16 @@ module Ruby { 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) @@ -1491,13 +1497,13 @@ module Ruby { 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) } } @@ -1508,10 +1514,10 @@ module Ruby { 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. */ @@ -1520,10 +1526,10 @@ module Ruby { 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. */ @@ -1532,10 +1538,10 @@ module Ruby { 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. */ @@ -1544,10 +1550,12 @@ module Ruby { 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 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. */ @@ -1556,13 +1564,13 @@ module Ruby { 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) } } @@ -1579,10 +1587,10 @@ module Ruby { 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. */ @@ -1597,13 +1605,13 @@ module Ruby { 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) } } @@ -1614,19 +1622,19 @@ module Ruby { 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 @@ -1640,10 +1648,10 @@ module Ruby { 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. */ @@ -1652,10 +1660,10 @@ module Ruby { 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. */ @@ -1664,10 +1672,10 @@ module Ruby { 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 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. */ @@ -1676,10 +1684,10 @@ module Ruby { 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 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. */ @@ -1694,10 +1702,10 @@ module Ruby { 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 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. */ @@ -1712,10 +1720,10 @@ module Ruby { 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. */ @@ -1724,10 +1732,10 @@ module Ruby { 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 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. */ @@ -1736,13 +1744,13 @@ module Ruby { 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) } } @@ -1753,10 +1761,10 @@ module Ruby { 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 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. */ @@ -1771,7 +1779,7 @@ module Ruby { 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,7 +1799,7 @@ 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. */ @@ -1800,10 +1808,10 @@ module Ruby { 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 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. */ @@ -1818,16 +1826,16 @@ module Ruby { 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) @@ -1840,10 +1848,10 @@ module Ruby { 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. */ @@ -1852,13 +1860,13 @@ module Ruby { 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) } } @@ -1869,13 +1877,13 @@ module Ruby { 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) } } @@ -1886,13 +1894,13 @@ module Ruby { 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) } } @@ -1903,10 +1911,12 @@ module Ruby { 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. */ @@ -1915,13 +1925,13 @@ module Ruby { 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 Pattern getPattern(int i) { ruby_when_pattern(this, i, result) } + final F::Pattern getPattern(int i) { ruby_when_pattern(this, i, result) } /** 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) } } @@ -1932,13 +1942,13 @@ module Ruby { 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) } } @@ -1949,13 +1959,13 @@ module Ruby { 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) } } @@ -1966,10 +1976,10 @@ module Ruby { 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. */ @@ -2309,6 +2319,8 @@ module Ruby { overlay[local] module Erb { + private import Erb as F + /** The base class for all AST nodes */ private class AstNodeImpl extends @erb_ast_node { /** Gets a string representation of this element. */ @@ -2318,13 +2330,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 = "???" } @@ -2393,10 +2405,10 @@ module Erb { 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. */ @@ -2411,10 +2423,10 @@ module Erb { 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. */ @@ -2423,10 +2435,10 @@ module Erb { 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. */ @@ -2435,10 +2447,10 @@ module Erb { 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. */ @@ -2447,10 +2459,10 @@ module Erb { 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 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. */ diff --git a/unified/ql/lib/codeql/unified/Ast.qll b/unified/ql/lib/codeql/unified/Ast.qll index 4ad61ff353bf..e4f17df788c3 100644 --- a/unified/ql/lib/codeql/unified/Ast.qll +++ b/unified/ql/lib/codeql/unified/Ast.qll @@ -25,6 +25,8 @@ 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 { /** Gets a string representation of this element. */ @@ -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 = "???" } @@ -103,25 +105,27 @@ module Unified { 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 Modifier getModifier(int i) { unified_accessor_declaration_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_accessor_declaration_modifier(this, i, result) } /** 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 Parameter getParameter(int i) { unified_accessor_declaration_parameter(this, i, result) } + final F::Parameter getParameter(int i) { + unified_accessor_declaration_parameter(this, i, result) + } /** 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 @@ -143,16 +147,16 @@ module Unified { 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 `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) @@ -165,10 +169,10 @@ module Unified { 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 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. */ @@ -177,13 +181,13 @@ module Unified { 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) } } @@ -194,18 +198,18 @@ module Unified { 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 `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) @@ -218,13 +222,13 @@ module Unified { 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 `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) } } @@ -235,16 +239,16 @@ module Unified { 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) @@ -257,10 +261,10 @@ module Unified { 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 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. */ @@ -275,13 +279,13 @@ module Unified { 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) } @@ -293,10 +297,10 @@ module Unified { 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. */ @@ -311,10 +315,12 @@ module Unified { 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 a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_bulk_importing_pattern_modifier(this, _, result) } } @@ -325,16 +331,16 @@ module Unified { 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 `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 Modifier getModifier(int i) { unified_call_expr_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_call_expr_modifier(this, i, result) } /** 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) @@ -347,16 +353,16 @@ module Unified { 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 `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) @@ -369,29 +375,33 @@ module Unified { 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 `member`. */ - final Member getMember(int i) { unified_class_like_declaration_member(this, i, result) } + final F::Member getMember(int i) { unified_class_like_declaration_member(this, i, result) } /** 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 `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_parameter`. */ - final TypeParameter getTypeParameter(int i) { + final F::TypeParameter getTypeParameter(int i) { unified_class_like_declaration_type_parameter(this, i, result) } /** 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 @@ -407,16 +417,16 @@ module Unified { 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) @@ -429,16 +439,16 @@ module Unified { 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 `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) @@ -451,21 +461,23 @@ module Unified { 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 Modifier getModifier(int i) { unified_constructor_declaration_modifier(this, i, result) } + final F::Modifier getModifier(int i) { + unified_constructor_declaration_modifier(this, i, result) + } /** 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 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 @@ -479,16 +491,18 @@ module Unified { 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 `modifier`. */ - final Modifier getModifier(int i) { unified_constructor_pattern_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_constructor_pattern_modifier(this, i, result) } /** 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) @@ -501,10 +515,10 @@ module Unified { 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. */ @@ -513,13 +527,15 @@ module Unified { 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 Modifier getModifier(int i) { unified_destructor_declaration_modifier(this, i, result) } + final F::Modifier getModifier(int i) { + unified_destructor_declaration_modifier(this, i, result) + } /** 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) } @@ -531,16 +547,16 @@ module Unified { 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 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) @@ -559,13 +575,13 @@ module Unified { 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) } @@ -579,10 +595,10 @@ module Unified { 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 { } @@ -609,22 +625,22 @@ module Unified { 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 `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 @@ -639,32 +655,34 @@ module Unified { 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 Modifier getModifier(int i) { unified_function_declaration_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_function_declaration_modifier(this, i, result) } /** 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 `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_parameter`. */ - final TypeParameter getTypeParameter(int i) { + final F::TypeParameter getTypeParameter(int i) { unified_function_declaration_type_parameter(this, i, result) } /** 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 @@ -681,24 +699,24 @@ module Unified { 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 `modifier`. */ - final Modifier getModifier(int i) { unified_function_expr_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_function_expr_modifier(this, i, result) } /** 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 `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 @@ -713,13 +731,13 @@ module Unified { 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 `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) } @@ -731,15 +749,15 @@ module Unified { 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 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) } @@ -751,13 +769,13 @@ module Unified { 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) } } @@ -774,16 +792,16 @@ module Unified { 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) @@ -802,16 +820,16 @@ module Unified { 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 Modifier getModifier(int i) { unified_import_declaration_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_import_declaration_modifier(this, i, result) } /** 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) @@ -836,13 +854,15 @@ module Unified { 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 Modifier getModifier(int i) { unified_initializer_declaration_modifier(this, i, result) } + final F::Modifier getModifier(int i) { + unified_initializer_declaration_modifier(this, i, result) + } /** 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) } @@ -860,13 +880,13 @@ module Unified { 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) } } @@ -877,13 +897,13 @@ module Unified { 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) } } @@ -894,10 +914,10 @@ module Unified { 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 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 { } @@ -908,13 +928,13 @@ module Unified { 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) } @@ -932,10 +952,10 @@ module Unified { 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. */ @@ -944,13 +964,13 @@ module Unified { 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 Modifier getModifier(int i) { unified_name_pattern_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_name_pattern_modifier(this, i, result) } /** 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) } } @@ -961,13 +981,13 @@ module Unified { 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) } } @@ -980,21 +1000,21 @@ module Unified { 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 `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 @@ -1008,13 +1028,13 @@ module Unified { 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 `pattern`. */ - final Pattern getPattern(int i) { unified_or_pattern_pattern(this, i, result) } + final F::Pattern getPattern(int i) { unified_or_pattern_pattern(this, i, result) } /** 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) } } @@ -1025,22 +1045,22 @@ module Unified { 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 `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 @@ -1057,16 +1077,16 @@ module Unified { 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 Modifier getModifier(int i) { unified_pattern_element_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_pattern_element_modifier(this, i, result) } /** 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) @@ -1079,13 +1099,13 @@ module Unified { 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) } @@ -1115,10 +1135,10 @@ module Unified { 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 { } @@ -1141,16 +1161,16 @@ module Unified { 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 `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) @@ -1163,16 +1183,16 @@ module Unified { 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 `modifier`. */ - final Modifier getModifier(int i) { unified_switch_expr_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_switch_expr_modifier(this, i, result) } /** 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) @@ -1185,10 +1205,10 @@ module Unified { 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. */ @@ -1197,10 +1217,10 @@ module Unified { 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. */ @@ -1209,16 +1229,16 @@ module Unified { 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 `modifier`. */ - final Modifier getModifier(int i) { unified_try_expr_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_try_expr_modifier(this, i, result) } /** 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) @@ -1231,10 +1251,10 @@ module Unified { 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 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. */ @@ -1243,13 +1263,13 @@ module Unified { 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 `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 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) } @@ -1261,13 +1281,13 @@ module Unified { 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) } } @@ -1278,10 +1298,12 @@ module Unified { 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 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. */ @@ -1290,26 +1312,28 @@ module Unified { 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 `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_parameter`. */ - final TypeParameter getTypeParameter(int i) { + final F::TypeParameter getTypeParameter(int i) { unified_type_alias_declaration_type_parameter(this, i, result) } /** 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 @@ -1324,16 +1348,16 @@ module Unified { 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) @@ -1350,16 +1374,16 @@ module Unified { 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 Modifier getModifier(int i) { unified_type_parameter_modifier(this, i, result) } + final F::Modifier getModifier(int i) { unified_type_parameter_modifier(this, i, result) } /** 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) @@ -1372,16 +1396,16 @@ module Unified { 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) @@ -1394,13 +1418,13 @@ module Unified { 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) } @@ -1412,13 +1436,13 @@ module Unified { 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) } } @@ -1429,12 +1453,12 @@ module Unified { 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 a field or child node of this node. */ - final override AstNode getAFieldOrChild() { + final override F::AstNode getAFieldOrChild() { unified_unresolved_operator_sequence_element(this, _, result) } } @@ -1451,19 +1475,19 @@ module Unified { 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 `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 @@ -1477,16 +1501,16 @@ module Unified { 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 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) From 0c196ded444185c526f666486905b336221a284f Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 13:08:51 +0200 Subject: [PATCH 03/21] unified: Move AST files into internal Users are not supposed to 'import' these files directly, so putting them into 'internal'. --- unified/ql/lib/codeql/unified/{ => internal}/Ast.qll | 0 unified/scripts/create-extractor-pack.sh | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename unified/ql/lib/codeql/unified/{ => internal}/Ast.qll (100%) diff --git a/unified/ql/lib/codeql/unified/Ast.qll b/unified/ql/lib/codeql/unified/internal/Ast.qll similarity index 100% rename from unified/ql/lib/codeql/unified/Ast.qll rename to unified/ql/lib/codeql/unified/internal/Ast.qll 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 From 33cd8d2d39b34a6611a3c601a4968116dd92d9cf Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 13:08:51 +0200 Subject: [PATCH 04/21] unified: Add a basic facade AST --- .../lib/codeql/unified/internal/FacadeAst.qll | 20 +++++++++++++++++++ unified/ql/lib/unified.qll | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 unified/ql/lib/codeql/unified/internal/FacadeAst.qll 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..12cf0cea6420 --- /dev/null +++ b/unified/ql/lib/codeql/unified/internal/FacadeAst.qll @@ -0,0 +1,20 @@ +/** + * 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 + + 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 + ) + } + } +} diff --git a/unified/ql/lib/unified.qll b/unified/ql/lib/unified.qll index 477ac22f3661..ae22a2d76410 100644 --- a/unified/ql/lib/unified.qll +++ b/unified/ql/lib/unified.qll @@ -4,6 +4,6 @@ import codeql.Locations import codeql.files.FileSystem -import codeql.unified.Ast::Unified +import codeql.unified.internal.FacadeAst::Unified import codeql.unified.internal.AstExtra::Public import codeql.unified.internal.Variables::Public From 7ee0ac2b3b16bed4b11cafcac0bb4092439a6646 Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 14:22:24 +0200 Subject: [PATCH 05/21] tree-sitter-extractor: Move final aliases into sibling module The split between private, non-final Impl classes and public final classes ultimately prevented the facade AST from instrumenting base classes like 'Expr' and have its subclasses actually inherit those members. This commit takes a step towards fixing that by moving the final aliases into a separate module and making the other classes public and stripping their Impl suffix. It is up to each language to avoid leaking the non-final classes (which Ruby and QL4QL don't do anyway). --- .../src/generator/mod.rs | 64 +++++++-- .../src/generator/ql_gen.rs | 122 +++++++----------- 2 files changed, 99 insertions(+), 87 deletions(-) diff --git a/shared/tree-sitter-extractor/src/generator/mod.rs b/shared/tree-sitter-extractor/src/generator/mod.rs index bc1d6fc34aab..718c25cd2d84 100644 --- a/shared/tree-sitter-extractor/src/generator/mod.rs +++ b/shared/tree-sitter-extractor/src/generator/mod.rs @@ -135,17 +135,16 @@ pub fn generate( alias: Some("F"), })); - for c in ql_gen::create_ast_node_class( + 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( @@ -179,14 +178,53 @@ pub fn generate( body.append(&mut ql_gen::convert_nodes(&nodes)); body.push(ql_gen::create_print_ast_module(&nodes)); + let mut final_body = 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, + }), + ]; + 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_gen.rs b/shared/tree-sitter-extractor/src/generator/ql_gen.rs index 73fc5bc0e975..e68d2b336c38 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( @@ -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::Normal("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,12 +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"), + ql::Type::Normal("AstNode"), ] .into_iter() .collect(), @@ -309,10 +283,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::Normal("Token")] .into_iter() .collect(), characteristic_predicate: None, @@ -816,12 +790,12 @@ pub fn convert_nodes(nodes: &node_types::NodeTypeMap) -> Vec> { 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")); + supertypes.insert(ql::Type::Normal("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,12 +811,12 @@ 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"), + ql::Type::Normal("AstNode"), ] .into_iter() .collect(), @@ -871,12 +845,12 @@ 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"), + ql::Type::Normal("AstNode"), ] .into_iter() .collect(), From c62722ff3943656c295b8482f1bcbf25424b1dff Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 14:22:44 +0200 Subject: [PATCH 06/21] unified: Regenerate AST and update import --- .../ql/lib/codeql/unified/internal/Ast.qll | 381 +++++++++++++----- unified/ql/lib/unified.qll | 2 +- 2 files changed, 285 insertions(+), 98 deletions(-) diff --git a/unified/ql/lib/codeql/unified/internal/Ast.qll b/unified/ql/lib/codeql/unified/internal/Ast.qll index e4f17df788c3..a165be1af82e 100644 --- a/unified/ql/lib/codeql/unified/internal/Ast.qll +++ b/unified/ql/lib/codeql/unified/internal/Ast.qll @@ -28,7 +28,7 @@ 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() } @@ -51,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, AstNode { /** Gets the value of this token. */ final string getValue() { unified_tokeninfo(this, _, result) } @@ -65,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, AstNode { /** Gets the source text of this trivia token. */ final string getValue() { unified_trivia_tokeninfo(this, _, result) } @@ -100,7 +96,7 @@ module Unified { } /** A class representing `accessor_declaration` nodes. */ - final class AccessorDeclaration extends @unified_accessor_declaration, AstNodeImpl { + class AccessorDeclaration extends @unified_accessor_declaration, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AccessorDeclaration" } @@ -136,13 +132,13 @@ module Unified { } /** A class representing `accessor_kind` tokens. */ - final class AccessorKind extends @unified_token_accessor_kind, TokenImpl { + class AccessorKind extends @unified_token_accessor_kind, 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Argument" } @@ -164,7 +160,7 @@ module Unified { } /** A class representing `array_literal` nodes. */ - final class ArrayLiteral extends @unified_array_literal, AstNodeImpl { + class ArrayLiteral extends @unified_array_literal, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ArrayLiteral" } @@ -176,7 +172,7 @@ module Unified { } /** A class representing `assign_expr` nodes. */ - final class AssignExpr extends @unified_assign_expr, AstNodeImpl { + class AssignExpr extends @unified_assign_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AssignExpr" } @@ -193,7 +189,7 @@ module Unified { } /** A class representing `associated_type_declaration` nodes. */ - final class AssociatedTypeDeclaration extends @unified_associated_type_declaration, AstNodeImpl { + class AssociatedTypeDeclaration extends @unified_associated_type_declaration, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AssociatedTypeDeclaration" } @@ -217,7 +213,7 @@ module Unified { } /** A class representing `base_type` nodes. */ - final class BaseType extends @unified_base_type, AstNodeImpl { + class BaseType extends @unified_base_type, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BaseType" } @@ -234,7 +230,7 @@ module Unified { } /** A class representing `binary_expr` nodes. */ - final class BinaryExpr extends @unified_binary_expr, AstNodeImpl { + class BinaryExpr extends @unified_binary_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BinaryExpr" } @@ -256,7 +252,7 @@ module Unified { } /** A class representing `block` nodes. */ - final class Block extends @unified_block, AstNodeImpl { + class Block extends @unified_block, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Block" } @@ -268,13 +264,13 @@ module Unified { } /** A class representing `boolean_literal` tokens. */ - final class BooleanLiteral extends @unified_token_boolean_literal, TokenImpl { + class BooleanLiteral extends @unified_token_boolean_literal, 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BoundTypeConstraint" } @@ -292,7 +288,7 @@ module Unified { } /** A class representing `break_expr` nodes. */ - final class BreakExpr extends @unified_break_expr, AstNodeImpl { + class BreakExpr extends @unified_break_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BreakExpr" } @@ -304,13 +300,13 @@ module Unified { } /** A class representing `builtin_expr` tokens. */ - final class BuiltinExpr extends @unified_token_builtin_expr, TokenImpl { + class BuiltinExpr extends @unified_token_builtin_expr, 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BulkImportingPattern" } @@ -326,7 +322,7 @@ module Unified { } /** A class representing `call_expr` nodes. */ - final class CallExpr extends @unified_call_expr, AstNodeImpl { + class CallExpr extends @unified_call_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CallExpr" } @@ -348,7 +344,7 @@ module Unified { } /** A class representing `catch_clause` nodes. */ - final class CatchClause extends @unified_catch_clause, AstNodeImpl { + class CatchClause extends @unified_catch_clause, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CatchClause" } @@ -370,7 +366,7 @@ 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ClassLikeDeclaration" } @@ -412,7 +408,7 @@ 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CompoundAssignExpr" } @@ -456,7 +452,7 @@ module Unified { } /** A class representing `constructor_declaration` nodes. */ - final class ConstructorDeclaration extends @unified_constructor_declaration, AstNodeImpl { + class ConstructorDeclaration extends @unified_constructor_declaration, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ConstructorDeclaration" } @@ -486,7 +482,7 @@ module Unified { } /** A class representing `constructor_pattern` nodes. */ - final class ConstructorPattern extends @unified_constructor_pattern, AstNodeImpl { + class ConstructorPattern extends @unified_constructor_pattern, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ConstructorPattern" } @@ -510,7 +506,7 @@ module Unified { } /** A class representing `continue_expr` nodes. */ - final class ContinueExpr extends @unified_continue_expr, AstNodeImpl { + class ContinueExpr extends @unified_continue_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ContinueExpr" } @@ -522,7 +518,7 @@ module Unified { } /** A class representing `destructor_declaration` nodes. */ - final class DestructorDeclaration extends @unified_destructor_declaration, AstNodeImpl { + class DestructorDeclaration extends @unified_destructor_declaration, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "DestructorDeclaration" } @@ -542,7 +538,7 @@ module Unified { } /** A class representing `do_while_stmt` nodes. */ - final class DoWhileStmt extends @unified_do_while_stmt, AstNodeImpl { + class DoWhileStmt extends @unified_do_while_stmt, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "DoWhileStmt" } @@ -564,13 +560,13 @@ module Unified { } /** A class representing `empty_expr` tokens. */ - final class EmptyExpr extends @unified_token_empty_expr, TokenImpl { + class EmptyExpr extends @unified_token_empty_expr, 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "EqualityTypeConstraint" } @@ -587,10 +583,10 @@ module Unified { } } - final class Expr extends @unified_expr, AstNodeImpl { } + class Expr extends @unified_expr, AstNode { } /** A class representing `expr_equality_pattern` nodes. */ - final class ExprEqualityPattern extends @unified_expr_equality_pattern, AstNodeImpl { + class ExprEqualityPattern extends @unified_expr_equality_pattern, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ExprEqualityPattern" } @@ -601,26 +597,26 @@ module Unified { 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, AstNode { } - final class ExprOrPattern extends @unified_expr_or_pattern, AstNodeImpl { } + class ExprOrPattern extends @unified_expr_or_pattern, AstNode { } - final class ExprOrType extends @unified_expr_or_type, AstNodeImpl { } + class ExprOrType extends @unified_expr_or_type, AstNode { } /** A class representing `fixity` tokens. */ - final class Fixity extends @unified_token_fixity, TokenImpl { + class Fixity extends @unified_token_fixity, 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, 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ForEachStmt" } @@ -650,7 +646,7 @@ module Unified { } /** A class representing `function_declaration` nodes. */ - final class FunctionDeclaration extends @unified_function_declaration, AstNodeImpl { + class FunctionDeclaration extends @unified_function_declaration, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "FunctionDeclaration" } @@ -694,7 +690,7 @@ module Unified { } /** A class representing `function_expr` nodes. */ - final class FunctionExpr extends @unified_function_expr, AstNodeImpl { + class FunctionExpr extends @unified_function_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "FunctionExpr" } @@ -726,7 +722,7 @@ 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "FunctionTypeExpr" } @@ -744,7 +740,7 @@ module Unified { } /** A class representing `generic_type_expr` nodes. */ - final class GenericTypeExpr extends @unified_generic_type_expr, AstNodeImpl { + class GenericTypeExpr extends @unified_generic_type_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "GenericTypeExpr" } @@ -764,7 +760,7 @@ module Unified { } /** A class representing `guard_if_stmt` nodes. */ - final class GuardIfStmt extends @unified_guard_if_stmt, AstNodeImpl { + class GuardIfStmt extends @unified_guard_if_stmt, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "GuardIfStmt" } @@ -781,13 +777,13 @@ module Unified { } /** A class representing `identifier` tokens. */ - final class Identifier extends @unified_token_identifier, TokenImpl { + class Identifier extends @unified_token_identifier, 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "IfExpr" } @@ -809,13 +805,13 @@ module Unified { } /** A class representing `ignore_pattern` tokens. */ - final class IgnorePattern extends @unified_token_ignore_pattern, TokenImpl { + class IgnorePattern extends @unified_token_ignore_pattern, 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ImportDeclaration" } @@ -837,19 +833,19 @@ 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, Token { /** 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, 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "InitializerDeclaration" } @@ -869,13 +865,13 @@ module Unified { } /** A class representing `int_literal` tokens. */ - final class IntLiteral extends @unified_token_int_literal, TokenImpl { + class IntLiteral extends @unified_token_int_literal, 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "KeyValuePair" } @@ -892,7 +888,7 @@ module Unified { } /** A class representing `labeled_stmt` nodes. */ - final class LabeledStmt extends @unified_labeled_stmt, AstNodeImpl { + class LabeledStmt extends @unified_labeled_stmt, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "LabeledStmt" } @@ -909,7 +905,7 @@ module Unified { } /** A class representing `map_literal` nodes. */ - final class MapLiteral extends @unified_map_literal, AstNodeImpl { + class MapLiteral extends @unified_map_literal, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "MapLiteral" } @@ -920,10 +916,10 @@ module Unified { final override F::AstNode getAFieldOrChild() { unified_map_literal_element(this, _, result) } } - final class Member extends @unified_member, AstNodeImpl { } + class Member extends @unified_member, AstNode { } /** A class representing `member_access_expr` nodes. */ - final class MemberAccessExpr extends @unified_member_access_expr, AstNodeImpl { + class MemberAccessExpr extends @unified_member_access_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "MemberAccessExpr" } @@ -941,13 +937,13 @@ module Unified { } /** A class representing `modifier` tokens. */ - final class Modifier extends @unified_token_modifier, TokenImpl { + class Modifier extends @unified_token_modifier, 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "NameExpr" } @@ -959,7 +955,7 @@ module Unified { } /** A class representing `name_pattern` nodes. */ - final class NamePattern extends @unified_name_pattern, AstNodeImpl { + class NamePattern extends @unified_name_pattern, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "NamePattern" } @@ -976,7 +972,7 @@ module Unified { } /** A class representing `named_type_expr` nodes. */ - final class NamedTypeExpr extends @unified_named_type_expr, AstNodeImpl { + class NamedTypeExpr extends @unified_named_type_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "NamedTypeExpr" } @@ -992,10 +988,10 @@ module Unified { } } - final class Operator extends @unified_operator, AstNodeImpl { } + class Operator extends @unified_operator, AstNode { } /** A class representing `operator_syntax_declaration` nodes. */ - final class OperatorSyntaxDeclaration extends @unified_operator_syntax_declaration, AstNodeImpl { + class OperatorSyntaxDeclaration extends @unified_operator_syntax_declaration, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "OperatorSyntaxDeclaration" } @@ -1023,7 +1019,7 @@ module Unified { } /** A class representing `or_pattern` nodes. */ - final class OrPattern extends @unified_or_pattern, AstNodeImpl { + class OrPattern extends @unified_or_pattern, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "OrPattern" } @@ -1040,7 +1036,7 @@ module Unified { } /** A class representing `parameter` nodes. */ - final class Parameter extends @unified_parameter, AstNodeImpl { + class Parameter extends @unified_parameter, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Parameter" } @@ -1069,10 +1065,10 @@ module Unified { } } - final class Pattern extends @unified_pattern, AstNodeImpl { } + class Pattern extends @unified_pattern, AstNode { } /** A class representing `pattern_element` nodes. */ - final class PatternElement extends @unified_pattern_element, AstNodeImpl { + class PatternElement extends @unified_pattern_element, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PatternElement" } @@ -1094,7 +1090,7 @@ 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PatternGuardExpr" } @@ -1112,25 +1108,25 @@ module Unified { } /** A class representing `postfix_operator` tokens. */ - final class PostfixOperator extends @unified_token_postfix_operator, TokenImpl { + class PostfixOperator extends @unified_token_postfix_operator, 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, 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, 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ReturnExpr" } @@ -1141,22 +1137,22 @@ module Unified { final override F::AstNode getAFieldOrChild() { unified_return_expr_value(this, result) } } - final class Stmt extends @unified_stmt, AstNodeImpl { } + class Stmt extends @unified_stmt, AstNode { } /** A class representing `string_literal` tokens. */ - final class StringLiteral extends @unified_token_string_literal, TokenImpl { + class StringLiteral extends @unified_token_string_literal, 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, 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SwitchCase" } @@ -1178,7 +1174,7 @@ module Unified { } /** A class representing `switch_expr` nodes. */ - final class SwitchExpr extends @unified_switch_expr, AstNodeImpl { + class SwitchExpr extends @unified_switch_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SwitchExpr" } @@ -1200,7 +1196,7 @@ module Unified { } /** A class representing `throw_expr` nodes. */ - final class ThrowExpr extends @unified_throw_expr, AstNodeImpl { + class ThrowExpr extends @unified_throw_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ThrowExpr" } @@ -1212,7 +1208,7 @@ module Unified { } /** A class representing `top_level` nodes. */ - final class TopLevel extends @unified_top_level, AstNodeImpl { + class TopLevel extends @unified_top_level, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TopLevel" } @@ -1224,7 +1220,7 @@ module Unified { } /** A class representing `try_expr` nodes. */ - final class TryExpr extends @unified_try_expr, AstNodeImpl { + class TryExpr extends @unified_try_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TryExpr" } @@ -1246,7 +1242,7 @@ module Unified { } /** A class representing `tuple_expr` nodes. */ - final class TupleExpr extends @unified_tuple_expr, AstNodeImpl { + class TupleExpr extends @unified_tuple_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TupleExpr" } @@ -1258,7 +1254,7 @@ module Unified { } /** A class representing `tuple_pattern` nodes. */ - final class TuplePattern extends @unified_tuple_pattern, AstNodeImpl { + class TuplePattern extends @unified_tuple_pattern, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TuplePattern" } @@ -1276,7 +1272,7 @@ module Unified { } /** A class representing `tuple_type_element` nodes. */ - final class TupleTypeElement extends @unified_tuple_type_element, AstNodeImpl { + class TupleTypeElement extends @unified_tuple_type_element, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TupleTypeElement" } @@ -1293,7 +1289,7 @@ module Unified { } /** A class representing `tuple_type_expr` nodes. */ - final class TupleTypeExpr extends @unified_tuple_type_expr, AstNodeImpl { + class TupleTypeExpr extends @unified_tuple_type_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TupleTypeExpr" } @@ -1307,7 +1303,7 @@ module Unified { } /** A class representing `type_alias_declaration` nodes. */ - final class TypeAliasDeclaration extends @unified_type_alias_declaration, AstNodeImpl { + class TypeAliasDeclaration extends @unified_type_alias_declaration, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeAliasDeclaration" } @@ -1343,7 +1339,7 @@ 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeCastExpr" } @@ -1364,12 +1360,12 @@ module Unified { } } - final class TypeConstraint extends @unified_type_constraint, AstNodeImpl { } + class TypeConstraint extends @unified_type_constraint, AstNode { } - final class TypeExpr extends @unified_type_expr, AstNodeImpl { } + class TypeExpr extends @unified_type_expr, AstNode { } /** A class representing `type_parameter` nodes. */ - final class TypeParameter extends @unified_type_parameter, AstNodeImpl { + class TypeParameter extends @unified_type_parameter, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeParameter" } @@ -1391,7 +1387,7 @@ 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeTestExpr" } @@ -1413,7 +1409,7 @@ 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeTestPattern" } @@ -1431,7 +1427,7 @@ module Unified { } /** A class representing `unary_expr` nodes. */ - final class UnaryExpr extends @unified_unary_expr, AstNodeImpl { + class UnaryExpr extends @unified_unary_expr, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "UnaryExpr" } @@ -1448,7 +1444,7 @@ module Unified { } /** A class representing `unresolved_operator_sequence` nodes. */ - final class UnresolvedOperatorSequence extends @unified_unresolved_operator_sequence, AstNodeImpl { + class UnresolvedOperatorSequence extends @unified_unresolved_operator_sequence, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "UnresolvedOperatorSequence" } @@ -1464,13 +1460,13 @@ module Unified { } /** A class representing `unsupported_node` tokens. */ - final class UnsupportedNode extends @unified_token_unsupported_node, TokenImpl { + class UnsupportedNode extends @unified_token_unsupported_node, Token { /** 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, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "VariableDeclaration" } @@ -1496,7 +1492,7 @@ module Unified { } /** A class representing `while_stmt` nodes. */ - final class WhileStmt extends @unified_while_stmt, AstNodeImpl { + class WhileStmt extends @unified_while_stmt, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "WhileStmt" } @@ -1849,3 +1845,194 @@ 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 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/unified.qll b/unified/ql/lib/unified.qll index ae22a2d76410..fad4b3ef9e67 100644 --- a/unified/ql/lib/unified.qll +++ b/unified/ql/lib/unified.qll @@ -4,6 +4,6 @@ import codeql.Locations import codeql.files.FileSystem -import codeql.unified.internal.FacadeAst::Unified +import codeql.unified.internal.Ast::UnifiedFinal import codeql.unified.internal.AstExtra::Public import codeql.unified.internal.Variables::Public From e3ef8e8d5fb3b854acc97c607eddfd4c21a18c76 Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 14:35:46 +0200 Subject: [PATCH 07/21] tree-sitter-extractor: List more precise base classes Previously each class just used 'AstNode' as its base class. Now it mentions each of the supertypes it is part of. --- .../src/generator/ql_gen.rs | 67 ++++++-- .../tree-sitter-extractor/src/node_types.rs | 2 +- .../ql/lib/codeql/unified/internal/Ast.qll | 148 +++++++++--------- 3 files changed, 129 insertions(+), 88 deletions(-) diff --git a/shared/tree-sitter-extractor/src/generator/ql_gen.rs b/shared/tree-sitter-extractor/src/generator/ql_gen.rs index e68d2b336c38..e389a960f35a 100644 --- a/shared/tree-sitter-extractor/src/generator/ql_gen.rs +++ b/shared/tree-sitter-extractor/src/generator/ql_gen.rs @@ -770,10 +770,51 @@ fn create_field_getters<'a>( ) } +fn compute_direct_supertypes<'a>( + nodes: &'a 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::Normal(name)) + .collect(), + _ => vec![ql::Type::Normal("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 { @@ -788,8 +829,8 @@ 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)); + let mut supertypes = + class_supertypes(type_name, &node.dbscheme_name, &direct_supertypes); supertypes.insert(ql::Type::Normal("Token")); classes.push(ql::TopLevel::Class(ql::Class { qldoc: Some(format!("A class representing `{}` tokens.", type_name.kind)), @@ -814,12 +855,11 @@ pub fn convert_nodes(nodes: &node_types::NodeTypeMap) -> Vec> { is_final: false, is_private: false, alias: None, - supertypes: vec![ - ql::Type::At(&node.dbscheme_name), - ql::Type::Normal("AstNode"), - ] - .into_iter() - .collect(), + supertypes: class_supertypes( + type_name, + &node.dbscheme_name, + &direct_supertypes, + ), characteristic_predicate: None, predicates: vec![], })); @@ -848,12 +888,11 @@ pub fn convert_nodes(nodes: &node_types::NodeTypeMap) -> Vec> { is_final: false, is_private: false, alias: None, - supertypes: vec![ - ql::Type::At(&node.dbscheme_name), - ql::Type::Normal("AstNode"), - ] - .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)], }; diff --git a/shared/tree-sitter-extractor/src/node_types.rs b/shared/tree-sitter-extractor/src/node_types.rs index 7a457fa73f0d..b56515b06456 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, diff --git a/unified/ql/lib/codeql/unified/internal/Ast.qll b/unified/ql/lib/codeql/unified/internal/Ast.qll index a165be1af82e..3187c46f9e2a 100644 --- a/unified/ql/lib/codeql/unified/internal/Ast.qll +++ b/unified/ql/lib/codeql/unified/internal/Ast.qll @@ -96,7 +96,7 @@ module Unified { } /** A class representing `accessor_declaration` nodes. */ - class AccessorDeclaration extends @unified_accessor_declaration, AstNode { + class AccessorDeclaration extends @unified_accessor_declaration, Member, Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AccessorDeclaration" } @@ -132,7 +132,7 @@ module Unified { } /** A class representing `accessor_kind` tokens. */ - class AccessorKind extends @unified_token_accessor_kind, Token { + class AccessorKind extends @unified_token_accessor_kind, AstNode, Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AccessorKind" } } @@ -160,7 +160,7 @@ module Unified { } /** A class representing `array_literal` nodes. */ - class ArrayLiteral extends @unified_array_literal, AstNode { + class ArrayLiteral extends @unified_array_literal, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ArrayLiteral" } @@ -172,7 +172,7 @@ module Unified { } /** A class representing `assign_expr` nodes. */ - class AssignExpr extends @unified_assign_expr, AstNode { + class AssignExpr extends @unified_assign_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AssignExpr" } @@ -189,7 +189,7 @@ module Unified { } /** A class representing `associated_type_declaration` nodes. */ - class AssociatedTypeDeclaration extends @unified_associated_type_declaration, AstNode { + class AssociatedTypeDeclaration extends @unified_associated_type_declaration, Member { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AssociatedTypeDeclaration" } @@ -230,7 +230,7 @@ module Unified { } /** A class representing `binary_expr` nodes. */ - class BinaryExpr extends @unified_binary_expr, AstNode { + class BinaryExpr extends @unified_binary_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BinaryExpr" } @@ -252,7 +252,7 @@ module Unified { } /** A class representing `block` nodes. */ - class Block extends @unified_block, AstNode { + class Block extends @unified_block, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Block" } @@ -264,13 +264,13 @@ module Unified { } /** A class representing `boolean_literal` tokens. */ - class BooleanLiteral extends @unified_token_boolean_literal, Token { + class BooleanLiteral extends @unified_token_boolean_literal, Expr, 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. */ - class BoundTypeConstraint extends @unified_bound_type_constraint, AstNode { + class BoundTypeConstraint extends @unified_bound_type_constraint, TypeConstraint { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BoundTypeConstraint" } @@ -288,7 +288,7 @@ module Unified { } /** A class representing `break_expr` nodes. */ - class BreakExpr extends @unified_break_expr, AstNode { + class BreakExpr extends @unified_break_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BreakExpr" } @@ -300,13 +300,13 @@ module Unified { } /** A class representing `builtin_expr` tokens. */ - class BuiltinExpr extends @unified_token_builtin_expr, Token { + class BuiltinExpr extends @unified_token_builtin_expr, Expr, 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. */ - class BulkImportingPattern extends @unified_bulk_importing_pattern, AstNode { + class BulkImportingPattern extends @unified_bulk_importing_pattern, Pattern { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "BulkImportingPattern" } @@ -322,7 +322,7 @@ module Unified { } /** A class representing `call_expr` nodes. */ - class CallExpr extends @unified_call_expr, AstNode { + class CallExpr extends @unified_call_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CallExpr" } @@ -366,7 +366,7 @@ module Unified { } /** A class representing `class_like_declaration` nodes. */ - class ClassLikeDeclaration extends @unified_class_like_declaration, AstNode { + class ClassLikeDeclaration extends @unified_class_like_declaration, Member, Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ClassLikeDeclaration" } @@ -408,7 +408,7 @@ module Unified { } /** A class representing `compound_assign_expr` nodes. */ - class CompoundAssignExpr extends @unified_compound_assign_expr, AstNode { + class CompoundAssignExpr extends @unified_compound_assign_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CompoundAssignExpr" } @@ -452,7 +452,7 @@ module Unified { } /** A class representing `constructor_declaration` nodes. */ - class ConstructorDeclaration extends @unified_constructor_declaration, AstNode { + class ConstructorDeclaration extends @unified_constructor_declaration, Member, Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ConstructorDeclaration" } @@ -482,7 +482,7 @@ module Unified { } /** A class representing `constructor_pattern` nodes. */ - class ConstructorPattern extends @unified_constructor_pattern, AstNode { + class ConstructorPattern extends @unified_constructor_pattern, Pattern { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ConstructorPattern" } @@ -506,7 +506,7 @@ module Unified { } /** A class representing `continue_expr` nodes. */ - class ContinueExpr extends @unified_continue_expr, AstNode { + class ContinueExpr extends @unified_continue_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ContinueExpr" } @@ -518,7 +518,7 @@ module Unified { } /** A class representing `destructor_declaration` nodes. */ - class DestructorDeclaration extends @unified_destructor_declaration, AstNode { + class DestructorDeclaration extends @unified_destructor_declaration, Member, Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "DestructorDeclaration" } @@ -538,7 +538,7 @@ module Unified { } /** A class representing `do_while_stmt` nodes. */ - class DoWhileStmt extends @unified_do_while_stmt, AstNode { + class DoWhileStmt extends @unified_do_while_stmt, Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "DoWhileStmt" } @@ -560,13 +560,13 @@ module Unified { } /** A class representing `empty_expr` tokens. */ - class EmptyExpr extends @unified_token_empty_expr, Token { + class EmptyExpr extends @unified_token_empty_expr, Expr, 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. */ - class EqualityTypeConstraint extends @unified_equality_type_constraint, AstNode { + class EqualityTypeConstraint extends @unified_equality_type_constraint, TypeConstraint { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "EqualityTypeConstraint" } @@ -583,10 +583,10 @@ module Unified { } } - class Expr extends @unified_expr, AstNode { } + class Expr extends @unified_expr, ExprOrOperator, ExprOrPattern, ExprOrType, Stmt { } /** A class representing `expr_equality_pattern` nodes. */ - class ExprEqualityPattern extends @unified_expr_equality_pattern, AstNode { + class ExprEqualityPattern extends @unified_expr_equality_pattern, Pattern { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ExprEqualityPattern" } @@ -604,19 +604,19 @@ module Unified { class ExprOrType extends @unified_expr_or_type, AstNode { } /** A class representing `fixity` tokens. */ - class Fixity extends @unified_token_fixity, Token { + class Fixity extends @unified_token_fixity, AstNode, Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Fixity" } } /** A class representing `float_literal` tokens. */ - class FloatLiteral extends @unified_token_float_literal, Token { + class FloatLiteral extends @unified_token_float_literal, Expr, 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. */ - class ForEachStmt extends @unified_for_each_stmt, AstNode { + class ForEachStmt extends @unified_for_each_stmt, Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ForEachStmt" } @@ -646,7 +646,7 @@ module Unified { } /** A class representing `function_declaration` nodes. */ - class FunctionDeclaration extends @unified_function_declaration, AstNode { + class FunctionDeclaration extends @unified_function_declaration, Member, Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "FunctionDeclaration" } @@ -690,7 +690,7 @@ module Unified { } /** A class representing `function_expr` nodes. */ - class FunctionExpr extends @unified_function_expr, AstNode { + class FunctionExpr extends @unified_function_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "FunctionExpr" } @@ -722,7 +722,7 @@ module Unified { } /** A class representing `function_type_expr` nodes. */ - class FunctionTypeExpr extends @unified_function_type_expr, AstNode { + class FunctionTypeExpr extends @unified_function_type_expr, TypeExpr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "FunctionTypeExpr" } @@ -740,7 +740,7 @@ module Unified { } /** A class representing `generic_type_expr` nodes. */ - class GenericTypeExpr extends @unified_generic_type_expr, AstNode { + class GenericTypeExpr extends @unified_generic_type_expr, TypeExpr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "GenericTypeExpr" } @@ -760,7 +760,7 @@ module Unified { } /** A class representing `guard_if_stmt` nodes. */ - class GuardIfStmt extends @unified_guard_if_stmt, AstNode { + class GuardIfStmt extends @unified_guard_if_stmt, Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "GuardIfStmt" } @@ -777,13 +777,13 @@ module Unified { } /** A class representing `identifier` tokens. */ - class Identifier extends @unified_token_identifier, Token { + class Identifier extends @unified_token_identifier, AstNode, Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Identifier" } } /** A class representing `if_expr` nodes. */ - class IfExpr extends @unified_if_expr, AstNode { + class IfExpr extends @unified_if_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "IfExpr" } @@ -805,13 +805,13 @@ module Unified { } /** A class representing `ignore_pattern` tokens. */ - class IgnorePattern extends @unified_token_ignore_pattern, Token { + class IgnorePattern extends @unified_token_ignore_pattern, Pattern, Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "IgnorePattern" } } /** A class representing `import_declaration` nodes. */ - class ImportDeclaration extends @unified_import_declaration, AstNode { + class ImportDeclaration extends @unified_import_declaration, Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ImportDeclaration" } @@ -833,19 +833,19 @@ module Unified { } /** A class representing `inferred_type_expr` tokens. */ - class InferredTypeExpr extends @unified_token_inferred_type_expr, Token { + class InferredTypeExpr extends @unified_token_inferred_type_expr, Token, TypeExpr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "InferredTypeExpr" } } /** A class representing `infix_operator` tokens. */ - class InfixOperator extends @unified_token_infix_operator, Token { + class InfixOperator extends @unified_token_infix_operator, ExprOrOperator, Operator, Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "InfixOperator" } } /** A class representing `initializer_declaration` nodes. */ - class InitializerDeclaration extends @unified_initializer_declaration, AstNode { + class InitializerDeclaration extends @unified_initializer_declaration, Member { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "InitializerDeclaration" } @@ -865,13 +865,13 @@ module Unified { } /** A class representing `int_literal` tokens. */ - class IntLiteral extends @unified_token_int_literal, Token { + class IntLiteral extends @unified_token_int_literal, Expr, 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. */ - class KeyValuePair extends @unified_key_value_pair, AstNode { + class KeyValuePair extends @unified_key_value_pair, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "KeyValuePair" } @@ -888,7 +888,7 @@ module Unified { } /** A class representing `labeled_stmt` nodes. */ - class LabeledStmt extends @unified_labeled_stmt, AstNode { + class LabeledStmt extends @unified_labeled_stmt, Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "LabeledStmt" } @@ -905,7 +905,7 @@ module Unified { } /** A class representing `map_literal` nodes. */ - class MapLiteral extends @unified_map_literal, AstNode { + class MapLiteral extends @unified_map_literal, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "MapLiteral" } @@ -919,7 +919,7 @@ module Unified { class Member extends @unified_member, AstNode { } /** A class representing `member_access_expr` nodes. */ - class MemberAccessExpr extends @unified_member_access_expr, AstNode { + class MemberAccessExpr extends @unified_member_access_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "MemberAccessExpr" } @@ -937,13 +937,13 @@ module Unified { } /** A class representing `modifier` tokens. */ - class Modifier extends @unified_token_modifier, Token { + class Modifier extends @unified_token_modifier, AstNode, Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Modifier" } } /** A class representing `name_expr` nodes. */ - class NameExpr extends @unified_name_expr, AstNode { + class NameExpr extends @unified_name_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "NameExpr" } @@ -955,7 +955,7 @@ module Unified { } /** A class representing `name_pattern` nodes. */ - class NamePattern extends @unified_name_pattern, AstNode { + class NamePattern extends @unified_name_pattern, Pattern { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "NamePattern" } @@ -972,7 +972,7 @@ module Unified { } /** A class representing `named_type_expr` nodes. */ - class NamedTypeExpr extends @unified_named_type_expr, AstNode { + class NamedTypeExpr extends @unified_named_type_expr, TypeExpr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "NamedTypeExpr" } @@ -991,7 +991,7 @@ module Unified { class Operator extends @unified_operator, AstNode { } /** A class representing `operator_syntax_declaration` nodes. */ - class OperatorSyntaxDeclaration extends @unified_operator_syntax_declaration, AstNode { + class OperatorSyntaxDeclaration extends @unified_operator_syntax_declaration, Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "OperatorSyntaxDeclaration" } @@ -1019,7 +1019,7 @@ module Unified { } /** A class representing `or_pattern` nodes. */ - class OrPattern extends @unified_or_pattern, AstNode { + class OrPattern extends @unified_or_pattern, Pattern { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "OrPattern" } @@ -1065,7 +1065,7 @@ module Unified { } } - class Pattern extends @unified_pattern, AstNode { } + class Pattern extends @unified_pattern, ExprOrPattern { } /** A class representing `pattern_element` nodes. */ class PatternElement extends @unified_pattern_element, AstNode { @@ -1090,7 +1090,7 @@ module Unified { } /** A class representing `pattern_guard_expr` nodes. */ - class PatternGuardExpr extends @unified_pattern_guard_expr, AstNode { + class PatternGuardExpr extends @unified_pattern_guard_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PatternGuardExpr" } @@ -1108,25 +1108,25 @@ module Unified { } /** A class representing `postfix_operator` tokens. */ - class PostfixOperator extends @unified_token_postfix_operator, Token { + class PostfixOperator extends @unified_token_postfix_operator, Operator, Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PostfixOperator" } } /** A class representing `prefix_operator` tokens. */ - class PrefixOperator extends @unified_token_prefix_operator, Token { + class PrefixOperator extends @unified_token_prefix_operator, Operator, Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "PrefixOperator" } } /** A class representing `regex_literal` tokens. */ - class RegexLiteral extends @unified_token_regex_literal, Token { + class RegexLiteral extends @unified_token_regex_literal, Expr, Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "RegexLiteral" } } /** A class representing `return_expr` nodes. */ - class ReturnExpr extends @unified_return_expr, AstNode { + class ReturnExpr extends @unified_return_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ReturnExpr" } @@ -1140,13 +1140,13 @@ module Unified { class Stmt extends @unified_stmt, AstNode { } /** A class representing `string_literal` tokens. */ - class StringLiteral extends @unified_token_string_literal, Token { + class StringLiteral extends @unified_token_string_literal, Expr, Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "StringLiteral" } } /** A class representing `super_expr` tokens. */ - class SuperExpr extends @unified_token_super_expr, Token { + class SuperExpr extends @unified_token_super_expr, Expr, Token { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SuperExpr" } } @@ -1174,7 +1174,7 @@ module Unified { } /** A class representing `switch_expr` nodes. */ - class SwitchExpr extends @unified_switch_expr, AstNode { + class SwitchExpr extends @unified_switch_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "SwitchExpr" } @@ -1196,7 +1196,7 @@ module Unified { } /** A class representing `throw_expr` nodes. */ - class ThrowExpr extends @unified_throw_expr, AstNode { + class ThrowExpr extends @unified_throw_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ThrowExpr" } @@ -1220,7 +1220,7 @@ module Unified { } /** A class representing `try_expr` nodes. */ - class TryExpr extends @unified_try_expr, AstNode { + class TryExpr extends @unified_try_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TryExpr" } @@ -1242,7 +1242,7 @@ module Unified { } /** A class representing `tuple_expr` nodes. */ - class TupleExpr extends @unified_tuple_expr, AstNode { + class TupleExpr extends @unified_tuple_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TupleExpr" } @@ -1254,7 +1254,7 @@ module Unified { } /** A class representing `tuple_pattern` nodes. */ - class TuplePattern extends @unified_tuple_pattern, AstNode { + class TuplePattern extends @unified_tuple_pattern, Pattern { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TuplePattern" } @@ -1289,7 +1289,7 @@ module Unified { } /** A class representing `tuple_type_expr` nodes. */ - class TupleTypeExpr extends @unified_tuple_type_expr, AstNode { + class TupleTypeExpr extends @unified_tuple_type_expr, TypeExpr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TupleTypeExpr" } @@ -1303,7 +1303,7 @@ module Unified { } /** A class representing `type_alias_declaration` nodes. */ - class TypeAliasDeclaration extends @unified_type_alias_declaration, AstNode { + class TypeAliasDeclaration extends @unified_type_alias_declaration, Member, Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeAliasDeclaration" } @@ -1339,7 +1339,7 @@ module Unified { } /** A class representing `type_cast_expr` nodes. */ - class TypeCastExpr extends @unified_type_cast_expr, AstNode { + class TypeCastExpr extends @unified_type_cast_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeCastExpr" } @@ -1362,7 +1362,7 @@ module Unified { class TypeConstraint extends @unified_type_constraint, AstNode { } - class TypeExpr extends @unified_type_expr, AstNode { } + class TypeExpr extends @unified_type_expr, ExprOrType { } /** A class representing `type_parameter` nodes. */ class TypeParameter extends @unified_type_parameter, AstNode { @@ -1387,7 +1387,7 @@ module Unified { } /** A class representing `type_test_expr` nodes. */ - class TypeTestExpr extends @unified_type_test_expr, AstNode { + class TypeTestExpr extends @unified_type_test_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeTestExpr" } @@ -1427,7 +1427,7 @@ module Unified { } /** A class representing `unary_expr` nodes. */ - class UnaryExpr extends @unified_unary_expr, AstNode { + class UnaryExpr extends @unified_unary_expr, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "UnaryExpr" } @@ -1444,7 +1444,7 @@ module Unified { } /** A class representing `unresolved_operator_sequence` nodes. */ - class UnresolvedOperatorSequence extends @unified_unresolved_operator_sequence, AstNode { + class UnresolvedOperatorSequence extends @unified_unresolved_operator_sequence, Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "UnresolvedOperatorSequence" } @@ -1460,13 +1460,15 @@ module Unified { } /** A class representing `unsupported_node` tokens. */ - class UnsupportedNode extends @unified_token_unsupported_node, Token { + class UnsupportedNode extends @unified_token_unsupported_node, Expr, Member, Pattern, Token, + TypeExpr + { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "UnsupportedNode" } } /** A class representing `variable_declaration` nodes. */ - class VariableDeclaration extends @unified_variable_declaration, AstNode { + class VariableDeclaration extends @unified_variable_declaration, Member, Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "VariableDeclaration" } @@ -1492,7 +1494,7 @@ module Unified { } /** A class representing `while_stmt` nodes. */ - class WhileStmt extends @unified_while_stmt, AstNode { + class WhileStmt extends @unified_while_stmt, Stmt { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "WhileStmt" } From 628d1b4a2479a8f4945ad0da13dc85561b296446 Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 14:39:37 +0200 Subject: [PATCH 08/21] unified: Refer to facade in more cases Now that final classes are factored out, base classes can refer to the facade now. Also covers a few other missed cases. --- .../src/generator/ql_gen.rs | 16 +- .../ql/lib/codeql/unified/internal/Ast.qll | 190 +++++++++--------- 2 files changed, 104 insertions(+), 102 deletions(-) diff --git a/shared/tree-sitter-extractor/src/generator/ql_gen.rs b/shared/tree-sitter-extractor/src/generator/ql_gen.rs index e389a960f35a..e08debb2b079 100644 --- a/shared/tree-sitter-extractor/src/generator/ql_gen.rs +++ b/shared/tree-sitter-extractor/src/generator/ql_gen.rs @@ -193,7 +193,7 @@ pub fn create_token_class<'a>(token_type: &'a str, tokeninfo: &'a str) -> ql::Cl is_final: false, is_private: false, alias: None, - supertypes: vec![ql::Type::At(token_type), ql::Type::Normal("AstNode")] + supertypes: vec![ql::Type::At(token_type), ql::Type::Facade("AstNode")] .into_iter() .collect(), characteristic_predicate: None, @@ -262,7 +262,7 @@ pub fn create_trivia_token_class<'a>( alias: None, supertypes: vec![ ql::Type::At(trivia_token_type), - ql::Type::Normal("AstNode"), + ql::Type::Facade("AstNode"), ] .into_iter() .collect(), @@ -286,7 +286,7 @@ pub fn create_reserved_word_class(db_name: &str) -> ql::Class<'_> { is_final: false, is_private: false, alias: None, - supertypes: vec![ql::Type::At(db_name), ql::Type::Normal("Token")] + supertypes: vec![ql::Type::At(db_name), ql::Type::Facade("Token")] .into_iter() .collect(), characteristic_predicate: None, @@ -794,9 +794,9 @@ fn ast_base_types<'a>( match direct_supertypes.get(type_name) { Some(supertypes) if !supertypes.is_empty() => supertypes .iter() - .map(|name| ql::Type::Normal(name)) + .map(|name| ql::Type::Facade(name)) .collect(), - _ => vec![ql::Type::Normal("AstNode")].into_iter().collect(), + _ => vec![ql::Type::Facade("AstNode")].into_iter().collect(), } } @@ -831,7 +831,7 @@ pub fn convert_nodes(nodes: &node_types::NodeTypeMap) -> Vec> { create_get_a_primary_ql_class(&node.ql_class_name, true); let mut supertypes = class_supertypes(type_name, &node.dbscheme_name, &direct_supertypes); - supertypes.insert(ql::Type::Normal("Token")); + 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, @@ -1005,11 +1005,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/unified/ql/lib/codeql/unified/internal/Ast.qll b/unified/ql/lib/codeql/unified/internal/Ast.qll index 3187c46f9e2a..8e231bee79f4 100644 --- a/unified/ql/lib/codeql/unified/internal/Ast.qll +++ b/unified/ql/lib/codeql/unified/internal/Ast.qll @@ -52,7 +52,7 @@ module Unified { } /** A token. */ - class Token extends @unified_token, AstNode { + class Token extends @unified_token, F::AstNode { /** Gets the value of this token. */ final string getValue() { unified_tokeninfo(this, _, result) } @@ -64,7 +64,7 @@ module Unified { } /** A trivia token, such as a comment, preserved from the original parse tree. */ - class TriviaToken extends @unified_trivia_token, AstNode { + class TriviaToken extends @unified_trivia_token, F::AstNode { /** Gets the source text of this trivia token. */ final string getValue() { unified_trivia_tokeninfo(this, _, result) } @@ -96,7 +96,7 @@ module Unified { } /** A class representing `accessor_declaration` nodes. */ - class AccessorDeclaration extends @unified_accessor_declaration, Member, Stmt { + 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" } @@ -132,13 +132,13 @@ module Unified { } /** A class representing `accessor_kind` tokens. */ - class AccessorKind extends @unified_token_accessor_kind, AstNode, Token { + 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. */ - class Argument extends @unified_argument, AstNode { + class Argument extends @unified_argument, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Argument" } @@ -160,7 +160,7 @@ module Unified { } /** A class representing `array_literal` nodes. */ - class ArrayLiteral extends @unified_array_literal, Expr { + 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" } @@ -172,7 +172,7 @@ module Unified { } /** A class representing `assign_expr` nodes. */ - class AssignExpr extends @unified_assign_expr, Expr { + 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" } @@ -189,7 +189,7 @@ module Unified { } /** A class representing `associated_type_declaration` nodes. */ - class AssociatedTypeDeclaration extends @unified_associated_type_declaration, Member { + 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" } @@ -213,7 +213,7 @@ module Unified { } /** A class representing `base_type` nodes. */ - class BaseType extends @unified_base_type, AstNode { + 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" } @@ -230,7 +230,7 @@ module Unified { } /** A class representing `binary_expr` nodes. */ - class BinaryExpr extends @unified_binary_expr, Expr { + 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" } @@ -252,7 +252,7 @@ module Unified { } /** A class representing `block` nodes. */ - class Block extends @unified_block, Expr { + class Block extends @unified_block, F::Expr { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Block" } @@ -264,13 +264,13 @@ module Unified { } /** A class representing `boolean_literal` tokens. */ - class BooleanLiteral extends @unified_token_boolean_literal, Expr, Token { + 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. */ - class BoundTypeConstraint extends @unified_bound_type_constraint, TypeConstraint { + 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" } @@ -288,7 +288,7 @@ module Unified { } /** A class representing `break_expr` nodes. */ - class BreakExpr extends @unified_break_expr, Expr { + 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" } @@ -300,13 +300,13 @@ module Unified { } /** A class representing `builtin_expr` tokens. */ - class BuiltinExpr extends @unified_token_builtin_expr, Expr, Token { + 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. */ - class BulkImportingPattern extends @unified_bulk_importing_pattern, Pattern { + 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" } @@ -322,7 +322,7 @@ module Unified { } /** A class representing `call_expr` nodes. */ - class CallExpr extends @unified_call_expr, Expr { + 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" } @@ -344,7 +344,7 @@ module Unified { } /** A class representing `catch_clause` nodes. */ - class CatchClause extends @unified_catch_clause, AstNode { + 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" } @@ -366,7 +366,7 @@ module Unified { } /** A class representing `class_like_declaration` nodes. */ - class ClassLikeDeclaration extends @unified_class_like_declaration, Member, Stmt { + 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" } @@ -408,7 +408,7 @@ module Unified { } /** A class representing `compound_assign_expr` nodes. */ - class CompoundAssignExpr extends @unified_compound_assign_expr, Expr { + 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" } @@ -452,7 +452,7 @@ module Unified { } /** A class representing `constructor_declaration` nodes. */ - class ConstructorDeclaration extends @unified_constructor_declaration, Member, Stmt { + 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" } @@ -482,7 +482,7 @@ module Unified { } /** A class representing `constructor_pattern` nodes. */ - class ConstructorPattern extends @unified_constructor_pattern, Pattern { + 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" } @@ -506,7 +506,7 @@ module Unified { } /** A class representing `continue_expr` nodes. */ - class ContinueExpr extends @unified_continue_expr, Expr { + 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" } @@ -518,7 +518,7 @@ module Unified { } /** A class representing `destructor_declaration` nodes. */ - class DestructorDeclaration extends @unified_destructor_declaration, Member, Stmt { + 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" } @@ -538,7 +538,7 @@ module Unified { } /** A class representing `do_while_stmt` nodes. */ - class DoWhileStmt extends @unified_do_while_stmt, Stmt { + 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" } @@ -560,13 +560,13 @@ module Unified { } /** A class representing `empty_expr` tokens. */ - class EmptyExpr extends @unified_token_empty_expr, Expr, Token { + 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. */ - class EqualityTypeConstraint extends @unified_equality_type_constraint, TypeConstraint { + 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" } @@ -583,10 +583,10 @@ module Unified { } } - class Expr extends @unified_expr, ExprOrOperator, ExprOrPattern, ExprOrType, Stmt { } + class Expr extends @unified_expr, F::ExprOrOperator, F::ExprOrPattern, F::ExprOrType, F::Stmt { } /** A class representing `expr_equality_pattern` nodes. */ - class ExprEqualityPattern extends @unified_expr_equality_pattern, Pattern { + 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" } @@ -597,26 +597,26 @@ module Unified { final override F::AstNode getAFieldOrChild() { unified_expr_equality_pattern_def(this, result) } } - class ExprOrOperator extends @unified_expr_or_operator, AstNode { } + class ExprOrOperator extends @unified_expr_or_operator, F::AstNode { } - class ExprOrPattern extends @unified_expr_or_pattern, AstNode { } + class ExprOrPattern extends @unified_expr_or_pattern, F::AstNode { } - class ExprOrType extends @unified_expr_or_type, AstNode { } + class ExprOrType extends @unified_expr_or_type, F::AstNode { } /** A class representing `fixity` tokens. */ - class Fixity extends @unified_token_fixity, AstNode, Token { + 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. */ - class FloatLiteral extends @unified_token_float_literal, Expr, Token { + 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. */ - class ForEachStmt extends @unified_for_each_stmt, Stmt { + 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" } @@ -646,7 +646,7 @@ module Unified { } /** A class representing `function_declaration` nodes. */ - class FunctionDeclaration extends @unified_function_declaration, Member, Stmt { + 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" } @@ -690,7 +690,7 @@ module Unified { } /** A class representing `function_expr` nodes. */ - class FunctionExpr extends @unified_function_expr, Expr { + 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" } @@ -722,7 +722,7 @@ module Unified { } /** A class representing `function_type_expr` nodes. */ - class FunctionTypeExpr extends @unified_function_type_expr, TypeExpr { + 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" } @@ -740,7 +740,7 @@ module Unified { } /** A class representing `generic_type_expr` nodes. */ - class GenericTypeExpr extends @unified_generic_type_expr, TypeExpr { + 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" } @@ -760,7 +760,7 @@ module Unified { } /** A class representing `guard_if_stmt` nodes. */ - class GuardIfStmt extends @unified_guard_if_stmt, Stmt { + 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" } @@ -777,13 +777,13 @@ module Unified { } /** A class representing `identifier` tokens. */ - class Identifier extends @unified_token_identifier, AstNode, Token { + 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. */ - class IfExpr extends @unified_if_expr, Expr { + 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" } @@ -805,13 +805,13 @@ module Unified { } /** A class representing `ignore_pattern` tokens. */ - class IgnorePattern extends @unified_token_ignore_pattern, Pattern, Token { + 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. */ - class ImportDeclaration extends @unified_import_declaration, Stmt { + 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" } @@ -833,19 +833,21 @@ module Unified { } /** A class representing `inferred_type_expr` tokens. */ - class InferredTypeExpr extends @unified_token_inferred_type_expr, Token, TypeExpr { + 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. */ - class InfixOperator extends @unified_token_infix_operator, ExprOrOperator, Operator, Token { + 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. */ - class InitializerDeclaration extends @unified_initializer_declaration, Member { + 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" } @@ -865,13 +867,13 @@ module Unified { } /** A class representing `int_literal` tokens. */ - class IntLiteral extends @unified_token_int_literal, Expr, Token { + 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. */ - class KeyValuePair extends @unified_key_value_pair, Expr { + 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" } @@ -888,7 +890,7 @@ module Unified { } /** A class representing `labeled_stmt` nodes. */ - class LabeledStmt extends @unified_labeled_stmt, Stmt { + 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" } @@ -905,7 +907,7 @@ module Unified { } /** A class representing `map_literal` nodes. */ - class MapLiteral extends @unified_map_literal, Expr { + 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" } @@ -916,10 +918,10 @@ module Unified { final override F::AstNode getAFieldOrChild() { unified_map_literal_element(this, _, result) } } - class Member extends @unified_member, AstNode { } + class Member extends @unified_member, F::AstNode { } /** A class representing `member_access_expr` nodes. */ - class MemberAccessExpr extends @unified_member_access_expr, Expr { + 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" } @@ -937,13 +939,13 @@ module Unified { } /** A class representing `modifier` tokens. */ - class Modifier extends @unified_token_modifier, AstNode, Token { + 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. */ - class NameExpr extends @unified_name_expr, Expr { + 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" } @@ -955,7 +957,7 @@ module Unified { } /** A class representing `name_pattern` nodes. */ - class NamePattern extends @unified_name_pattern, Pattern { + 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" } @@ -972,7 +974,7 @@ module Unified { } /** A class representing `named_type_expr` nodes. */ - class NamedTypeExpr extends @unified_named_type_expr, TypeExpr { + 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" } @@ -988,10 +990,10 @@ module Unified { } } - class Operator extends @unified_operator, AstNode { } + class Operator extends @unified_operator, F::AstNode { } /** A class representing `operator_syntax_declaration` nodes. */ - class OperatorSyntaxDeclaration extends @unified_operator_syntax_declaration, Stmt { + 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" } @@ -1019,7 +1021,7 @@ module Unified { } /** A class representing `or_pattern` nodes. */ - class OrPattern extends @unified_or_pattern, Pattern { + 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" } @@ -1036,7 +1038,7 @@ module Unified { } /** A class representing `parameter` nodes. */ - class Parameter extends @unified_parameter, AstNode { + class Parameter extends @unified_parameter, F::AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "Parameter" } @@ -1065,10 +1067,10 @@ module Unified { } } - class Pattern extends @unified_pattern, ExprOrPattern { } + class Pattern extends @unified_pattern, F::ExprOrPattern { } /** A class representing `pattern_element` nodes. */ - class PatternElement extends @unified_pattern_element, AstNode { + 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" } @@ -1090,7 +1092,7 @@ module Unified { } /** A class representing `pattern_guard_expr` nodes. */ - class PatternGuardExpr extends @unified_pattern_guard_expr, Expr { + 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" } @@ -1108,25 +1110,25 @@ module Unified { } /** A class representing `postfix_operator` tokens. */ - class PostfixOperator extends @unified_token_postfix_operator, Operator, Token { + 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. */ - class PrefixOperator extends @unified_token_prefix_operator, Operator, Token { + 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. */ - class RegexLiteral extends @unified_token_regex_literal, Expr, Token { + 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. */ - class ReturnExpr extends @unified_return_expr, Expr { + 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" } @@ -1137,22 +1139,22 @@ module Unified { final override F::AstNode getAFieldOrChild() { unified_return_expr_value(this, result) } } - class Stmt extends @unified_stmt, AstNode { } + class Stmt extends @unified_stmt, F::AstNode { } /** A class representing `string_literal` tokens. */ - class StringLiteral extends @unified_token_string_literal, Expr, Token { + 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. */ - class SuperExpr extends @unified_token_super_expr, Expr, Token { + 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. */ - class SwitchCase extends @unified_switch_case, AstNode { + 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" } @@ -1174,7 +1176,7 @@ module Unified { } /** A class representing `switch_expr` nodes. */ - class SwitchExpr extends @unified_switch_expr, Expr { + 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" } @@ -1196,7 +1198,7 @@ module Unified { } /** A class representing `throw_expr` nodes. */ - class ThrowExpr extends @unified_throw_expr, Expr { + 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" } @@ -1208,7 +1210,7 @@ module Unified { } /** A class representing `top_level` nodes. */ - class TopLevel extends @unified_top_level, AstNode { + 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" } @@ -1220,7 +1222,7 @@ module Unified { } /** A class representing `try_expr` nodes. */ - class TryExpr extends @unified_try_expr, Expr { + 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" } @@ -1242,7 +1244,7 @@ module Unified { } /** A class representing `tuple_expr` nodes. */ - class TupleExpr extends @unified_tuple_expr, Expr { + 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" } @@ -1254,7 +1256,7 @@ module Unified { } /** A class representing `tuple_pattern` nodes. */ - class TuplePattern extends @unified_tuple_pattern, Pattern { + 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" } @@ -1272,7 +1274,7 @@ module Unified { } /** A class representing `tuple_type_element` nodes. */ - class TupleTypeElement extends @unified_tuple_type_element, AstNode { + 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" } @@ -1289,7 +1291,7 @@ module Unified { } /** A class representing `tuple_type_expr` nodes. */ - class TupleTypeExpr extends @unified_tuple_type_expr, TypeExpr { + 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" } @@ -1303,7 +1305,7 @@ module Unified { } /** A class representing `type_alias_declaration` nodes. */ - class TypeAliasDeclaration extends @unified_type_alias_declaration, Member, Stmt { + 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" } @@ -1339,7 +1341,7 @@ module Unified { } /** A class representing `type_cast_expr` nodes. */ - class TypeCastExpr extends @unified_type_cast_expr, Expr { + 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" } @@ -1360,12 +1362,12 @@ module Unified { } } - class TypeConstraint extends @unified_type_constraint, AstNode { } + class TypeConstraint extends @unified_type_constraint, F::AstNode { } - class TypeExpr extends @unified_type_expr, ExprOrType { } + class TypeExpr extends @unified_type_expr, F::ExprOrType { } /** A class representing `type_parameter` nodes. */ - class TypeParameter extends @unified_type_parameter, AstNode { + 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" } @@ -1387,7 +1389,7 @@ module Unified { } /** A class representing `type_test_expr` nodes. */ - class TypeTestExpr extends @unified_type_test_expr, Expr { + 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" } @@ -1409,7 +1411,7 @@ module Unified { } /** A class representing `type_test_pattern` nodes. */ - class TypeTestPattern extends @unified_type_test_pattern, AstNode { + 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" } @@ -1427,7 +1429,7 @@ module Unified { } /** A class representing `unary_expr` nodes. */ - class UnaryExpr extends @unified_unary_expr, Expr { + 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" } @@ -1444,7 +1446,7 @@ module Unified { } /** A class representing `unresolved_operator_sequence` nodes. */ - class UnresolvedOperatorSequence extends @unified_unresolved_operator_sequence, Expr { + 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" } @@ -1460,15 +1462,15 @@ module Unified { } /** A class representing `unsupported_node` tokens. */ - class UnsupportedNode extends @unified_token_unsupported_node, Expr, Member, Pattern, Token, - TypeExpr + 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. */ - class VariableDeclaration extends @unified_variable_declaration, Member, Stmt { + 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" } @@ -1494,7 +1496,7 @@ module Unified { } /** A class representing `while_stmt` nodes. */ - class WhileStmt extends @unified_while_stmt, Stmt { + 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" } @@ -1518,7 +1520,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" From 0ab8c20c77f2e6ad486c27f221dc009449618e82 Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 14:35:21 +0200 Subject: [PATCH 09/21] unified: Fix a broken import in a test --- unified/ql/test/library-tests/BasicTest/test.ql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unified/ql/test/library-tests/BasicTest/test.ql b/unified/ql/test/library-tests/BasicTest/test.ql index ca422d039781..5e70f9303687 100644 --- a/unified/ql/test/library-tests/BasicTest/test.ql +++ b/unified/ql/test/library-tests/BasicTest/test.ql @@ -1,4 +1,4 @@ -import codeql.unified.Ast::Unified +import unified query predicate nameExpr(NameExpr node, string value) { value = node.getIdentifier().getValue() } From ea1ba4349d0f74cfa9eb6bd23ec9b087b0fc5119 Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 14:49:19 +0200 Subject: [PATCH 10/21] Regenerate QL and Ruby AST classes --- .../src/codeql_ql/ast/internal/TreeSitter.qll | 664 +++++++++++----- .../codeql/ruby/ast/internal/TreeSitter.qll | 718 +++++++++++++----- 2 files changed, 1031 insertions(+), 351 deletions(-) diff --git a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll index 7452f7b290b2..fd1494d06b5c 100644 --- a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll +++ b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll @@ -28,7 +28,7 @@ module QL { private import QL as F /** 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() } @@ -51,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) } @@ -65,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" } } @@ -94,7 +90,7 @@ 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" } @@ -116,19 +112,19 @@ 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" } @@ -140,7 +136,7 @@ module QL { } /** 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" } @@ -152,13 +148,13 @@ module QL { } /** 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" } @@ -175,7 +171,7 @@ module QL { } /** 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" } @@ -193,7 +189,7 @@ module QL { } /** 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" } @@ -205,7 +201,7 @@ module QL { } /** 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" } @@ -217,13 +213,13 @@ module QL { } /** 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" } @@ -235,7 +231,7 @@ module QL { } /** 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" } @@ -247,7 +243,7 @@ module QL { } /** 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" } @@ -259,7 +255,7 @@ module QL { } /** 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" } @@ -273,7 +269,7 @@ module QL { } /** 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" } @@ -290,7 +286,7 @@ module QL { } /** 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" } @@ -302,13 +298,13 @@ module QL { } /** 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" } @@ -330,13 +326,13 @@ 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" } @@ -358,13 +354,13 @@ 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" } @@ -381,7 +377,7 @@ module QL { } /** 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" } @@ -407,7 +403,7 @@ 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" } @@ -424,7 +420,7 @@ module QL { } /** 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" } @@ -441,7 +437,7 @@ module QL { } /** 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" } @@ -453,19 +449,19 @@ module QL { } /** 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" } @@ -482,13 +478,13 @@ module QL { } /** 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" } @@ -505,7 +501,7 @@ module QL { } /** 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" } @@ -527,13 +523,13 @@ 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" } @@ -545,13 +541,13 @@ module QL { } /** 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" } @@ -577,7 +573,7 @@ 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" } @@ -594,7 +590,7 @@ module QL { } /** 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" } @@ -616,7 +612,7 @@ 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" } @@ -633,7 +629,7 @@ module QL { } /** 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" } @@ -645,7 +641,7 @@ module QL { } /** 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" } @@ -662,7 +658,7 @@ module QL { } /** 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" } @@ -679,7 +675,7 @@ module QL { } /** 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" } @@ -691,19 +687,19 @@ module QL { } /** 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" } @@ -715,13 +711,13 @@ module QL { } /** 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" } @@ -743,7 +739,7 @@ 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" } @@ -769,7 +765,7 @@ 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" } @@ -781,7 +777,7 @@ module QL { } /** 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" } @@ -798,7 +794,7 @@ module QL { } /** 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" } @@ -815,7 +811,7 @@ module QL { } /** 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" } @@ -827,7 +823,7 @@ module QL { } /** 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" } @@ -839,7 +835,7 @@ module QL { } /** 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" } @@ -856,7 +852,7 @@ module QL { } /** 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" } @@ -878,13 +874,13 @@ 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" } @@ -896,7 +892,7 @@ module QL { } /** 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" } @@ -908,7 +904,7 @@ module QL { } /** 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" } @@ -920,7 +916,7 @@ module QL { } /** 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" } @@ -932,13 +928,13 @@ module QL { } /** 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" } @@ -950,7 +946,7 @@ module QL { } /** 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" } @@ -962,13 +958,13 @@ module QL { } /** 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" } @@ -980,13 +976,13 @@ module QL { } /** 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" } @@ -998,13 +994,13 @@ module QL { } /** 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" } @@ -1021,7 +1017,7 @@ module QL { } /** 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" } @@ -1033,7 +1029,7 @@ module QL { } /** 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" } @@ -1059,13 +1055,13 @@ 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" } @@ -1082,13 +1078,13 @@ module QL { } /** 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" } @@ -1100,7 +1096,7 @@ module QL { } /** 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" } @@ -1112,7 +1108,7 @@ module QL { } /** 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" } @@ -1134,19 +1130,19 @@ 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" } @@ -1158,19 +1154,19 @@ module QL { } /** 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" } @@ -1182,19 +1178,19 @@ module QL { } /** 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" } @@ -1206,7 +1202,7 @@ module QL { } /** 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" } @@ -1228,7 +1224,7 @@ 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" } @@ -1240,7 +1236,7 @@ module QL { } /** 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" } @@ -1252,19 +1248,19 @@ module QL { } /** 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" } @@ -1286,7 +1282,7 @@ 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" } @@ -1298,7 +1294,7 @@ module QL { } /** 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" } @@ -1310,7 +1306,7 @@ module QL { } /** 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" } @@ -1324,7 +1320,7 @@ module QL { /** 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" @@ -1560,12 +1556,217 @@ module QL { } } +module QLFinal { + private import QL as F + 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 import Dbscheme as F /** 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() } @@ -1588,10 +1789,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) } @@ -1602,10 +1801,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" } } @@ -1631,13 +1828,13 @@ 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" } @@ -1657,7 +1854,7 @@ module Dbscheme { } /** 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" } @@ -1674,19 +1871,19 @@ module Dbscheme { } /** 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" } @@ -1703,7 +1900,7 @@ module Dbscheme { } /** 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" } @@ -1725,7 +1922,7 @@ 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" } @@ -1737,7 +1934,7 @@ module Dbscheme { } /** 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" } @@ -1771,13 +1968,13 @@ 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" } @@ -1789,13 +1986,13 @@ module Dbscheme { } /** 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" } @@ -1807,43 +2004,43 @@ module Dbscheme { } /** 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" } @@ -1855,19 +2052,19 @@ module Dbscheme { } /** 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" } @@ -1884,7 +2081,7 @@ module Dbscheme { } /** 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" } @@ -1896,7 +2093,7 @@ module Dbscheme { } /** 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" } @@ -1913,13 +2110,13 @@ module Dbscheme { } /** 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" } } @@ -1927,7 +2124,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" @@ -1979,12 +2176,77 @@ module Dbscheme { } } +module DbschemeFinal { + private import Dbscheme as F + 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 import Blame as F /** 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() } @@ -2007,10 +2269,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) } @@ -2021,10 +2281,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" } } @@ -2050,7 +2308,7 @@ 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" } @@ -2067,7 +2325,7 @@ module Blame { } /** 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" } @@ -2084,13 +2342,13 @@ module Blame { } /** 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" } @@ -2107,13 +2365,13 @@ module Blame { } /** 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" } } @@ -2121,7 +2379,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" @@ -2137,12 +2395,35 @@ module Blame { } } +module BlameFinal { + private import Blame as F + 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 import JSON as F /** 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() } @@ -2165,10 +2446,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) } @@ -2179,10 +2458,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" } } @@ -2207,10 +2484,10 @@ 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" } @@ -2222,13 +2499,13 @@ module JSON { } /** 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" } @@ -2240,31 +2517,31 @@ module JSON { } /** 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" } @@ -2276,7 +2553,7 @@ module JSON { } /** 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" } @@ -2293,7 +2570,7 @@ module JSON { } /** 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" } @@ -2305,13 +2582,13 @@ module JSON { } /** 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" } } @@ -2319,7 +2596,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" @@ -2334,3 +2611,40 @@ module JSON { } } } + +module JSONFinal { + private import JSON as F + 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/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll b/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll index db5360ef5d58..c4ca03fc96a1 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll @@ -28,7 +28,7 @@ module Ruby { private import Ruby as F /** 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() } @@ -51,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) } @@ -65,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" } } @@ -93,41 +89,49 @@ module Ruby { ) } - final class UnderscoreArg extends @ruby_underscore_arg, AstNodeImpl { } - - final class UnderscoreCallOperator extends @ruby_underscore_call_operator, AstNodeImpl { } + class UnderscoreArg extends @ruby_underscore_arg, F::UnderscoreExpression { } - final class UnderscoreExpression extends @ruby_underscore_expression, AstNodeImpl { } + class UnderscoreCallOperator extends @ruby_underscore_call_operator, F::AstNode { } - final class UnderscoreLhs extends @ruby_underscore_lhs, AstNodeImpl { } + class UnderscoreExpression extends @ruby_underscore_expression, F::UnderscoreStatement { } - final class UnderscoreMethodName extends @ruby_underscore_method_name, AstNodeImpl { } + class UnderscoreLhs extends @ruby_underscore_lhs, F::UnderscorePrimary { } - final class UnderscoreNonlocalVariable extends @ruby_underscore_nonlocal_variable, AstNodeImpl { } + class UnderscoreMethodName extends @ruby_underscore_method_name, F::AstNode { } - 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 { } + + class UnderscorePrimary extends @ruby_underscore_primary, F::UnderscoreArg { } - final class UnderscoreSimpleNumeric extends @ruby_underscore_simple_numeric, AstNodeImpl { } + class UnderscoreSimpleNumeric extends @ruby_underscore_simple_numeric, + F::UnderscorePatternPrimitive, F::UnderscorePrimary + { } - final class UnderscoreStatement extends @ruby_underscore_statement, AstNodeImpl { } + 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" } @@ -144,7 +148,7 @@ module Ruby { } /** 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" } @@ -160,7 +164,7 @@ module Ruby { } /** 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" } @@ -172,7 +176,7 @@ module Ruby { } /** 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" } @@ -184,7 +188,9 @@ module Ruby { } /** 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" } @@ -201,7 +207,7 @@ module Ruby { } /** 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" } @@ -218,7 +224,7 @@ module Ruby { } /** 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" } @@ -235,7 +241,7 @@ module Ruby { } /** 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" } @@ -247,7 +253,7 @@ module Ruby { } /** 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" } @@ -259,7 +265,7 @@ module Ruby { } /** 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" } @@ -271,7 +277,7 @@ module Ruby { } /** 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" } @@ -283,7 +289,7 @@ module Ruby { } /** 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" } @@ -355,7 +361,7 @@ module Ruby { } /** 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" } @@ -372,7 +378,7 @@ module Ruby { } /** 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" } @@ -384,7 +390,7 @@ module Ruby { } /** 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" } @@ -396,7 +402,7 @@ module Ruby { } /** 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" } @@ -408,7 +414,7 @@ module Ruby { } /** 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" } @@ -425,7 +431,7 @@ module Ruby { } /** 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" } @@ -437,7 +443,7 @@ module Ruby { } /** 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" } @@ -449,7 +455,7 @@ module Ruby { } /** 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" } @@ -479,7 +485,7 @@ 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" } @@ -496,7 +502,7 @@ module Ruby { } /** 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" } @@ -518,7 +524,7 @@ 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" } @@ -530,13 +536,13 @@ module Ruby { } /** 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" } @@ -558,19 +564,19 @@ 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" } @@ -582,7 +588,7 @@ module Ruby { } /** 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" } @@ -604,13 +610,17 @@ 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" } @@ -622,7 +632,7 @@ module Ruby { } /** 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" } @@ -636,7 +646,7 @@ module Ruby { } /** 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" } @@ -650,7 +660,7 @@ module Ruby { } /** 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" } @@ -662,7 +672,7 @@ module Ruby { } /** 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" } @@ -679,7 +689,7 @@ module Ruby { } /** 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" } @@ -701,7 +711,7 @@ 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" } @@ -713,7 +723,7 @@ module Ruby { } /** 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" } @@ -735,19 +745,19 @@ 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" } @@ -759,7 +769,7 @@ module Ruby { } /** 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" } @@ -771,13 +781,13 @@ module Ruby { } /** 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" } @@ -789,7 +799,7 @@ module Ruby { } /** 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" } @@ -801,7 +811,9 @@ module Ruby { } /** 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" } @@ -815,19 +827,21 @@ module Ruby { } /** 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" } @@ -844,13 +858,13 @@ module Ruby { } /** 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" } @@ -872,25 +886,25 @@ 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" } @@ -902,13 +916,15 @@ module Ruby { } /** 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" } @@ -925,7 +941,7 @@ module Ruby { } /** 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" } @@ -937,13 +953,13 @@ module Ruby { } /** 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" } @@ -955,13 +971,15 @@ module Ruby { } /** 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" } @@ -973,25 +991,27 @@ module Ruby { } /** 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" } @@ -1013,7 +1033,7 @@ 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" } @@ -1025,7 +1045,7 @@ module Ruby { } /** 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" } @@ -1042,7 +1062,7 @@ module Ruby { } /** 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" } @@ -1054,7 +1074,7 @@ module Ruby { } /** 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" } @@ -1076,19 +1096,21 @@ 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" } @@ -1100,7 +1122,7 @@ module Ruby { } /** 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" } @@ -1117,7 +1139,7 @@ module Ruby { } /** 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" } @@ -1134,7 +1156,7 @@ module Ruby { } /** 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" } @@ -1151,7 +1173,7 @@ module Ruby { } /** 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" } @@ -1163,7 +1185,7 @@ module Ruby { } /** 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" } @@ -1177,13 +1199,13 @@ module Ruby { } /** 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" } @@ -1200,7 +1222,7 @@ module Ruby { } /** 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" } @@ -1222,7 +1244,7 @@ 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" } @@ -1234,7 +1256,7 @@ module Ruby { } /** 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" } @@ -1251,7 +1273,7 @@ module Ruby { } /** 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" } @@ -1263,19 +1285,21 @@ module Ruby { } /** 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" } @@ -1324,7 +1348,7 @@ module Ruby { } /** 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" } @@ -1341,7 +1365,7 @@ module Ruby { } /** 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" } @@ -1358,7 +1382,7 @@ module Ruby { } /** 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" } @@ -1370,7 +1394,7 @@ module Ruby { } /** 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" } @@ -1384,7 +1408,7 @@ module Ruby { } /** 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" } @@ -1396,7 +1420,7 @@ module Ruby { } /** 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" } @@ -1408,7 +1432,7 @@ module Ruby { } /** 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" } @@ -1434,7 +1458,7 @@ module Ruby { } /** 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" } @@ -1446,7 +1470,7 @@ module Ruby { } /** 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" } @@ -1458,7 +1482,7 @@ module Ruby { } /** 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" } @@ -1470,7 +1494,7 @@ module Ruby { } /** 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" } @@ -1492,7 +1516,7 @@ 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" } @@ -1509,7 +1533,7 @@ module Ruby { } /** 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" } @@ -1521,7 +1545,7 @@ module Ruby { } /** 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" } @@ -1533,7 +1557,7 @@ module Ruby { } /** 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" } @@ -1545,7 +1569,7 @@ module Ruby { } /** 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" } @@ -1559,7 +1583,9 @@ module Ruby { } /** 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" } @@ -1576,13 +1602,15 @@ module Ruby { } /** 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" } @@ -1594,13 +1622,15 @@ module Ruby { } /** 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" } @@ -1617,7 +1647,7 @@ module Ruby { } /** 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" } @@ -1643,7 +1673,7 @@ 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" } @@ -1655,7 +1685,7 @@ module Ruby { } /** 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" } @@ -1667,7 +1697,7 @@ module Ruby { } /** 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" } @@ -1679,7 +1709,7 @@ module Ruby { } /** 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" } @@ -1691,13 +1721,13 @@ module Ruby { } /** 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" } @@ -1709,13 +1739,13 @@ module Ruby { } /** 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" } @@ -1727,7 +1757,7 @@ module Ruby { } /** 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" } @@ -1739,7 +1769,7 @@ module Ruby { } /** 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" } @@ -1756,7 +1786,7 @@ module Ruby { } /** 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" } @@ -1768,13 +1798,15 @@ module Ruby { } /** 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" } @@ -1803,7 +1835,7 @@ module Ruby { } /** 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" } @@ -1815,13 +1847,13 @@ module Ruby { } /** 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" } @@ -1843,7 +1875,7 @@ 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" } @@ -1855,7 +1887,7 @@ module Ruby { } /** 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" } @@ -1872,7 +1904,7 @@ module Ruby { } /** 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" } @@ -1889,7 +1921,7 @@ module Ruby { } /** 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" } @@ -1906,7 +1938,9 @@ module Ruby { } /** 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" } @@ -1920,7 +1954,7 @@ module Ruby { } /** 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" } @@ -1937,7 +1971,7 @@ module Ruby { } /** 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" } @@ -1954,7 +1988,7 @@ module Ruby { } /** 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" } @@ -1971,7 +2005,7 @@ module Ruby { } /** 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" } @@ -1985,7 +2019,7 @@ module Ruby { /** 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" @@ -2317,12 +2351,321 @@ module Ruby { } } +module RubyFinal { + private import Ruby as F + 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 import Erb as F /** 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() } @@ -2345,10 +2688,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) } @@ -2359,10 +2700,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" } } @@ -2388,19 +2727,19 @@ 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" } @@ -2412,13 +2751,13 @@ module Erb { } /** 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" } @@ -2430,7 +2769,7 @@ module Erb { } /** 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" } @@ -2442,7 +2781,7 @@ module Erb { } /** 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" } @@ -2454,7 +2793,7 @@ module Erb { } /** 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" } @@ -2468,7 +2807,7 @@ module Erb { /** 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" @@ -2481,3 +2820,30 @@ module Erb { } } } + +module ErbFinal { + private import Erb as F + 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; +} From d28b149833c8978fb41dc6c81f65875cecc88fea Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 14:56:02 +0200 Subject: [PATCH 11/21] unified: Regenerate QL after rebasing --- unified/ql/lib/codeql/unified/internal/Ast.qll | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unified/ql/lib/codeql/unified/internal/Ast.qll b/unified/ql/lib/codeql/unified/internal/Ast.qll index 8e231bee79f4..532b5d3cf716 100644 --- a/unified/ql/lib/codeql/unified/internal/Ast.qll +++ b/unified/ql/lib/codeql/unified/internal/Ast.qll @@ -430,7 +430,7 @@ 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" } @@ -1896,6 +1896,8 @@ module UnifiedFinal { final class CompoundAssignExpr = F::CompoundAssignExpr; + final class ConditionalPattern = F::ConditionalPattern; + final class ConstructorDeclaration = F::ConstructorDeclaration; final class ConstructorPattern = F::ConstructorPattern; From 41bd51608200050eae5f880f6d15bdc47de32066 Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 15:08:48 +0200 Subject: [PATCH 12/21] unified: Use start-line for detecting variable aliases --- unified/ql/test/library-tests/variables/test.swift | 7 +++---- unified/ql/test/library-tests/variables/variables.ql | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unified/ql/test/library-tests/variables/test.swift b/unified/ql/test/library-tests/variables/test.swift index 35aac75d393f..20ae492b78bd 100644 --- a/unified/ql/test/library-tests/variables/test.swift +++ b/unified/ql/test/library-tests/variables/test.swift @@ -343,11 +343,10 @@ enum E38 { } // Switch with a multi-pattern case that binds 'x' in each pattern -// Note: the testing framework does not make it possible to name the 'x' variable in this case. func t38(value: E38) { switch value { // $ access=value - case .a(let x), // $ access=x - .b(let x): // $ access=x - print(x) // $ access=x + case .a(let x), // $ access=x1 // name=x1 + .b(let x): // $ access=x1 + print(x) // $ access=x1 } } diff --git a/unified/ql/test/library-tests/variables/variables.ql b/unified/ql/test/library-tests/variables/variables.ql index 146da296ae74..f26c082a40c2 100644 --- a/unified/ql/test/library-tests/variables/variables.ql +++ b/unified/ql/test/library-tests/variables/variables.ql @@ -25,6 +25,7 @@ module VariableAccessTest implements TestSig { private predicate declAt(Variable v, string filepath, int line) { v.getLocation().hasLocationInfo(filepath, _, _, line, _) + v.getLocation().hasLocationInfo(filepath, line, _, _, _) } private predicate decl(Variable v, string alias) { From 99889b2e4d5dcc41490bd3a382cc3d015b971990 Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 15:10:09 +0200 Subject: [PATCH 13/21] unified: Detect missing handling of ConditionalPattern ConditionalPattern was not added to getEnclosingOrPattern() Update the test to detect the bug --- unified/ql/test/library-tests/variables/test.swift | 4 ++++ .../test/library-tests/variables/variables.expected | 4 ++++ .../ql/test/library-tests/variables/variables.ql | 13 +++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/unified/ql/test/library-tests/variables/test.swift b/unified/ql/test/library-tests/variables/test.swift index 20ae492b78bd..e4280dc5b408 100644 --- a/unified/ql/test/library-tests/variables/test.swift +++ b/unified/ql/test/library-tests/variables/test.swift @@ -348,5 +348,9 @@ func t38(value: E38) { case .a(let x), // $ access=x1 // name=x1 .b(let x): // $ access=x1 print(x) // $ access=x1 + + case .a(let y) where y < 1, // $ access=y1 // name=y1 + .b(let y): // $ access=y1 + print(y) // $ access=y1 } } diff --git a/unified/ql/test/library-tests/variables/variables.expected b/unified/ql/test/library-tests/variables/variables.expected index e69de29bb2d1..a9c2d35f1237 100644 --- a/unified/ql/test/library-tests/variables/variables.expected +++ b/unified/ql/test/library-tests/variables/variables.expected @@ -0,0 +1,4 @@ +testFailures +ambiguousVariable +| test.swift:352:10:353:17 | y | y | test.swift | 352 | +| test.swift:352:17:352:17 | y | y | test.swift | 352 | diff --git a/unified/ql/test/library-tests/variables/variables.ql b/unified/ql/test/library-tests/variables/variables.ql index f26c082a40c2..cf653afebd9d 100644 --- a/unified/ql/test/library-tests/variables/variables.ql +++ b/unified/ql/test/library-tests/variables/variables.ql @@ -23,8 +23,7 @@ predicate keyValueCommentAt(string filepath, int line, string key, string value) module VariableAccessTest implements TestSig { string getARelevantTag() { result = "access" } - private predicate declAt(Variable v, string filepath, int line) { - v.getLocation().hasLocationInfo(filepath, _, _, line, _) + additional predicate declAt(Variable v, string filepath, int line) { v.getLocation().hasLocationInfo(filepath, line, _, _, _) } @@ -50,3 +49,13 @@ module VariableAccessTest implements TestSig { } import MakeTest + +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 +} From 90ca93cf90e83d2fe1e7e526ce5ad2135e28cfa3 Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 15:14:05 +0200 Subject: [PATCH 14/21] unified: Add Pattern.getEnclosingPattern() --- .../lib/codeql/unified/internal/FacadeAst.qll | 9 +++++++ .../lib/codeql/unified/internal/Variables.qll | 27 +++---------------- .../variables/variables.expected | 2 -- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/unified/ql/lib/codeql/unified/internal/FacadeAst.qll b/unified/ql/lib/codeql/unified/internal/FacadeAst.qll index 12cf0cea6420..d64bdeddc026 100644 --- a/unified/ql/lib/codeql/unified/internal/FacadeAst.qll +++ b/unified/ql/lib/codeql/unified/internal/FacadeAst.qll @@ -17,4 +17,13 @@ module Unified { ) } } + + 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 Date: Thu, 30 Jul 2026 15:24:26 +0200 Subject: [PATCH 15/21] shared: Fix clippy and rustfmt errors --- .../src/generator/ql_gen.rs | 15 +++++-------- shared/yeast-macros/src/parse.rs | 13 ++++++----- shared/yeast/src/dump.rs | 22 +++++++++---------- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/shared/tree-sitter-extractor/src/generator/ql_gen.rs b/shared/tree-sitter-extractor/src/generator/ql_gen.rs index e08debb2b079..fff899317373 100644 --- a/shared/tree-sitter-extractor/src/generator/ql_gen.rs +++ b/shared/tree-sitter-extractor/src/generator/ql_gen.rs @@ -260,12 +260,9 @@ pub fn create_trivia_token_class<'a>( is_final: false, is_private: false, alias: None, - supertypes: vec![ - ql::Type::At(trivia_token_type), - ql::Type::Facade("AstNode"), - ] - .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, @@ -770,9 +767,9 @@ fn create_field_getters<'a>( ) } -fn compute_direct_supertypes<'a>( - nodes: &'a node_types::NodeTypeMap, -) -> std::collections::BTreeMap> { +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 { 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..06ede1fa3438 100644 --- a/shared/yeast/src/dump.rs +++ b/shared/yeast/src/dump.rs @@ -2,6 +2,12 @@ use std::fmt::Write; use crate::{schema::Schema, Ast, Id, Node, NodeContent, CHILD_FIELD}; +type TypeCheckContext<'a> = ( + &'a Schema, + Option<&'a [crate::schema::NodeType]>, + Option<(&'a str, &'a str)>, +); + /// Options for controlling AST dump output. pub struct DumpOptions { /// Whether to include source locations in the output. @@ -179,11 +185,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) { @@ -268,8 +270,8 @@ fn dump_node( 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) - .or(Some(EMPTY_NODE_TYPES)); + let expected = + expected_for_field(schema, node.kind_name(), field_name).or(Some(EMPTY_NODE_TYPES)); let parent_field = Some((node.kind_name(), field_name)); (schema, expected, parent_field) }); @@ -359,11 +361,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) { From 051b4bde6cb4947300d0438b803deb32543531ca Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 15:29:13 +0200 Subject: [PATCH 16/21] tree-sitter-extractor: Use a module alias for 'F' when not using facades When not using a facade, the self-import could accidentally resolve to a file instead of the enclosing module. --- .../src/generator/mod.rs | 57 +++++++++++++------ .../tree-sitter-extractor/src/generator/ql.rs | 18 ++++++ 2 files changed, 58 insertions(+), 17 deletions(-) diff --git a/shared/tree-sitter-extractor/src/generator/mod.rs b/shared/tree-sitter-extractor/src/generator/mod.rs index 718c25cd2d84..cf445aaaac7f 100644 --- a/shared/tree-sitter-extractor/src/generator/mod.rs +++ b/shared/tree-sitter-extractor/src/generator/mod.rs @@ -129,11 +129,19 @@ pub fn generate( } else { language.name.clone() // If not using a facade AST, treat the module itself as the facade module. }; - body.push(ql::TopLevel::Import(ql::Import { - is_private: true, - module: &facade_import_name, - alias: Some("F"), - })); + 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, @@ -178,18 +186,33 @@ pub fn generate( body.append(&mut ql_gen::convert_nodes(&nodes)); body.push(ql_gen::create_print_ast_module(&nodes)); - let mut final_body = 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, - }), - ]; + 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 { diff --git a/shared/tree-sitter-extractor/src/generator/ql.rs b/shared/tree-sitter-extractor/src/generator/ql.rs index 5991cab4a6c1..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,12 +15,29 @@ 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, From c1c41c80f3bebdcc6bc6ea4ba374f0e7bee2634c Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 16:22:31 +0200 Subject: [PATCH 17/21] Regenerate QL again --- .../src/codeql_ql/ast/internal/TreeSitter.qll | 20 +++++++++++-------- .../codeql/ruby/ast/internal/TreeSitter.qll | 10 ++++++---- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll index fd1494d06b5c..d741bac2b221 100644 --- a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll +++ b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll @@ -25,7 +25,7 @@ private predicate discardLocation(@location_default loc) { overlay[local] module QL { - private import QL as F + private module F = QL; /** The base class for all AST nodes */ class AstNode extends @ql_ast_node { @@ -1557,7 +1557,8 @@ module QL { } module QLFinal { - private import QL as F + private module F = QL; + import F final class AstNode = F::AstNode; @@ -1763,7 +1764,7 @@ module QLFinal { overlay[local] module Dbscheme { - private import Dbscheme as F + private module F = Dbscheme; /** The base class for all AST nodes */ class AstNode extends @dbscheme_ast_node { @@ -2177,7 +2178,8 @@ module Dbscheme { } module DbschemeFinal { - private import Dbscheme as F + private module F = Dbscheme; + import F final class AstNode = F::AstNode; @@ -2243,7 +2245,7 @@ module DbschemeFinal { overlay[local] module Blame { - private import Blame as F + private module F = Blame; /** The base class for all AST nodes */ class AstNode extends @blame_ast_node { @@ -2396,7 +2398,8 @@ module Blame { } module BlameFinal { - private import Blame as F + private module F = Blame; + import F final class AstNode = F::AstNode; @@ -2420,7 +2423,7 @@ module BlameFinal { overlay[local] module JSON { - private import JSON as F + private module F = JSON; /** The base class for all AST nodes */ class AstNode extends @json_ast_node { @@ -2613,7 +2616,8 @@ module JSON { } module JSONFinal { - private import JSON as F + private module F = JSON; + import F final class AstNode = F::AstNode; diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll b/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll index c4ca03fc96a1..d4b21080b245 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll @@ -25,7 +25,7 @@ private predicate discardLocation(@location_default loc) { overlay[local] module Ruby { - private import Ruby as F + private module F = Ruby; /** The base class for all AST nodes */ class AstNode extends @ruby_ast_node { @@ -2352,7 +2352,8 @@ module Ruby { } module RubyFinal { - private import Ruby as F + private module F = Ruby; + import F final class AstNode = F::AstNode; @@ -2662,7 +2663,7 @@ module RubyFinal { overlay[local] module Erb { - private import Erb as F + private module F = Erb; /** The base class for all AST nodes */ class AstNode extends @erb_ast_node { @@ -2822,7 +2823,8 @@ module Erb { } module ErbFinal { - private import Erb as F + private module F = Erb; + import F final class AstNode = F::AstNode; From cfff4dbcea5f4b31b94a391c9eebc90b322d5f4e Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 16:33:37 +0200 Subject: [PATCH 18/21] tree-sitter-extractor: Generate plural getters --- .../src/generator/ql_gen.rs | 53 +++++++++++++------ .../tree-sitter-extractor/src/node_types.rs | 14 +++++ 2 files changed, 51 insertions(+), 16 deletions(-) diff --git a/shared/tree-sitter-extractor/src/generator/ql_gen.rs b/shared/tree-sitter-extractor/src/generator/ql_gen.rs index fff899317373..fe6f9a2a828b 100644 --- a/shared/tree-sitter-extractor/src/generator/ql_gen.rs +++ b/shared/tree-sitter-extractor/src/generator/ql_gen.rs @@ -606,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 /// @@ -627,7 +628,7 @@ 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::Facade(&nodes.get(t).unwrap().ql_class_name)) @@ -751,20 +752,40 @@ 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( @@ -902,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) } diff --git a/shared/tree-sitter-extractor/src/node_types.rs b/shared/tree-sitter-extractor/src/node_types.rs index b56515b06456..4c67c2e4f20e 100644 --- a/shared/tree-sitter-extractor/src/node_types.rs +++ b/shared/tree-sitter-extractor/src/node_types.rs @@ -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, }); } From b0055636dedef7cf23c5d12e5602f1879eae39ac Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 16:33:46 +0200 Subject: [PATCH 19/21] Regenerate ASTs --- .../src/codeql_ql/ast/internal/TreeSitter.qll | 162 ++++++++++++++++ .../codeql/ruby/ast/internal/TreeSitter.qll | 132 +++++++++++++ .../ql/lib/codeql/unified/internal/Ast.qll | 174 ++++++++++++++++++ 3 files changed, 468 insertions(+) diff --git a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll index d741bac2b221..51424106719d 100644 --- a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll +++ b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll @@ -131,6 +131,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_aggregate_child(this, _, result) } } @@ -161,6 +164,9 @@ module QL { /** Gets the node corresponding to the field `args`. */ 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 F::AnnotName getName() { ql_annotation_def(this, result) } @@ -196,6 +202,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_as_expr_child(this, _, result) } } @@ -208,6 +217,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_as_exprs_child(this, _, result) } } @@ -250,6 +262,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_call_body_child(this, _, result) } } @@ -262,6 +277,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_call_or_unqual_agg_expr_child(this, _, result) @@ -293,6 +311,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_class_member_child(this, _, result) } } @@ -317,6 +338,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_classless_predicate_def(this, result, _) or @@ -384,15 +408,24 @@ module QL { /** Gets the node corresponding to the field `extends`. */ 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 F::AstNode getAnInstanceof() { result = this.getInstanceof(_) } + /** Gets the node corresponding to the field `name`. */ final F::ClassName getName() { ql_dataclass_def(this, result) } /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_dataclass_extends(this, _, result) or @@ -430,6 +463,9 @@ module QL { /** 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 F::AstNode getAChild() { result = this.getChild(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { ql_datatype_branch_def(this, result) or ql_datatype_branch_child(this, _, result) @@ -444,6 +480,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_datatype_branches_child(this, _, result) } } @@ -563,6 +602,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_full_aggregate_body_as_exprs(this, result) or @@ -583,6 +625,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_higher_order_term_def(this, result) or ql_higher_order_term_child(this, _, result) @@ -636,6 +681,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_import_directive_child(this, _, result) } } @@ -648,6 +696,9 @@ module QL { /** Gets the node corresponding to the field `qualName`. */ 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 F::ModuleExpr getChild() { ql_import_module_expr_def(this, result) } @@ -682,6 +733,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_instance_of_child(this, _, result) } } @@ -730,6 +784,9 @@ module QL { /** 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 F::AstNode getAChild() { result = this.getChild(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { ql_member_predicate_def(this, result, _) or @@ -746,15 +803,24 @@ module QL { /** Gets the node corresponding to the field `implements`. */ 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 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 F::ModuleParam getAParameter() { result = this.getParameter(_) } + /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_module_implements(this, _, result) or @@ -804,6 +870,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_module_instantiation_def(this, result) or ql_module_instantiation_child(this, _, result) @@ -818,6 +887,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_module_member_child(this, _, result) } } @@ -899,6 +971,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_order_by_child(this, _, result) } } @@ -911,6 +986,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_order_bys_child(this, _, result) } } @@ -953,6 +1031,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_predicate_expr_child(this, _, result) } } @@ -971,6 +1052,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_prefix_cast_child(this, _, result) } } @@ -989,6 +1073,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_ql_child(this, _, result) } } @@ -1010,6 +1097,9 @@ module QL { /** 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 F::AstNode getAChild() { result = this.getChild(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { ql_qualified_rhs_name(this, result) or ql_qualified_rhs_child(this, _, result) @@ -1024,6 +1114,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_qualified_expr_child(this, _, result) } } @@ -1045,6 +1138,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_quantified_expr(this, result) or @@ -1091,6 +1187,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_select_child(this, _, result) } } @@ -1103,6 +1202,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_set_literal_child(this, _, result) } } @@ -1173,6 +1275,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_super_ref_child(this, _, result) } } @@ -1231,6 +1336,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_type_union_body_child(this, _, result) } } @@ -1243,6 +1351,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_unary_expr_child(this, _, result) } } @@ -1267,12 +1378,18 @@ module QL { /** Gets the node corresponding to the field `asExprs`. */ 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 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 F::VarDecl getAChild() { result = this.getChild(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { ql_unqual_agg_body_as_exprs(this, _, result) or @@ -1289,6 +1406,9 @@ module QL { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ql_var_decl_child(this, _, result) } } @@ -1865,6 +1985,9 @@ module Dbscheme { /** 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 F::SimpleId getAChild() { result = this.getChild(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { dbscheme_args_annotation_def(this, result) or dbscheme_args_annotation_child(this, _, result) @@ -1894,6 +2017,9 @@ module Dbscheme { /** 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 F::AstNode getAChild() { result = this.getChild(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { dbscheme_branch_qldoc(this, result) or dbscheme_branch_child(this, _, result) @@ -1914,6 +2040,9 @@ module Dbscheme { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { dbscheme_case_decl_def(this, result, _) or @@ -1982,6 +2111,9 @@ module Dbscheme { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { dbscheme_dbscheme_child(this, _, result) } } @@ -2048,6 +2180,9 @@ module Dbscheme { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { dbscheme_repr_type_child(this, _, result) } } @@ -2075,6 +2210,9 @@ module Dbscheme { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { dbscheme_table_def(this, result) or dbscheme_table_child(this, _, result) @@ -2104,6 +2242,9 @@ module Dbscheme { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { dbscheme_union_decl_def(this, result) or dbscheme_union_decl_child(this, _, result) @@ -2320,6 +2461,9 @@ module Blame { /** 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 F::Number getALine() { result = this.getLine(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { blame_blame_entry_def(this, result) or blame_blame_entry_line(this, _, result) @@ -2334,6 +2478,9 @@ module Blame { /** Gets the node corresponding to the field `file_entry`. */ 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 F::Date getToday() { blame_blame_info_def(this, result) } @@ -2357,6 +2504,9 @@ module Blame { /** Gets the node corresponding to the field `blame_entry`. */ 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 F::Filename getFileName() { blame_file_entry_def(this, result) } @@ -2497,6 +2647,9 @@ module JSON { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { json_array_child(this, _, result) } } @@ -2515,6 +2668,9 @@ module JSON { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { json_document_child(this, _, result) } } @@ -2551,6 +2707,9 @@ module JSON { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { json_object_child(this, _, result) } } @@ -2580,6 +2739,9 @@ module JSON { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { json_string_child(this, _, result) } } diff --git a/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll b/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll index d4b21080b245..0d442a5dda88 100644 --- a/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll +++ b/ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll @@ -157,6 +157,9 @@ module Ruby { 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 F::AstNode getAFieldOrChild() { ruby_alternative_pattern_alternatives(this, _, result) @@ -171,6 +174,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_argument_list_child(this, _, result) } } @@ -183,6 +189,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_array_child(this, _, result) } } @@ -200,6 +209,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_array_pattern_class(this, result) or ruby_array_pattern_child(this, _, result) @@ -248,6 +260,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_bare_string_child(this, _, result) } } @@ -260,6 +275,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_bare_symbol_child(this, _, result) } } @@ -272,6 +290,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_begin_child(this, _, result) } } @@ -284,6 +305,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_begin_block_child(this, _, result) } } @@ -397,6 +421,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_block_body_child(this, _, result) } } @@ -421,9 +448,15 @@ module Ruby { /** Gets the node corresponding to the field `locals`. */ 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 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 F::AstNode getAFieldOrChild() { ruby_block_parameters_locals(this, _, result) or ruby_block_parameters_child(this, _, result) @@ -438,6 +471,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_body_statement_child(this, _, result) } } @@ -495,6 +531,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_case_value(this, result) or ruby_case_child(this, _, result) @@ -509,6 +548,9 @@ module Ruby { /** Gets the node corresponding to the field `clauses`. */ 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 F::Else getElse() { ruby_case_match_else(this, result) } @@ -531,6 +573,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_chained_string_child(this, _, result) } } @@ -627,6 +672,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_delimited_symbol_child(this, _, result) } } @@ -639,6 +687,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_destructured_left_assignment_child(this, _, result) @@ -653,6 +704,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_destructured_parameter_child(this, _, result) @@ -667,6 +721,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_do_child(this, _, result) } } @@ -702,6 +759,9 @@ module Ruby { /** 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 F::AstNode getAChild() { result = this.getChild(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { ruby_element_reference_block(this, result) or @@ -718,6 +778,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_else_child(this, _, result) } } @@ -764,6 +827,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_end_block_child(this, _, result) } } @@ -776,6 +842,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_ensure_child(this, _, result) } } @@ -806,6 +875,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_exceptions_child(this, _, result) } } @@ -851,6 +923,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_find_pattern_class(this, result) or ruby_find_pattern_child(this, _, result) @@ -911,6 +986,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_hash_child(this, _, result) } } @@ -934,6 +1012,9 @@ module Ruby { /** 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 F::AstNode getAChild() { result = this.getChild(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { ruby_hash_pattern_class(this, result) or ruby_hash_pattern_child(this, _, result) @@ -986,6 +1067,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_heredoc_body_child(this, _, result) } } @@ -1117,6 +1201,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_interpolation_child(this, _, result) } } @@ -1180,6 +1267,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_lambda_parameters_child(this, _, result) } } @@ -1192,6 +1282,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_left_assignment_list_child(this, _, result) @@ -1251,6 +1344,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_method_parameters_child(this, _, result) } } @@ -1401,6 +1497,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_parenthesized_statements_child(this, _, result) @@ -1427,6 +1526,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_program_child(this, _, result) } } @@ -1489,6 +1591,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_regex_child(this, _, result) } } @@ -1576,6 +1681,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_right_assignment_list_child(this, _, result) @@ -1704,6 +1812,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_string_child(this, _, result) } } @@ -1716,6 +1827,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_string_array_child(this, _, result) } } @@ -1734,6 +1848,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_subshell_child(this, _, result) } } @@ -1764,6 +1881,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_symbol_array_child(this, _, result) } } @@ -1793,6 +1913,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_then_child(this, _, result) } } @@ -1842,6 +1965,9 @@ module Ruby { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { ruby_undef_child(this, _, result) } } @@ -1964,6 +2090,9 @@ module Ruby { /** 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 F::Pattern getAPattern() { result = this.getPattern(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { ruby_when_body(this, result) or ruby_when_pattern(this, _, result) @@ -2801,6 +2930,9 @@ module Erb { /** Gets the `i`th child of this node. */ 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 F::AstNode getAFieldOrChild() { erb_template_child(this, _, result) } } diff --git a/unified/ql/lib/codeql/unified/internal/Ast.qll b/unified/ql/lib/codeql/unified/internal/Ast.qll index 532b5d3cf716..20ff74e6eaf7 100644 --- a/unified/ql/lib/codeql/unified/internal/Ast.qll +++ b/unified/ql/lib/codeql/unified/internal/Ast.qll @@ -109,6 +109,9 @@ module Unified { /** 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 F::Modifier getAModifier() { result = this.getModifier(_) } + /** Gets the node corresponding to the field `name`. */ final F::Identifier getName() { unified_accessor_declaration_def(this, _, result) } @@ -117,6 +120,9 @@ module Unified { unified_accessor_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 `type`. */ final F::TypeExpr getType() { unified_accessor_declaration_type(this, result) } @@ -145,6 +151,9 @@ module Unified { /** Gets the node corresponding to the field `modifier`. */ 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 F::Identifier getName() { unified_argument_name(this, result) } @@ -167,6 +176,9 @@ module Unified { /** Gets the node corresponding to the field `element`. */ 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 F::AstNode getAFieldOrChild() { unified_array_literal_element(this, _, result) } } @@ -201,6 +213,9 @@ module Unified { 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 F::Identifier getName() { unified_associated_type_declaration_def(this, result) } @@ -220,6 +235,9 @@ module Unified { /** Gets the node corresponding to the field `modifier`. */ 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 F::TypeExpr getType() { unified_base_type_def(this, result) } @@ -259,6 +277,9 @@ module Unified { /** Gets the node corresponding to the field `stmt`. */ 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 F::AstNode getAFieldOrChild() { unified_block_stmt(this, _, result) } } @@ -315,6 +336,9 @@ module Unified { 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 F::AstNode getAFieldOrChild() { unified_bulk_importing_pattern_modifier(this, _, result) @@ -329,12 +353,18 @@ module Unified { /** Gets the node corresponding to the field `argument`. */ 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 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 F::Modifier getAModifier() { result = this.getModifier(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { unified_call_expr_argument(this, _, result) or @@ -354,6 +384,9 @@ module Unified { /** Gets the node corresponding to the field `modifier`. */ 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 F::Pattern getPattern() { unified_catch_clause_pattern(this, result) } @@ -375,14 +408,23 @@ module Unified { 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 F::Member getAMember() { result = this.getMember(_) } + /** Gets the node corresponding to the field `modifier`. */ 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 F::Identifier getName() { unified_class_like_declaration_name(this, result) } @@ -391,11 +433,17 @@ module Unified { 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 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 F::AstNode getAFieldOrChild() { unified_class_like_declaration_base_type(this, _, result) or @@ -440,6 +488,9 @@ module Unified { /** Gets the node corresponding to the field `modifier`. */ 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 F::Pattern getPattern() { unified_conditional_pattern_def(this, _, result) } @@ -464,6 +515,9 @@ module Unified { unified_constructor_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 F::Identifier getName() { unified_constructor_declaration_name(this, result) } @@ -472,6 +526,9 @@ module Unified { 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 F::AstNode getAFieldOrChild() { unified_constructor_declaration_def(this, result) or @@ -494,9 +551,15 @@ module Unified { 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 F::Modifier getAModifier() { result = this.getModifier(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { unified_constructor_pattern_def(this, result) or @@ -530,6 +593,9 @@ module Unified { unified_destructor_declaration_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 F::AstNode getAFieldOrChild() { unified_destructor_declaration_def(this, result) or @@ -551,6 +617,9 @@ module Unified { /** Gets the node corresponding to the field `modifier`. */ 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 F::AstNode getAFieldOrChild() { unified_do_while_stmt_body(this, result) or @@ -632,6 +701,9 @@ module Unified { /** Gets the node corresponding to the field `modifier`. */ 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 F::Pattern getPattern() { unified_for_each_stmt_def(this, _, result) } @@ -656,6 +728,9 @@ module Unified { /** 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 F::Modifier getAModifier() { result = this.getModifier(_) } + /** Gets the node corresponding to the field `name`. */ final F::Identifier getName() { unified_function_declaration_def(this, result) } @@ -664,6 +739,9 @@ module Unified { 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 F::TypeExpr getReturnType() { unified_function_declaration_return_type(this, result) } @@ -672,11 +750,17 @@ module Unified { 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 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 F::AstNode getAFieldOrChild() { unified_function_declaration_body(this, result) or @@ -702,12 +786,21 @@ module Unified { 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 F::Modifier getAModifier() { result = this.getModifier(_) } + /** Gets the node corresponding to the field `parameter`. */ 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 F::TypeExpr getReturnType() { unified_function_expr_return_type(this, result) } @@ -729,6 +822,9 @@ module Unified { /** Gets the node corresponding to the field `parameter`. */ 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 F::TypeExpr getReturnType() { unified_function_type_expr_def(this, result) } @@ -752,6 +848,9 @@ module Unified { 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 F::AstNode getAFieldOrChild() { unified_generic_type_expr_def(this, result) or @@ -821,6 +920,9 @@ module Unified { /** 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 F::Modifier getAModifier() { result = this.getModifier(_) } + /** Gets the node corresponding to the field `pattern`. */ final F::Pattern getPattern() { unified_import_declaration_pattern(this, result) } @@ -859,6 +961,9 @@ module Unified { unified_initializer_declaration_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 F::AstNode getAFieldOrChild() { unified_initializer_declaration_def(this, result) or @@ -914,6 +1019,9 @@ module Unified { /** Gets the node corresponding to the field `element`. */ 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 F::AstNode getAFieldOrChild() { unified_map_literal_element(this, _, result) } } @@ -967,6 +1075,9 @@ module Unified { /** 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 F::Modifier getAModifier() { result = this.getModifier(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { unified_name_pattern_def(this, result) or unified_name_pattern_modifier(this, _, result) @@ -1005,6 +1116,9 @@ module Unified { 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 F::Identifier getName() { unified_operator_syntax_declaration_def(this, result) } @@ -1028,9 +1142,15 @@ module Unified { /** Gets the node corresponding to the field `modifier`. */ 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 F::Pattern getAPattern() { result = this.getPattern(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { unified_or_pattern_modifier(this, _, result) or unified_or_pattern_pattern(this, _, result) @@ -1051,6 +1171,9 @@ module Unified { /** Gets the node corresponding to the field `modifier`. */ 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 F::Pattern getPattern() { unified_parameter_pattern(this, result) } @@ -1080,6 +1203,9 @@ module Unified { /** 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 F::Modifier getAModifier() { result = this.getModifier(_) } + /** Gets the node corresponding to the field `pattern`. */ final F::Pattern getPattern() { unified_pattern_element_def(this, result) } @@ -1164,6 +1290,9 @@ module Unified { /** Gets the node corresponding to the field `modifier`. */ 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 F::Pattern getPattern() { unified_switch_case_pattern(this, result) } @@ -1183,9 +1312,15 @@ module Unified { /** Gets the node corresponding to the field `case`. */ 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 F::Modifier getAModifier() { result = this.getModifier(_) } + /** Gets the node corresponding to the field `value`. */ final F::Expr getValue() { unified_switch_expr_def(this, result) } @@ -1232,9 +1367,15 @@ module Unified { /** Gets the node corresponding to the field `catch_clause`. */ 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 F::Modifier getAModifier() { result = this.getModifier(_) } + /** Gets a field or child node of this node. */ final override F::AstNode getAFieldOrChild() { unified_try_expr_def(this, result) or @@ -1251,6 +1392,9 @@ module Unified { /** Gets the node corresponding to the field `element`. */ 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 F::AstNode getAFieldOrChild() { unified_tuple_expr_element(this, _, result) } } @@ -1263,9 +1407,15 @@ module Unified { /** Gets the node corresponding to the field `element`. */ 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 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 F::AstNode getAFieldOrChild() { unified_tuple_pattern_element(this, _, result) or @@ -1298,6 +1448,9 @@ module Unified { /** Gets the node corresponding to the field `element`. */ 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 F::AstNode getAFieldOrChild() { unified_tuple_type_expr_element(this, _, result) @@ -1314,6 +1467,9 @@ module Unified { 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 F::Identifier getName() { unified_type_alias_declaration_def(this, result, _) } @@ -1325,11 +1481,17 @@ module Unified { 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 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 F::AstNode getAFieldOrChild() { unified_type_alias_declaration_modifier(this, _, result) or @@ -1377,6 +1539,9 @@ module Unified { /** 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 F::Modifier getAModifier() { result = this.getModifier(_) } + /** Gets the node corresponding to the field `name`. */ final F::Identifier getName() { unified_type_parameter_def(this, result) } @@ -1455,6 +1620,9 @@ module Unified { 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 F::AstNode getAFieldOrChild() { unified_unresolved_operator_sequence_element(this, _, result) @@ -1477,6 +1645,9 @@ module Unified { /** Gets the node corresponding to the field `modifier`. */ 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 F::Pattern getPattern() { unified_variable_declaration_def(this, result) } @@ -1509,6 +1680,9 @@ module Unified { /** Gets the node corresponding to the field `modifier`. */ 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 F::AstNode getAFieldOrChild() { unified_while_stmt_body(this, result) or From b34549425a514b133d2e006fe78ff6e449a06d98 Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 30 Jul 2026 16:40:17 +0200 Subject: [PATCH 20/21] unified: Fix qldoc warnings --- unified/ql/lib/codeql/unified/internal/FacadeAst.qll | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unified/ql/lib/codeql/unified/internal/FacadeAst.qll b/unified/ql/lib/codeql/unified/internal/FacadeAst.qll index d64bdeddc026..a25fb3447c1e 100644 --- a/unified/ql/lib/codeql/unified/internal/FacadeAst.qll +++ b/unified/ql/lib/codeql/unified/internal/FacadeAst.qll @@ -8,6 +8,7 @@ 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) { @@ -18,6 +19,7 @@ module Unified { } } + /** 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() { From 329d1980fc2fbcf423c486e21bfbd7dc8d856d65 Mon Sep 17 00:00:00 2001 From: Asger F Date: Fri, 31 Jul 2026 13:56:58 +0200 Subject: [PATCH 21/21] unified: Convert TypeCheckContext to a struct --- shared/yeast/src/dump.rs | 63 ++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/shared/yeast/src/dump.rs b/shared/yeast/src/dump.rs index 06ede1fa3438..0e2e57e6f82a 100644 --- a/shared/yeast/src/dump.rs +++ b/shared/yeast/src/dump.rs @@ -2,11 +2,12 @@ use std::fmt::Write; use crate::{schema::Schema, Ast, Id, Node, NodeContent, CHILD_FIELD}; -type TypeCheckContext<'a> = ( - &'a Schema, - Option<&'a [crate::schema::NodeType]>, - Option<(&'a str, &'a str)>, -); +#[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 { @@ -76,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 @@ -221,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(); } } @@ -244,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 @@ -269,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).or(Some(EMPTY_NODE_TYPES)); + 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 { @@ -312,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) @@ -329,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) { @@ -392,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(); } }