Browse Source

Minor tweaks

Yentl Van Tendeloo 8 years ago
parent
commit
fbefc3083a
1 changed files with 8 additions and 6 deletions
  1. 8 6
      bootstrap/typing.alc

+ 8 - 6
bootstrap/typing.alc

@@ -21,7 +21,8 @@ Element function get_type_mapping(model : Element):
 		edge = create_edge(m, mm)
 
 		dict_add_fast(tm_model, cast_id2s(m), m)
-		dict_add_fast(tm_model, cast_id2s(mm), mm)
+		if (bool_not(dict_in(tm_model, cast_id2s(mm)))):
+			dict_add_fast(tm_model, cast_id2s(mm), mm)
 		dict_add_fast(tm_model, cast_id2s(edge), edge)
 
 	return tm_model!
@@ -41,11 +42,12 @@ Void function set_type_mapping(model : Element, type_mapping_model : Element):
 
 	while (set_len(keys) > 0):
 		key = set_pop(keys)
-		if (bool_not(bool_or(dict_in(rev_model, cast_id2s(type_mapping_model[key])), dict_in(rev_metamodel, cast_id2s(type_mapping_model[key]))))):
-			// Element is in neither model or metamodel
-			// Must be a typing link!
-			// So add it
-			dict_add_fast(type_mapping, rev_model[cast_id2s(read_edge_src(type_mapping_model[key]))], rev_metamodel[cast_id2s(read_edge_dst(type_mapping_model[key]))])
+		if (is_edge(type_mapping_model[key])):
+			if (bool_not(bool_or(dict_in(rev_model, cast_id2s(type_mapping_model[key])), dict_in(rev_metamodel, cast_id2s(type_mapping_model[key]))))):
+				// Element is in neither model or metamodel
+				// Must be a typing link!
+				// So add it
+				dict_add_fast(type_mapping, rev_model[cast_id2s(read_edge_src(type_mapping_model[key]))], rev_metamodel[cast_id2s(read_edge_dst(type_mapping_model[key]))])
 
 	dict_overwrite(model, "type_mapping", type_mapping)
 	return!