mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
LibJS: Make FunctionDeclaration and CallExpression scope-aware
This commit is contained in:
parent
ad401ca098
commit
0d6be2cac2
Notes:
sideshowbarker
2024-07-19 08:47:52 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/0d6be2cac25
1 changed files with 2 additions and 2 deletions
|
@ -40,7 +40,7 @@ Value ScopeNode::execute(Interpreter& interpreter) const
|
|||
Value FunctionDeclaration::execute(Interpreter& interpreter) const
|
||||
{
|
||||
auto* function = interpreter.heap().allocate<Function>(name(), body());
|
||||
interpreter.global_object().put(m_name, Value(function));
|
||||
interpreter.set_variable(m_name, Value(function));
|
||||
return Value(function);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ Value CallExpression::execute(Interpreter& interpreter) const
|
|||
return js_undefined();
|
||||
}
|
||||
|
||||
auto callee = interpreter.global_object().get(name());
|
||||
auto callee = interpreter.get_variable(name());
|
||||
ASSERT(callee.is_object());
|
||||
auto* callee_object = callee.as_object();
|
||||
ASSERT(callee_object->is_function());
|
||||
|
|
Loading…
Add table
Reference in a new issue