cache a bit more (again)

This commit is contained in:
Erik Krogh Kristensen
2021-12-15 21:52:13 +01:00
parent d9ced55e2c
commit b74852ffd6
3 changed files with 11 additions and 2 deletions

View File

@@ -18,7 +18,11 @@ abstract class AstNode extends AstNode_ {
* NOTE: For some statements and other purely syntactic elements,
* there may not be a `ControlFlowNode`
*/
ControlFlowNode getAFlowNode() { py_flow_bb_node(result, this, _, _) }
cached
ControlFlowNode getAFlowNode() {
Stages::AST::ref() and
py_flow_bb_node(result, this, _, _)
}
/** Gets the location for this AST node */
cached

View File

@@ -194,7 +194,9 @@ class ControlFlowNode extends @py_flow_node {
BasicBlock getBasicBlock() { result.contains(this) }
/** Gets the scope containing this flow node */
cached
Scope getScope() {
Stages::AST::ref() and
if this.getNode() instanceof Scope
then
/* Entry or exit node */

View File

@@ -76,8 +76,12 @@ module Stages {
or
exists(any(AstExtended::AstNode n).getParentNode())
or
exists(any(AstExtended::AstNode n).getAFlowNode())
or
exists(any(PyFlow::BasicBlock b).getImmediateDominator())
or
exists(any(PyFlow::BasicBlock b).getScope())
or
any(PyFlow::BasicBlock b).strictlyDominates(_)
or
any(PyFlow::BasicBlock b).strictlyReaches(_)
@@ -141,7 +145,6 @@ module Stages {
private import semmle.python.objects.TObject as TObject
private import semmle.python.Flow as Flow
private import semmle.python.objects.ObjectInternal as ObjectInternal
private import semmle.python.objects.ObjectAPI as ObjectAPI
private import semmle.python.pointsto.PointsTo as PointsTo
/**