Python points-to: Rationalize handling of expressions and conditions. Tweak API to be a bit more backward-compatible.

This commit is contained in:
Mark Shannon
2019-04-02 14:15:24 +01:00
parent 54c27e1d4b
commit ef0a6b6713
7 changed files with 356 additions and 108 deletions

View File

@@ -5,10 +5,9 @@ import semmle.python.pointsto.PointsToContext
import Util
from ControlFlowNode test, ControlFlowNode use, Object val, boolean eval, ClassObject cls, PointsToContext ctx
from ControlFlowNode test, ControlFlowNode use, Value val, boolean eval, PointsToContext ctx
where
not use instanceof NameConstantNode and
not use.getNode() instanceof ImmutableLiteral and
PointsTo::points_to(use, ctx, val, cls, _) and
eval = PointsTo::test_evaluates_boolean(test, use, ctx, val, cls, _)
select locate(test.getLocation(), "bc"), test.getNode().toString(), eval.toString(), use.getNode().toString(), val.toString()
eval = Conditionals::testEvaluates(test, use, ctx, val, _)
select locate(test.getLocation(), "bc"), test.getNode().toString(), eval.toString(), use.getNode().toString(), val.getSource().toString()