Pass Expressions by value in Statement factories. (#611)

This commit is contained in:
Geoff Romer
2021-06-30 11:10:36 -07:00
committed by GitHub
parent d70297077b
commit 7e70a0335e
5 changed files with 55 additions and 60 deletions
@@ -1233,7 +1233,7 @@ void StepStmt() {
scopes.Push(scope);
Stack<Action*> todo;
todo.Push(MakeStmtAct(Statement::MakeReturn(
stmt->line_num, Expression::MakeTuple(stmt->line_num, {}))));
stmt->line_num, *Expression::MakeTuple(stmt->line_num, {}))));
todo.Push(MakeStmtAct(stmt->GetContinuation().body));
Frame* continuation_frame = new Frame("__continuation", scopes, todo);
Address continuation_address = state->heap.AllocateValue(
@@ -1257,7 +1257,7 @@ void StepStmt() {
// Push an expression statement action to ignore the result
// value from the continuation.
Action* ignore_result = MakeStmtAct(Statement::MakeExpStmt(
stmt->line_num, Expression::MakeTuple(stmt->line_num, {})));
stmt->line_num, *Expression::MakeTuple(stmt->line_num, {})));
ignore_result->pos = 0;
frame->todo.Push(ignore_result);
// Push the continuation onto the current stack.