@@ -134,9 +134,25 @@ API::Node getExtraSuccessorFromNode(API::Node node, AccessPathTokenBase token) {
134
134
token .getAnArgument ( ) = "any-named" and
135
135
result = node .getKeywordParameter ( _)
136
136
)
137
+ or
138
+ // content based steps
139
+ //
140
+ // note: if we want to migrate to use `FlowSummaryImpl::Input::encodeContent` like
141
+ // they do in Ruby, be aware that we currently don't make
142
+ // `DataFlow::DictionaryElementContent` just from seeing a subscript read, so we would
143
+ // need to add that. (also need to handle things like `DictionaryElementAny` which
144
+ // doesn't have any value for .getAnArgument())
145
+ (
146
+ token .getName ( ) = "DictionaryElement" and
147
+ result = node .getSubscript ( token .getAnArgument ( ) )
148
+ or
149
+ token .getName ( ) = "DictionaryElementAny" and
150
+ result = node .getASubscript ( ) and
151
+ not exists ( token .getAnArgument ( ) )
152
+ // TODO: ListElement/SetElement/TupleElement
153
+ )
137
154
// Some features don't have MaD tokens yet, they would need to be added to API-graphs first.
138
155
// - decorators ("DecoratedClass", "DecoratedMember", "DecoratedParameter")
139
- // - Array/Map elements ("ArrayElement", "Element", "MapKey", "MapValue")
140
156
}
141
157
142
158
/**
@@ -242,15 +258,19 @@ InvokeNode getAnInvocationOf(API::Node node) { result = node.getACall() }
242
258
*/
243
259
bindingset [ name]
244
260
predicate isExtraValidTokenNameInIdentifyingAccessPath ( string name ) {
245
- name = [ "Member" , "Instance" , "Awaited" , "Call" , "Method" , "Subclass" ]
261
+ name =
262
+ [
263
+ "Member" , "Instance" , "Awaited" , "Call" , "Method" , "Subclass" , "DictionaryElement" ,
264
+ "DictionaryElementAny"
265
+ ]
246
266
}
247
267
248
268
/**
249
269
* Holds if `name` is a valid name for an access path token with no arguments, occurring
250
270
* in an identifying access path.
251
271
*/
252
272
predicate isExtraValidNoArgumentTokenInIdentifyingAccessPath ( string name ) {
253
- name = [ "Instance" , "Awaited" , "Call" , "Subclass" ]
273
+ name = [ "Instance" , "Awaited" , "Call" , "Subclass" , "DictionaryElementAny" ]
254
274
}
255
275
256
276
/**
@@ -259,7 +279,7 @@ predicate isExtraValidNoArgumentTokenInIdentifyingAccessPath(string name) {
259
279
*/
260
280
bindingset [ name, argument]
261
281
predicate isExtraValidTokenArgumentInIdentifyingAccessPath ( string name , string argument ) {
262
- name = [ "Member" , "Method" ] and
282
+ name = [ "Member" , "Method" , "DictionaryElement" ] and
263
283
exists ( argument )
264
284
or
265
285
name = [ "Argument" , "Parameter" ] and
0 commit comments