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