@@ -444,6 +444,7 @@ private void collect(JSModule module, Scope scope, Node n) {
444444 type = getValueType (n .getFirstChild ());
445445 break ;
446446 case NAME :
447+ case GETPROP :
447448 // TODO(b/127505242): CAST parents may indicate a set.
448449 // This may be a variable get or set.
449450 switch (parent .getToken ()) {
@@ -492,7 +493,9 @@ private void collect(JSModule module, Scope scope, Node n) {
492493 case ITER_REST :
493494 case OBJECT_REST :
494495 // This may be a set.
495- if (NodeUtil .isLhsByDestructuring (n )) {
496+ // TODO(b/120303257): this should extend to qnames too, but doing
497+ // so causes invalid output. Covered in CollapsePropertiesTest
498+ if (n .isName () && NodeUtil .isLhsByDestructuring (n )) {
496499 isSet = true ;
497500 type = NameType .OTHER ;
498501 }
@@ -506,42 +509,12 @@ private void collect(JSModule module, Scope scope, Node n) {
506509 type = NameType .OTHER ;
507510 }
508511 }
509- name = n .getString ();
510- break ;
511- case GETPROP :
512- // TODO(b/117673791): Merge this case with NAME case to fix.
513- // TODO(b/120303257): Merging this case with the NAME case makes this a breaking bug.
514- // TODO(b/127505242): CAST parents may indicate a set.
515- // This may be a namespaced name get or set.
516- if (parent != null ) {
517- switch (parent .getToken ()) {
518- case ASSIGN :
519- if (parent .getFirstChild () == n ) {
520- isSet = true ;
521- type = getValueType (n .getNext ());
522- }
523- break ;
524- case GETPROP :
525- // This is nested in another getprop. Return and only create a Ref for the outermost
526- // getprop in the chain.
527- return ;
528- case INC :
529- case DEC :
530- case ITER_SPREAD :
531- case OBJECT_SPREAD :
532- break ; // isSet = false, type = OTHER.
533- default :
534- if (NodeUtil .isAssignmentOp (parent ) && parent .getFirstChild () == n ) {
535- isSet = true ;
536- type = NameType .OTHER ;
537- }
538- }
539- }
540512 if (!n .isQualifiedName ()) {
541513 return ;
542514 }
543515 name = n .getQualifiedName ();
544516 break ;
517+
545518 case CALL :
546519 if (isObjectHasOwnPropertyCall (n )) {
547520 String qname = n .getFirstFirstChild ().getQualifiedName ();
0 commit comments