@@ -243,6 +243,11 @@ module API {
243
243
*/
244
244
Node getAwaited ( ) { result = this .getASuccessor ( Label:: await ( ) ) }
245
245
246
+ /**
247
+ * Gets a node representing a subscript of this node.
248
+ */
249
+ Node getASubscript ( ) { result = this .getASuccessor ( Label:: subscript ( ) ) }
250
+
246
251
/**
247
252
* Gets a string representation of the lexicographically least among all shortest access paths
248
253
* from the root to this node.
@@ -750,6 +755,10 @@ module API {
750
755
lbl = Label:: await ( ) and
751
756
ref = pred .getAnAwaited ( )
752
757
or
758
+ // Subscripting a node that is a use of `base`
759
+ lbl = Label:: subscript ( ) and
760
+ ref = pred .getASubscript ( )
761
+ or
753
762
// Subclassing a node
754
763
lbl = Label:: subclass ( ) and
755
764
exists ( PY:: ClassExpr clsExpr , DataFlow:: Node superclass | pred .flowsTo ( superclass ) |
@@ -982,6 +991,7 @@ module API {
982
991
MkLabelReturn ( ) or
983
992
MkLabelSubclass ( ) or
984
993
MkLabelAwait ( ) or
994
+ MkLabelSubscript ( ) or
985
995
MkLabelEntryPoint ( EntryPoint ep )
986
996
987
997
/** A label for a module. */
@@ -1057,6 +1067,11 @@ module API {
1057
1067
override string toString ( ) { result = "getAwaited()" }
1058
1068
}
1059
1069
1070
+ /** A label that gets the subscript of a sequence. */
1071
+ class LabelSubscript extends ApiLabel , MkLabelSubscript {
1072
+ override string toString ( ) { result = "getSubscript()" }
1073
+ }
1074
+
1060
1075
/** A label for entry points. */
1061
1076
class LabelEntryPoint extends ApiLabel , MkLabelEntryPoint {
1062
1077
private EntryPoint entry ;
@@ -1102,6 +1117,9 @@ module API {
1102
1117
/** Gets the `await` edge label. */
1103
1118
LabelAwait await ( ) { any ( ) }
1104
1119
1120
+ /** Gets the `subscript` edge label. */
1121
+ LabelSubscript subscript ( ) { any ( ) }
1122
+
1105
1123
/** Gets the label going from the root node to the nodes associated with the given entry point. */
1106
1124
LabelEntryPoint entryPoint ( EntryPoint ep ) { result = MkLabelEntryPoint ( ep ) }
1107
1125
}
0 commit comments