mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
LibJS: Implement most of the Reflect object
This commit is contained in:
parent
1ba2e6768d
commit
79b829637e
22 changed files with 877 additions and 54 deletions
|
@ -38,6 +38,9 @@
|
|||
#include <LibJS/Runtime/Value.h>
|
||||
#include <math.h>
|
||||
|
||||
// 2 ** 53 - 1
|
||||
#define MAX_ARRAY_LIKE_INDEX 9007199254740991.0
|
||||
|
||||
namespace JS {
|
||||
|
||||
bool Value::is_array() const
|
||||
|
@ -190,7 +193,7 @@ size_t Value::to_size_t() const
|
|||
auto number = to_number();
|
||||
if (number.is_nan() || number.as_double() <= 0)
|
||||
return 0;
|
||||
return min(number.to_i32(), (i32)pow(2, 53) - 1);
|
||||
return min((double)number.to_i32(), MAX_ARRAY_LIKE_INDEX);
|
||||
}
|
||||
|
||||
Value greater_than(Interpreter&, Value lhs, Value rhs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue