private void CheckWellFormedness(AssertModuleExpr assertExpr) { if (assertExpr.ModuleInfo != null) { return; } //check if the current module is wellformed CheckWellFormedness(assertExpr.ComponentModule); var componentModuleInfo = assertExpr.ComponentModule.ModuleInfo; // check that the observed events of the monitor is a subset of the sends set. foreach (var monitor in assertExpr.SpecMonitors) { if (!monitor.Observes.IsSubsetEqOf(componentModuleInfo.Sends)) { var @event = monitor.Observes.Events.First(e => !componentModuleInfo.Sends.Contains(e)); throw handler.InvalidAssertExpr(assertExpr.SourceLocation, monitor, @event); } } // check if the same monitor has already been attached foreach (var conflictMonitor in componentModuleInfo.MonitorMap.Keys.Where( x => assertExpr.SpecMonitors.Contains(x))) { throw handler.InvalidAssertExpr(assertExpr.SourceLocation, conflictMonitor); } assertExpr.ModuleInfo = new ModuleInfo(); var currentModule = assertExpr.ModuleInfo; //populate the attributes of the module // initialize the monitor map foreach (var mMapItem in componentModuleInfo.MonitorMap) { currentModule.MonitorMap.Add(mMapItem.Key, mMapItem.Value.ToList()); } foreach (var monitor in assertExpr.SpecMonitors) { currentModule.MonitorMap.Add(monitor, componentModuleInfo.InterfaceDef.Select(id => id.Key).ToList()); } // rest of the attributes remain same currentModule.PrivateEvents.AddEvents(componentModuleInfo.PrivateEvents.Events); currentModule.PrivateInterfaces.AddInterfaces(componentModuleInfo.PrivateInterfaces.Interfaces); currentModule.Sends.AddEvents(componentModuleInfo.Sends.Events); currentModule.Receives.AddEvents(componentModuleInfo.Receives.Events); currentModule.Creates.AddInterfaces(componentModuleInfo.Creates.Interfaces); foreach (var linkMapItem in componentModuleInfo .LinkMap) { currentModule.LinkMap[linkMapItem.Key] = new Dictionary <Interface, Interface>(); foreach (var localLinkMap in linkMapItem.Value) { currentModule.LinkMap[linkMapItem.Key].Add(localLinkMap.Key, localLinkMap.Value); } } foreach (var ipItem in componentModuleInfo.InterfaceDef) { currentModule.InterfaceDef.Add(ipItem.Key, ipItem.Value); } }