diff options
| author | Evan Haas <evan@lagerdata.com> | 2021-03-18 23:13:59 -0700 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2021-03-22 10:48:08 +0200 |
| commit | dce612ac2be5aa8a1aa0ee8dd670d7e875624216 (patch) | |
| tree | 5d551dbee5d5cb9f5270f40ea62057961440fc3f /lib/std | |
| parent | 187af14599a083f728f79c4a57ceed30fd01f85d (diff) | |
| download | zig-dce612ac2be5aa8a1aa0ee8dd670d7e875624216.tar.gz zig-dce612ac2be5aa8a1aa0ee8dd670d7e875624216.zip | |
translate-c: Ensure assignments are within a block when necessary
Ensures that if an assignment statement is the sole statement within a
C if statement, for loop, do loop, or do while loop, then when translated
it resides within a block, even though it does not in the original C.
Fixes the following invalid translation:
`if (1) if (1) 2;` -> `if (true) if (true) _ = @as(c_int, 2);`
To this:
```zig
if (true) if (true) {
_ = @as(c_int, 2);
};
```
Fixes #8159
Diffstat (limited to 'lib/std')
0 files changed, 0 insertions, 0 deletions
