davidot
ae8b55a80a
LibJS: Add additional generic Array.prototype.slice tests
2021-06-14 09:57:06 +01:00
davidot
6c13cc67c6
LibJS: Implement Array.prototype.copyWithin generically
2021-06-14 09:57:06 +01:00
davidot
417f752306
LibJS: Implement Array.prototype.entries
2021-06-14 09:57:06 +01:00
davidot
910b803d8d
LibJS: Implement Array.prototype.flatMap
...
Also made recursive_array_flat more compliant with the spec
So renamed it to flatten_into_array
2021-06-14 09:57:06 +01:00
davidot
4152409ac5
LibJS: Make Array.prototype.concat generic
2021-06-14 09:57:06 +01:00
davidot
2ef9df989f
LibJS: Make Array.prototype.reverse generic
2021-06-14 09:57:06 +01:00
davidot
516f6240e8
LibJS: Add additional Array.prototype.reverse tests
2021-06-14 09:57:06 +01:00
davidot
d723c01af7
LibJS: Make Array.prototype.unshift generic
2021-06-14 09:57:06 +01:00
davidot
7c1e2adf8a
LibJS: Make Array.prototype.shift generic
2021-06-14 09:57:06 +01:00
Idan Horowitz
690eb3bb8a
LibJS: Add support for hex, octal & binary big integer literals
2021-06-14 01:45:04 +01:00
Idan Horowitz
e4e6e03364
LibJS: Add tests for DataView.prototype getters and setters
2021-06-14 01:45:04 +01:00
Idan Horowitz
e4d267d4fb
LibJS: Add the DataView built-in object
2021-06-14 01:45:04 +01:00
Luke
d72aeb2e1a
LibJS: Rewrite Array.prototype.slice to be spec compliant
...
This makes it generic in the process (which is required by jQuery)
This fixes 19 test262 test cases :^)
2021-06-13 16:21:34 +01:00
Linus Groh
33eea1f722
LibJS: Fix Object.prototype.valueOf() behavior
...
No idea why it was implemented like this, but a value_of() call on the
coerced object is not part of the spec. Also added some tests.
2021-06-13 01:06:36 +01:00
Idan Horowitz
322c8a3995
LibJS: Add the MapIterator built-in and the key/values/entries methods
...
While this implementation should be complete it is based on HashMap's
iterator, which currently follows bucket-order instead of the required
insertion order. This can be simply fixed by replacing the underlying
HashMap member in Map with an enhanced one that maintains a linked
list in insertion order.
2021-06-13 00:33:18 +01:00
Idan Horowitz
6c0d5163a1
LibJS: Add most of the Map.prototype methods
...
Specifically all aside from "keys", "values" and "entries" which
require an implementation of the MapIterator object.
2021-06-13 00:33:18 +01:00
Idan Horowitz
a96ac8bd56
LibJS: Add the Map built-in object
2021-06-13 00:33:18 +01:00
Idan Horowitz
3c83298a26
LibJS: Use undefined as the fallback value for iterable entry key/value
...
As defined in OdinaryGet in the specification.
2021-06-12 22:34:28 +01:00
Idan Horowitz
bd9e20ef79
LibJS: Add the Object.getOwnPropertySymbols method
2021-06-12 18:39:23 +01:00
Idan Horowitz
a2da3f97ef
LibJS: Remove argument count checks in Object.* methods
...
These are inconsistent with the specification.
2021-06-12 18:39:23 +01:00
Idan Horowitz
b9d4dd6850
LibJS: Add the WeakRef.prototype.deref method
...
This is the only exposed method of the WeakRef built-in.
2021-06-12 18:39:23 +01:00
Idan Horowitz
7eba63a8a3
LibJS: Add the WeakRef built-in object
2021-06-12 18:39:23 +01:00
davidot
e044a3e428
LibJS: Add Array.prototype.keys()
2021-06-12 14:40:34 +01:00
Linus Groh
7e1bffdeb8
LibJS: Implement Object.assign()
2021-06-12 11:36:17 +01:00
Idan Horowitz
77c2db4183
LibJS: Add all of the WeakMap.prototype methods (delete, get, has, set)
2021-06-12 10:44:28 +01:00
Linus Groh
862ba64037
LibJS: Implement the Error Cause proposal
...
Currently stage 3. https://github.com/tc39/proposal-error-cause
2021-06-11 21:34:05 +01:00
Linus Groh
8d77a3297a
LibJS: Improve Error/NativeError tests
...
Some of this stuff is already tested properly in the name and message
prototype tests, so let's focus on covering all error types here as well
instead.
2021-06-11 21:34:05 +01:00
Linus Groh
cbd7437d40
LibJS: Implement AggregateError
2021-06-11 18:49:50 +01:00
Luke
bc540de0af
LibJS: Pass in actual_delete_count to removed array creation in splice
...
More specifically, Array.prototype.splice. Additionally adds a missing
exception check to the array creation and a link to the spec.
Fixes create-non-array-invalid-len.js in the splice tests in test262.
This test timed out instead of throwing an "Invalid array length"
exception.
2021-06-10 10:04:06 +01:00
Linus Groh
f932da095e
LibJS: Use create_list_from_array_like() in Reflect.{apply,construct}()
2021-06-09 23:46:37 +01:00
Idan Horowitz
a00d154522
LibJS: Notify WeakSets when heap cells are sweeped
...
This is an implementation of the following optional optimization:
https://tc39.es/ecma262/#sec-weakref-execution
2021-06-09 21:52:25 +01:00
Idan Horowitz
fb63aeae4d
LibJS: Add all of the WeakSet.prototype methods (add, delete, has)
2021-06-09 21:52:25 +01:00
Idan Horowitz
8b6beac5ce
LibJS: Add the WeakSet built-in object
2021-06-09 21:52:25 +01:00
Idan Horowitz
2a3090d292
LibJS: Add the SetIterator built-in and Set.prototype.{values, entries}
...
While this implementation should be complete it is based on HashTable's
iterator, which currently follows bucket-order instead of the required
insertion order. This can be simply fixed by replacing the underlying
HashTable member in Set with an enhanced one that maintains a linked
list in insertion order.
2021-06-09 11:48:04 +01:00
Idan Horowitz
0b0f1eda05
LibJS: Add most of the Set.prototype methods
...
Specifically all aside from "values" and "entries" which require an
implementation of the SetIterator object.
2021-06-09 11:48:04 +01:00
Idan Horowitz
670be04c81
LibJS: Add the Set built-in object
2021-06-09 11:48:04 +01:00
Linus Groh
83be39c91a
LibJS: Handle Proxy with Array target in IsArray() abstract operation
...
This was missing from Value::is_array(), which is equivalent to the
spec's IsArray() abstract operation - it treats a Proxy value with an
Array target object as being an Array.
It can throw, so needs both the global object and an exception check
now.
2021-06-08 23:53:13 +02:00
Linus Groh
9b35231453
LibJS: Implement Proxy.revocable()
2021-06-08 23:53:13 +02:00
Linus Groh
e39dd65cf0
LibJS: Remove Proxy() argument count check
...
Let's just treat missing arguments as undefined and throw with
'target/handler must be object' - this is more JavaScript-y.
2021-06-08 23:53:13 +02:00
Linus Groh
6c256bb400
LibJS: Add @@toStringTag to Reflect
2021-06-08 19:13:14 +01:00
Linus Groh
b377777208
LibJS: Add @@toStringTag to Promise.prototype
2021-06-08 19:13:14 +01:00
Linus Groh
4e555fae22
LibJS: Add missing cyclic prototype check to Object.setPrototypeOf()
2021-06-07 22:56:16 +01:00
Idan Horowitz
17afe015a5
LibJS: Add Date.prototype.setTime()
2021-06-06 19:14:11 +01:00
Idan Horowitz
a93b1c7ea0
LibJS: Add Date.prototype.setMonth()
2021-06-06 19:14:11 +01:00
Idan Horowitz
59034554a4
LibJS: Account for differences in month representations (0-11 vs 1-12)
...
Since DateTime stores months as 1 to 12, while JS accepts months as
0 to 11, we have to account for the difference (by subtracting or
adding 1) where appropriate.
2021-06-06 19:14:11 +01:00
Idan Horowitz
b893963651
LibJS: Add Date.prototype.setDate()
2021-06-06 19:14:11 +01:00
Linus Groh
b661363dfe
LibJS: Implement String.prototype[@@toPrimitive]()
2021-06-06 19:34:43 +02:00
Linus Groh
8d7ec28924
LibJS: Remove String.prototype.length
...
A string's length property is supposed to be a regular non-writable,
non-enumerable, non-configurable property on the StringObject instead.
2021-06-06 19:34:43 +02:00
Linus Groh
d255e6892b
LibJS: Update NumberPrototype's this_number_value() to take a Value
...
This is now about as close to the spec as it gets - instead of querying
the |this| value inside of the function, we now pass it in from the
outside.
Also get rid of the oddly specific error messages, they're nice but
pretty inconsistent with most others. Let's prefer consistency and
simplicity for now.
Other than that, no functionality change.
2021-06-06 19:34:43 +02:00
Linus Groh
adc3de4480
LibJS: Implement Number.prototype.valueOf()
2021-06-06 06:56:08 +01:00