瀏覽代碼

fixed #566 - avoid creation of calls to null

Axel Terfloth 9 年之前
父節點
當前提交
1fa4ba63cd

+ 11 - 2
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/BehaviorMapping.xtend

@@ -51,6 +51,7 @@ import org.yakindu.sct.model.stext.stext.ReactionTrigger
 import org.yakindu.sct.model.stext.stext.RegularEventSpec
 import org.yakindu.sct.model.stext.stext.TimeEventSpec
 import org.yakindu.base.expressions.expressions.ExpressionsFactory
+import java.util.Collection
 
 class BehaviorMapping {
 
@@ -603,12 +604,20 @@ class BehaviorMapping {
 					s.addEnterStepsForTargetsToSequence(targets, seq)
 			}
 		} else {
-			//in the case only sibling regions contain targets the region must be entered using the defaut enter sequence
-			seq.steps.add(it.enterSequences.defaultSequence.newCall)
+			// in the case only sibling regions contain targets the region must be entered 
+			// using the defaut enter sequence, if this exists
+			it.enterSequences.defaultSequence?.newCall?.addTo(seq.steps)
 		}
 	}
 	
 	
+	/** TODO: move... */
+	def <T> Collection<T> addTo(T it, Collection<T> c) {
+		c.add(it);
+		c
+	}
+	
+	
 	def dispatch Set<ExecutionNode> allNodes(ExecutionRegion it) {
 		val allNodes = new HashSet<ExecutionNode>()
 		allNodes.addAll(nodes)

+ 1 - 1
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/SexecElementMapping.xtend

@@ -238,7 +238,7 @@ import org.yakindu.base.types.Event
 	} 
 
 	def Call newCall(Step step) {
-//	  if (step ==  null) throw new IllegalArgumentException("Attempt to create 'null' call.")
+		if (step ==  null) throw new IllegalArgumentException("Attempt to create 'null' call.")
 		val r = sexecFactory.createCall
 		r.step = step
 		r