mirror of
https://github.com/github/codeql.git
synced 2026-02-20 17:03:41 +01:00
AST: make Expr extend Stmt
This commit is contained in:
@@ -1,30 +1,15 @@
|
||||
private import codeql_ruby.AST
|
||||
private import codeql_ruby.CFG
|
||||
private import internal.Expr
|
||||
private import internal.Variable
|
||||
private import codeql_ruby.controlflow.internal.ControlFlowGraphImpl
|
||||
|
||||
/**
|
||||
* An expression.
|
||||
*
|
||||
* This is the root QL class for all expressions.
|
||||
*/
|
||||
class Expr extends AstNode {
|
||||
class Expr extends Stmt {
|
||||
override Expr::Range range;
|
||||
|
||||
Expr() { this = range }
|
||||
|
||||
/** Gets a control-flow node for this expression, if any. */
|
||||
CfgNodes::AstCfgNode getAControlFlowNode() { result.getNode() = this }
|
||||
|
||||
/** Gets the control-flow scope of this expression, if any. */
|
||||
CfgScope getCfgScope() { result = getCfgScope(this) }
|
||||
|
||||
/** Gets the variable scope that this expression belongs to. */
|
||||
VariableScope getVariableScope() { result = enclosingScope(this) }
|
||||
|
||||
/** Gets the enclosing callable, if any. */
|
||||
Callable getEnclosingCallable() { result = this.getCfgScope() }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
private import codeql_ruby.AST
|
||||
private import codeql_ruby.CFG
|
||||
private import internal.Statement
|
||||
private import internal.Variable
|
||||
private import codeql_ruby.controlflow.internal.ControlFlowGraphImpl
|
||||
|
||||
/**
|
||||
@@ -17,6 +18,9 @@ class Stmt extends AstNode {
|
||||
/** Gets the control-flow scope of this statement, if any. */
|
||||
CfgScope getCfgScope() { result = getCfgScope(this) }
|
||||
|
||||
/** Gets the variable scope that this statement belongs to. */
|
||||
VariableScope getVariableScope() { result = enclosingScope(this) }
|
||||
|
||||
/** Gets the enclosing callable, if any. */
|
||||
Callable getEnclosingCallable() { result = this.getCfgScope() }
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
private import codeql_ruby.AST
|
||||
private import codeql_ruby.ast.internal.AST
|
||||
private import codeql_ruby.ast.internal.Pattern
|
||||
private import codeql_ruby.ast.internal.Statement
|
||||
private import codeql_ruby.ast.internal.TreeSitter
|
||||
private import codeql_ruby.ast.internal.Variable
|
||||
|
||||
module Expr {
|
||||
abstract class Range extends AstNode::Range { }
|
||||
abstract class Range extends Stmt::Range { }
|
||||
}
|
||||
|
||||
module Literal {
|
||||
|
||||
Reference in New Issue
Block a user