diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-12 20:04:54 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-12 20:04:54 +0100 |
commit | d1d136b4e5c935ec659fe49fc5e81ca08a969f9e (patch) | |
tree | 77871a5ff1541d49fd77b30e91949799004b8fd2 /Libraries/LibJS/AST.cpp | |
parent | 9ad17d4674269fe4c9743ecf0aa4a4e296f9e327 (diff) | |
download | serenity-d1d136b4e5c935ec659fe49fc5e81ca08a969f9e.zip |
LibJS: Replace $gc() hack with a NativeFunction on the global object
To make this work, also start passing Interpreter& to native functions.
Diffstat (limited to 'Libraries/LibJS/AST.cpp')
-rw-r--r-- | Libraries/LibJS/AST.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index af0f21aef3..dce5c0092c 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -55,11 +55,6 @@ Value ExpressionStatement::execute(Interpreter& interpreter) const Value CallExpression::execute(Interpreter& interpreter) const { - if (name() == "$gc") { - interpreter.heap().collect_garbage(); - return js_undefined(); - } - auto callee = interpreter.get_variable(name()); ASSERT(callee.is_object()); auto* callee_object = callee.as_object(); @@ -78,7 +73,7 @@ Value CallExpression::execute(Interpreter& interpreter) const return interpreter.run(static_cast<Function&>(*callee_object).body(), move(passed_arguments), ScopeType::Function); if (callee_object->is_native_function()) { - return static_cast<NativeFunction&>(*callee_object).native_function()(move(passed_arguments)); + return static_cast<NativeFunction&>(*callee_object).native_function()(interpreter, move(passed_arguments)); } ASSERT_NOT_REACHED(); |