mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:28:11 +00:00
LibJS: Pass Realm to define_native_{accessor,function}()
This is needed so that the allocated NativeFunction receives the correct realm, usually forwarded from the Object's initialize() function, rather than using the current realm.
This commit is contained in:
parent
7c468b5a77
commit
e3895e6c80
116 changed files with 893 additions and 890 deletions
|
@ -25,41 +25,41 @@ void MathObject::initialize(Realm& realm)
|
|||
auto& vm = this->vm();
|
||||
Object::initialize(realm);
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.abs, abs, 1, attr);
|
||||
define_native_function(vm.names.random, random, 0, attr);
|
||||
define_native_function(vm.names.sqrt, sqrt, 1, attr);
|
||||
define_native_function(vm.names.floor, floor, 1, attr);
|
||||
define_native_function(vm.names.ceil, ceil, 1, attr);
|
||||
define_native_function(vm.names.round, round, 1, attr);
|
||||
define_native_function(vm.names.max, max, 2, attr);
|
||||
define_native_function(vm.names.min, min, 2, attr);
|
||||
define_native_function(vm.names.trunc, trunc, 1, attr);
|
||||
define_native_function(vm.names.sin, sin, 1, attr);
|
||||
define_native_function(vm.names.cos, cos, 1, attr);
|
||||
define_native_function(vm.names.tan, tan, 1, attr);
|
||||
define_native_function(vm.names.pow, pow, 2, attr);
|
||||
define_native_function(vm.names.exp, exp, 1, attr);
|
||||
define_native_function(vm.names.expm1, expm1, 1, attr);
|
||||
define_native_function(vm.names.sign, sign, 1, attr);
|
||||
define_native_function(vm.names.clz32, clz32, 1, attr);
|
||||
define_native_function(vm.names.acos, acos, 1, attr);
|
||||
define_native_function(vm.names.acosh, acosh, 1, attr);
|
||||
define_native_function(vm.names.asin, asin, 1, attr);
|
||||
define_native_function(vm.names.asinh, asinh, 1, attr);
|
||||
define_native_function(vm.names.atan, atan, 1, attr);
|
||||
define_native_function(vm.names.atanh, atanh, 1, attr);
|
||||
define_native_function(vm.names.log1p, log1p, 1, attr);
|
||||
define_native_function(vm.names.cbrt, cbrt, 1, attr);
|
||||
define_native_function(vm.names.atan2, atan2, 2, attr);
|
||||
define_native_function(vm.names.fround, fround, 1, attr);
|
||||
define_native_function(vm.names.hypot, hypot, 2, attr);
|
||||
define_native_function(vm.names.imul, imul, 2, attr);
|
||||
define_native_function(vm.names.log, log, 1, attr);
|
||||
define_native_function(vm.names.log2, log2, 1, attr);
|
||||
define_native_function(vm.names.log10, log10, 1, attr);
|
||||
define_native_function(vm.names.sinh, sinh, 1, attr);
|
||||
define_native_function(vm.names.cosh, cosh, 1, attr);
|
||||
define_native_function(vm.names.tanh, tanh, 1, attr);
|
||||
define_native_function(realm, vm.names.abs, abs, 1, attr);
|
||||
define_native_function(realm, vm.names.random, random, 0, attr);
|
||||
define_native_function(realm, vm.names.sqrt, sqrt, 1, attr);
|
||||
define_native_function(realm, vm.names.floor, floor, 1, attr);
|
||||
define_native_function(realm, vm.names.ceil, ceil, 1, attr);
|
||||
define_native_function(realm, vm.names.round, round, 1, attr);
|
||||
define_native_function(realm, vm.names.max, max, 2, attr);
|
||||
define_native_function(realm, vm.names.min, min, 2, attr);
|
||||
define_native_function(realm, vm.names.trunc, trunc, 1, attr);
|
||||
define_native_function(realm, vm.names.sin, sin, 1, attr);
|
||||
define_native_function(realm, vm.names.cos, cos, 1, attr);
|
||||
define_native_function(realm, vm.names.tan, tan, 1, attr);
|
||||
define_native_function(realm, vm.names.pow, pow, 2, attr);
|
||||
define_native_function(realm, vm.names.exp, exp, 1, attr);
|
||||
define_native_function(realm, vm.names.expm1, expm1, 1, attr);
|
||||
define_native_function(realm, vm.names.sign, sign, 1, attr);
|
||||
define_native_function(realm, vm.names.clz32, clz32, 1, attr);
|
||||
define_native_function(realm, vm.names.acos, acos, 1, attr);
|
||||
define_native_function(realm, vm.names.acosh, acosh, 1, attr);
|
||||
define_native_function(realm, vm.names.asin, asin, 1, attr);
|
||||
define_native_function(realm, vm.names.asinh, asinh, 1, attr);
|
||||
define_native_function(realm, vm.names.atan, atan, 1, attr);
|
||||
define_native_function(realm, vm.names.atanh, atanh, 1, attr);
|
||||
define_native_function(realm, vm.names.log1p, log1p, 1, attr);
|
||||
define_native_function(realm, vm.names.cbrt, cbrt, 1, attr);
|
||||
define_native_function(realm, vm.names.atan2, atan2, 2, attr);
|
||||
define_native_function(realm, vm.names.fround, fround, 1, attr);
|
||||
define_native_function(realm, vm.names.hypot, hypot, 2, attr);
|
||||
define_native_function(realm, vm.names.imul, imul, 2, attr);
|
||||
define_native_function(realm, vm.names.log, log, 1, attr);
|
||||
define_native_function(realm, vm.names.log2, log2, 1, attr);
|
||||
define_native_function(realm, vm.names.log10, log10, 1, attr);
|
||||
define_native_function(realm, vm.names.sinh, sinh, 1, attr);
|
||||
define_native_function(realm, vm.names.cosh, cosh, 1, attr);
|
||||
define_native_function(realm, vm.names.tanh, tanh, 1, attr);
|
||||
|
||||
// 21.3.1 Value Properties of the Math Object, https://tc39.es/ecma262/#sec-value-properties-of-the-math-object
|
||||
define_direct_property(vm.names.E, Value(M_E), 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue