Browse Source

Fix import name exportation bug; Fix procedure type printing

gingerBill 8 years ago
parent
commit
f0980c0a98
2 changed files with 12 additions and 12 deletions
  1. 3 3
      src/check_expr.cpp
  2. 9 9
      src/ir_print.cpp

+ 3 - 3
src/check_expr.cpp

@@ -4630,10 +4630,10 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
 
 			bool implicit_is_found = is_entity_implicitly_imported(e, entity);
 			bool is_not_exported = !is_entity_exported(entity);
-			if (!implicit_is_found) {
-				is_not_exported = false;
-			} else if (entity->kind == Entity_ImportName) {
+			if (entity->kind == Entity_ImportName) {
 				is_not_exported = true;
+			} else if (!implicit_is_found) {
+				is_not_exported = false;
 			}
 
 			if (is_not_exported) {

+ 9 - 9
src/ir_print.cpp

@@ -183,10 +183,9 @@ void ir_print_proc_type_without_pointer(irFileBuffer *f, irModule *m, Type *t) {
 	ir_fprintf(f, " (");
 	if (t->Proc.return_by_pointer) {
 		ir_print_type(f, m, reduce_tuple_to_single_type(t->Proc.results));
-		ir_fprintf(f, "* sret noalias ");
-		if (param_count > 0) {
-			ir_fprintf(f, ", ");
-		}
+		// ir_fprintf(f, "* sret noalias ");
+		ir_fprintf(f, "* noalias ");
+		if (param_count > 0) ir_fprintf(f, ", ");
 	}
 	isize param_index = 0;
 	for (isize i = 0; i < param_count; i++) {
@@ -333,12 +332,16 @@ void ir_print_type(irFileBuffer *f, irModule *m, Type *t) {
 
 
 	case Type_Named:
-		if (is_type_struct(t) || is_type_union(t)) {
+		switch (base_type(t)->kind) {
+		case Type_Struct:
+		case Type_Union: {
 			String *name = map_get(&m->entity_names, hash_pointer(t->Named.type_name));
 			GB_ASSERT_MSG(name != nullptr, "%.*s %p", LIT(t->Named.name), t->Named.type_name);
 			ir_print_encoded_local(f, *name);
-		} else {
+		} break;
+		default:
 			ir_print_type(f, m, base_type(t));
+			break;
 		}
 		return;
 	case Type_Tuple:
@@ -1718,9 +1721,6 @@ void ir_print_proc(irFileBuffer *f, irModule *m, irProcedure *proc) {
 void ir_print_type_name(irFileBuffer *f, irModule *m, irValue *v) {
 	GB_ASSERT(v->kind == irValue_TypeName);
 	Type *bt = base_type(ir_type(v));
-	if (!is_type_struct(bt) && !is_type_union(bt)) {
-		return;
-	}
 	ir_print_encoded_local(f, v->TypeName.name);
 	ir_fprintf(f, " = type ");
 	ir_print_type(f, m, base_type(v->TypeName.type));