diff options
| author | Lachlan Easton <lachlan@lakebythewoods.xyz> | 2020-04-14 18:42:25 +1000 |
|---|---|---|
| committer | Lachlan Easton <lachlan@lakebythewoods.xyz> | 2020-04-14 22:13:43 +1000 |
| commit | 0122f2cff6fd44b08b17214e8535e8afba3d4985 (patch) | |
| tree | a866be9d8e678876d5baabf53d37a55a28c31ce5 /lib/std | |
| parent | 448f8c2eb8335e1c8fc0dd76c3ed728b80487a63 (diff) | |
| download | zig-0122f2cff6fd44b08b17214e8535e8afba3d4985.tar.gz zig-0122f2cff6fd44b08b17214e8535e8afba3d4985.zip | |
Translate C: Redo Add comment containing c source location for failed decls.
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/zig/render.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/std/zig/render.zig b/lib/std/zig/render.zig index 1fe02dce08..5d22d66f6f 100644 --- a/lib/std/zig/render.zig +++ b/lib/std/zig/render.zig @@ -2346,8 +2346,10 @@ fn renderTokenOffset( } while (true) { - assert(loc.line != 0); - const newline_count = if (loc.line == 1) @as(u8, 1) else @as(u8, 2); + // translate-c doesn't generate correct newlines + // in generated code (loc.line == 0) so treat that case + // as though there was meant to be a newline between the tokens + const newline_count = if (loc.line <= 1) @as(u8, 1) else @as(u8, 2); try stream.writeByteNTimes('\n', newline_count); try stream.writeByteNTimes(' ', indent); try stream.writeAll(mem.trimRight(u8, tree.tokenSlicePtr(next_token), " ")); |
