Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions unified/extractor/ast_types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ supertypes:
- while_stmt
- do_while_stmt
- labeled_stmt
callable:
- top_level
- function_expr
- function_declaration
- constructor_declaration
- destructor_declaration
- accessor_declaration
- initializer_declaration
# A member is anything that can appear in the body of a class-like declaration
member:
- constructor_declaration
Expand Down
22 changes: 15 additions & 7 deletions unified/ql/lib/codeql/unified/internal/Ast.qll
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
}

/** A class representing `accessor_declaration` nodes. */
class AccessorDeclaration extends @unified_accessor_declaration, F::Member, F::Stmt {
class AccessorDeclaration extends @unified_accessor_declaration, F::Callable, F::Member, F::Stmt {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "AccessorDeclaration" }

Expand Down Expand Up @@ -373,6 +373,8 @@
}
}

class Callable extends @unified_callable, F::AstNode { }

Check warning on line 376 in unified/ql/lib/codeql/unified/internal/Ast.qll

View workflow job for this annotation

GitHub Actions / qldoc

Missing QLdoc for class Ast::Unified::Callable

/** A class representing `catch_clause` nodes. */
class CatchClause extends @unified_catch_clause, F::AstNode {
/** Gets the name of the primary QL class for this element. */
Expand Down Expand Up @@ -503,7 +505,9 @@
}

/** A class representing `constructor_declaration` nodes. */
class ConstructorDeclaration extends @unified_constructor_declaration, F::Member, F::Stmt {
class ConstructorDeclaration extends @unified_constructor_declaration, F::Callable, F::Member,
F::Stmt
{
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "ConstructorDeclaration" }

Expand Down Expand Up @@ -581,7 +585,9 @@
}

/** A class representing `destructor_declaration` nodes. */
class DestructorDeclaration extends @unified_destructor_declaration, F::Member, F::Stmt {
class DestructorDeclaration extends @unified_destructor_declaration, F::Callable, F::Member,
F::Stmt
{
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "DestructorDeclaration" }

Expand Down Expand Up @@ -718,7 +724,7 @@
}

/** A class representing `function_declaration` nodes. */
class FunctionDeclaration extends @unified_function_declaration, F::Member, F::Stmt {
class FunctionDeclaration extends @unified_function_declaration, F::Callable, F::Member, F::Stmt {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "FunctionDeclaration" }

Expand Down Expand Up @@ -774,7 +780,7 @@
}

/** A class representing `function_expr` nodes. */
class FunctionExpr extends @unified_function_expr, F::Expr {
class FunctionExpr extends @unified_function_expr, F::Callable, F::Expr {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "FunctionExpr" }

Expand Down Expand Up @@ -949,7 +955,7 @@
}

/** A class representing `initializer_declaration` nodes. */
class InitializerDeclaration extends @unified_initializer_declaration, F::Member {
class InitializerDeclaration extends @unified_initializer_declaration, F::Callable, F::Member {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "InitializerDeclaration" }

Expand Down Expand Up @@ -1350,7 +1356,7 @@
}

/** A class representing `top_level` nodes. */
class TopLevel extends @unified_top_level, F::AstNode {
class TopLevel extends @unified_top_level, F::Callable {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "TopLevel" }

Expand Down Expand Up @@ -2071,6 +2077,8 @@

final class CallExpr = F::CallExpr;

final class Callable = F::Callable;

final class CatchClause = F::CatchClause;

final class ClassLikeDeclaration = F::ClassLikeDeclaration;
Expand Down
2 changes: 2 additions & 0 deletions unified/ql/lib/unified.dbscheme
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ unified_call_expr_def(
int callee: @unified_expr_or_type ref
);

@unified_callable = @unified_accessor_declaration | @unified_constructor_declaration | @unified_destructor_declaration | @unified_function_declaration | @unified_function_expr | @unified_initializer_declaration | @unified_top_level

#keyset[unified_catch_clause, index]
unified_catch_clause_modifier(
int unified_catch_clause: @unified_catch_clause ref,
Expand Down
Loading