Commit 0f105ea324

jacob gw <jacoblevgw@gmail.com>
2021-04-07 01:56:54
stage2: fix bug where a parser error would break errors
A parser error would deinit the tree, but the tree is needed for the node locations. This removes the offending code written before node locations.
1 parent 99ec511
Changed files (1)
src/Module.zig
@@ -3219,9 +3219,7 @@ pub fn getAstTree(mod: *Module, root_scope: *Scope.File) !*const ast.Tree {
 
             const source = try root_scope.getSource(mod);
 
-            var keep_tree = false;
             root_scope.tree = try std.zig.parse(mod.gpa, source);
-            defer if (!keep_tree) root_scope.tree.deinit(mod.gpa);
 
             const tree = &root_scope.tree;
 
@@ -3249,7 +3247,6 @@ pub fn getAstTree(mod: *Module, root_scope: *Scope.File) !*const ast.Tree {
             }
 
             root_scope.status = .loaded_success;
-            keep_tree = true;
 
             return tree;
         },