Browse Source

Fixed resolution problem for globals not present in the map

Yentl Van Tendeloo 9 years ago
parent
commit
4c43730fc1
2 changed files with 61051 additions and 60456 deletions
  1. 61038 60452
      bootstrap/bootstrap.m
  2. 13 4
      bootstrap/constructors.alc

File diff suppressed because it is too large
+ 61038 - 60452
bootstrap/bootstrap.m


+ 13 - 4
bootstrap/constructors.alc

@@ -172,8 +172,16 @@ Action function construct_access():
 
 Action function construct_resolve():
 	Action this_element
+	Element linked_element
+	String name
+
 	this_element = create_value(!resolve)
-	dict_add(this_element, "var", dict_read(variable_map, input()))
+	name = input()
+	if dict_in(variable_map, name):
+		linked_element = variable_map[name]
+	else:
+		linked_element = name
+	dict_add(this_element, "var", linked_element)
 	return this_element
 
 Action function construct_assign():
@@ -239,10 +247,13 @@ Action function construct_const():
 Action function construct_declare():
 	Action this_element
 	Element declared_element
+	String name
+
 	this_element = create_value(!declare)
 	declared_element = create_node()
 	dict_add(this_element, "var", declared_element)
-	dict_add(variable_map, input(), declared_element)
+	name = input()
+	dict_add(variable_map, name, declared_element)
 	if (input()):
 		dict_add(this_element, "next", construct_unknown())
 	return this_element
@@ -286,12 +297,10 @@ Action function construct_function():
 	Element params
 	String arg_names_decl
 
-	log("Constructing function")
 	while (value_neq(input(), "funcdef")):
 		// We skip over everything that is not a funcdef, as these are all just definitions of global stuff
 		log("Skip over input!")
 
-	log("Reading name of function")
 	// Consume the name
 	input()