mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 08:31:04 +01:00
Lex/parse support for ->?, :?, and form literals (#6695)
See #5389 (pending) for the language design.
This commit is contained in:
@@ -25,6 +25,10 @@ auto HandleFunctionAfterParams(Context& context) -> void {
|
||||
context.PushState(StateKind::FunctionReturnTypeFinish);
|
||||
context.ConsumeAndDiscard();
|
||||
context.PushStateForExpr(PrecedenceGroup::ForType());
|
||||
} else if (context.PositionIs(Lex::TokenKind::MinusGreaterQuestion)) {
|
||||
context.PushState(StateKind::FunctionReturnFormFinish);
|
||||
context.ConsumeAndDiscard();
|
||||
context.PushStateForExpr(PrecedenceGroup::ForType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +38,12 @@ auto HandleFunctionReturnTypeFinish(Context& context) -> void {
|
||||
context.AddNode(NodeKind::ReturnType, state.token, state.has_error);
|
||||
}
|
||||
|
||||
auto HandleFunctionReturnFormFinish(Context& context) -> void {
|
||||
auto state = context.PopState();
|
||||
|
||||
context.AddNode(NodeKind::ReturnForm, state.token, state.has_error);
|
||||
}
|
||||
|
||||
auto HandleFunctionSignatureFinish(Context& context) -> void {
|
||||
auto state = context.PopState();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user