Browse Source

Cache some intermediate values in read_attribute

Yentl Van Tendeloo 7 years ago
parent
commit
523ebe6bae
2 changed files with 9 additions and 4 deletions
  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
 		Element elem
 		String name
 		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)
 		count = read_nr_out(elem)
 
 
 		i = 0
 		i = 0
 		while (i < count):
 		while (i < count):
 			edge = read_out(elem, i)
 			edge = read_out(elem, i)
-			name = reverseKeyLookup(model["model"], edge)
+			name = reverseKeyLookup(model_dict, edge)
 			if (name != ""):
 			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))):
 				if (element_eq(edge_type, dict_read_edge(read_edge_src(edge_type), attribute))):
 					return read_edge_dst(edge)!
 					return read_edge_dst(edge)!
 			i = i + 1
 			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)
 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 author: Yentl Van Tendeloo
 Model name:   MvK Server
 Model name:   MvK Server