mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
python: Avoid abstract class in public interface
use construction from Ruby with `ParameterNodeImpl`
This commit is contained in:
@@ -651,8 +651,20 @@ class SummaryCall extends DataFlowCall, TSummaryCall {
|
|||||||
override Location getLocation() { result = c.getLocation() }
|
override Location getLocation() { result = c.getLocation() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value of a parameter at function entry, viewed as a node in a data
|
||||||
|
* flow graph.
|
||||||
|
*/
|
||||||
|
abstract class ParameterNodeImpl extends Node {
|
||||||
|
/**
|
||||||
|
* Holds if this node is the parameter of callable `c` at the
|
||||||
|
* (zero-based) index `i`.
|
||||||
|
*/
|
||||||
|
abstract predicate isParameterOf(DataFlowCallable c, int i);
|
||||||
|
}
|
||||||
|
|
||||||
/** A parameter for a library callable with a flow summary. */
|
/** A parameter for a library callable with a flow summary. */
|
||||||
class SummaryParameterNode extends ParameterNode, TSummaryParameterNode {
|
class SummaryParameterNode extends ParameterNodeImpl, TSummaryParameterNode {
|
||||||
private FlowSummaryImpl::Public::SummarizedCallable sc;
|
private FlowSummaryImpl::Public::SummarizedCallable sc;
|
||||||
private int pos;
|
private int pos;
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,8 @@ newtype TNode =
|
|||||||
FlowSummaryImpl::Private::summaryParameterNodeRange(c, pos)
|
FlowSummaryImpl::Private::summaryParameterNodeRange(c, pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TParameterNode = TCfgNode or TSummaryParameterNode;
|
||||||
|
|
||||||
/** Helper for `Node::getEnclosingCallable`. */
|
/** Helper for `Node::getEnclosingCallable`. */
|
||||||
private DataFlowCallable getCallableScope(Scope s) {
|
private DataFlowCallable getCallableScope(Scope s) {
|
||||||
result.getScope() = s
|
result.getScope() = s
|
||||||
@@ -286,15 +288,16 @@ ExprNode exprNode(DataFlowExpr e) { result.getNode().getNode() = e }
|
|||||||
* The value of a parameter at function entry, viewed as a node in a data
|
* The value of a parameter at function entry, viewed as a node in a data
|
||||||
* flow graph.
|
* flow graph.
|
||||||
*/
|
*/
|
||||||
abstract class ParameterNode extends Node {
|
class ParameterNode extends Node, TParameterNode instanceof ParameterNodeImpl {
|
||||||
/**
|
/**
|
||||||
* Holds if this node is the parameter of callable `c` at the
|
* Holds if this node is the parameter of callable `c` at the
|
||||||
* (zero-based) index `i`.
|
* (zero-based) index `i`.
|
||||||
*/
|
*/
|
||||||
abstract predicate isParameterOf(DataFlowCallable c, int i);
|
final predicate isParameterOf(DataFlowCallable c, int i) { super.isParameterOf(c, i) }
|
||||||
}
|
}
|
||||||
|
|
||||||
class SourceParameterNode extends ParameterNode, CfgNode {
|
/** A parameter node foudn in the source code (not in a summary). */
|
||||||
|
class SourceParameterNode extends ParameterNodeImpl, CfgNode {
|
||||||
//, LocalSourceNode {
|
//, LocalSourceNode {
|
||||||
ParameterDefinition def;
|
ParameterDefinition def;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user