Now it builds and what remains in this branch is:
* fix the stage2 compiler regressions from this branch
* finish the rest of zig fmt test cases, get them passing
* Merge in Vexu's translate-c AST branch & fix translate-c regressions
The previous iteration of translate-c used an incorrect block label
in the break statement for a translated C statement expression. This adds
a test to ensure the correct label is used in the new intermediate AST
version of translate-c.
Using this in its current state would be a bug as it could cause line
comments to be deleted or a `// zig fmt: (on|off)` directive to be
missed.
Removing it doesn't currently cause any test failures, if a reason for
its continued existence is discovered in the future another solution
will have to be found.
This type is not widely applicable enough to be a public part of the
public interface of the std.
The current implementation in only fully utilized by the zig fmt
implementation, which could benefit by even tighter integration as
will be demonstrated in the next commit. Therefore, move the current
io.AutoIndentingStream to lib/std/zig/render.zig.
The C backend of the self hosted compiler also use this type currently,
but it does not require anywhere near its full complexity. Therefore,
implement a greatly simplified version of this interface in
src/codegen/c.zig.
additionally introduce a new file to centralize all the data about
builtin functions that we have, including:
* enum tag identifying the builtin function
* number of parameters.
* whether the expression may need a memory location.
* whether the expression allows an lvalue (currently only true for
`@field`).
Now there is only one ComptimeStringMap that has this data as the value,
and we dispatch on the enum tag in order to asgen the builtin function.
In particular this simplifies the logic for checking the number of
parameters.
This removes some untested code paths from if and while, which need to
be restored with #7929 in mind.
After this there are only a handful left of expression types to rework
to the new memory layout, and then it will be only compile errors left
to solve.
break, continue, blocks, bit_not, negation, identifiers, string
literals, integer literals, inline assembly
also gave multiline string literals a different node tag from regular
string literals, for code clarity and to avoid an unnecessary load from
token_tags array.