mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
LibJS: Actually leave the current function scope on "return"
We now unwind until the nearest function-level scope on the scope stack when executing a return statement.
This commit is contained in:
parent
df524203b2
commit
494df52961
3 changed files with 13 additions and 6 deletions
|
@ -81,7 +81,7 @@ Value CallExpression::execute(Interpreter& interpreter) const
|
|||
Value ReturnStatement::execute(Interpreter& interpreter) const
|
||||
{
|
||||
auto value = argument() ? argument()->execute(interpreter) : js_undefined();
|
||||
interpreter.do_return();
|
||||
interpreter.unwind(ScopeType::Function);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue