@@ -243,6 +243,11 @@ module API {
243243 */
244244 Node getAwaited ( ) { result = this .getASuccessor ( Label:: await ( ) ) }
245245
246+ /**
247+ * Gets a node representing a subscript of this node.
248+ */
249+ Node getASubscript ( ) { result = this .getASuccessor ( Label:: subscript ( ) ) }
250+
246251 /**
247252 * Gets a string representation of the lexicographically least among all shortest access paths
248253 * from the root to this node.
@@ -750,6 +755,10 @@ module API {
750755 lbl = Label:: await ( ) and
751756 ref = pred .getAnAwaited ( )
752757 or
758+ // Subscripting a node that is a use of `base`
759+ lbl = Label:: subscript ( ) and
760+ ref = pred .getASubscript ( )
761+ or
753762 // Subclassing a node
754763 lbl = Label:: subclass ( ) and
755764 exists ( PY:: ClassExpr clsExpr , DataFlow:: Node superclass | pred .flowsTo ( superclass ) |
@@ -982,6 +991,7 @@ module API {
982991 MkLabelReturn ( ) or
983992 MkLabelSubclass ( ) or
984993 MkLabelAwait ( ) or
994+ MkLabelSubscript ( ) or
985995 MkLabelEntryPoint ( EntryPoint ep )
986996
987997 /** A label for a module. */
@@ -1057,6 +1067,11 @@ module API {
10571067 override string toString ( ) { result = "getAwaited()" }
10581068 }
10591069
1070+ /** A label that gets the subscript of a sequence. */
1071+ class LabelSubscript extends ApiLabel , MkLabelSubscript {
1072+ override string toString ( ) { result = "getSubscript()" }
1073+ }
1074+
10601075 /** A label for entry points. */
10611076 class LabelEntryPoint extends ApiLabel , MkLabelEntryPoint {
10621077 private EntryPoint entry ;
@@ -1102,6 +1117,9 @@ module API {
11021117 /** Gets the `await` edge label. */
11031118 LabelAwait await ( ) { any ( ) }
11041119
1120+ /** Gets the `subscript` edge label. */
1121+ LabelSubscript subscript ( ) { any ( ) }
1122+
11051123 /** Gets the label going from the root node to the nodes associated with the given entry point. */
11061124 LabelEntryPoint entryPoint ( EntryPoint ep ) { result = MkLabelEntryPoint ( ep ) }
11071125 }
0 commit comments