aboutsummaryrefslogtreecommitdiff
path: root/src/checker/expr.cpp
diff options
context:
space:
mode:
authorgingerBill <ginger.bill.22@gmail.com>2016-08-15 13:46:01 +0100
committergingerBill <ginger.bill.22@gmail.com>2016-08-15 13:46:01 +0100
commit3ed75b22a357292393618fc684b18a1d167f4eb7 (patch)
tree9233d60f2a870416f09a833ecd31956f375120da /src/checker/expr.cpp
parent0f48a7d299a80c2e461bdcf5b37b5f624a48d7e8 (diff)
string comparisons
Diffstat (limited to 'src/checker/expr.cpp')
-rw-r--r--src/checker/expr.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/checker/expr.cpp b/src/checker/expr.cpp
index bdae13257..204d27819 100644
--- a/src/checker/expr.cpp
+++ b/src/checker/expr.cpp
@@ -41,7 +41,7 @@ void check_struct_type(Checker *c, Type *struct_type, AstNode *node) {
Token name_token = i->token;
// TODO(bill): is the curr_scope correct?
Entity *e = make_entity_field(c->allocator, c->context.scope, name_token, type);
- u64 key = hash_string(name_token.string);
+ HashKey key = hash_string(name_token.string);
if (map_get(&entity_map, key)) {
// TODO(bill): Scope checking already checks the declaration
error(&c->error_collector, name_token, "`%.*s` is already declared in this structure", LIT(name_token.string));
@@ -615,8 +615,10 @@ b32 check_is_expr_vector_index(Checker *c, AstNode *expr) {
expr = unparen_expr(expr);
if (expr->kind == AstNode_IndexExpr) {
ast_node(ie, IndexExpr, expr);
- Type *t = get_base_type(type_of_expr(&c->info, ie->expr));
- return is_type_vector(t);
+ Type *t = type_of_expr(&c->info, ie->expr);
+ if (t != NULL) {
+ return is_type_vector(get_base_type(t));
+ }
}
return false;
}
@@ -1057,7 +1059,7 @@ void check_binary_expr(Checker *c, Operand *x, AstNode *node) {
void update_expr_type(Checker *c, AstNode *e, Type *type, b32 final) {
- u64 key = hash_pointer(e);
+ HashKey key = hash_pointer(e);
ExpressionInfo *found = map_get(&c->info.untyped, key);
if (found == NULL)
return;