davidot
c2ebaa9d87
LibJS: Replace the verify in private identifier with a syntax error
...
Since sometimes expressions are parsed without checking we can hit this
expression without it being followed by an 'in'.
2021-11-30 17:05:32 +00:00
davidot
b7c7d54167
LibJS: Split parsing program to script and module separately
...
This allows us to only perform checks like export bindings existing only
for modules. Also this makes it easier to set strict and other state
variables with TemporaryChanges.
2021-11-30 17:05:32 +00:00
davidot
22174d3b7b
LibJS: Rename in_async_function_context to await_expression_is_valid
...
Since await can be valid in module code which is not an async function
the old name is not really representative for the usage.
2021-11-30 17:05:32 +00:00
davidot
045a42cf35
LibJS: Parse dynamic import calls 'import()' and 'import.meta'
...
For now both just throw when executing but this can be implemented when
modules are implemented :^).
2021-11-30 17:05:32 +00:00
davidot
73eb29dabe
LibJS: Lookahead for a period when parsing new.target
...
This allows us to skip saving and loading the state whenever we parse
'new'.
2021-11-30 17:05:32 +00:00
davidot
4d7e79fb72
LibJS: Stop parsing an expression on comma after a yield
2021-11-30 17:05:32 +00:00
davidot
156dfe3d62
LibJS: Disallow member expression in binding pattern as parameters
2021-11-30 17:05:32 +00:00
davidot
51e23cd043
LibJS: Disallow shorthand properties with reserved names
2021-11-30 17:05:32 +00:00
davidot
e491fc0e81
LibJS: Allow defining class fields with "keyword" names
2021-11-30 17:05:32 +00:00
davidot
cbbfcd35e7
LibJS: Disallow await keywords in static init blocks
...
In static init blocks 'await' cannot be used. Note that this does not
cover all the cases since the parser currently cannot distinguish
between expressions within parenthesis and direct expressions.
2021-11-30 17:05:32 +00:00
davidot
7624c3de0e
LibJS: Disallow '\8' and '\9' in strict mode due to being octal escapes
2021-11-30 17:05:32 +00:00
davidot
c57721cf83
LibJS: Allow escaped 'async' as identifier
...
Since 'async' is only special if it occurs before a function it can be
used as escaped identifier in all cases.
2021-11-30 17:05:32 +00:00
davidot
e751dcea43
LibJS: Treat private identifier as divisible token
...
And also make sure private identifiers are correctly checked when
synthesizing a binding pattern.
2021-11-30 17:05:32 +00:00
davidot
afde1821b5
LibJS: Disallow numerical separators in octal numbers and after '.'
2021-11-30 17:05:32 +00:00
davidot
32016d3924
LibJS: Allow object properties called 'async'
2021-11-30 17:05:32 +00:00
davidot
450dedabd1
LibJS: Add messages to the toEval and toEvalTo tests
...
This makes it a lot easier to understand what is going wrong when an
eval test fails. As an example instead of just getting:
`ExpectationError`
You would now get:
`ExpectationError: Expected _1_2E+0_1_ to eval to _12_ but got _120_`.
2021-11-30 17:05:32 +00:00
Timothy Flynn
1039159a6c
LibJS: Change LargerOfTwoTemporalUnits AO to return a StringView
2021-11-30 00:01:07 +00:00
Luke Wilde
2cea4ad508
LibJS: Implement Temporal.Duration.prototype.subtract
2021-11-29 22:56:35 +00:00
Luke Wilde
ac8c3919cb
LibJS: Implement Temporal.Duration.prototype.add
2021-11-29 22:56:35 +00:00
Luke Wilde
acf8729a81
LibJS: Implement Temporal.Duration.prototype.round
2021-11-29 22:56:35 +00:00
Timothy Flynn
4a08fd2be2
LibJS: Implement Intl.DateTimeFormat.prototype.resolvedOptions
2021-11-29 22:48:46 +00:00
Timothy Flynn
d0e1997e07
LibJS: Implement Intl.DateTimeFormat.supportedLocalesOf
2021-11-29 22:48:46 +00:00
Timothy Flynn
16151aa7d5
LibJS+LibUnicode: Implement the Intl.DateTimeFormat constructor
2021-11-29 22:48:46 +00:00
Timothy Flynn
75b2a09a2f
LibJS: Implement a nearly empty Intl.DateTimeFormat object
...
This adds plumbing for the Intl.DateTimeFormat object, constructor, and
prototype.
Note that unlike other Intl objects, the Intl.DateTimeFormat object has
a LibUnicode structure as a base. This is to prevent wild amounts of
code duplication between LibUnicode, Intl.DateTimeFormat, and other
not-yet-defined Intl structures, because there's 12 fields shared
between them.
2021-11-29 22:48:46 +00:00
Timothy Flynn
914675e826
LibJS+LibUnicode: Separate number formatting methods from Locale.h
...
Currently, we generate separate data files for locale and number format
related tables/methods, but provide public accessors for all of the data
in one Locale.h file. Rather than continuing this trend for date-time,
relative time, etc. formatting, it's a bit easier to reason about if the
public accessors are also in separate files.
2021-11-29 22:48:46 +00:00
Timothy Flynn
bb11437792
LibJS: Change Intl's GetOption AO to accept a Span rather than a Vector
...
Allocating a Vector for each of these invocations is a bit silly when
the values are basically all compile-time arrays. This AO is used even
more heavily by Intl.DateTimeFormat, so change it to accept a Span to
reduce its cost.
This also adds an overload to accept a fixed-size C-array so callers do
not have to be prefixed with AK::Array, i.e. this:
get_option(..., AK::Array { "a"sv, "b"sv }, ...);
Reduces to:
get_option(..., { "a"sv, "b"sv }, ...);
(Which is how all call sites were already written to construct a Vector
in place).
2021-11-29 22:48:46 +00:00
davidot
e69276e704
LibJS: Implement parsing and executing for-await-of loops
2021-11-29 15:20:07 +00:00
davidot
b3699029e2
LibJS: Implement the async versions of iterator operations
...
Since AsyncIteratorClose and IteratorClose differ only in that the async
version awaits the inner value we just implement them with an enum flag
to switch just that behavior.
2021-11-29 15:20:07 +00:00
davidot
064c8be627
LibJS: Add AsyncFromSyncIteratorPrototype and Async-From-Sync instances
...
Until we have actual iterator records we have to store the sync iterator
as the raw object.
2021-11-29 15:20:07 +00:00
davidot
0535c1abbd
LibJS: Move the TRY_OR_REJECT macro to PromiseReaction
...
Also fixes that we ignored the result of the Call which we shouldn't
according to the spec.
2021-11-29 15:20:07 +00:00
davidot
7fd38eac98
LibJS: Add AsyncIteratorPrototype
2021-11-29 15:20:07 +00:00
Ali Mohammad Pur
ccf713bf23
LibJS: Spin the event loop while waiting for async completion in await
2021-11-28 13:28:01 +00:00
Linus Groh
f7ba81ac52
LibJS: Implement parsing of TemporalDurationString
2021-11-28 10:32:28 +00:00
Linus Groh
908d943e85
LibJS: Parse TemporalInstantString as part of TemporalCalendarString
2021-11-27 23:54:38 +00:00
Linus Groh
8f99c05f97
LibJS: Implement Temporal.PlainYearMonth.prototype.since()
2021-11-27 19:11:31 +00:00
Linus Groh
bdd2c357fd
LibJS: Implement Temporal.PlainYearMonth.prototype.until()
2021-11-27 19:11:31 +00:00
Linus Groh
6f2e0b3355
LibJS: Implement Temporal.PlainYearMonth.prototype.subtract()
2021-11-27 17:48:04 +00:00
Linus Groh
acbcd64cdc
LibJS: Implement Temporal.PlainYearMonth.prototype.add()
2021-11-27 17:48:04 +00:00
Idan Horowitz
957f54d96f
LibJS: Throw InternalErrors instead of Errors on CallStackSizeExceeded
...
These seem more appropriate.
2021-11-27 01:58:05 +02:00
Linus Groh
905b8bd545
LibJS: Make section URLs more consistent
...
- Drop index.html
- Include trailing slash before anchor
- Don't use multipage spec URLs
2021-11-24 18:37:57 +00:00
Linus Groh
ad294ff2ee
LibJS: Simplify TemporalRelativeToString
...
This is an editorial change in the Temporal spec.
See: d3b2e90
2021-11-24 18:18:05 +00:00
Linus Groh
de69f5dbf4
LibJS: Implement Temporal.ZonedDateTime.prototype.since()
2021-11-24 17:53:00 +00:00
Linus Groh
7a2eeae8c6
LibJS: Implement Temporal.ZonedDateTime.prototype.until()
2021-11-24 17:53:00 +00:00
Luke Wilde
7dc846d51c
LibJS: Implement balance_duration_relative()
2021-11-24 17:53:00 +00:00
Luke Wilde
9559cea8e5
LibJS: Implement add_duration()
2021-11-24 17:53:00 +00:00
Luke Wilde
1f84deaf63
LibJS: Implement default_temporal_largest_unit()
2021-11-24 17:53:00 +00:00
Luke Wilde
16301a603c
LibJS: Implement difference_zoned_date_time()
2021-11-24 17:53:00 +00:00
Linus Groh
1e41a8668d
LibJS: Add sign(Crypto::SignedBigInteger const&) overload
2021-11-24 17:53:00 +00:00
Linus Groh
a20b189eab
LibJS: Fix incorrectly formatted section comments
...
A couple of missing URLs, spaces, and a stray comma.
2021-11-24 17:37:27 +00:00
Timothy Flynn
251f692440
LibJS: Re-implement SetNumberFormatDigitOptions AO
...
This is an editorial change in the Intl spec.
See: d89c84f
2021-11-24 14:17:15 +00:00