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.
This commit is contained in:
jacob gw 2021-04-06 19:56:54 -04:00 committed by Andrew Kelley
parent 99ec511c4c
commit 0f105ea324

View File

@ -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;
},