aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2017-12-12 18:21:40 +0000
committergingerBill <bill@gingerbill.org>2017-12-12 18:21:40 +0000
commitf7e9649be466ea03f556e2918063c5a4d0d28e2e (patch)
tree254ccca62132e5fae8af7bbf03ffe7fc5b75f0a4 /src/check_stmt.cpp
parentfd1f6ec75cf7e26e2e87f84885e4166cd25cf376 (diff)
Disable struct field reordering (for the time being)
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 17d50fb6d..140e5a5ea 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -1682,6 +1682,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
Entity **entities = gb_alloc_array(c->allocator, Entity *, vd->names.count);
isize entity_count = 0;
+ isize new_name_count = 0;
for_array(i, vd->names) {
AstNode *name = vd->names[i];
Entity *entity = nullptr;
@@ -1694,6 +1695,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
// NOTE(bill): Ignore assignments to '_'
if (!is_blank_ident(str)) {
found = current_scope_lookup_entity(c->context.scope, str);
+ new_name_count += 1;
}
if (found == nullptr) {
entity = make_entity_variable(c->allocator, c->context.scope, token, nullptr, false);
@@ -1721,6 +1723,10 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
entities[entity_count++] = entity;
}
+ if (new_name_count == 0) {
+ error(node, "No new declarations on the lhs");
+ }
+
Type *init_type = nullptr;
if (vd->type != nullptr) {
init_type = check_type(c, vd->type, nullptr);