diff options
| author | J.C. Moyer <jcmoyer32@gmail.com> | 2021-06-28 17:31:47 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-07-02 14:08:52 -0400 |
| commit | d84b386f6034278c8a9e8c3d2b0975ac541584aa (patch) | |
| tree | 279ab79fca1601c226a509b3a3a6bbdf0fbf477c /src/main.zig | |
| parent | 7140bb64e1aa77f6b6de5c7e4f78d880346c0747 (diff) | |
| download | zig-d84b386f6034278c8a9e8c3d2b0975ac541584aa.tar.gz zig-d84b386f6034278c8a9e8c3d2b0975ac541584aa.zip | |
stage2: print valid filename in error messages
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig index 5d58b86390..902d893169 100644 --- a/src/main.zig +++ b/src/main.zig @@ -3117,6 +3117,9 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void { .root_decl = null, }; + file.pkg = try Package.create(gpa, null, file.sub_file_path); + defer file.pkg.destroy(gpa); + file.zir = try AstGen.generate(gpa, file.tree); file.zir_loaded = true; defer file.zir.deinit(gpa); @@ -3309,6 +3312,9 @@ fn fmtPathFile( .root_decl = null, }; + file.pkg = try Package.create(fmt.gpa, null, file.sub_file_path); + defer file.pkg.destroy(fmt.gpa); + if (stat.size > max_src_size) return error.FileTooBig; @@ -3901,6 +3907,9 @@ pub fn cmdAstCheck( file.stat_size = source.len; } + file.pkg = try Package.create(gpa, null, file.sub_file_path); + defer file.pkg.destroy(gpa); + file.tree = try std.zig.parse(gpa, file.source); file.tree_loaded = true; defer file.tree.deinit(gpa); @@ -4017,6 +4026,9 @@ pub fn cmdChangelist( .root_decl = null, }; + file.pkg = try Package.create(gpa, null, file.sub_file_path); + defer file.pkg.destroy(gpa); + const source = try arena.allocSentinel(u8, @intCast(usize, stat.size), 0); const amt = try f.readAll(source); if (amt != stat.size) |
