Minor code reorganization

This commit is contained in:
Ginger Bill
2017-10-08 12:27:03 +01:00
parent 580ee5cc4a
commit 4e42d7df43
5 changed files with 2396 additions and 2437 deletions
+6 -2409
View File
File diff suppressed because it is too large Load Diff
+2383
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -1826,6 +1826,7 @@ void check_procedure_overloading(Checker *c, Entity *e) {
#include "check_expr.cpp"
#include "check_type.cpp"
#include "check_decl.cpp"
#include "check_stmt.cpp"
+6 -14
View File
@@ -2,7 +2,6 @@ struct Scope;
struct Checker;
struct Type;
struct DeclInfo;
// typedef enum BuiltinProcId BuiltinProcId;
#define ENTITY_KINDS \
@@ -51,15 +50,9 @@ enum EntityFlag {
// Zero value means the overloading process is not yet done
enum OverloadKind {
Overload_Unknown,
Overload_No,
Overload_Yes,
};
enum EntityAliasKind {
EntityAlias_Invalid,
EntityAlias_Type,
EntityAlias_Entity,
Overload_Unknown = 0,
Overload_No = 1,
Overload_Yes = 2,
};
@@ -99,7 +92,7 @@ struct Entity {
String link_name;
} Variable;
struct {
bool is_type_alias;
bool is_type_alias;
Type *type_parameter_specialization;
} TypeName;
struct {
@@ -129,7 +122,7 @@ struct Entity {
} LibraryName;
i32 Nil;
struct {
String name;
String name;
AstNode *node;
} Label;
};
@@ -268,8 +261,7 @@ Entity *make_entity_library_name(gbAllocator a, Scope *scope, Token token, Type
Entity *make_entity_nil(gbAllocator a, String name, Type *type) {
Token token = make_token_ident(name);
Entity *entity = alloc_entity(a, Entity_Nil, nullptr, token, type);
Entity *entity = alloc_entity(a, Entity_Nil, nullptr, make_token_ident(name), type);
return entity;
}
-14
View File
@@ -3232,20 +3232,6 @@ irValue *ir_emit_transmute(irProcedure *proc, irValue *value, Type *t) {
return ir_emit_bitcast(proc, value, dst);
}
irValue *ir_emit_down_cast(irProcedure *proc, irValue *value, Type *t) {
GB_ASSERT(is_type_pointer(ir_type(value)));
gbAllocator allocator = proc->module->allocator;
String field_name = check_down_cast_name(t, type_deref(ir_type(value)));
GB_ASSERT(field_name.len > 0);
Selection sel = lookup_field(proc->module->allocator, t, field_name, false);
irValue *bytes = ir_emit_conv(proc, value, t_u8_ptr);
i64 offset_ = type_offset_of_from_selection(allocator, type_deref(t), sel);
irValue *offset = ir_const_int(allocator, -offset_);
irValue *head = ir_emit_ptr_offset(proc, bytes, offset);
return ir_emit_conv(proc, head, t);
}
irValue *ir_emit_union_cast(irProcedure *proc, irValue *value, Type *type, TokenPos pos) {
gbAllocator a = proc->module->allocator;