@@ -462,6 +462,14 @@ module API {
462462 lbl = Label:: memberFromRef ( pw ) and
463463 rhs = pw .getValue ( )
464464 )
465+ or
466+ // TODO: I had expected `DataFlow::AttrWrite` to contain the attribute writes from a dict, that's how JS works.
467+ exists ( Dict dict , KeyValuePair item |
468+ dict = pred .asExpr ( ) and
469+ dict .getItem ( _) = item and
470+ lbl = Label:: member ( item .getKey ( ) .( StrConst ) .getS ( ) ) and
471+ rhs .asExpr ( ) = item .getValue ( )
472+ )
465473 // or
466474 // special case: from `require('m')` to an export of `prop` in `m`
467475 // TODO: Figure out if this is needed.
@@ -528,7 +536,7 @@ module API {
528536 |
529537 // Referring to an attribute on a node that is a use of `base`:
530538 lbl = Label:: memberFromRef ( ref ) and
531- ref = pred .getAnAttributeReference ( )
539+ ref = pred .getAnAttributeReference ( ) // TODO: Change to read.
532540 or
533541 // Calling a node that is a use of `base`
534542 lbl = Label:: return ( ) and
@@ -548,20 +556,12 @@ module API {
548556 )
549557 )
550558 or
551- exists ( DataFlow:: Node def , CallableExpr fn |
559+ exists ( DataFlow:: Node def , CallableExpr fn , int i |
552560 rhs ( base , def ) and fn = trackDefNode ( def ) .asExpr ( )
553561 |
554- exists ( int i |
555- lbl = Label:: parameter ( i ) and
556- ref .asExpr ( ) = fn .getInnerScope ( ) .getArg ( i )
557- )
558- /*
559- * or // TODO: Figure out self. (and arg = -2, that might be a thing in python)
560- * lbl = Label::receiver() and
561- * ref = fn.getReceiver()
562- */
563-
564- )
562+ lbl = Label:: parameter ( i ) and
563+ ref .asExpr ( ) = fn .getInnerScope ( ) .getArg ( i )
564+ )
565565 or
566566 /*
567567 * or // TODO: Figure out classes.
@@ -771,7 +771,8 @@ module API {
771771 ImportStar:: namePossiblyDefinedInImportStar ( _, member , _) or
772772 Impl:: prefix_member ( _, member , _) or
773773 exists ( any ( Module mod ) .getSubModule ( member ) ) or
774- exports ( _, member , _)
774+ exports ( _, member , _) or
775+ member = any ( Dict d ) .getAnItem ( ) .( KeyValuePair ) .getKey ( ) .( StrConst ) .getS ( )
775776 } or
776777 MkLabelUnknownMember ( ) or
777778 MkLabelParameter ( int i ) {
0 commit comments