Andrew Kelley
5f35dc0c0d
zig fmt the std lib
2021-02-24 21:29:23 -07:00
Andrew Kelley
d7049fc8e0
Merge pull request #7920 from ziglang/ast-memory-layout
...
Rework AST memory layout for better memory usage and performance
2021-02-24 18:49:07 -08:00
Andrew Kelley
9ada7638a5
zig fmt: function with labeled block as return type
2021-02-24 16:42:46 -07:00
Andrew Kelley
c79ee1fc8d
build.zig: expose a strip option
2021-02-24 16:36:27 -07:00
Andrew Kelley
8e6c2b7a47
Merge remote-tracking branch 'origin/master' into ast-memory-layout
2021-02-24 15:08:23 -07:00
Andrew Kelley
38441b5eab
MultiArrayList: use @memcpy as a workaround
...
Reverts bf642204b3
and uses a different
workaround, suggested by @LemonBoy.
There is either a compiler bug or a design flaw somewhere around here.
It does not have to block this branch, but I need to understand exactly
what's going on here and make it so that nobody ever has to run into
this problem again.
2021-02-24 12:49:12 -07:00
Isaac Freund
52c45bf44d
zig fmt: rework single statement if/while/for indentation
...
This approach properly handles nesting unlike the approach in the
previous commit.
2021-02-24 17:28:29 +01:00
Josh Wolfe
8b9434871e
Avoid concept of a "Unicode character" in documentation and error messages ( #8059 )
2021-02-24 08:26:13 -05:00
Isaac Freund
371b21bdfb
zig fmt: fix comment indent after multiline single statement if/while/for
2021-02-24 13:46:11 +01:00
Isaac Freund
15c7c6ab97
zig fmt: handle comments in switch case value list
2021-02-24 12:29:17 +01:00
Isaac Freund
1b8eca030e
zig fmt: fix firstToken() for switch_case
2021-02-24 12:14:15 +01:00
Andrew Kelley
db4c15be50
zig fmt: respect extra newline between fn and pub usingnamespace
2021-02-23 23:01:16 -07:00
Andrew Kelley
bf642204b3
std.MultiArrayList: add workaround for LLVM bug
2021-02-23 22:24:59 -07:00
Andrew Kelley
05f304807f
zig fmt: add 3 more disabled failing test cases
...
Found by running `zig fmt` on the std lib.
2021-02-23 18:48:01 -07:00
Andrew Kelley
4420fe97be
zig fmt: for loop with ptr payload and index
2021-02-23 18:33:13 -07:00
Andrew Kelley
988f1c6a6f
zig fmt: fn proto end with anytype and comma
...
also
zig fmt: space after top level doc comment
2021-02-23 18:23:49 -07:00
Andrew Kelley
08107a555e
zig fmt: fix inline assembly test cases
...
All zig fmt test cases are now passing again in this branch.
2021-02-23 17:19:01 -07:00
Andrew Kelley
bb89c619ed
zig fmt: multiline string literals + array init
2021-02-23 17:00:33 -07:00
Andrew Kelley
6f4a1bafcf
zig fmt: fn call with comments and multiline strings
...
forcing the parameters over multiple lines
2021-02-23 16:09:51 -07:00
Isaac Freund
4ee368c4b3
zig fmt: comments/line breaks in field access chain
2021-02-23 23:17:38 +01:00
Andrew Kelley
ca9259340d
zig fmt now intentionally respects all empty line comments
2021-02-23 14:30:21 -07:00
Andrew Kelley
f041425e48
translate-c: fix using wrong slice and AST tag
2021-02-23 13:55:12 -07:00
Andrew Kelley
01e89c9171
translate-c: update to latest AST tag changes
2021-02-23 12:39:50 -07:00
Isaac Freund
b028a92a60
zig fmt: handle comments in array type/init/access
2021-02-23 19:56:56 +01:00
Isaac Freund
abfe213830
zig fmt: enable array init trailing comment insertion test
...
Modify the test case slightly to match similar modifications done in
5820bd0
and 0f24b61
.
2021-02-23 19:40:34 +01:00
Isaac Freund
6b9f19a644
zig fmt: remove stray std.debug.print()
2021-02-23 19:18:36 +01:00
Isaac Freund
0f24b61ed5
zig fmt: insert trailing comma in struct init with comment
2021-02-23 19:17:11 +01:00
Isaac Freund
5820bd0e64
zig fmt: insert trailing comma in fn params with comment
2021-02-23 19:11:50 +01:00
Isaac Freund
5306b1a9ab
zig fmt: container doc comments
2021-02-23 18:32:47 +01:00
johnLate
d9e46dceec
std.Thread.Semaphore: Fix wrong variable name
...
Fixes ziglang#8052
2021-02-23 11:10:24 +02:00
Veikka Tuominen
1f62e87031
fix formatting in translate-c test case
2021-02-23 10:53:25 +02:00
Andrew Kelley
1e3a200ba6
zig fmt: array literal with hint
...
This regresses the test case of `zig fmt` deleting empty line comments.
Two open questions here:
* What should the rules be about deleting empty line comments?
It makes sense usually, but for array initization, empty line
comments cause a line break, affecting the row/column alignment.
Perhaps we should therefore respect all empty line comments?
Or should we special case array initializations?
* If we decide to special case some kinds of line comments to respect
them (which is status quo!), how should that be implemented?
2021-02-22 23:25:12 -07:00
Andrew Kelley
1253903fef
zig fmt: struct literal containing a multiline expression
...
I modified this test case to expect different results.
Now, the trailing comma on a list of struct fields is the only deciding
factor, not whether or not the field init expressions contain a newline.
2021-02-22 21:33:21 -07:00
Andrew Kelley
8379fff804
zig fmt: alignment in anonymous literal
2021-02-22 21:04:22 -07:00
Andrew Kelley
a6038f0375
zig fmt: function params should align nicely
2021-02-22 18:17:26 -07:00
Andrew Kelley
fec51ad7c5
zig fmt: while
2021-02-22 17:55:19 -07:00
Andrew Kelley
20cfa0b5b6
zig fmt: if condition has line break, no fn call comma
2021-02-22 17:34:30 -07:00
Andrew Kelley
ec987a7a46
zig fmt: if condition has line break but must not wrap
2021-02-22 16:39:50 -07:00
Andrew Kelley
b301999cd3
zig fmt: if condition wraps
2021-02-22 16:21:19 -07:00
Andrew Kelley
253906fb93
zig fmt: 2nd arg multiline string
2021-02-22 16:00:21 -07:00
Isaac Freund
45634851de
zig fmt: fix firstToken() for extern fn_protos
2021-02-22 23:51:54 +01:00
Isaac Freund
550688f427
zig fmt: insert trailing comma in switches
2021-02-22 23:51:54 +01:00
Veikka Tuominen
4758e0c9a6
update docgen to use new ast
2021-02-22 21:52:22 +02:00
Veikka Tuominen
d83698ab54
translate-c: check for noreturn in switch in more cases
2021-02-22 21:52:22 +02:00
Isaac Freund
f3ee10b454
zig fmt: fix comments ending with EOF after decls
...
Achieve this by reducing the amount of special casing to handle EOF so
that the already correct logic for normal comments does not need to be
duplicated.
2021-02-22 18:32:37 +01:00
Veikka Tuominen
011bc1b84f
translate-c: switch default should have an empty block not break
2021-02-22 19:26:19 +02:00
Isaac Freund
ce9b3ee0f9
parser: anytype is not a vaild return type
2021-02-22 17:38:09 +01:00
Isaac Freund
34c08a91d5
zig fmt: fix formatting of parser tests
2021-02-22 17:37:17 +01:00
Veikka Tuominen
928790364a
zig fmt: correct Node.firstToken for .fn_decl, add error for missing container
2021-02-22 17:39:41 +02:00
Veikka Tuominen
69d5a106da
render: handle comments ending in EOF
2021-02-22 16:59:44 +02:00