diff options
| author | Timon Kruiper <timonkruiper@gmail.com> | 2021-04-05 22:50:54 +0200 |
|---|---|---|
| committer | Timon Kruiper <timonkruiper@gmail.com> | 2021-04-08 14:23:18 +0200 |
| commit | ac14b52e85f857f7f70846d22ea18ea265acb91a (patch) | |
| tree | bceefa15a211ba323fe7645dd69ab6b768f59555 /src/Sema.zig | |
| parent | e85cd616ef6439fdb9e7ac118251bb7c2296e553 (diff) | |
| download | zig-ac14b52e85f857f7f70846d22ea18ea265acb91a.tar.gz zig-ac14b52e85f857f7f70846d22ea18ea265acb91a.zip | |
stage2: add support for start.zig
This adds a simplified start2.zig that the current stage2 compiler is
able to generate code for.
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index b4b4798850..d4c2592446 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -4699,7 +4699,7 @@ fn namedFieldPtr( } // TODO this will give false positives for structs inside the root file - if (container_scope.file_scope == mod.root_scope) { + if (container_scope.file_scope == mod.root_scope.?) { return mod.fail( &block.base, src, @@ -5338,6 +5338,9 @@ fn analyzeImport(sema: *Sema, block: *Scope.Block, src: LazySrcLoc, target_strin .ty = struct_ty, }, }; + if (mem.eql(u8, target_string, "root")) { + sema.mod.root_scope = file_scope; + } sema.mod.analyzeContainer(&file_scope.root_container) catch |err| switch (err) { error.AnalysisFail => { assert(sema.mod.comp.totalErrorCount() != 0); |
