aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-11-17 22:58:00 +0000
committerGinger Bill <bill@gingerbill.org>2016-11-17 22:58:00 +0000
commit24ca1065214f51cfbeb9c0eff98002c7d33139a2 (patch)
treef8504275c6b20ac4a3aaa47d7d7f6b982f8aabe0 /src
parent4895031df56c8378db756db8d330f5cb07d4b14a (diff)
v0.0.3 Build
Diffstat (limited to 'src')
-rw-r--r--src/checker/expr.cpp3
-rw-r--r--src/ssa.cpp9
-rw-r--r--src/tokenizer.cpp10
3 files changed, 14 insertions, 8 deletions
diff --git a/src/checker/expr.cpp b/src/checker/expr.cpp
index b0b7a0f9c..1d9cad048 100644
--- a/src/checker/expr.cpp
+++ b/src/checker/expr.cpp
@@ -92,7 +92,7 @@ b32 check_is_assignable_to(Checker *c, Operand *operand, Type *type, b32 is_argu
if (is_type_maybe(dst)) {
Type *elem = base_type(dst)->Maybe.elem;
- return are_types_identical(elem, src);
+ return are_types_identical(elem, s);
}
if (is_type_untyped_nil(src)) {
@@ -2458,6 +2458,7 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node) {
GB_ASSERT(entity->type != NULL);
b32 is_not_exported = !is_entity_exported(entity);
+ // TODO(bill): Fix this for `#import "file.odin" as .`
if (is_not_exported) {
auto found = map_get(&e->ImportName.scope->implicit, hash_string(sel_name));
if (!found && e->ImportName.scope != entity->scope) {
diff --git a/src/ssa.cpp b/src/ssa.cpp
index 47b81a8e0..a63000762 100644
--- a/src/ssa.cpp
+++ b/src/ssa.cpp
@@ -1722,6 +1722,8 @@ ssaValue *ssa_emit_deep_field_gep(ssaProcedure *proc, Type *type, ssaValue *e, S
e = ssa_emit_struct_ep(proc, e, index);
} else if (type->kind == Type_Vector) {
e = ssa_emit_array_ep(proc, e, index);
+ } else if (type->kind == Type_Array) {
+ e = ssa_emit_array_ep(proc, e, index);
} else {
GB_PANIC("un-gep-able type");
}
@@ -5098,6 +5100,9 @@ void ssa_gen_tree(ssaGen *s) {
ssaValue *count = ssa_emit_struct_ep(proc, tag, 2);
ssa_emit_store(proc, count, ssa_make_const_int(a, t->Vector.count));
+ ssaValue *align = ssa_emit_struct_ep(proc, tag, 3);
+ ssa_emit_store(proc, count, ssa_make_const_int(a, type_align_of(m->sizes, a, t)));
+
} break;
case Type_Record: {
switch (t->Record.kind) {
@@ -5245,8 +5250,8 @@ void ssa_gen_tree(ssaGen *s) {
}
for (isize i = 0; i < count; i++) {
- ssaValue *value_gep = ssa_emit_struct_ep(proc, value_array, i);
- ssaValue *name_gep = ssa_emit_struct_ep(proc, name_array, i);
+ ssaValue *value_gep = ssa_emit_array_ep(proc, value_array, i);
+ ssaValue *name_gep = ssa_emit_array_ep(proc, name_array, i);
ssa_emit_store(proc, value_gep, ssa_make_const_i64(a, fields[i]->Constant.value.value_integer));
ssa_emit_store(proc, name_gep, ssa_make_const_string(a, fields[i]->token.string));
diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp
index 4e0cc5791..d0f14990a 100644
--- a/src/tokenizer.cpp
+++ b/src/tokenizer.cpp
@@ -38,6 +38,9 @@ TOKEN_KIND(Token__OperatorBegin, "_OperatorBegin"), \
TOKEN_KIND(Token_Prime, "'"), \
TOKEN_KIND(Token_DoublePrime, "''"), \
\
+ TOKEN_KIND(Token_CmpAnd, "&&"), \
+ TOKEN_KIND(Token_CmpOr, "||"), \
+\
TOKEN_KIND(Token__AssignOpBegin, "_AssignOpBegin"), \
TOKEN_KIND(Token_AddEq, "+="), \
TOKEN_KIND(Token_SubEq, "-="), \
@@ -50,17 +53,14 @@ TOKEN_KIND(Token__AssignOpBegin, "_AssignOpBegin"), \
TOKEN_KIND(Token_AndNotEq, "&~="), \
TOKEN_KIND(Token_ShlEq, "<<="), \
TOKEN_KIND(Token_ShrEq, ">>="), \
+ TOKEN_KIND(Token_CmpAndEq, "&&="), \
+ TOKEN_KIND(Token_CmpOrEq, "||="), \
TOKEN_KIND(Token__AssignOpEnd, "_AssignOpEnd"), \
TOKEN_KIND(Token_Increment, "++"), \
TOKEN_KIND(Token_Decrement, "--"), \
TOKEN_KIND(Token_ArrowRight, "->"), \
TOKEN_KIND(Token_ArrowLeft, "<-"), \
\
- TOKEN_KIND(Token_CmpAnd, "&&"), \
- TOKEN_KIND(Token_CmpOr, "||"), \
- TOKEN_KIND(Token_CmpAndEq, "&&="), \
- TOKEN_KIND(Token_CmpOrEq, "||="), \
-\
TOKEN_KIND(Token__ComparisonBegin, "_ComparisonBegin"), \
TOKEN_KIND(Token_CmpEq, "=="), \
TOKEN_KIND(Token_NotEq, "!="), \