aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-04-08 11:29:31 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-04-08 11:29:31 -0700
commitb9e508c410cd077d704a73418281f6d7839df241 (patch)
tree1ec79de1aebed48460a5e87170a7cbbce99c0dcd /src/Module.zig
parenta483e38df62f73dc0cdadee6faf3e083094210d4 (diff)
downloadzig-b9e508c410cd077d704a73418281f6d7839df241.tar.gz
zig-b9e508c410cd077d704a73418281f6d7839df241.zip
stage2: revert to only has_decl and export ZIR support
Reverting most of the code from the previous commits in this branch. Will pull in the code with modifications bit by bit.
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/Module.zig b/src/Module.zig
index dab3319b2e..933917d948 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -35,11 +35,8 @@ comp: *Compilation,
zig_cache_artifact_directory: Compilation.Directory,
/// Pointer to externally managed resource. `null` if there is no zig file being compiled.
root_pkg: *Package,
-/// This is populated when `@import("root")` is analysed.
-root_scope: ?*Scope.File,
-start_pkg: *Package,
/// Module owns this resource.
-start_scope: *Scope.File,
+root_scope: *Scope.File,
/// It's rare for a decl to be exported, so we save memory by having a sparse map of
/// Decl pointers to details about them being exported.
/// The Export memory is owned by the `export_owners` table; the slice itself is owned by this table.
@@ -2344,9 +2341,7 @@ pub fn deinit(mod: *Module) void {
mod.export_owners.deinit(gpa);
mod.symbol_exports.deinit(gpa);
-
- mod.start_scope.destroy(gpa);
- mod.start_pkg.destroy(gpa);
+ mod.root_scope.destroy(gpa);
var it = mod.global_error_set.iterator();
while (it.next()) |entry| {
@@ -2518,7 +2513,6 @@ fn astgenAndSemaDecl(mod: *Module, decl: *Decl) !bool {
const block_expr = node_datas[decl_node].lhs;
_ = try AstGen.comptimeExpr(&gen_scope, &gen_scope.base, .none, block_expr);
- _ = try gen_scope.addBreak(.break_inline, gen_scope.break_block, .void_value);
const code = try gen_scope.finish();
if (std.builtin.mode == .Debug and mod.comp.verbose_ir) {
@@ -2863,9 +2857,8 @@ fn astgenAndSemaFn(
_ = try AstGen.expr(&gen_scope, params_scope, .none, body_node);
- const inst_tags = astgen.instructions.items(.tag);
- if (inst_tags.len == 0 or
- !inst_tags[inst_tags.len - 1]
+ if (gen_scope.instructions.items.len == 0 or
+ !astgen.instructions.items(.tag)[gen_scope.instructions.items.len - 1]
.isNoReturn())
{
// astgen uses result location semantics to coerce return operands.