aboutsummaryrefslogtreecommitdiff
path: root/src/checker.c
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-02-11 21:20:57 +0000
committerGinger Bill <bill@gingerbill.org>2017-02-11 21:20:57 +0000
commite1fdd675cebc6e6dad50a359d8908c779a6d69b5 (patch)
tree76c5d3a0c34e2ea3c2100545a683ef3b2e797425 /src/checker.c
parent4306345ff10e9f8225b156633aa986fee3f97987 (diff)
v0.1.0v0.1.0
Added: * Dynamic Arrays `[...]Type` * Dynamic Maps `map[Key]Value` * Dynamic array and map literals * Custom struct alignemnt `struct #align 8 { bar: i8 }` * Allow `_` in numbers * Variadic `append` * fmt.sprint* * Entities prefixes with an underscore do not get exported on imports * Overloaded `free` for pointers, slices, strings, dynamic arrays, and dynamic maps * enum types have an implict `names` field, a []string of all the names in that enum Removed: * Maybe/option types * immutable variables * Remove `type` keyword and other "reserved" keywords * `compile_assert` and `assert`return the value of the condition for semantic reasons Changed: * thread_local -> #thread_local * #include -> #load * Files only get checked if they are actually used * match x in y {} // For type match statements * Version numbering now starts from 0.1.0 and uses the convention: - major.minor.patch Fixes: * Many fmt.* fixes To come very Soon™: * Linux and OS X builds (unofficial ones do exist already)
Diffstat (limited to 'src/checker.c')
-rw-r--r--src/checker.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/checker.c b/src/checker.c
index 7f1d74f0d..657df6f57 100644
--- a/src/checker.c
+++ b/src/checker.c
@@ -1470,7 +1470,7 @@ void check_collect_entities(Checker *c, AstNodeArray nodes, bool is_file_scope)
if (id->is_import) {
error_node(decl, "#import declarations are only allowed in the file scope");
} else {
- error_node(decl, "#include declarations are only allowed in the file scope");
+ error_node(decl, "#load declarations are only allowed in the file scope");
}
// NOTE(bill): _Should_ be caught by the parser
// TODO(bill): Better error handling if it isn't
@@ -1686,7 +1686,7 @@ void check_import_entities(Checker *c, MapScope *file_scopes) {
if (!previously_added) {
array_add(&parent_scope->imported, scope);
} else {
- warning(token, "Multiple #import of the same file within this scope");
+ warning(token, "Multiple import of the same file within this scope");
}
scope->has_been_imported = true;
@@ -1698,24 +1698,19 @@ void check_import_entities(Checker *c, MapScope *file_scopes) {
if (e->scope == parent_scope) {
continue;
}
- switch (e->kind) {
- case Entity_ImportName:
- case Entity_LibraryName:
- break;
- default: {
-
- if (id->is_import) {
- if (is_entity_name_exported(e)) {
- // TODO(bill): Should these entities be imported but cause an error when used?
- bool ok = add_entity(c, parent_scope, NULL, e);
- if (ok) {
- map_bool_set(&parent_scope->implicit, hash_pointer(e), true);
- }
+ if (!is_entity_kind_exported(e->kind)) {
+ continue;
+ }
+ if (id->is_import) {
+ if (is_entity_exported(e)) {
+ // TODO(bill): Should these entities be imported but cause an error when used?
+ bool ok = add_entity(c, parent_scope, NULL, e);
+ if (ok) {
+ map_bool_set(&parent_scope->implicit, hash_pointer(e), true);
}
- } else {
- /* bool ok = */add_entity(c, parent_scope, NULL, e);
}
- } break;
+ } else {
+ add_entity(c, parent_scope, NULL, e);
}
}
} else {