Luke Wilde
fa1416987a
LibJS: Add yearOfWeek calendar methods and properties
...
This is a normative change in the Temporal spec.
See:
- https://github.com/tc39/proposal-temporal/commit/7fa4d18
- https://github.com/tc39/proposal-temporal/commit/caa941d
2022-12-26 09:30:36 +01:00
Timothy Flynn
a2cf026b30
LibJS: Throw a RangeError when when formatting strings in DurationFormat
...
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/2546080
2022-12-15 09:40:09 +00:00
davidot
2bbea62176
LibJS: Don't update names of resulting functions in object expression
...
The only cases where the name should be set is if the function comes
from a direct anonymous function expression.
2022-12-14 15:27:08 +00:00
Luke Wilde
ce39c907fd
LibJS: Support MM/DD/YYYY HH:MM <timezone-offset> format for Date
...
Required by Discord to determine if it should show Christmas themed
loading tips on the loading screen.
Fixes #16473 .
2022-12-13 21:42:28 +00:00
Linus Groh
5ee1758f46
LibJS: Use ToPropertyKey AO for computed member expression value
...
This ensures the value goes through the regular ToPrimitive mechanism,
which PropertyKey::from_value() bypasses. This is relevant for objects
with a @@toPrimitive method, for example.
Also enables one skipped test in delete-basic.js, which now passes.
2022-12-10 01:08:34 +00:00
Timothy Flynn
d37d6b3479
LibJS: Protect CanonicalIndex against double-to-integer overflow
...
Explicitly disallow constructing a CanonicalIndex from a floating point
type without going through a factory method that will throw when the
provided index cannot fit in a u32.
2022-12-07 16:43:19 +00:00
davidot
cf0d30add6
LibJS: Add a function to ensure calls are made within the same second
...
Before these tests could be flaky if they happened to be called around
the edge of a second. Now we try up to 5 times to execute the tests
while staying within the same second.
2022-12-03 23:04:08 +00:00
Idan Horowitz
2e806dab07
LibJS: Implement Set.prototype.isDisjointFrom
2022-12-02 13:09:15 +01:00
Idan Horowitz
3470f33a0f
LibJS: Implement Set.prototype.isSupersetOf
2022-12-02 13:09:15 +01:00
Idan Horowitz
e29be4eaa8
LibJS: Implement Set.prototype.isSubsetOf
2022-12-02 13:09:15 +01:00
Idan Horowitz
e359eeabe8
LibJS: Implement Set.prototype.symmetricDifference
2022-12-02 13:09:15 +01:00
Idan Horowitz
be8329d5f6
LibJS: Implement Set.prototype.difference
2022-12-02 13:09:15 +01:00
Idan Horowitz
9e693304ff
LibJS: Implement Set.prototype.intersection
2022-12-02 13:09:15 +01:00
Idan Horowitz
fee65f6453
LibJS: Implement Set.prototype.union
2022-12-02 13:09:15 +01:00
Linus Groh
b0e7d59b8b
LibJS: Throw on conversion from TimeZone to Calendar and vice versa
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/2084e77
2022-12-02 02:04:13 +01:00
Timothy Flynn
3ee5217adc
LibJS: Implement String.prototype.toWellFormed
2022-12-01 17:03:55 +01:00
Timothy Flynn
0bb46235a7
LibJS: Implement String.prototype.isWellFormed
2022-12-01 17:03:55 +01:00
Timothy Flynn
34e328e580
LibJS: Allow TypedArrays to become detached while sorting
...
This is a normative change in the Change Array by Copy proposal. See:
https://github.com/tc39/proposal-change-array-by-copy/commit/17d8b54
2022-11-30 23:27:51 +01:00
davidot
d218a68296
LibJS: Allow CallExpressions as lhs of assignments in most cases
...
Although not quite like the spec says the web reality is that a lhs
target of CallExpression should not give a SyntaxError but only a
ReferenceError once executed.
2022-11-30 08:05:37 +01:00
davidot
8319d7ac06
LibJS: Fix that constant declaration in for loop was mutable in body
2022-11-30 08:05:37 +01:00
Timothy Flynn
675e5bfdce
LibJS: Allow specifying only roundingIncrement in NumberFormat options
...
This is a normative change in the Intl.NumberFormat v3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/a260aa3
2022-11-29 10:24:44 +01:00
davidot
ab19d7c99d
LibJS: Enable commented out tests in Math.asin
2022-11-28 13:10:21 +01:00
davidot
bf1b2d63c6
LibJS: Add spec comments and check for edge cases in Math.tanh
2022-11-28 13:10:21 +01:00
davidot
8de8742b7c
LibJS: Add spec comments and check for edge cases in Math.sinh
2022-11-28 13:10:21 +01:00
davidot
4306462a95
LibJS: Add spec comments and check for edge cases in Math.log10
2022-11-28 13:10:21 +01:00
davidot
eda90b54d4
LibJS: Add spec comments and check for edge cases in Math.log2
2022-11-28 13:10:21 +01:00
davidot
4813385c9a
LibJS: Add spec comments and check for edge cases in Math.log
2022-11-28 13:10:21 +01:00
davidot
d4e5644df8
LibJS: Add spec comments and check for edge cases in Math.atanh
2022-11-28 13:10:21 +01:00
davidot
c565cbd30c
LibJS: Add spec comments and check for edge cases in Math.atanh
2022-11-28 13:10:21 +01:00
davidot
68aeeea5d2
LibJS: Add spec comments and check for edge cases in Math.asinh
2022-11-28 13:10:21 +01:00
davidot
6bdf021b0c
LibJS: Add spec comments and check for edge cases in Math.asin
2022-11-28 13:10:21 +01:00
davidot
cf4daa3941
LibJS: Add spec comments and check for edge cases in Math.acosh
2022-11-28 13:10:21 +01:00
Andreas Kling
f7a252ae85
LibJS: Fix UTF-16 corruption in String.prototype.replace()
...
We were mistakenly trying to append UTF-16 code units to a StringBuilder
via the append(char) API. This patch fixes that by accumulating the
result in a Vector<u16> instead.
This'll be a bit worse for performance, since we're now doing additional
UTF-16 string conversions, but we're going for correctness at this stage
and can worry about performance later.
2022-11-19 11:30:06 -07:00
davidot
16ac43c9d4
LibJS: Make sure private identifier is valid in optional chain
...
If we don't check that a private identifier is valid this can break the
assumption that we have a private environment when evaluation the
private identifier. Also an unknown private identifier this should
be a SyntaxError.
2022-11-17 16:05:20 +00:00
davidot
49fc0e2514
LibJS: Add space in output of toEval in test-common.js
2022-11-17 16:05:20 +00:00
davidot
8fa6861f66
LibJS: Initialize functions in spec order
...
This is only visible with something like `Object.getOwnPropertyNames` on
the global object. All other declaration instantiations put the
functions on an environment making the order invisible.
Note that spec order is not quite tree order as in non-strict mode
functions which get hoisted out of blocks appear before top level
functions.
Co-authored-by: Hendiadyoin1 <leon.a@serenityos.org >
2022-11-17 16:05:20 +00:00
davidot
5ca6e8dca8
LibJS: No longer hoist if parent scope has a function with the same name
2022-11-17 16:05:20 +00:00
davidot
67865306d3
LibJS: Fix that functions in module did not look for var declarations
2022-11-15 12:00:36 +00:00
davidot
385c2f2eb8
LibJS: Use correct this value for tagged template calls
...
This has to get quite messy because we currently do evaluation to value
and reference separately meaning we have to deal with a lot of edge
cases here.
2022-11-15 12:00:36 +00:00
davidot
b3edd94869
LibJS: Treat '\\' as an escaped character in template literals
...
Before this change we would ignore that the second backslash is escaped
and template strings ending with ` \\` would be unterminated as the
second slash was used to escape the closing quote.
2022-11-15 12:00:36 +00:00
Luke Wilde
08750f69e4
LibJS: Add thorough tests for try/finally using continue and break
...
I wrote these tests a while ago while trying to improve the bytecode,
but didn't end up making them pass and gave up. They work in AST
interpreter mode, so we can have them in now to have them around for
anyone who wants to try and make them pass in bytecode.
2022-11-08 21:10:53 +00:00
Timothy Flynn
8eec25b7ae
LibJS: Use more accurate number-to-string method in Number toExponential
2022-11-04 21:12:10 +00:00
Timothy Flynn
5898db8c0f
LibJS: Use more accurate number-to-string method in Number toPrecision
2022-11-04 21:12:10 +00:00
Timothy Flynn
d56205f991
LibJS: Use more accurate number-to-string method in Intl.NumberFormat
...
Intl.NumberFormat only ever wants literal number-to-digits here, without
extra exponential formatting.
2022-11-04 21:12:10 +00:00
Luke Wilde
ac67077b57
LibJS: Fix length of PlainDateTime.withPlainTime
...
withPlainTime's argument is optional, so the length of the function is
actually 0.
2022-11-03 21:09:58 +00:00
Luke Wilde
b26b18a0bc
LibJS: Add timeZoneName: "critical" option to ZonedDateTime.toString()
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/d84937f
2022-11-03 19:15:50 +00:00
Luke Wilde
4a167cfbec
LibJS: Add calendarName: "critical" option to toString() methods
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/e715a50
2022-11-03 19:15:50 +00:00
Luke Wilde
192aa75279
LibJS: Align ISO 8601 grammar with annotations from IXDTF
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/c64b844
2022-11-03 19:15:50 +00:00
Timothy Flynn
a5bf32018f
LibJS+LibUnicode: Add "microsecond" and "nanosecond" as sanctioned units
...
This is a normative change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/f627573
2022-11-03 18:37:48 +00:00
Timothy Flynn
4686989582
LibJS: Map DurationFormat's list style to "short" when it is "digital"
...
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/7495e32
2022-11-01 14:33:07 +00:00