فهرست منبع

Fixed some library functions when instantiating an anonymous object

Yentl Van Tendeloo 8 سال پیش
والد
کامیت
b6f6c98f2d
2فایلهای تغییر یافته به همراه6 افزوده شده و 8 حذف شده
  1. BIN
      bootstrap/bootstrap.m.gz
  2. 6 8
      bootstrap/modelling.alc

BIN
bootstrap/bootstrap.m.gz


+ 6 - 8
bootstrap/modelling.alc

@@ -102,7 +102,7 @@ String function instantiate_node(model : Element, type_name : String, instance_n
 	String actual_name
 
 	actual_name = model_add_node(model, instance_name)
-	retype(model, instance_name, type_name)
+	retype(model, actual_name, type_name)
 
 	return actual_name!
 
@@ -172,8 +172,11 @@ Void function instantiate_attribute(model : Element, element : String, attribute
 		log("Could not find attribute " + cast_v2s(attribute_name))
 		return!
 		
-	attr_name = model_add_value(model, (element + ".") + attribute_name, value)
-	retype(model, attr_name, reverseKeyLookup(model["metamodel"]["model"], read_edge_dst(model["metamodel"]["model"][attr_type])))
+	if (set_in_node(model["model"], value)):
+		attr_name = reverseKeyLookup(model["model"], value)
+	else:
+		attr_name = model_add_value(model, (element + ".") + attribute_name, value)
+		retype(model, attr_name, reverseKeyLookup(model["metamodel"]["model"], read_edge_dst(model["metamodel"]["model"][attr_type])))
 	instantiate_link(model, attr_type, "", element, attr_name)
 
 	return!
@@ -275,7 +278,6 @@ Void function add_AL_links(model : Element, list : Element, element : Element, t
 	return!
 
 String function add_AL(model : Element, element : Element):
-	log("Adding constraint: " + cast_e2s(element))
 	Element todo
 	Element node
 	Element work_node
@@ -294,7 +296,6 @@ String function add_AL(model : Element, element : Element):
 		type = list_read(work_node, 1)
 
 		if (bool_not(set_in_node(model["model"], elem))):
-			log("Adding")
 			// Determine the type if we don't know it
 			if (type == ""):
 				if (is_physical_action(elem)):
@@ -350,8 +351,6 @@ String function add_AL(model : Element, element : Element):
 				add_AL_links(model, todo, elem, type, "params", "param")
 				add_AL_links(model, todo, elem, type, "last_param", "param")
 				add_AL_links(model, todo, elem, type, "next", "")
-		else:
-			log("Already in there")
 
 	return reverseKeyLookup(model["model"], element)!
 
@@ -414,7 +413,6 @@ Void function construct_model():
 		elif (command == "import_node"):
 			Element m
 			m = import_node(input())
-			log("Imported node " + cast_e2s(m))
 			dict_add(global_models, input(), m)
 		else:
 			log("Modelling error: did not understand command " + command)