about summary refs log tree commit diff
path: root/src/bootstrap/codegen.pry
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap/codegen.pry')
-rw-r--r--src/bootstrap/codegen.pry15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/bootstrap/codegen.pry b/src/bootstrap/codegen.pry
index 9363265..858ebfa 100644
--- a/src/bootstrap/codegen.pry
+++ b/src/bootstrap/codegen.pry
@@ -170,6 +170,14 @@ let codegen_get_llvm_type = (c: *codegen, node: *Node) => *LLVMTypeRef {
 			return r;
 		};
 
+		let v = environment_get_variable((*c).environment, simple_type.name);
+		if (v != cast(*Variable, null)) {
+			assert((*v).type != cast(LLVMTypeRef, null));
+			let r = cast(*LLVMTypeRef, arena_alloc((*c).arena, sizeof(LLVMTypeRef)));
+			*r = (*v).type;
+			return r;
+		};
+
 		printf("NO SIMPLE TYPE %s!\n", simple_type.name);
 		assert(false);
 	};
@@ -783,6 +791,13 @@ let codegen_generate_expression_value = (c: *codegen, expression: *Node, name: *
 		v.node_type = simple_type_node;
 		return codegen_create_variable(c, v);
 	};
+	
+	if ((*expression).type == NODE_STRUCT_INSTANCIATION) {
+		let struc_data = *cast(*NODE_STRUCT_INSTANCIATION_DATA, (*expression).data);
+		let v = environment_get_variable((*c).environment, struc_data.typ);
+		assert(v != cast(*Variable, null));
+		return v;
+	};
 
 	printf("ASSERT 1: %d\n", (*expression).type);
 	assert(false);