mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-18 20:10:29 +00:00
Add support for return; (#678)
This creates a ReturnExpression. A separate change should enforce that an implicit return of `()` is only allowed in functions that have an implicit return type of `()`, and I think the structure taken here should ease that.
This commit is contained in:
1 parent
b1993a6cd0
commit
6ae9cc3cf8
16 files changed
+114
-33
No files matched your search
@@ -1093,8 +1093,9 @@ void StepStmt() {
|
||||
Stack<Scope*> scopes;
|
||||
scopes.Push(scope);
|
||||
Stack<Action*> todo;
|
||||
todo.Push(Action::MakeStatementAction(Statement::MakeReturn(
|
||||
stmt->line_num, Expression::MakeTupleLiteral(stmt->line_num, {}))));
|
||||
todo.Push(Action::MakeStatementAction(
|
||||
Statement::MakeReturn(stmt->line_num, nullptr,
|
||||
/*is_omitted_exp=*/true)));
|
||||
todo.Push(Action::MakeStatementAction(stmt->GetContinuation().body));
|
||||
Frame* continuation_frame =
|
||||
global_arena->New<Frame>("__continuation", scopes, todo);
|
||||
|
||||
Reference in new issue
Block a user