aboutsummaryrefslogtreecommitdiff
path: root/src/AstGen.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-08-28 15:35:59 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-09-01 17:54:06 -0700
commit332eafeb7f3d866556ab767b960a04661bc43bc7 (patch)
treed299cbc233ca756ca42885e66f54e2b08f2a3d9a /src/AstGen.zig
parentc05a20fc8c36742dab8792d15e79716da1a55759 (diff)
downloadzig-332eafeb7f3d866556ab767b960a04661bc43bc7.tar.gz
zig-332eafeb7f3d866556ab767b960a04661bc43bc7.zip
stage2: first pass at implementing usingnamespace
Ran into a design flaw here which will need to get solved by having AstGen annotate ZIR with which instructions are closed over.
Diffstat (limited to 'src/AstGen.zig')
-rw-r--r--src/AstGen.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig
index 245e40c3a1..c96a97ddeb 100644
--- a/src/AstGen.zig
+++ b/src/AstGen.zig
@@ -6416,6 +6416,9 @@ fn identifier(
},
.top => break,
};
+ if (found_already == null) {
+ return astgen.failNode(ident, "use of undeclared identifier '{s}'", .{ident_name});
+ }
// Decl references happen by name rather than ZIR index so that when unrelated
// decls are modified, ZIR code containing references to them can be unmodified.
@@ -10052,7 +10055,7 @@ fn isPrimitive(name: []const u8) bool {
}
}
-/// Local variables shadowing detection, including function parameters and primitives.
+/// Local variables shadowing detection, including function parameters.
fn detectLocalShadowing(
astgen: *AstGen,
scope: *Scope,