1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 18:55:07 +00:00
Commit graph

3168 commits

Author SHA1 Message Date
Matthias Zimmerman
c10d48b72c AK/ByteBuffer+Everywhere: Handle errors in ByteBuffer::slice() 2022-06-13 15:38:51 +01:00
Luke Wilde
125a71d36d LibJS/Bytecode: Define named functions as a variable inside their scope
This allows you to recurse into a named function that is stored in a
variable. For example, this would previously print "wrong" instead of
"right":
```js
function g() { console.log("wrong") }
f = function g(i) { if (i !== 1) g(1); else console.log("right"); }
f()
```
2022-06-13 07:13:03 +04:30
Luke Wilde
9ad807d08b LibJS/Bytecode: Pass contains_direct_call_to_eval into ESFO::create
Previously it would pass in `is_arrow_function` as
`contains_direct_call_to_eval`, which broke strict mode propagation in
arrow functions. This makes test-js work without falling apart because
`this` is mysteriously undefined because of the use of arrow functions
inside classes, which are strict mode by default.
2022-06-13 07:13:03 +04:30
Luke Wilde
77f88d00e0 LibJS/Bytecode: Make return; return undefined
Previously it would return whatever was in the accumulator.
2022-06-13 07:13:03 +04:30
Luke Wilde
482a827346 LibJS/Bytecode: Make typeof return "undefined" on unresolvable IDs
Previously it would throw instead of returning "undefined" for
`typeof Identifier` if Identifier does not exist.
2022-06-13 07:13:03 +04:30
Luke Wilde
c0fadfb9b7 LibJS/Bytecode: Implement break/continue labels
This is done by keeping track of all the labels that apply to a given
break/continue scope alongside their bytecode target. When a
break/continue with a label is generated, we scan from the most inner
scope to the most outer scope looking for the label, performing any
necessary unwinds on the way. Once the label is found, it is then
jumped to.
2022-06-13 07:13:03 +04:30
Linus Groh
4c77575ec5 LibJS: Simplify Temporal unit AOs
This is an editorial change in the Temporal spec.

See: 1b3d018
2022-06-10 12:39:11 +02:00
Linus Groh
b9beb2b120 LibJS: Remove unnecessary ToLimitedTemporalDuration AO
This is an editorial change in the Temporal spec.

See: c6571f4
2022-06-10 12:39:11 +02:00
Linus Groh
237f537b5c LibJS: Align DifferenceTemporalInstant with similar AOs
This is an editorial change in the Temporal spec.

See: cf9118b
2022-06-10 12:39:11 +02:00
Linus Groh
3bb94dd62e LibJS: Refactor Temporal parse AOs
This is an editorial change in the Temporal spec.

See: 7fe29eb
2022-06-10 12:39:11 +02:00
Linus Groh
86e22abd76 LibJS: Rename DefaultMergeFields to DefaultMergeCalendarFields
This is an editorial change in the Temporal spec.

See: 0ee80b2
2022-06-10 12:39:11 +02:00
Linus Groh
125530c71d LibJS: Mark a call of CreateTemporalDate as infallible
This is an editorial change in the Temporal spec.

See: c403d3f
2022-06-10 12:39:11 +02:00
stelar7
771e3b9868 LibJS: Stub out String.prototype.normalize 2022-06-02 23:04:27 +01:00
Linus Groh
9400b76d79 LibJS: Remove assertions replaced with structured headers
This is an editorial change in the Temporal spec.

See: 74fd5e8
2022-05-25 00:25:23 +01:00
Linus Groh
c3f1d8f5ba LibJS: Correct section IDs of Temporal .prototype property clauses
This is an editorial change in the Temporal spec.

See: e4eb181
2022-05-25 00:25:23 +01:00
Linus Groh
ae1fdf299d LibJS: Use the rounding abstract operations from Intl.NumberFormat V3
This is an editorial change in the Temporal spec.

See: 75279e5

