Skip to content

Commit c111066

Browse files
committed
Python: remaining content-based summary components
1 parent 1a57f81 commit c111066

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

python/ql/lib/semmle/python/dataflow/new/FlowSummary.qll

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,27 @@ module SummaryComponent {
2828
/** Gets a summary component that represents a list element. */
2929
SummaryComponent listElement() { result = content(any(ListElementContent c)) }
3030

31+
/** Gets a summary component that represents a set element. */
32+
SummaryComponent setElement() { result = content(any(SetElementContent c)) }
33+
34+
/** Gets a summary component that represents a tuple element. */
35+
SummaryComponent tupleElement(int index) {
36+
exists(TupleElementContent c | c.getIndex() = index and result = content(c))
37+
}
38+
39+
/** Gets a summary component that represents a dictionary element. */
40+
SummaryComponent dictionaryElement(string key) {
41+
exists(DictionaryElementContent c | c.getKey() = key and result = content(c))
42+
}
43+
44+
/** Gets a summary component that represents a dictionary element at any key. */
45+
SummaryComponent dictionaryElementAny() { result = content(any(DictionaryElementAnyContent c)) }
46+
47+
/** Gets a summary component that represents an attribute element. */
48+
SummaryComponent attribute(string attr) {
49+
exists(AttributeContent c | c.getAttribute() = attr and result = content(c))
50+
}
51+
3152
/** Gets a summary component that represents the return value of a call. */
3253
SummaryComponent return() { result = SC::return(any(ReturnKind rk)) }
3354
}

0 commit comments

Comments
 (0)