Parser: block literals and __block variables#971
Open
dotcarmen wants to merge 17 commits into
Open
Conversation
dotcarmen
force-pushed
the
dotcarmen/block-literals
branch
2 times, most recently
from
February 27, 2026 01:06
f0b3a01 to
4a15846
Compare
dotcarmen
marked this pull request as ready for review
February 27, 2026 01:27
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
dotcarmen
marked this pull request as draft
February 27, 2026 02:14
dotcarmen
force-pushed
the
dotcarmen/block-literals
branch
10 times, most recently
from
February 28, 2026 15:54
a82f534 to
51c20b7
Compare
dotcarmen
marked this pull request as ready for review
February 28, 2026 15:54
Contributor
Author
|
i just realized aro doesn't support lowering to |
dotcarmen
force-pushed
the
dotcarmen/block-literals
branch
2 times, most recently
from
March 4, 2026 14:42
22a3bdb to
201fca6
Compare
dotcarmen
force-pushed
the
dotcarmen/block-literals
branch
from
March 18, 2026 00:55
201fca6 to
a66ae0c
Compare
dotcarmen
force-pushed
the
dotcarmen/block-literals
branch
2 times, most recently
from
March 25, 2026 22:08
a295122 to
4f224ce
Compare
dotcarmen
force-pushed
the
dotcarmen/block-literals
branch
4 times, most recently
from
March 28, 2026 12:33
73b3cad to
c9e93a3
Compare
dotcarmen
force-pushed
the
dotcarmen/block-literals
branch
from
July 8, 2026 16:50
c8af2f8 to
dbf0fca
Compare
Contributor
Author
|
^ still working on addressing review comments |
dotcarmen
force-pushed
the
dotcarmen/block-literals
branch
2 times, most recently
from
July 10, 2026 00:52
34e3c24 to
538b1e1
Compare
Vexu
reviewed
Jul 10, 2026
| .keyword_forceinline, | ||
| .keyword_forceinline2, | ||
| => { | ||
| try p.err(bad_attr_tok_i, .block_does_not_allow_specifier, .{"function specifier"}); |
Owner
There was a problem hiding this comment.
I added this warning in 2750279. You'll probably want to inline typeNameExtra here to handle decl attributes in the type properly:
int (^a)(int) = ^int __attribute__((const)) (int a){
return a;
};
dotcarmen
force-pushed
the
dotcarmen/block-literals
branch
2 times, most recently
from
July 10, 2026 22:21
907f240 to
6a78430
Compare
use repr.data directly for the token in attr map undo marking implicit return with implicit-true operand
dotcarmen
force-pushed
the
dotcarmen/block-literals
branch
4 times, most recently
from
July 19, 2026 22:35
bef07be to
fccb197
Compare
dotcarmen
force-pushed
the
dotcarmen/block-literals
branch
from
July 19, 2026 22:36
fccb197 to
9f8271f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
blocked on/part 2 of #969, wip towards closing #825This PR implements parsing of block literals according to the language extension specification by Clang. Caveat: while the spec document specifies that the parameter list may only be omitted when the return type is omitted, Clang actually compiles programs that omit the return type but not the parameter list (excuse the linker error). The behavior here matches that behavior
Additionally, this change makes no attempt to track
__blockvariable references within block bodies, since that's not necessary for the parse to complete, and that extra information would not be used anywhere yet. in the future, when implementing lowering support for blocks, this information tracking can be added