diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-05-03 18:12:07 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-05-03 18:12:07 -0400 |
| commit | 698829b772fe39c4311a75b20324256b8d7392b1 (patch) | |
| tree | c1434e819ef38698a79a711c164ca62d9418a9c7 /std/debug.zig | |
| parent | 644ea2dde9fbb1f948cf12115df2a15e908f3c29 (diff) | |
| download | zig-698829b772fe39c4311a75b20324256b8d7392b1.tar.gz zig-698829b772fe39c4311a75b20324256b8d7392b1.zip | |
change while syntax
Old:
```
while (condition; expression) {}
```
New:
```
while (condition) : (expression) {}
```
This is in preparation to allow nullable and
error union types as the condition. See #357
Diffstat (limited to 'std/debug.zig')
| -rw-r--r-- | std/debug.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/std/debug.zig b/std/debug.zig index 8e5416e8ae..03b172e5d0 100644 --- a/std/debug.zig +++ b/std/debug.zig @@ -79,7 +79,7 @@ pub fn writeStackTrace(out_stream: &io.OutStream, allocator: &mem.Allocator, tty var ignored_count: usize = 0; var fp = usize(@frameAddress()); - while (fp != 0; fp = *@intToPtr(&const usize, fp)) { + while (fp != 0) : (fp = *@intToPtr(&const usize, fp)) { if (ignored_count < ignore_frame_count) { ignored_count += 1; continue; @@ -108,7 +108,7 @@ pub fn writeStackTrace(out_stream: &io.OutStream, allocator: &mem.Allocator, tty if (line_info.column == 0) { %return out_stream.write("\n"); } else { - {var col_i: usize = 1; while (col_i < line_info.column; col_i += 1) { + {var col_i: usize = 1; while (col_i < line_info.column) : (col_i += 1) { %return out_stream.writeByte(' '); }} %return out_stream.write(GREEN ++ "^" ++ RESET ++ "\n"); @@ -594,7 +594,7 @@ fn getLineNumberInfo(st: &ElfStackTrace, compile_unit: &const CompileUnit, targe var this_offset = st.debug_line.offset; var this_index: usize = 0; - while (this_offset < debug_line_end; this_index += 1) { + while (this_offset < debug_line_end) : (this_index += 1) { %return in_stream.seekTo(this_offset); var is_64: bool = undefined; @@ -628,7 +628,7 @@ fn getLineNumberInfo(st: &ElfStackTrace, compile_unit: &const CompileUnit, targe const standard_opcode_lengths = %return st.allocator().alloc(u8, opcode_base - 1); - {var i: usize = 0; while (i < opcode_base - 1; i += 1) { + {var i: usize = 0; while (i < opcode_base - 1) : (i += 1) { standard_opcode_lengths[i] = %return in_stream.readByte(); }} |
