Selaa lähdekoodia

Cache some intermediate values in read_attribute

Yentl Van Tendeloo 7 vuotta sitten
vanhempi
commit
523ebe6bae
2 muutettua tiedostoa jossa 9 lisäystä ja 4 poistoa
  1. 8 3
      bootstrap/modelling.alc
  2. 1 1
      wrappers/modelverse_SCCD.py

+ 8 - 3
bootstrap/modelling.alc

@@ -417,15 +417,20 @@ Element function read_attribute(model : Element, element : String, attribute : S
 		Element elem
 		String name
 
-		elem = model["model"][element]
+		Element model_dict
+		Element mm_dict
+		model_dict = model["model"]
+		mm_dict = model["metamodel"]["model"]
+
+		elem = model_dict[element]
 		count = read_nr_out(elem)
 
 		i = 0
 		while (i < count):
 			edge = read_out(elem, i)
-			name = reverseKeyLookup(model["model"], edge)
+			name = reverseKeyLookup(model_dict, edge)
 			if (name != ""):
-				edge_type = model["metamodel"]["model"][read_type(model, name)]
+				edge_type = mm_dict[read_type(model, name)]
 				if (element_eq(edge_type, dict_read_edge(read_edge_src(edge_type), attribute))):
 					return read_edge_dst(edge)!
 			i = i + 1

+ 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)
 
-Date:   Thu May 24 09:33:04 2018
+Date:   Thu May 24 10:31:08 2018
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server