瀏覽代碼

Add error message in transformation when no OnSuccess/OnFailure found and required.

Yentl Van Tendeloo 7 年之前
父節點
當前提交
2d412afea2
共有 1 個文件被更改,包括 10 次插入2 次删除
  1. 10 2
      bootstrap/transform.alc

+ 10 - 2
bootstrap/transform.alc

@@ -510,10 +510,18 @@ Boolean function transform_composite(host_model : Element, schedule_model : Elem
 		elif (typename == "ForAll"):
 			result = transform_forall(host_model, schedule_model, current)
 
+		Element result_set
 		if (result):
-			current = set_pop(allAssociationDestinations(schedule_model, current, "OnSuccess"))
+			result_set = allAssociationDestinations(schedule_model, current, "OnSuccess")
 		else:
-			current = set_pop(allAssociationDestinations(schedule_model, current, "OnFailure"))
+			result_set = allAssociationDestinations(schedule_model, current, "OnFailure")
+
+		if (set_len(result_set) == 0):
+			log("ERROR: no next rule found for execution result " + cast_b2s(result))
+		elif (set_len(result_set) > 1):
+			log("WARNING: multiple next rules found for execution result " + cast_b2s(result))
+			log("Picking one at random...")
+		current = set_pop(result_set)
 
 	// No longer a rule, so it is either success or failure
 	if (is_nominal_instance(schedule_model, current, "Success")):