Skip to content

Commit

Permalink
Drop call arguments _after_ the call
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Oct 1, 2020
1 parent 4823f84 commit 0a1b432
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/fizzy/execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,14 @@ inline bool invoke_function(
{
assert(stack.size() >= num_args);
span<const Value> call_args{stack.rend() - num_args, num_args};
stack.drop(num_args);

const auto ret = func(instance, call_args, depth + 1);
// Bubble up traps
if (ret.trapped)
return false;
return false; // Bubble up traps

// Push back the result
stack.drop(num_args);
if (ret.has_value)
stack.push(ret.value);
stack.push(ret.value); // Push back the result

return true;
}
Expand Down

0 comments on commit 0a1b432

Please sign in to comment.