@@ -49,22 +49,35 @@ public AstBasedPropagation(Map<SymbolV2, Set<Propagation>> propagationsByLhs, Ty
4949 }
5050
5151 public Map <SymbolV2 , Set <PythonType >> processPropagations (Set <SymbolV2 > trackedVars ) {
52- Set <Propagation > propagations = new HashSet <>();
52+ computePropagationDependencies (trackedVars );
53+
5354 Set <SymbolV2 > initializedVars = new HashSet <>();
55+ Set <Propagation > propagations = getTrackedPropagation (trackedVars );
5456
57+ applyPropagations (propagations , initializedVars , true );
58+ applyPropagations (propagations , initializedVars , false );
59+ return propagations .stream ().collect (Collectors .groupingBy (Propagation ::lhsSymbol , Collectors .mapping (Propagation ::rhsType , Collectors .toSet ())));
60+ }
61+
62+ private void computePropagationDependencies (Set <SymbolV2 > trackedVars ) {
5563 propagationsByLhs .forEach ((lhs , props ) -> {
5664 if (trackedVars .contains (lhs )) {
5765 props .stream ()
5866 .filter (Assignment .class ::isInstance )
5967 .map (Assignment .class ::cast )
6068 .forEach (a -> a .computeDependencies (trackedVars ));
61- propagations .addAll (props );
6269 }
6370 });
71+ }
6472
65- applyPropagations (propagations , initializedVars , true );
66- applyPropagations (propagations , initializedVars , false );
67- return propagations .stream ().collect (Collectors .groupingBy (Propagation ::lhsSymbol , Collectors .mapping (Propagation ::rhsType , Collectors .toSet ())));
73+ private Set <Propagation > getTrackedPropagation (Set <SymbolV2 > trackedVars ) {
74+ Set <Propagation > trackedPropagations = new HashSet <>();
75+ propagationsByLhs .forEach ((lhs , propagations ) -> {
76+ if (trackedVars .contains (lhs )) {
77+ trackedPropagations .addAll (propagations );
78+ }
79+ });
80+ return trackedPropagations ;
6881 }
6982
7083 private void applyPropagations (Set <Propagation > propagations , Set <SymbolV2 > initializedVars , boolean checkDependenciesReadiness ) {
0 commit comments