@@ -161,9 +161,9 @@ class Dependency {
161161 return [ context , identifier , value ] ;
162162 }
163163
164- notifyAExprs ( ) {
164+ notifyAExprs ( location ) {
165165 const aexprs = DependenciesToAExprs . getAExprsForDep ( this ) ;
166- DependencyManager . checkAndNotifyAExprs ( aexprs ) ;
166+ DependencyManager . checkAndNotifyAExprs ( aexprs , location ) ;
167167 }
168168
169169 isMemberDependency ( ) {
@@ -339,7 +339,7 @@ export class AEDebuggingCache {
339339 }
340340 /*MD ## Rewriting API MD*/
341341 updateFiles ( files ) {
342- if ( ! files ) return ;
342+ if ( ! files ) return ;
343343 files . forEach ( file => this . changedFiles . add ( file ) ) ;
344344 this . debouncedUpdateDebuggingViews ( ) ;
345345 }
@@ -406,7 +406,7 @@ const DependenciesToAExprs = {
406406 const location = aexpr . meta ( ) . get ( "location" ) ;
407407 if ( location && location . file ) {
408408 DebuggingCache . updateFiles ( [ location . file ] ) ;
409- if ( this . _AEsPerFile . has ( location . file ) ) {
409+ if ( this . _AEsPerFile . has ( location . file ) ) {
410410 this . _AEsPerFile . get ( location . file ) . delete ( aexpr ) ;
411411 }
412412 }
@@ -430,9 +430,11 @@ const DependenciesToAExprs = {
430430 } ,
431431
432432 getAExprsForDep ( dep ) {
433+ if ( ! this . _depsToAExprs . hasLeft ( dep ) ) return [ ] ;
433434 return Array . from ( this . _depsToAExprs . getRightsFor ( dep ) ) ;
434435 } ,
435436 getDepsForAExpr ( aexpr ) {
437+ if ( ! this . _depsToAExprs . hasRight ( aexpr ) ) return [ ] ;
436438 return Array . from ( this . _depsToAExprs . getLeftsFor ( aexpr ) ) ;
437439 } ,
438440
@@ -461,7 +463,7 @@ const HooksToDependencies = {
461463 // Track affected files
462464 hook . getLocations ( ) . then ( locations => DebuggingCache . updateFiles ( locations . map ( loc => loc . file ) ) ) ;
463465 for ( const ae of DependenciesToAExprs . getAExprsForDep ( dep ) ) {
464- if ( ae . meta ( ) . has ( "location" ) ) {
466+ if ( ae . meta ( ) . has ( "location" ) ) {
465467 DebuggingCache . updateFiles ( [ ae . meta ( ) . get ( "location" ) . file ] ) ;
466468 }
467469 }
@@ -472,8 +474,8 @@ const HooksToDependencies = {
472474
473475 // Track affected files
474476 hook . getLocations ( ) . then ( locations => DebuggingCache . updateFiles ( locations . map ( loc => loc . file ) ) ) ;
475- for ( const ae of DependenciesToAExprs . getAExprsForDep ( dep ) ) {
476- if ( ae . meta ( ) . has ( "location" ) ) {
477+ for ( const ae of DependenciesToAExprs . getAExprsForDep ( dep ) ) {
478+ if ( ae . meta ( ) . has ( "location" ) ) {
477479 DebuggingCache . updateFiles ( [ ae . meta ( ) . get ( "location" ) . file ] ) ;
478480 }
479481 }
@@ -498,17 +500,19 @@ const HooksToDependencies = {
498500 for ( const hook of HooksToDependencies . getHooksForDep ( dep ) ) {
499501 hook . getLocations ( ) . then ( locations => DebuggingCache . updateFiles ( locations . map ( loc => loc . file ) ) ) ;
500502 }
501- for ( const ae of DependenciesToAExprs . getAExprsForDep ( dep ) ) {
502- if ( ae . meta ( ) . has ( "location" ) ) {
503+ for ( const ae of DependenciesToAExprs . getAExprsForDep ( dep ) ) {
504+ if ( ae . meta ( ) . has ( "location" ) ) {
503505 DebuggingCache . updateFiles ( [ ae . meta ( ) . get ( "location" ) . file ] ) ;
504506 }
505507 }
506508 } ,
507509
508510 getDepsForHook ( hook ) {
511+ if ( ! this . _hooksToDeps . hasLeft ( hook ) ) return [ ] ;
509512 return Array . from ( this . _hooksToDeps . getRightsFor ( hook ) ) ;
510513 } ,
511514 getHooksForDep ( dep ) {
515+ if ( ! this . _hooksToDeps . hasRight ( dep ) ) return [ ] ;
512516 return Array . from ( this . _hooksToDeps . getLeftsFor ( dep ) ) ;
513517 } ,
514518
@@ -577,13 +581,13 @@ class Hook {
577581 return this . locations ;
578582 }
579583
580- notifyDependencies ( ) {
581- HooksToDependencies . getDepsForHook ( this ) . forEach ( dep => dep . notifyAExprs ( ) ) ;
582-
584+ notifyDependencies ( location ) {
585+ HooksToDependencies . getDepsForHook ( this ) . forEach ( dep => dep . notifyAExprs ( location ) ) ;
586+
583587 this . getLocations ( ) . then ( locations => DebuggingCache . updateFiles ( locations . map ( loc => loc . file ) ) ) ;
584588 for ( const dep of HooksToDependencies . getDepsForHook ( this ) ) {
585589 for ( const ae of DependenciesToAExprs . getAExprsForDep ( dep ) ) {
586- if ( ae . meta ( ) . has ( "location" ) ) {
590+ if ( ae . meta ( ) . has ( "location" ) ) {
587591 DebuggingCache . updateFiles ( [ ae . meta ( ) . get ( "location" ) . file ] ) ;
588592 }
589593 }
@@ -652,8 +656,9 @@ class DataStructureHook extends Hook {
652656 }
653657
654658 this ; // references the modified container
655- hook . addLocation ( TracingHandler . findRegistrationLocation ( ) ) ;
656- hook . notifyDependencies ( ) ;
659+ const location = TracingHandler . findRegistrationLocation ( ) ;
660+ hook . addLocation ( location ) ;
661+ hook . notifyDependencies ( location ) ;
657662 } ) ;
658663 } else {
659664 // console.warn(`Property ${addDescriptor.key} has a value that is not a function, but ${addDescriptor.value}.`)
@@ -897,9 +902,9 @@ class DependencyManager {
897902 }
898903
899904 // #TODO, #REFACTOR: extract into configurable dispatcher class
900- static checkAndNotifyAExprs ( aexprs ) {
905+ static checkAndNotifyAExprs ( aexprs , location ) {
901906 aexprs . forEach ( aexpr => aexpr . updateDependencies ( ) ) ;
902- aexprs . forEach ( aexpr => aexpr . checkAndNotify ( ) ) ;
907+ aexprs . forEach ( aexpr => aexpr . checkAndNotify ( location ) ) ;
903908 }
904909
905910 /**
@@ -935,21 +940,21 @@ class TracingHandler {
935940 const hook = SourceCodeHook . get ( obj , prop ) ;
936941 if ( ! hook ) return ;
937942 hook . addLocation ( location || TracingHandler . findRegistrationLocation ( ) ) ;
938- hook . notifyDependencies ( ) ;
943+ hook . notifyDependencies ( location ) ;
939944 }
940945
941946 static globalUpdated ( globalName , location ) {
942947 const hook = SourceCodeHook . get ( globalRef , globalName ) ;
943948 if ( ! hook ) return ;
944949 hook . addLocation ( location || TracingHandler . findRegistrationLocation ( ) ) ;
945- hook . notifyDependencies ( ) ;
950+ hook . notifyDependencies ( location ) ;
946951 }
947952
948953 static localUpdated ( scope , varName , location ) {
949954 const hook = SourceCodeHook . get ( scope , varName ) ;
950955 if ( ! hook ) return ;
951956 hook . addLocation ( location || TracingHandler . findRegistrationLocation ( ) ) ;
952- hook . notifyDependencies ( ) ;
957+ hook . notifyDependencies ( location ) ;
953958 }
954959
955960 static async findRegistrationLocation ( ) {
0 commit comments