@@ -444,6 +444,7 @@ private void collect(JSModule module, Scope scope, Node n) {
444
444
type = getValueType (n .getFirstChild ());
445
445
break ;
446
446
case NAME :
447
+ case GETPROP :
447
448
// TODO(b/127505242): CAST parents may indicate a set.
448
449
// This may be a variable get or set.
449
450
switch (parent .getToken ()) {
@@ -492,7 +493,9 @@ private void collect(JSModule module, Scope scope, Node n) {
492
493
case ITER_REST :
493
494
case OBJECT_REST :
494
495
// 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 )) {
496
499
isSet = true ;
497
500
type = NameType .OTHER ;
498
501
}
@@ -506,42 +509,12 @@ private void collect(JSModule module, Scope scope, Node n) {
506
509
type = NameType .OTHER ;
507
510
}
508
511
}
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
- }
540
512
if (!n .isQualifiedName ()) {
541
513
return ;
542
514
}
543
515
name = n .getQualifiedName ();
544
516
break ;
517
+
545
518
case CALL :
546
519
if (isObjectHasOwnPropertyCall (n )) {
547
520
String qname = n .getFirstFirstChild ().getQualifiedName ();
0 commit comments