Просмотр исходного кода

Handle the case where reverseKeyLookup receives non-existing element

Yentl Van Tendeloo 8 лет назад
Родитель
Сommit
b5eecc3dcf

BIN
bootstrap/bootstrap.m.gz


+ 10 - 8
bootstrap/object_operations.alc

@@ -77,11 +77,12 @@ Element function allOutgoingAssociationInstances(model : Element, source_name :
 	i = 0
 	i = 0
 	while (i < all_out):
 	while (i < all_out):
 		option = reverseKeyLookup(model["model"], read_out(source, i))
 		option = reverseKeyLookup(model["model"], read_out(source, i))
-		if (assoc_name != ""):
-			if (is_nominal_instance(model, option, assoc_name)):
+		if (option != ""):
+			if (assoc_name != ""):
+				if (is_nominal_instance(model, option, assoc_name)):
+					set_add(result, option)
+			else:
 				set_add(result, option)
 				set_add(result, option)
-		else:
-			set_add(result, option)
 		i = i + 1
 		i = i + 1
 
 
 	return result!
 	return result!
@@ -100,11 +101,12 @@ Element function allIncomingAssociationInstances(model : Element, target_name :
 	i = 0
 	i = 0
 	while (i < all_out):
 	while (i < all_out):
 		option = reverseKeyLookup(model["model"], read_in(source, i))
 		option = reverseKeyLookup(model["model"], read_in(source, i))
-		if (assoc_name != ""):
-			if (is_nominal_instance(model, option, assoc_name)):
+		if (option != ""):
+			if (assoc_name != ""):
+				if (is_nominal_instance(model, option, assoc_name)):
+					set_add(result, option)
+			else:
 				set_add(result, option)
 				set_add(result, option)
-		else:
-			set_add(result, option)
 		i = i + 1
 		i = i + 1
 
 
 	return result!
 	return result!

+ 2 - 1
kernel/modelverse_kernel/compiled.py

@@ -22,7 +22,8 @@ def reverseKeyLookupMulti(a, b, **remainder):
 
 
 def reverseKeyLookup(a, b, **remainder):
 def reverseKeyLookup(a, b, **remainder):
     if a is None or b is None:
     if a is None or b is None:
-        print("ERROR @ reverseKeyLookup: " + str(locals()))
+        result, = yield [("CNV", [""])]
+        raise PrimitiveFinished(result)
     edges_out, edges_in = yield [("RO", [a]), ("RI", [b])]
     edges_out, edges_in = yield [("RO", [a]), ("RI", [b])]
     options = set(edges_out) & set(edges_in)
     options = set(edges_out) & set(edges_in)
     if options:
     if options:

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
 
-Date:   Thu Nov 23 11:56:08 2017
+Date:   Fri Nov 24 09:21:18 2017
 
 
 Model author: Yentl Van Tendeloo
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
 Model name:   MvK Server