Co-Authored-By: Idan Horowitz <idan.horowitz@gmail.com>
2022-05-25 00:25:23 +01:00
Linus Groh
93a20b3bfb LibJS: Use default argument of CalendarDateFromFields
This is an editorial change in the Temporal spec.

See: 7a4a518
2022-05-25 00:25:23 +01:00
Linus Groh
cf1ea18b7f LibJS: Align DifferenceTemporalPlainTime with other Difference* AOs
This is an editorial change in the Temporal spec.

See: 70f739d
2022-05-25 00:25:23 +01:00
Linus Groh
89d4094709 LibJS: Mark concrete method calls of Environment Records with ?/!
This is an editorial change in the ECMA-262 spec.

See: 7ae3ecf
2022-05-25 00:25:23 +01:00
Linus Groh
74695ce76e LibJS: Mark two Get operations in ToTemporalZonedDateTime infallible
This is an editorial change in the Temporal spec.

See: fed9f16
2022-05-17 21:24:50 +01:00
Linus Groh
a5c41aa905 LibJS: Use required fields argument in ISOYearMonthFromFields
This is an editorial change in the Temporal spec.

See: ff02f87
2022-05-17 21:16:56 +01:00
Linus Groh
0946f82c8c LibJS: Combine TemporalTimeZoneIdentifier and TimeZoneBracketedName
This is an editorial change in the Temporal spec.

See: 6db76f4
2022-05-17 21:14:01 +01:00
Luke Wilde
2b764b3594 LibJS: Remove faulty assertion in BalanceDurationRelative
This is an editorial change in the Temporal spec.

See: 66f7464
2022-05-16 20:48:41 +01:00
Linus Groh
d2c1dd5454 LibJS: Introduce ISO Date Records
This is an editorial change in the Temporal spec.

See: d264341
2022-05-16 20:46:46 +01:00
Linus Groh
0558eb6d2f LibJS: Swap until/since arguments to DifferenceTemporalZonedDateTime
This is an editorial change in the Temporal spec.

See: b911bc9
2022-05-16 20:35:13 +01:00
Linus Groh
6d7970a23c LibJS: Remove unnecessary CalendarDate production
This is an editorial change in the Temporal spec.

See: 48744ea
2022-05-16 20:33:22 +01:00
Linus Groh
03017be5bd LibJS: Remove redundant TemporalRelativeToString production
This is an editorial change in the Temporal spec.

See: f85f953
2022-05-16 20:29:32 +01:00
Linus Groh
51e01b5a80 LibJS: Remove redundant TemporalDateString production
This is an editorial change in the Temporal spec.

See: 41a8a5c
2022-05-16 20:28:26 +01:00
Linus Groh
33f53041e7 LibJS: Replace "enclosed by" with "contained within" in spec comments
This is an editorial change in the Temporal spec.

See: cb10d3f
2022-05-16 20:17:23 +01:00
Linus Groh
80048c694a LibJS: Use '2 × nsMaxInstant' in a couple of assertion comments
This is an editorial change in the Temporal spec.

See: a225863
2022-05-09 20:27:20 +02:00
Luke Wilde
ee6fb51db6 LibJS: Add a couple of missing spec steps to PerformEval
I missed these in 34f902fb52.
2022-05-08 17:12:27 +02:00
Luke Wilde
77ba3d3e3f LibJS: Remove callerRealm from HostEnsureCanCompileStrings
This is a normative change in the ecma262 spec.

See: 2527be4
2022-05-08 17:12:27 +02:00
Linus Groh
b751f80166 LibJS: Change internal slots of Duration to store mathematical values
This is a normative change in the Temporal spec.

See: 1f3fba8
2022-05-08 01:01:32 +02:00
Linus Groh
cc8f5151d7 LibJS: Refactor Temporal since/until to common AOs
This is an editorial change in the Temporal spec.

