Merge pull request #22082 from hvitved/shared/final-tree-sitter-classes

Shared: Generate `final` tree-sitter classes
This commit is contained in:
Tom Hvitved
2026-06-30 09:09:42 +02:00
committed by GitHub
7 changed files with 556 additions and 456 deletions

BIN
ql/Cargo.lock generated

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -120,14 +120,20 @@ pub fn generate(
)));
dbscheme::write(&mut dbscheme_writer, &dbscheme_tail)?;
let mut body = vec![
ql::TopLevel::Class(ql_gen::create_ast_node_class(
&ast_node_name,
&node_location_table_name,
&node_parent_table_name,
)),
ql::TopLevel::Class(ql_gen::create_token_class(&token_name, &tokeninfo_name)),
];
let mut body = vec![];
for c in 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));
}
if has_trivia_tokens {
body.push(ql::TopLevel::Class(ql_gen::create_trivia_token_class(
&trivia_token_name,

View File

@@ -40,9 +40,12 @@ pub struct Class<'a> {
pub qldoc: Option<String>,
pub name: &'a str,
pub is_abstract: bool,
pub is_final: bool,
pub is_private: bool,
pub supertypes: BTreeSet<Type<'a>>,
pub characteristic_predicate: Option<Expression<'a>>,
pub predicates: Vec<Predicate<'a>>,
pub alias: Option<String>,
}
impl fmt::Display for Class<'_> {
@@ -50,6 +53,16 @@ impl fmt::Display for Class<'_> {
if let Some(qldoc) = &self.qldoc {
write!(f, "/** {qldoc} */")?;
}
if self.is_final {
write!(f, "final ")?;
}
if self.is_private {
write!(f, "private ")?;
}
if let Some(alias) = &self.alias {
write!(f, "class {} = {alias};", &self.name)?;
return Ok(());
}
if self.is_abstract {
write!(f, "abstract ")?;
}

View File

@@ -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> {
) -> [ql::Class<'a>; 2] {
// Default implementation of `toString` calls `this.getAPrimaryQlClass()`
let to_string = ql::Predicate {
qldoc: Some(String::from(
@@ -132,25 +132,41 @@ pub fn create_ast_node_class<'a>(
),
overlay: None,
};
ql::Class {
qldoc: Some(String::from("The base class for all AST nodes")),
name: "AstNode",
is_abstract: false,
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: 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![],
},
]
}
pub fn create_token_class<'a>(token_type: &'a str, tokeninfo: &'a str) -> ql::Class<'a> {
pub fn create_token_class<'a>(token_type: &'a str, tokeninfo: &'a str) -> [ql::Class<'a>; 2] {
let tokeninfo_arity = 3; // id, kind, value
let get_value = ql::Predicate {
qldoc: Some(String::from("Gets the value of this token.")),
@@ -183,20 +199,36 @@ pub fn create_token_class<'a>(token_type: &'a str, tokeninfo: &'a str) -> ql::Cl
),
overlay: None,
};
ql::Class {
qldoc: Some(String::from("A token.")),
name: "Token",
is_abstract: false,
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),
],
}
[
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![],
},
]
}
/// Creates the `TriviaToken` class. Trivia tokens (e.g. comments) are
@@ -251,9 +283,15 @@ pub fn create_trivia_token_class<'a>(
)),
name: "TriviaToken",
is_abstract: false,
supertypes: vec![ql::Type::At(trivia_token_type), ql::Type::Normal("AstNode")]
.into_iter()
.collect(),
is_final: true,
is_private: false,
alias: None,
supertypes: vec![
ql::Type::At(trivia_token_type),
ql::Type::Normal("AstNodeImpl"),
]
.into_iter()
.collect(),
characteristic_predicate: None,
predicates: vec![
get_value,
@@ -271,7 +309,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,
supertypes: vec![ql::Type::At(db_name), ql::Type::Normal("Token")]
is_final: true,
is_private: false,
alias: None,
supertypes: vec![ql::Type::At(db_name), ql::Type::Normal("TokenImpl")]
.into_iter()
.collect(),
characteristic_predicate: None,
@@ -775,11 +816,14 @@ pub fn convert_nodes(nodes: &node_types::NodeTypeMap) -> Vec<ql::TopLevel<'_>> {
create_get_a_primary_ql_class(&node.ql_class_name, true);
let mut supertypes: BTreeSet<ql::Type> = BTreeSet::new();
supertypes.insert(ql::Type::At(&node.dbscheme_name));
supertypes.insert(ql::Type::Normal("Token"));
supertypes.insert(ql::Type::Normal("TokenImpl"));
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_private: false,
alias: None,
supertypes,
characteristic_predicate: None,
predicates: vec![get_a_primary_ql_class],
@@ -793,9 +837,12 @@ pub fn convert_nodes(nodes: &node_types::NodeTypeMap) -> Vec<ql::TopLevel<'_>> {
qldoc: None,
name: &node.ql_class_name,
is_abstract: false,
is_final: true,
is_private: false,
alias: None,
supertypes: vec![
ql::Type::At(&node.dbscheme_name),
ql::Type::Normal("AstNode"),
ql::Type::Normal("AstNodeImpl"),
]
.into_iter()
.collect(),
@@ -824,9 +871,12 @@ pub fn convert_nodes(nodes: &node_types::NodeTypeMap) -> Vec<ql::TopLevel<'_>> {
qldoc: Some(format!("A class representing `{}` nodes.", type_name.kind)),
name: main_class_name,
is_abstract: false,
is_final: true,
is_private: false,
alias: None,
supertypes: vec![
ql::Type::At(&node.dbscheme_name),
ql::Type::Normal("AstNode"),
ql::Type::Normal("AstNodeImpl"),
]
.into_iter()
.collect(),

View File

@@ -26,7 +26,7 @@ private predicate discardLocation(@location_default loc) {
overlay[local]
module Unified {
/** The base class for all AST nodes */
class AstNode extends @unified_ast_node {
private class AstNodeImpl extends @unified_ast_node {
/** Gets a string representation of this element. */
string toString() { result = this.getAPrimaryQlClass() }
@@ -49,8 +49,10 @@ module Unified {
string getPrimaryQlClasses() { result = concat(this.getAPrimaryQlClass(), ",") }
}
final class AstNode = AstNodeImpl;
/** A token. */
class Token extends @unified_token, AstNode {
private class TokenImpl extends @unified_token, AstNodeImpl {
/** Gets the value of this token. */
final string getValue() { unified_tokeninfo(this, _, result) }
@@ -61,8 +63,10 @@ module Unified {
override string getAPrimaryQlClass() { result = "Token" }
}
final class Token = TokenImpl;
/** A trivia token, such as a comment, preserved from the original parse tree. */
class TriviaToken extends @unified_trivia_token, AstNode {
final class TriviaToken extends @unified_trivia_token, AstNodeImpl {
/** Gets the source text of this trivia token. */
final string getValue() { unified_trivia_tokeninfo(this, _, result) }
@@ -94,7 +98,7 @@ module Unified {
}
/** A class representing `accessor_declaration` nodes. */
class AccessorDeclaration extends @unified_accessor_declaration, AstNode {
final class AccessorDeclaration extends @unified_accessor_declaration, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "AccessorDeclaration" }
@@ -128,13 +132,13 @@ module Unified {
}
/** A class representing `accessor_kind` tokens. */
class AccessorKind extends @unified_token_accessor_kind, Token {
final class AccessorKind extends @unified_token_accessor_kind, TokenImpl {
/** 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 {
final class Argument extends @unified_argument, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "Argument" }
@@ -156,7 +160,7 @@ module Unified {
}
/** A class representing `array_literal` nodes. */
class ArrayLiteral extends @unified_array_literal, AstNode {
final class ArrayLiteral extends @unified_array_literal, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "ArrayLiteral" }
@@ -168,7 +172,7 @@ module Unified {
}
/** A class representing `assign_expr` nodes. */
class AssignExpr extends @unified_assign_expr, AstNode {
final class AssignExpr extends @unified_assign_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "AssignExpr" }
@@ -185,7 +189,7 @@ module Unified {
}
/** A class representing `associated_type_declaration` nodes. */
class AssociatedTypeDeclaration extends @unified_associated_type_declaration, AstNode {
final class AssociatedTypeDeclaration extends @unified_associated_type_declaration, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "AssociatedTypeDeclaration" }
@@ -209,7 +213,7 @@ module Unified {
}
/** A class representing `base_type` nodes. */
class BaseType extends @unified_base_type, AstNode {
final class BaseType extends @unified_base_type, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "BaseType" }
@@ -226,7 +230,7 @@ module Unified {
}
/** A class representing `binary_expr` nodes. */
class BinaryExpr extends @unified_binary_expr, AstNode {
final class BinaryExpr extends @unified_binary_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "BinaryExpr" }
@@ -248,7 +252,7 @@ module Unified {
}
/** A class representing `block` nodes. */
class Block extends @unified_block, AstNode {
final class Block extends @unified_block, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "Block" }
@@ -260,13 +264,13 @@ module Unified {
}
/** A class representing `boolean_literal` tokens. */
class BooleanLiteral extends @unified_token_boolean_literal, Token {
final class BooleanLiteral extends @unified_token_boolean_literal, TokenImpl {
/** 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 {
final class BoundTypeConstraint extends @unified_bound_type_constraint, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "BoundTypeConstraint" }
@@ -284,7 +288,7 @@ module Unified {
}
/** A class representing `break_expr` nodes. */
class BreakExpr extends @unified_break_expr, AstNode {
final class BreakExpr extends @unified_break_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "BreakExpr" }
@@ -296,13 +300,13 @@ module Unified {
}
/** A class representing `builtin_expr` tokens. */
class BuiltinExpr extends @unified_token_builtin_expr, Token {
final class BuiltinExpr extends @unified_token_builtin_expr, TokenImpl {
/** 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 {
final class BulkImportingPattern extends @unified_bulk_importing_pattern, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "BulkImportingPattern" }
@@ -316,7 +320,7 @@ module Unified {
}
/** A class representing `call_expr` nodes. */
class CallExpr extends @unified_call_expr, AstNode {
final class CallExpr extends @unified_call_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "CallExpr" }
@@ -338,7 +342,7 @@ module Unified {
}
/** A class representing `catch_clause` nodes. */
class CatchClause extends @unified_catch_clause, AstNode {
final class CatchClause extends @unified_catch_clause, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "CatchClause" }
@@ -364,7 +368,7 @@ module Unified {
}
/** A class representing `class_like_declaration` nodes. */
class ClassLikeDeclaration extends @unified_class_like_declaration, AstNode {
final class ClassLikeDeclaration extends @unified_class_like_declaration, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "ClassLikeDeclaration" }
@@ -402,7 +406,7 @@ module Unified {
}
/** A class representing `compound_assign_expr` nodes. */
class CompoundAssignExpr extends @unified_compound_assign_expr, AstNode {
final class CompoundAssignExpr extends @unified_compound_assign_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "CompoundAssignExpr" }
@@ -424,7 +428,7 @@ module Unified {
}
/** A class representing `constructor_declaration` nodes. */
class ConstructorDeclaration extends @unified_constructor_declaration, AstNode {
final class ConstructorDeclaration extends @unified_constructor_declaration, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "ConstructorDeclaration" }
@@ -452,7 +456,7 @@ module Unified {
}
/** A class representing `constructor_pattern` nodes. */
class ConstructorPattern extends @unified_constructor_pattern, AstNode {
final class ConstructorPattern extends @unified_constructor_pattern, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "ConstructorPattern" }
@@ -474,7 +478,7 @@ module Unified {
}
/** A class representing `continue_expr` nodes. */
class ContinueExpr extends @unified_continue_expr, AstNode {
final class ContinueExpr extends @unified_continue_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "ContinueExpr" }
@@ -486,7 +490,7 @@ module Unified {
}
/** A class representing `destructor_declaration` nodes. */
class DestructorDeclaration extends @unified_destructor_declaration, AstNode {
final class DestructorDeclaration extends @unified_destructor_declaration, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "DestructorDeclaration" }
@@ -504,7 +508,7 @@ module Unified {
}
/** A class representing `do_while_stmt` nodes. */
class DoWhileStmt extends @unified_do_while_stmt, AstNode {
final class DoWhileStmt extends @unified_do_while_stmt, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "DoWhileStmt" }
@@ -526,13 +530,13 @@ module Unified {
}
/** A class representing `empty_expr` tokens. */
class EmptyExpr extends @unified_token_empty_expr, Token {
final class EmptyExpr extends @unified_token_empty_expr, TokenImpl {
/** 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 {
final class EqualityTypeConstraint extends @unified_equality_type_constraint, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "EqualityTypeConstraint" }
@@ -549,10 +553,10 @@ module Unified {
}
}
class Expr extends @unified_expr, AstNode { }
final class Expr extends @unified_expr, AstNodeImpl { }
/** A class representing `expr_equality_pattern` nodes. */
class ExprEqualityPattern extends @unified_expr_equality_pattern, AstNode {
final class ExprEqualityPattern extends @unified_expr_equality_pattern, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "ExprEqualityPattern" }
@@ -563,24 +567,24 @@ module Unified {
final override AstNode getAFieldOrChild() { unified_expr_equality_pattern_def(this, result) }
}
class ExprOrPattern extends @unified_expr_or_pattern, AstNode { }
final class ExprOrPattern extends @unified_expr_or_pattern, AstNodeImpl { }
class ExprOrType extends @unified_expr_or_type, AstNode { }
final class ExprOrType extends @unified_expr_or_type, AstNodeImpl { }
/** A class representing `fixity` tokens. */
class Fixity extends @unified_token_fixity, Token {
final class Fixity extends @unified_token_fixity, TokenImpl {
/** 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 {
final class FloatLiteral extends @unified_token_float_literal, TokenImpl {
/** 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 {
final class ForEachStmt extends @unified_for_each_stmt, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "ForEachStmt" }
@@ -610,7 +614,7 @@ module Unified {
}
/** A class representing `function_declaration` nodes. */
class FunctionDeclaration extends @unified_function_declaration, AstNode {
final class FunctionDeclaration extends @unified_function_declaration, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "FunctionDeclaration" }
@@ -652,7 +656,7 @@ module Unified {
}
/** A class representing `function_expr` nodes. */
class FunctionExpr extends @unified_function_expr, AstNode {
final class FunctionExpr extends @unified_function_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "FunctionExpr" }
@@ -684,7 +688,7 @@ module Unified {
}
/** A class representing `function_type_expr` nodes. */
class FunctionTypeExpr extends @unified_function_type_expr, AstNode {
final class FunctionTypeExpr extends @unified_function_type_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "FunctionTypeExpr" }
@@ -702,7 +706,7 @@ module Unified {
}
/** A class representing `generic_type_expr` nodes. */
class GenericTypeExpr extends @unified_generic_type_expr, AstNode {
final class GenericTypeExpr extends @unified_generic_type_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "GenericTypeExpr" }
@@ -722,7 +726,7 @@ module Unified {
}
/** A class representing `guard_if_stmt` nodes. */
class GuardIfStmt extends @unified_guard_if_stmt, AstNode {
final class GuardIfStmt extends @unified_guard_if_stmt, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "GuardIfStmt" }
@@ -739,13 +743,13 @@ module Unified {
}
/** A class representing `identifier` tokens. */
class Identifier extends @unified_token_identifier, Token {
final class Identifier extends @unified_token_identifier, TokenImpl {
/** 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 {
final class IfExpr extends @unified_if_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "IfExpr" }
@@ -767,13 +771,13 @@ module Unified {
}
/** A class representing `ignore_pattern` tokens. */
class IgnorePattern extends @unified_token_ignore_pattern, Token {
final class IgnorePattern extends @unified_token_ignore_pattern, TokenImpl {
/** 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 {
final class ImportDeclaration extends @unified_import_declaration, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "ImportDeclaration" }
@@ -795,19 +799,19 @@ module Unified {
}
/** A class representing `inferred_type_expr` tokens. */
class InferredTypeExpr extends @unified_token_inferred_type_expr, Token {
final class InferredTypeExpr extends @unified_token_inferred_type_expr, TokenImpl {
/** 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 {
final class InfixOperator extends @unified_token_infix_operator, TokenImpl {
/** 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 {
final class InitializerDeclaration extends @unified_initializer_declaration, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "InitializerDeclaration" }
@@ -825,13 +829,13 @@ module Unified {
}
/** A class representing `int_literal` tokens. */
class IntLiteral extends @unified_token_int_literal, Token {
final class IntLiteral extends @unified_token_int_literal, TokenImpl {
/** 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 {
final class KeyValuePair extends @unified_key_value_pair, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "KeyValuePair" }
@@ -848,7 +852,7 @@ module Unified {
}
/** A class representing `labeled_stmt` nodes. */
class LabeledStmt extends @unified_labeled_stmt, AstNode {
final class LabeledStmt extends @unified_labeled_stmt, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "LabeledStmt" }
@@ -865,7 +869,7 @@ module Unified {
}
/** A class representing `map_literal` nodes. */
class MapLiteral extends @unified_map_literal, AstNode {
final class MapLiteral extends @unified_map_literal, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "MapLiteral" }
@@ -876,10 +880,10 @@ module Unified {
final override AstNode getAFieldOrChild() { unified_map_literal_element(this, _, result) }
}
class Member extends @unified_member, AstNode { }
final class Member extends @unified_member, AstNodeImpl { }
/** A class representing `member_access_expr` nodes. */
class MemberAccessExpr extends @unified_member_access_expr, AstNode {
final class MemberAccessExpr extends @unified_member_access_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "MemberAccessExpr" }
@@ -897,13 +901,13 @@ module Unified {
}
/** A class representing `modifier` tokens. */
class Modifier extends @unified_token_modifier, Token {
final class Modifier extends @unified_token_modifier, TokenImpl {
/** 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 {
final class NameExpr extends @unified_name_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "NameExpr" }
@@ -915,7 +919,7 @@ module Unified {
}
/** A class representing `name_pattern` nodes. */
class NamePattern extends @unified_name_pattern, AstNode {
final class NamePattern extends @unified_name_pattern, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "NamePattern" }
@@ -932,7 +936,7 @@ module Unified {
}
/** A class representing `named_type_expr` nodes. */
class NamedTypeExpr extends @unified_named_type_expr, AstNode {
final class NamedTypeExpr extends @unified_named_type_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "NamedTypeExpr" }
@@ -948,10 +952,10 @@ module Unified {
}
}
class Operator extends @unified_operator, AstNode { }
final class Operator extends @unified_operator, AstNodeImpl { }
/** A class representing `operator_syntax_declaration` nodes. */
class OperatorSyntaxDeclaration extends @unified_operator_syntax_declaration, AstNode {
final class OperatorSyntaxDeclaration extends @unified_operator_syntax_declaration, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "OperatorSyntaxDeclaration" }
@@ -979,7 +983,7 @@ module Unified {
}
/** A class representing `or_pattern` nodes. */
class OrPattern extends @unified_or_pattern, AstNode {
final class OrPattern extends @unified_or_pattern, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "OrPattern" }
@@ -996,7 +1000,7 @@ module Unified {
}
/** A class representing `parameter` nodes. */
class Parameter extends @unified_parameter, AstNode {
final class Parameter extends @unified_parameter, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "Parameter" }
@@ -1025,10 +1029,10 @@ module Unified {
}
}
class Pattern extends @unified_pattern, AstNode { }
final class Pattern extends @unified_pattern, AstNodeImpl { }
/** A class representing `pattern_element` nodes. */
class PatternElement extends @unified_pattern_element, AstNode {
final class PatternElement extends @unified_pattern_element, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "PatternElement" }
@@ -1050,7 +1054,7 @@ module Unified {
}
/** A class representing `pattern_guard_expr` nodes. */
class PatternGuardExpr extends @unified_pattern_guard_expr, AstNode {
final class PatternGuardExpr extends @unified_pattern_guard_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "PatternGuardExpr" }
@@ -1068,25 +1072,25 @@ module Unified {
}
/** A class representing `postfix_operator` tokens. */
class PostfixOperator extends @unified_token_postfix_operator, Token {
final class PostfixOperator extends @unified_token_postfix_operator, TokenImpl {
/** 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 {
final class PrefixOperator extends @unified_token_prefix_operator, TokenImpl {
/** 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 {
final class RegexLiteral extends @unified_token_regex_literal, TokenImpl {
/** 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 {
final class ReturnExpr extends @unified_return_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "ReturnExpr" }
@@ -1097,22 +1101,22 @@ module Unified {
final override AstNode getAFieldOrChild() { unified_return_expr_value(this, result) }
}
class Stmt extends @unified_stmt, AstNode { }
final class Stmt extends @unified_stmt, AstNodeImpl { }
/** A class representing `string_literal` tokens. */
class StringLiteral extends @unified_token_string_literal, Token {
final class StringLiteral extends @unified_token_string_literal, TokenImpl {
/** 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 {
final class SuperExpr extends @unified_token_super_expr, TokenImpl {
/** 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 {
final class SwitchCase extends @unified_switch_case, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "SwitchCase" }
@@ -1138,7 +1142,7 @@ module Unified {
}
/** A class representing `switch_expr` nodes. */
class SwitchExpr extends @unified_switch_expr, AstNode {
final class SwitchExpr extends @unified_switch_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "SwitchExpr" }
@@ -1160,7 +1164,7 @@ module Unified {
}
/** A class representing `throw_expr` nodes. */
class ThrowExpr extends @unified_throw_expr, AstNode {
final class ThrowExpr extends @unified_throw_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "ThrowExpr" }
@@ -1172,7 +1176,7 @@ module Unified {
}
/** A class representing `top_level` nodes. */
class TopLevel extends @unified_top_level, AstNode {
final class TopLevel extends @unified_top_level, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TopLevel" }
@@ -1184,7 +1188,7 @@ module Unified {
}
/** A class representing `try_expr` nodes. */
class TryExpr extends @unified_try_expr, AstNode {
final class TryExpr extends @unified_try_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TryExpr" }
@@ -1206,7 +1210,7 @@ module Unified {
}
/** A class representing `tuple_expr` nodes. */
class TupleExpr extends @unified_tuple_expr, AstNode {
final class TupleExpr extends @unified_tuple_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TupleExpr" }
@@ -1218,7 +1222,7 @@ module Unified {
}
/** A class representing `tuple_pattern` nodes. */
class TuplePattern extends @unified_tuple_pattern, AstNode {
final class TuplePattern extends @unified_tuple_pattern, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TuplePattern" }
@@ -1236,7 +1240,7 @@ module Unified {
}
/** A class representing `tuple_type_element` nodes. */
class TupleTypeElement extends @unified_tuple_type_element, AstNode {
final class TupleTypeElement extends @unified_tuple_type_element, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TupleTypeElement" }
@@ -1253,7 +1257,7 @@ module Unified {
}
/** A class representing `tuple_type_expr` nodes. */
class TupleTypeExpr extends @unified_tuple_type_expr, AstNode {
final class TupleTypeExpr extends @unified_tuple_type_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TupleTypeExpr" }
@@ -1265,7 +1269,7 @@ module Unified {
}
/** A class representing `type_alias_declaration` nodes. */
class TypeAliasDeclaration extends @unified_type_alias_declaration, AstNode {
final class TypeAliasDeclaration extends @unified_type_alias_declaration, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TypeAliasDeclaration" }
@@ -1299,7 +1303,7 @@ module Unified {
}
/** A class representing `type_cast_expr` nodes. */
class TypeCastExpr extends @unified_type_cast_expr, AstNode {
final class TypeCastExpr extends @unified_type_cast_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TypeCastExpr" }
@@ -1320,12 +1324,12 @@ module Unified {
}
}
class TypeConstraint extends @unified_type_constraint, AstNode { }
final class TypeConstraint extends @unified_type_constraint, AstNodeImpl { }
class TypeExpr extends @unified_type_expr, AstNode { }
final class TypeExpr extends @unified_type_expr, AstNodeImpl { }
/** A class representing `type_parameter` nodes. */
class TypeParameter extends @unified_type_parameter, AstNode {
final class TypeParameter extends @unified_type_parameter, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TypeParameter" }
@@ -1347,7 +1351,7 @@ module Unified {
}
/** A class representing `type_test_expr` nodes. */
class TypeTestExpr extends @unified_type_test_expr, AstNode {
final class TypeTestExpr extends @unified_type_test_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TypeTestExpr" }
@@ -1369,7 +1373,7 @@ module Unified {
}
/** A class representing `type_test_pattern` nodes. */
class TypeTestPattern extends @unified_type_test_pattern, AstNode {
final class TypeTestPattern extends @unified_type_test_pattern, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TypeTestPattern" }
@@ -1387,7 +1391,7 @@ module Unified {
}
/** A class representing `unary_expr` nodes. */
class UnaryExpr extends @unified_unary_expr, AstNode {
final class UnaryExpr extends @unified_unary_expr, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "UnaryExpr" }
@@ -1404,13 +1408,13 @@ module Unified {
}
/** A class representing `unsupported_node` tokens. */
class UnsupportedNode extends @unified_token_unsupported_node, Token {
final class UnsupportedNode extends @unified_token_unsupported_node, TokenImpl {
/** 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 {
final class VariableDeclaration extends @unified_variable_declaration, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "VariableDeclaration" }
@@ -1436,7 +1440,7 @@ module Unified {
}
/** A class representing `while_stmt` nodes. */
class WhileStmt extends @unified_while_stmt, AstNode {
final class WhileStmt extends @unified_while_stmt, AstNodeImpl {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "WhileStmt" }