Handle parsing of require...impls declarations (#6255)

Check is not implemented yet, but some tests are added.
This commit is contained in:
Dana Jansens
2025-10-23 18:34:52 +00:00
committed by GitHub
parent 4f1f0fc7c2
commit 26381f6eaf
30 changed files with 790 additions and 61 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ namespace Carbon::Parse {
static auto ExpectAsOrTypeExpression(Context& context) -> void {
if (context.PositionIs(Lex::TokenKind::As)) {
// as <expression> ...
context.AddLeafNode(NodeKind::DefaultSelfImplAs, context.Consume());
context.AddLeafNode(NodeKind::ImplDefaultSelfAs, context.Consume());
context.PushState(StateKind::Expr);
} else {
// <expression> as <expression>...
@@ -62,7 +62,7 @@ auto HandleImplAfterForall(Context& context) -> void {
auto HandleImplBeforeAs(Context& context) -> void {
auto state = context.PopState();
if (auto as = context.ConsumeIf(Lex::TokenKind::As)) {
context.AddNode(NodeKind::TypeImplAs, *as, state.has_error);
context.AddNode(NodeKind::ImplTypeAs, *as, state.has_error);
context.PushState(StateKind::Expr);
} else {
if (!state.has_error) {