See: 85a9f57
2022-05-08 00:07:58 +02:00
Linus Groh
fc6cf3cb9d LibJS: Remove ToISODayOfWeek
This is an editorial change in the Temporal spec.

See: 3eab7e4
2022-05-08 00:07:58 +02:00
Linus Groh
cabcdd838b LibJS: Remove ToISODayOfYear
This is an editorial change in the Temporal spec.

See: 6117d90
2022-05-08 00:07:58 +02:00
Linus Groh
a216c0b6df LibJS: Remove IsISOLeapYear
This is an editorial change in the Temporal spec.

See: a36bdd4
2022-05-08 00:07:58 +02:00
Linus Groh
6d0d7c8fd0 LibJS: Remove ISODaysInYear
This is an editorial change in the Temporal spec.

See: f62e737
2022-05-08 00:07:58 +02:00
Linus Groh
ade7946217 LibJS: Simplify DifferenceISODate
This is an editorial change in the Temporal spec.

See: 76452d2
2022-05-08 00:07:58 +02:00
Linus Groh
6a2b73a4a9 LibJS: Simplify DaysUntil
This is an editorial change in the Temporal spec.

See: b2254b4
2022-05-08 00:07:58 +02:00
Linus Groh
de0ea331cd LibJS: Simplify BalanceISODate
This is an editorial change in the Temporal spec.

See: 9544573
2022-05-08 00:07:58 +02:00
Linus Groh
938e68d003 LibJS: Remove type assertion comment from IsValidISODate
This is an editorial change in the Temporal spec.

See: ddb5652
2022-05-08 00:07:58 +02:00
Linus Groh
15fe6297bc LibJS: Use "Completion" to emphasize completion record
This is an editorial change in the Temporal spec.

See: 31d9fc5
2022-05-08 00:07:58 +02:00
Linus Groh
f64b69955e LibJS: Fix numeric type in Date.prototype.toTemporalInstant()
This is an editorial change in the Temporal spec.

See: 435a111
2022-05-08 00:07:58 +02:00
Linus Groh
c6f7214a60 LibJS: Replace magic nanosecond numbers with constants
This is an editorial change in the Temporal spec.

See: 3fdbfda
2022-05-08 00:07:58 +02:00
Linus Groh
3729a910f6 LibJS: Refactor Temporal add/subtract to common AOs
This is an editorial change in the Temporal spec.

See:
- 2f96efc
- fbff635
2022-05-08 00:07:58 +02:00
Luke Wilde
05748ed607 LibJS: Convert Console to use MarkedVector<Value>
Using a Vector<Value> is unsafe as GC cannot see the stored values.
This is then vended to outside users of ConsoleClient, e.g. LibWeb and
WebContent, which is then outside of LibJS's control.

An example issue is if the client stores it for later use and forgets
to visit the stored values, meaning they can be destroyed at any time.
We can save the client from this by vending a MarkedVector<Value> to
them.
2022-05-07 01:22:09 +02:00
Linus Groh
f7c9bd0760 LibJS: Convert remaining Date AOs using JS::Value as in/output to double
There was an awful lot of JS::Value <-> double conversion going on, even
through these AOs only work with number values anyway.
They don't need a global object either as they won't allocate or throw,
that was simply to pass it to infallible calls of ToIntegerOrInfinity.
2022-05-06 22:32:47 +02:00
Linus Groh
b9b3d01bea LibJS: Add variant of to_integer_or_infinity() for plain doubles
In many cases we already know a certain value is a number, or don't have
JS values at all and would need to wrap doubles in a value. To optimize
these cases and avoid having to pass a global object into functions that
won't ever allocate or throw, add a standalone implementation of this
function that takes and returns doubles directly.
2022-05-06 22:32:47 +02:00
Linus Groh
875e59b740 LibJS: Remove unused LibCore/DateTime.h header from Date.cpp
We use a double for [[DateValue]] and the spec's own AOs for any
calculations now.
2022-05-06 22:32:47 +02:00