mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:25:07 +00:00
LibJS: Make Function::call() not require an Interpreter&
This makes a difference inside ScriptFunction::call(), which will now instantiate a temporary Interpreter if one is not attached to the VM.
This commit is contained in:
parent
be31805e8b
commit
1ff9d33131
42 changed files with 167 additions and 142 deletions
|
@ -55,14 +55,14 @@ StringConstructor::~StringConstructor()
|
|||
{
|
||||
}
|
||||
|
||||
Value StringConstructor::call(Interpreter& interpreter)
|
||||
Value StringConstructor::call()
|
||||
{
|
||||
if (!interpreter.argument_count())
|
||||
return js_string(interpreter, "");
|
||||
if (interpreter.argument(0).is_symbol())
|
||||
return js_string(interpreter, interpreter.argument(0).as_symbol().to_string());
|
||||
auto* string = interpreter.argument(0).to_primitive_string(interpreter);
|
||||
if (interpreter.exception())
|
||||
if (!vm().argument_count())
|
||||
return js_string(heap(), "");
|
||||
if (vm().argument(0).is_symbol())
|
||||
return js_string(heap(), vm().argument(0).as_symbol().to_string());
|
||||
auto* string = vm().argument(0).to_primitive_string(interpreter());
|
||||
if (vm().exception())
|
||||
return {};
|
||||
return string;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue