Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion python/ql/examples/snippets/builtin_object.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
*/

import python
private import LegacyPointsTo

from Expr e, string name
from ExprWithPointsTo e, string name
where e.pointsTo(Value::named(name)) and not name.charAt(_) = "."
select e
1 change: 1 addition & 0 deletions python/ql/examples/snippets/call.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import python
private import LegacyPointsTo

from Value len, CallNode call
where len.getName() = "len" and len.getACall() = call
Expand Down
3 changes: 2 additions & 1 deletion python/ql/examples/snippets/catch_exception.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
*/

import python
private import LegacyPointsTo

from ExceptStmt ex, ClassValue cls
where
cls.getName() = "MyExceptionClass" and
ex.getType().pointsTo(cls)
ex.getType().(ExprWithPointsTo).pointsTo(cls)
select ex
5 changes: 3 additions & 2 deletions python/ql/examples/snippets/conditional_expression.ql
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
*/

import python
private import LegacyPointsTo

from IfExp e, ClassObject cls1, ClassObject cls2
where
e.getBody().refersTo(_, cls1, _) and
e.getOrelse().refersTo(_, cls2, _) and
e.getBody().(ExprWithPointsTo).refersTo(_, cls1, _) and
e.getOrelse().(ExprWithPointsTo).refersTo(_, cls2, _) and
cls1 != cls2
select e
1 change: 1 addition & 0 deletions python/ql/examples/snippets/extend_class.ql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

import python
private import LegacyPointsTo

from ClassObject sub, ClassObject base
where
Expand Down
1 change: 1 addition & 0 deletions python/ql/examples/snippets/method_call.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import python
private import LegacyPointsTo

from AstNode call, PythonFunctionValue method
where
Expand Down
1 change: 1 addition & 0 deletions python/ql/examples/snippets/mutualrecursion.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import python
private import LegacyPointsTo

from FunctionObject m, FunctionObject n
where m != n and m.getACallee() = n and n.getACallee() = m
Expand Down
3 changes: 2 additions & 1 deletion python/ql/examples/snippets/new_instance.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
*/

import python
private import LegacyPointsTo

from Call new, ClassValue cls
where
cls.getName() = "MyClass" and
new.getFunc().pointsTo(cls)
new.getFunc().(ExprWithPointsTo).pointsTo(cls)
select new
1 change: 1 addition & 0 deletions python/ql/examples/snippets/override_method.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import python
private import LegacyPointsTo

from FunctionObject override, FunctionObject base
where
Expand Down
3 changes: 2 additions & 1 deletion python/ql/examples/snippets/print.ql
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
*/

import python
private import LegacyPointsTo

from AstNode print
where
/* Python 2 without `from __future__ import print_function` */
print instanceof Print
or
/* Python 3 or with `from __future__ import print_function` */
print.(Call).getFunc().pointsTo(Value::named("print"))
print.(Call).getFunc().(ExprWithPointsTo).pointsTo(Value::named("print"))
select print
3 changes: 2 additions & 1 deletion python/ql/examples/snippets/raise_exception.ql
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
*/

import python
private import LegacyPointsTo

from Raise raise, ClassValue ex
where
ex.getName() = "AnException" and
raise.getException().pointsTo(ex.getASuperType())
raise.getException().(ExprWithPointsTo).pointsTo(ex.getASuperType())
select raise, "Don't raise instances of 'AnException'"
1 change: 1 addition & 0 deletions python/ql/examples/snippets/recursion.ql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import python
private import LegacyPointsTo

from PythonFunctionValue f
where f.getACall().getScope() = f.getScope()
Expand Down
3 changes: 2 additions & 1 deletion python/ql/examples/snippets/store_none.ql
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
*/

import python
private import LegacyPointsTo

from SubscriptNode store
where
store.isStore() and
store.getIndex().pointsTo(Value::named("None"))
store.getIndex().(ControlFlowNodeWithPointsTo).pointsTo(Value::named("None"))
select store
Loading
Loading