mirror of
https://github.com/RGBCube/serenity
synced 2025-06-30 10:22:13 +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
|
@ -54,20 +54,20 @@ BigIntConstructor::~BigIntConstructor()
|
|||
{
|
||||
}
|
||||
|
||||
Value BigIntConstructor::call(Interpreter& interpreter)
|
||||
Value BigIntConstructor::call()
|
||||
{
|
||||
auto primitive = interpreter.argument(0).to_primitive(interpreter, Value::PreferredType::Number);
|
||||
if (interpreter.exception())
|
||||
auto primitive = vm().argument(0).to_primitive(Value::PreferredType::Number);
|
||||
if (vm().exception())
|
||||
return {};
|
||||
if (primitive.is_number()) {
|
||||
if (!primitive.is_integer()) {
|
||||
interpreter.vm().throw_exception<RangeError>(global_object(), ErrorType::BigIntIntArgument);
|
||||
vm().throw_exception<RangeError>(global_object(), ErrorType::BigIntIntArgument);
|
||||
return {};
|
||||
}
|
||||
return js_bigint(interpreter, Crypto::SignedBigInteger { primitive.as_i32() });
|
||||
return js_bigint(heap(), Crypto::SignedBigInteger { primitive.as_i32() });
|
||||
}
|
||||
auto* bigint = interpreter.argument(0).to_bigint(interpreter);
|
||||
if (interpreter.exception())
|
||||
auto* bigint = vm().argument(0).to_bigint(global_object());
|
||||
if (vm().exception())
|
||||
return {};
|
||||
return bigint;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue