aboutsummaryrefslogtreecommitdiff
path: root/src/checker.c
diff options
context:
space:
mode:
authorZac Pierson <zacpiersonhehe@gmail.com>2017-02-20 10:14:52 -0600
committerZac Pierson <zacpiersonhehe@gmail.com>2017-02-20 10:14:52 -0600
commit8d5896ab7e1b069135c25f7ae75ea8a806789a81 (patch)
tree473e8a53fdc1c4324e5f06f0420b5b55a21a493f /src/checker.c
parent802b1a70f881968f4e96eb8bbec9f072b4de2892 (diff)
parenta94dfdf21d798bc72bbee0cc04b80149f0d4b8d2 (diff)
Merge https://github.com/gingerBill/Odin
Diffstat (limited to 'src/checker.c')
-rw-r--r--src/checker.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/checker.c b/src/checker.c
index 3bb76245f..5521abfda 100644
--- a/src/checker.c
+++ b/src/checker.c
@@ -30,6 +30,7 @@ typedef enum BuiltinProcId {
BuiltinProc_reserve,
BuiltinProc_clear,
BuiltinProc_append,
+ BuiltinProc_delete,
BuiltinProc_size_of,
BuiltinProc_size_of_val,
@@ -73,6 +74,7 @@ gb_global BuiltinProc builtin_procs[BuiltinProc_Count] = {
{STR_LIT("reserve"), 2, false, Expr_Stmt},
{STR_LIT("clear"), 1, false, Expr_Stmt},
{STR_LIT("append"), 1, true, Expr_Expr},
+ {STR_LIT("delete"), 2, false, Expr_Stmt},
{STR_LIT("size_of"), 1, false, Expr_Expr},
{STR_LIT("size_of_val"), 1, false, Expr_Expr},
@@ -259,6 +261,7 @@ typedef struct DelayedDecl {
} DelayedDecl;
typedef struct CheckerContext {
+ Scope * file_scope;
Scope * scope;
DeclInfo * decl;
u32 stmt_state_flags;
@@ -1016,6 +1019,7 @@ void add_curr_ast_file(Checker *c, AstFile *file) {
c->curr_ast_file = file;
c->context.decl = file->decl_info;
c->context.scope = file->scope;
+ c->context.file_scope = file->scope;
}
}
@@ -1242,6 +1246,9 @@ void check_procedure_overloading(Checker *c, Entity *e) {
ProcTypeOverloadKind kind = are_proc_types_overload_safe(p->type, q->type);
switch (kind) {
case ProcOverload_Identical:
+ error(p->token, "Overloaded procedure `%.*s` as the same type as another procedure in this scope", LIT(name));
+ is_invalid = true;
+ break;
case ProcOverload_CallingConvention:
error(p->token, "Overloaded procedure `%.*s` as the same type as another procedure in this scope", LIT(name));
is_invalid = true;
@@ -1746,6 +1753,8 @@ void check_import_entities(Checker *c, MapScope *file_scopes) {
Entity *e = make_entity_import_name(c->allocator, parent_scope, id->import_name, t_invalid,
id->fullpath, id->import_name.string,
scope);
+
+
add_entity(c, parent_scope, NULL, e);
}
}