File tree Expand file tree Collapse file tree
test/function/samples/track-reassignments Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ export default class LocalVariable extends Variable {
155155 if ( path . length === 0 ) return false ;
156156 if ( this . isReassigned ) return true ;
157157 return ( this . init &&
158- ! context . accessed . trackEntityAtPathAndGetIfTracked ( path , this ) &&
158+ ! context . assigned . trackEntityAtPathAndGetIfTracked ( path , this ) &&
159159 this . init . hasEffectsWhenAssignedAtPath ( path , context ) ) ! ;
160160 }
161161
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ description : 'properly track reassignments (#4468)'
3+ } ;
Original file line number Diff line number Diff line change 1+ import { patchEventTarget } from './patchEventTarget.js' ;
2+
3+ class EventTarget {
4+ addEventListener ( callback ) {
5+ callback ( ) ;
6+ }
7+ }
8+ global . window = { EventTarget } ;
9+
10+ let patchCalled = false ;
11+ patchEventTarget ( ( ) => ( patchCalled = true ) ) ;
12+ const target = new EventTarget ( ) ;
13+ target . addEventListener ( )
14+
15+ assert . ok ( patchCalled , 'patch' ) ;
Original file line number Diff line number Diff line change 1+ export function patchEventTarget ( callback ) {
2+ var proto = window . EventTarget . prototype ;
3+ var nativeAddEventListener = proto . addEventListener ;
4+
5+ proto . addEventListener = function ( ) {
6+ return nativeAddEventListener ( callback ) ;
7+ } ;
8+
9+ return proto ;
10+ }
You can’t perform that action at this time.
0 commit comments