Files
codeql/python/ql/test/library-tests/objects/Literals.ql
Taus f0465f441f Python: Get rid of some get...Object methods
This frees `Class.qll`, `Exprs.qll`, and `Function.qll` from the
clutches of points-to. For the somewhat complicated setup with
`getLiteralObject` (an abstract method), I opted for a slightly ugly but
workable solution of just defining a predicate on `ImmutableLiteral`
that inlines each predicate body, special-cased to the specific instance
to which it applies.
2025-11-26 12:30:30 +00:00

14 lines
348 B
Plaintext

/* Test that there are no literals that do not have a corresponding object. */
import python
private import LegacyPointsTo
string repr(Expr e) {
result = e.(Num).getN() or
result = e.(Bytes).getS() or
result = e.(Unicode).getS()
}
from ImmutableLiteral l
where not exists(getLiteralObject(l))
select l.getLocation().getStartLine(), repr(l)