@@ -152,8 +152,8 @@ class Dependency {
152152 const compKey = CompositeKeyToDependencies . getLeftFor ( this ) ;
153153 CompositeKeyToDependencies . removeRight ( this ) ;
154154 HooksToDependencies . disconnectAllForDependency ( this ) ;
155-
156- if ( ! CompositeKeyToDependencies . hasLeft ( compKey ) ) {
155+
156+ if ( ! CompositeKeyToDependencies . hasLeft ( compKey ) ) {
157157 ContextAndIdentifierCompositeKey . remove ( compKey ) ;
158158 }
159159 }
@@ -167,9 +167,9 @@ class Dependency {
167167 return [ context , identifier , value ] ;
168168 }
169169
170- notifyAExprs ( location ) {
170+ notifyAExprs ( location , hook ) {
171171 const aexprs = DependenciesToAExprs . getAExprsForDep ( this ) ;
172- DependencyManager . checkAndNotifyAExprs ( aexprs , location ) ;
172+ DependencyManager . checkAndNotifyAExprs ( aexprs , location , this , hook ) ;
173173 }
174174
175175 isMemberDependency ( ) {
@@ -243,6 +243,16 @@ export class AEDebuggingCache {
243243 triplesCallback ( ( await this . getDependencyTriplesForFile ( url ) ) ) ;
244244 }
245245
246+ getTripletsForAE ( ae ) {
247+ const result = [ ] ;
248+ for ( const dependency of DependenciesToAExprs . getDepsForAExpr ( ae ) ) {
249+ for ( const hook of HooksToDependencies . getHooksForDep ( dependency ) ) {
250+ result . push ( { hook, dependency, ae } ) ;
251+ }
252+ }
253+ return result ;
254+ }
255+
246256 /*MD ## Caching MD*/
247257
248258 /*MD ## Code Change API MD*/
@@ -362,13 +372,9 @@ export class AEDebuggingCache {
362372 }
363373
364374 async getDependencyTriplesForFile ( url ) {
365- const result = [ ] ;
375+ let result = [ ] ;
366376 for ( const ae of DependenciesToAExprs . getAEsInFile ( url ) ) {
367- for ( const dependency of DependenciesToAExprs . getDepsForAExpr ( ae ) ) {
368- for ( const hook of HooksToDependencies . getHooksForDep ( dependency ) ) {
369- result . push ( { hook, dependency, ae } ) ;
370- }
371- }
377+ result = result . concat ( this . getTripletsForAE ( ae ) ) ;
372378 }
373379 for ( const hook of await HooksToDependencies . getHooksInFile ( url ) ) {
374380 for ( const dependency of HooksToDependencies . getDepsForHook ( hook ) ) {
@@ -383,6 +389,7 @@ export class AEDebuggingCache {
383389 }
384390 return result ;
385391 }
392+
386393}
387394
388395async function relatedFiles ( dependencies , aexprs ) { }
@@ -436,11 +443,11 @@ const DependenciesToAExprs = {
436443 } ,
437444
438445 getAExprsForDep ( dep ) {
439- if ( ! this . _depsToAExprs . hasLeft ( dep ) ) return [ ] ;
446+ if ( ! this . _depsToAExprs . hasLeft ( dep ) ) return [ ] ;
440447 return Array . from ( this . _depsToAExprs . getRightsFor ( dep ) ) ;
441448 } ,
442449 getDepsForAExpr ( aexpr ) {
443- if ( ! this . _depsToAExprs . hasRight ( aexpr ) ) return [ ] ;
450+ if ( ! this . _depsToAExprs . hasRight ( aexpr ) ) return [ ] ;
444451 return Array . from ( this . _depsToAExprs . getLeftsFor ( aexpr ) ) ;
445452 } ,
446453
@@ -510,16 +517,16 @@ const HooksToDependencies = {
510517 DebuggingCache . updateFiles ( [ ae . meta ( ) . get ( "location" ) . file ] ) ;
511518 }
512519 }
513-
520+
514521 this . _hooksToDeps . removeAllLeftFor ( dep ) ;
515522 } ,
516523
517524 getDepsForHook ( hook ) {
518- if ( ! this . _hooksToDeps . hasLeft ( hook ) ) return [ ] ;
525+ if ( ! this . _hooksToDeps . hasLeft ( hook ) ) return [ ] ;
519526 return Array . from ( this . _hooksToDeps . getRightsFor ( hook ) ) ;
520527 } ,
521528 getHooksForDep ( dep ) {
522- if ( ! this . _hooksToDeps . hasRight ( dep ) ) return [ ] ;
529+ if ( ! this . _hooksToDeps . hasRight ( dep ) ) return [ ] ;
523530 return Array . from ( this . _hooksToDeps . getLeftsFor ( dep ) ) ;
524531 } ,
525532
@@ -588,13 +595,17 @@ class Hook {
588595 this . locations = this . locations . filter ( l => l ) ;
589596 return this . locations ;
590597 }
591-
598+
599+ informationString ( ) {
600+ return "Generic Hook" ;
601+ }
602+
592603 untrack ( ) { }
593604
594- notifyDependencies ( location ) {
605+ notifyDependencies ( location ) {
595606 const loc = location || TracingHandler . findRegistrationLocation ( ) ;
596607 this . addLocation ( loc ) ;
597- HooksToDependencies . getDepsForHook ( this ) . forEach ( dep => dep . notifyAExprs ( loc ) ) ;
608+ HooksToDependencies . getDepsForHook ( this ) . forEach ( dep => dep . notifyAExprs ( loc , this ) ) ;
598609
599610 this . getLocations ( ) . then ( locations => DebuggingCache . updateFiles ( locations . map ( loc => loc . file ) ) ) ;
600611 for ( const dep of HooksToDependencies . getDepsForHook ( this ) ) {
@@ -610,14 +621,18 @@ class Hook {
610621class SourceCodeHook extends Hook {
611622 static getOrCreateFor ( context , identifier ) {
612623 const compKey = ContextAndIdentifierCompositeKey . for ( context , identifier ) ;
613- return CompositeKeyToSourceCodeHook . getOrCreateRightFor ( compKey , key => new SourceCodeHook ( ) ) ;
624+ return CompositeKeyToSourceCodeHook . getOrCreateRightFor ( compKey , key => new SourceCodeHook ( context , identifier ) ) ;
614625 }
615626
616627 static get ( context , identifier ) {
617628 const compKey = ContextAndIdentifierCompositeKey . for ( context , identifier ) ;
618629 return CompositeKeyToSourceCodeHook . getRightFor ( compKey ) ;
619630 }
620-
631+
632+ informationString ( ) {
633+ return "SourceCodeHook: " + this . context + "." + this . identifier ;
634+ }
635+
621636 untrack ( ) {
622637 CompositeKeyToSourceCodeHook . removeRight ( this ) ;
623638 }
@@ -912,9 +927,9 @@ class DependencyManager {
912927 }
913928
914929 // #TODO, #REFACTOR: extract into configurable dispatcher class
915- static checkAndNotifyAExprs ( aexprs , location ) {
930+ static checkAndNotifyAExprs ( aexprs , location , dependency , hook ) {
916931 aexprs . forEach ( aexpr => aexpr . updateDependencies ( ) ) ;
917- aexprs . forEach ( aexpr => aexpr . checkAndNotify ( location ) ) ;
932+ aexprs . forEach ( aexpr => aexpr . checkAndNotify ( location , dependency , hook ) ) ;
918933 }
919934
920935 /**
0 commit comments