@@ -1169,34 +1169,23 @@ export abstract class Reactor extends Component {
11691169 return CanConnectResult . RT_CONNECTION_OUTSIDE_CONTAINER ;
11701170 }
11711171
1172- // Take the local graph and merge in all the causality interfaces
1173- // of contained reactors. Then:
1174- const graph = new PrecedenceGraph < Port < unknown > | Reaction < Variable [ ] > > ( ) ;
1175- graph . addAll ( this . _dependencyGraph ) ;
1176-
1177- for ( const r of this . _getOwnReactors ( ) ) {
1178- graph . addAll ( r . _getCausalityInterface ( ) ) ;
1172+ /**
1173+ * TODO (axmmisaka): The following code is commented for multiple reasons:
1174+ * The causality interface check is not fully implemented so new checks are failing
1175+ * Second, direct feedthrough itself would not cause any problem *per se*.
1176+ * To ensure there is no cycle, the safest way is to check against the global dependency graph.
1177+ */
1178+
1179+ let app = this as Reactor ;
1180+ while ( app . _getContainer ( ) !== app ) {
1181+ app = app . _getContainer ( ) ;
11791182 }
1180-
1181- // Add the new edge.
1183+ const graph = app . _getPrecedenceGraph ( ) ;
11821184 graph . addEdge ( src , dst ) ;
1183-
1184- // 1) check for loops
1185- const hasCycle = graph . hasCycle ( ) ;
1186- if ( hasCycle ) {
1185+ if ( graph . hasCycle ( ) ) {
11871186 return CanConnectResult . RT_CYCLE ;
11881187 }
11891188
1190- // 2) check for direct feed through.
1191- // FIXME: This doesn't handle while direct feed thorugh cases.
1192- if (
1193- src instanceof InPort &&
1194- dst instanceof OutPort &&
1195- dst . getContainer ( ) === src . getContainer ( )
1196- ) {
1197- return CanConnectResult . RT_DIRECT_FEED_THROUGH ;
1198- }
1199-
12001189 return CanConnectResult . SUCCESS ;
12011190 }
12021191 }
0 commit comments