Browse Source

Allow the generation of actions in attributes

Yentl Van Tendeloo 8 years ago
parent
commit
e6ad83198e
1 changed files with 5 additions and 3 deletions
  1. 5 3
      bootstrap/transform.alc

+ 5 - 3
bootstrap/transform.alc

@@ -432,12 +432,14 @@ Void function rewrite(host_model : Element, schedule_model : Element, RHS : Stri
 				func = get_func_AL_model(import_node(value))
 				result = func(host_model, new_mapping[label], mapping)
 
-				if (has_value(result)):
+				if (element_eq(result, read_root())):
+					unset_attribute(host_model, new_mapping[label], string_substr(attribute, string_len("value_"), string_len(attribute) + 1))
+				elif (has_value(result)):
 					// New value defined, so assign!
 					instantiate_attribute(host_model, new_mapping[label], string_substr(attribute, string_len("value_"), string_len(attribute) + 1), result)
 				else:
-					// Non-value return means to destroy the attribute!
-					unset_attribute(host_model, new_mapping[label], string_substr(attribute, string_len("value_"), string_len(attribute) + 1))
+					// Try to interpret as code
+					instantiate_attribute_code(host_model, new_mapping[label], string_substr(attribute, string_len("value_"), string_len(attribute) + 1), result)
 
 		// Do the global action of each element
 		action = read_attribute(schedule_model, RHS_map[label], "action")