Merge pull request #844 from markshannon/python-hide-magic-variables-in-test

Python tests: Further hiding of special ESSA variables in tests
This commit is contained in:
Taus
2019-01-29 18:51:06 +01:00
committed by GitHub
5 changed files with 11 additions and 8 deletions

View File

@@ -4,5 +4,5 @@ import python
import Util
from EssaDefinition def, Variable v
where v = def.getSourceVariable()
where v = def.getSourceVariable() and not v instanceof SpecialSsaSourceVariable
select locate(def.getLocation(), "abdgk"), v.toString(), def.getAQlClass()

View File

@@ -5,6 +5,7 @@ private import semmle.python.pointsto.PointsToContext
import Util
from EssaVariable v, EssaDefinition def, Object o, ClassObject cls
where def = v.getDefinition() and
where def = v.getDefinition() and
not v.getSourceVariable() instanceof SpecialSsaSourceVariable and
PointsTo::ssa_variable_points_to(v, _, o, cls, _)
select locate(def.getLocation(), "abcdegjqmns_"), v.getRepresentation() + " = " + def.getRepresentation(), repr(o), repr(cls)

View File

@@ -6,5 +6,5 @@ import semmle.python.pointsto.PointsTo
import Util
from SsaSourceVariable var, ControlFlowNode use, BasicBlock pred
where var.hasRefinementEdge(use, pred, _)
where var.hasRefinementEdge(use, pred, _) and not var instanceof SpecialSsaSourceVariable
select locate(pred.getLastNode().getLocation(), "ab"), var.(Variable), use.toString()

View File

@@ -6,8 +6,10 @@ import semmle.python.pointsto.PointsTo
import Util
from SsaSourceVariable var, ControlFlowNode defn, string kind
where
var.hasDefiningNode(defn) and kind = "definition"
or
var.hasRefinement(_, defn) and kind = "refinement"
where not var instanceof SpecialSsaSourceVariable and
(
var.hasDefiningNode(defn) and kind = "definition"
or
var.hasRefinement(_, defn) and kind = "refinement"
)
select locate(defn.getLocation(), "ab"), var.(Variable), defn.toString(), kind

View File

@@ -5,5 +5,5 @@ import semmle.python.pointsto.PointsTo
import Util
from SsaSourceVariable var, ControlFlowNode use
where use = var.getAUse() or var.hasRefinement(use, _)
where (use = var.getAUse() or var.hasRefinement(use, _)) and not var instanceof SpecialSsaSourceVariable
select locate(use.getLocation(), "abd"), var.getName(), use.toString()