Linus Groh
78acc976a6
LibJS: Implement Temporal.PlainDateTime.prototype.valueOf()
2021-07-22 21:19:40 +01:00
Linus Groh
591ee813fb
LibJS: Implement Temporal.PlainDateTime.prototype[@@toStringTag]
2021-07-22 21:19:40 +01:00
Linus Groh
4be3196882
LibJS: Start implementing Temporal.PlainDateTime
...
This commit adds the PlainDateTime object itself, its constructor and
prototype (currently empty), and the CreateTemporalDateTime abstract
operation.
2021-07-22 21:19:40 +01:00
Linus Groh
8f26f51580
LibJS: Add missing spec links to System{Instant,UTCEpochNanoseconds}
2021-07-22 21:19:40 +01:00
Linus Groh
bece2093f2
LibJS: Remove pointless 'explicit' from a couple of constructors
2021-07-22 21:19:40 +01:00
Linus Groh
c65424d806
LibJS: Fix value of Temporal.PlainDate.length
...
Should be 3 (year, month, day, optional calendar-like), not 0.
2021-07-22 21:19:40 +01:00
Timothy Flynn
d3c25593b9
LibJS: Implement String.prototype.split with UTF-16 code units
...
Also required implementing the SplitMatch abstract operation with UTF-16
code units.
2021-07-22 09:10:44 +02:00
Timothy Flynn
733a92820b
LibJS: Implement String.prototype.replaceAll with UTF-16 code units
2021-07-22 09:10:44 +02:00
Timothy Flynn
06208aaa15
LibJS: Implement String.prototype.replace with UTF-16 code units
2021-07-22 09:10:44 +02:00
Timothy Flynn
bdbe716547
LibJS: Implement String.prototype.endsWith with UTF-16 code units
2021-07-22 09:10:44 +02:00
Timothy Flynn
d2e63a641f
LibJS: Implement String.prototype.startsWith with UTF-16 code units
2021-07-22 09:10:44 +02:00
Timothy Flynn
f920e121b3
LibJS: Implement String.prototype.lastIndexOf with UTF-16 code units
2021-07-22 09:10:44 +02:00
Timothy Flynn
5ac964d841
LibJS: Implement String.prototype.slice with UTF-16 code units
...
This also implements String.prototype.slice more closely to the spec
(such as handling indices equivalent to Infinity).
2021-07-22 09:10:44 +02:00
Timothy Flynn
eaa1360eee
LibJS: Implement StringPad abstract operation with UTF-16 code units
...
Affects String.prototype.padStart and String.prototype.padEnd.
2021-07-22 09:10:44 +02:00
Timothy Flynn
ef2ff5f88b
LibJS: Implement String.prototype.at with UTF-16 code units
2021-07-22 09:10:44 +02:00
Timothy Flynn
892bfdbbcf
LibJS: Implement String.prototype.substr with UTF-16 code units
2021-07-22 09:10:44 +02:00
Timothy Flynn
60d8852fc2
LibJS: Implement String.prototype.substring with UTF-16 code units
2021-07-22 09:10:44 +02:00
Timothy Flynn
767700d8a1
LibJS: Implement String.prototype.indexOf with UTF-16 code units
2021-07-22 09:10:44 +02:00
Timothy Flynn
70f9c7e1c7
LibJS: Implement String.prototype.includes with UTF-16 code units
...
This also implements String.prototype.includes more closely to the spec
(such as returning false when the search string is a RegExp object).
2021-07-22 09:10:44 +02:00
Timothy Flynn
a05ce330b8
LibJS: Implement String.prototype.codePointAt with UTF-16 code units
...
This also implements the CodePointAt abstract operation. This is needed
to handle invalid code units specific to the JavaScript spec, rather
than e.g. inserting replacement code units. This abstraction is public
because RegExp.prototype will also need it.
2021-07-22 09:10:44 +02:00
Timothy Flynn
48a28a9a73
LibJS: Implement String.prototype.charCodeAt with UTF-16 code units
2021-07-22 09:10:44 +02:00
Timothy Flynn
5d11614bc7
LibJS: Implement String.prototype.charAt with UTF-16 code units
2021-07-22 09:10:44 +02:00
Timothy Flynn
2bba20d123
LibJS: Report string properties using UTF-16 code units
...
String length is reported as the number of UTF-16 code units, and string
indices are reported as the UTF-16 code units themselves.
2021-07-22 09:10:44 +02:00
Timothy Flynn
0c42aece36
LibJS: Transcode UTF-8 strings to UTF-16 and add UTF-16 accessors
...
LibJS parses JavaScript as UTF-8, so when creating a string, we must
transcode it to UTF-16 to handle encoded surrogate pairs.
For example, consider the following string:
"\ud83d\ude00"
The UTF-8 encoding of this surrogate pair is:
0xf0 0x9f 0x98 0x80
However, LibJS will currently store the two surrogates individually as
UTF-8 encoded bytes, rather than combining the pair:
0xed 0xa0 0xb8, 0xed 0xb8 0x80
These are not equivalent. So, as String.prototype becomes UTF-16 aware,
this encoding will no longer work for abstractions like strict equality.
2021-07-22 09:10:44 +02:00
Timothy Flynn
0e25d2393f
LibJS: Add UTF-16 tests to String.prototype methods that already work
...
These methods did not require UTF-16 views, so just add test cases to
ensure they remain correct.
This also adds a couple of FIXME comments on tests that will fail even
with UTF-16 String.prototype support (for reasons such as lack of UTF-16
support in RegExp.prototype and Unicode case folding).
2021-07-22 09:10:44 +02:00
Idan Horowitz
d804ce830d
LibJS: Implement Temporal.PlainDate.prototype.equals & Required AO
2021-07-21 22:49:37 +01:00
Idan Horowitz
cf78efaef5
LibJS: Implement the ToTemporalDate Abstract Operation
...
This is required by most Temporal.PlainDate.prototype methods.
2021-07-21 22:49:37 +01:00
Idan Horowitz
1e471e2e2f
LibJS: Add Temporal.Calendar.prototype.dateFromFields & required AOs
...
This is required for implementing the DateFromFields PlainDate AO.
2021-07-21 22:49:37 +01:00
Idan Horowitz
7a33a5c9b5
LibJS: Use trunc instead of a static_cast<i64> in is_integral_number
...
This ensures we return true for integers that do not fit in an i64 aka,
above 9223372036854775807. (2**63 - 1)
2021-07-21 22:49:37 +01:00
Idan Horowitz
44c8e158c1
LibJS: Remove usages of String's null state in Temporal AOs
2021-07-21 22:49:37 +01:00
Idan Horowitz
68aad5d8fa
LibJS: Implement Temporal.PlainDate.prototype.valueOf
2021-07-21 22:49:37 +01:00
Andreas Kling
cdc1315dc8
LibJS: Use IntrusiveList for keeping track of WeakContainers
2021-07-21 20:17:55 +02:00
Andreas Kling
3fe1be20b7
LibJS: Use IntrusiveList for keeping track of MarkedValueLists
2021-07-21 19:51:19 +02:00
davidot
f8a869f2fc
LibJS: Fix that non-existent references are unresolvable in strict mode
2021-07-20 23:45:28 +02:00
Timothy Flynn
c6e9c6d6ab
LibJS: Follow the spec more closely when determining the this value
...
Co-authored-by: davidot <david.tuin@gmail.com>
2021-07-20 23:45:28 +02:00
davidot
a394aa5830
LibJS: Fix that vm.in_strict_mode was propagated to eval and functions
...
For eval it depends on the CallerMode and for a created function it
depends on the function itself.
2021-07-20 23:45:28 +02:00
Hendiadyoin1
ed46d52252
Everywhere: Use AK/Math.h if applicable
...
AK's version should see better inlining behaviors, than the LibM one.
We avoid mixed usage for now though.
Also clean up some stale math includes and improper floatingpoint usage.
2021-07-19 16:34:21 +04:30
Idan Horowitz
94322ea985
LibJS: Implement Temporal.PlainDate.prototype.calendar
2021-07-19 09:11:20 +01:00
Idan Horowitz
94e1324a67
LibJS: Implement Temporal.PlainDate.prototype[@@toStringTag]
2021-07-19 09:11:20 +01:00
Idan Horowitz
cc00ccec41
LibJS: Start implementing Temporal.PlainDate
...
This commit adds the PlainDate object itself, its constructor and
prototype (currently empty), and several required abstract operations.
2021-07-19 09:11:20 +01:00
Linus Groh
5516ad7158
LibJS: Rename Temporal.now => Temporal.Now
...
See:
- d0acb66
- 0097fdd
2021-07-19 00:59:26 +01:00
Linus Groh
d159938acc
LibJS: Reflect recent editorial changes in the Temporal proposal
...
See:
- 2148441
- 08c04cc
- b77da58
2021-07-19 00:59:26 +01:00
Linus Groh
5c77885873
LibJS: Implement Temporal.Duration.from()
...
...with ParseTemporalDurationString currently TODO()'d.
2021-07-19 00:34:28 +01:00
Linus Groh
7355c23e17
LibJS: Fix TemporalDurationLike property order
...
The table is sorted alphabetically and supposed to be iterated in that
oder. Also move this to a templated lambda for later re-use with
different target structs and value types.
2021-07-19 00:34:28 +01:00
Linus Groh
152251f5a7
LibJS: Move Temporal AO structs/enum classes above function declarations
...
This is a bit closer to our usual style, and tidier.
2021-07-19 00:34:28 +01:00
Ali Mohammad Pur
c85ab623c0
LibJS: Use a Utf8View on the subject if the regex has the unicode flag
...
This makes LibRegex behave (more) correctly with regards to matching
unicode code points.
2021-07-18 21:10:55 +04:30
Timothy Flynn
a2e734d202
LibJS: Report string length as the code point length, not byte length
...
For example, U+180E is 3 bytes, but should have a string length of 1.
2021-07-17 16:59:59 +01:00
Linus Groh
86c6e68431
LibJS: Implement Temporal.Duration.prototype.abs()
2021-07-16 21:59:13 +01:00
Linus Groh
7df47bf3fb
LibJS: Implement Temporal.Duration.prototype.negated()
2021-07-16 21:59:13 +01:00
Linus Groh
9aa1e4b885
LibJS: Implement Temporal.Duration.prototype.with()
2021-07-16 21:59:13 +01:00