Timothy Flynn
a2e791277e
LibJS: Implement Intl.RelativeTimeFormat.prototype.formatToParts
2022-01-27 21:16:44 +00:00
Timothy Flynn
9c5d7e515c
LibJS: Implement Intl.RelativeTimeFormat.prototype.format
2022-01-27 21:16:44 +00:00
Timothy Flynn
8098eb273a
LibJS: Add explicit constructors for PatternPartition
...
This is to enable emplacing this struct in containers. GCC is fine with
emplacing without this constructor, but Clang raises an error.
2022-01-27 21:16:44 +00:00
Timothy Flynn
236fd0a2cb
LibJS: Change RelativeTimeFormat::number_format to return a reference
...
In the one place this will be used, we will know that the NumberFormat
object is non-null. So return a reference, as the AO it is passed off to
also expects a reference.
2022-01-27 21:16:44 +00:00
Timothy Flynn
90e68bca6a
LibJS: Add missing spec link for InitializeRelativeTimeFormat
2022-01-27 21:16:44 +00:00
Timothy Flynn
cf92bc42a2
LibJS: Respect per-locale minimum grouping digits when number formatting
2022-01-27 20:30:52 +00:00
Timothy Flynn
236025df19
LibJS: Prevent implicit pointer-to-bool conversion in Value constructor
...
For example, say you try to create a Value from an Array and forgot to
include LibJS/Runtime/Array.h. This would cause the boolean constructor
to be used instead of a compile error.
2022-01-27 16:27:00 +00:00
Timothy Flynn
59ca435172
LibJS: Use new construct AO overload where easily applicable
2022-01-25 22:09:13 +00:00
Timothy Flynn
67e02f6ca6
LibJS: Add templated overloads for the construct AO to create its MVL
...
Instead of requiring callers to construct a MarkedValueList, add a
variadic templated overload to construct the MVL on the caller's behalf.
2022-01-25 22:09:13 +00:00
Timothy Flynn
4661a0f228
LibJS: Use forwarding references for call's variadic template arguments
2022-01-25 22:09:13 +00:00
Timothy Flynn
5c4b1e3d23
LibJS: Remove erroneous variadic template from some call overloads
...
These function do not use the Args variadic template.
2022-01-25 22:09:13 +00:00
Timothy Flynn
0c630d5687
LibJS: Implement Intl.RelativeTimeFormat.prototype.resolvedOptions
2022-01-25 19:02:59 +00:00
Timothy Flynn
b50880f28c
LibJS: Fix errors in Intl.DateTimeFormat.prototype.resolvedOptions tests
...
Noticed these while implementing this prototype for RelativeTimeFormat.
2022-01-25 19:02:59 +00:00
Timothy Flynn
cf166c1d93
LibJS: Implement Intl.RelativeTimeFormat.supportedLocalesOf
2022-01-25 19:02:59 +00:00
Timothy Flynn
a2e31ed736
LibJS: Implement the Intl.RelativeTimeFormat constructor
2022-01-25 19:02:59 +00:00
Timothy Flynn
79fdec85de
LibJS: Implement a nearly empty Intl.RelativeTimeFormat object
...
This adds plumbing for the Intl.RelativeTimeFormat object, constructor,
and prototype.
2022-01-25 19:02:59 +00:00
Timothy Flynn
0865f71d37
LibJS: Convert Intl.NumberFormat to use Unicode::Style
2022-01-25 19:02:59 +00:00
Timothy Flynn
25e67f63a2
LibJS: Convert Intl.DisplayNames to use Unicode::Style
2022-01-25 19:02:59 +00:00
Timothy Flynn
bced4e9324
LibJS+LibUnicode: Convert Intl.ListFormat to use Unicode::Style
...
Remove ListFormat's own definition of the Style enum, which was further
duplicated by a generated ListPatternStyle enum with the same values.
2022-01-25 19:02:59 +00:00
Linus Groh
96db8a061b
LibJS: Correct FormatTimeZoneOffsetString arg in CreateTemporalTimeZone
...
This is an editorial change in the Temporal spec (accidentally marked
normative).
See: https://github.com/tc39/proposal-temporal/commit/3039c98
2022-01-25 00:06:49 +00:00
Sam Atkins
45cf40653a
Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOr
...
Apologies for the enormous commit, but I don't see a way to split this
up nicely. In the vast majority of cases it's a simple change. A few
extra places can use TRY instead of manual error checking though. :^)
2022-01-24 22:36:09 +01:00
Linus Groh
140f1d9e55
LibJS/Tests: Enable Number.isInteger() test that now passes
2022-01-24 20:39:01 +00:00
Linus Groh
73a43e7cba
LibJS: Update ShadowRealm AO parameter declaration notations
...
This is an editorial change in the ShadowRealm spec.
See: https://github.com/tc39/proposal-shadowrealm/commit/f5013fe
2022-01-24 20:17:07 +00:00
Linus Groh
e20efaa083
LibJS: Let WrappedFunction inherit target name and length
...
This is a normative change in the ShadowRealm spec.
See: https://github.com/tc39/proposal-shadowrealm/commit/b73a1dc
2022-01-24 20:17:07 +00:00
Linus Groh
886d6c62f9
LibJS: Implement the SetFunctionLength AO
2022-01-24 20:17:07 +00:00
Linus Groh
5b04c49762
LibJS: Implement the SetFunctionName AO
2022-01-24 20:17:07 +00:00
davidot
6fa600fce3
LibJS: Fix the execution context for the bytecode interpreter
...
Because we now push an execution context when creating the "normal"
interpreter without valid environments we have to check for that case
as well when running the bytecode interpreter.
2022-01-24 19:55:50 +00:00
Idan Horowitz
ace36681ff
LibJS+LibIMAP: Use the new Optional<U>(Optional<T>) constructor
...
These look much nicer than these repeated ternaries :^)
2022-01-23 18:53:42 +02:00
mjz19910
61cf1c066e
LibJS: Remove VM::call()
2022-01-23 15:24:45 +00:00
mjz19910
1ef633472b
Everywhere: Convert VM::call() to JS::call()
2022-01-23 15:24:45 +00:00
mjz19910
d436746c95
LibJS: Add some overloads for JS::call() and JS::call_impl()
...
Overloads added:
- JS::call for FunctionObject&
- JS::call_impl for FunctionObject&
2022-01-23 15:24:45 +00:00
Timothy Flynn
0a4430fc41
LibJS+LibTimeZone+LibUnicode: Remove direct linkage to LibTimeZone
...
This is no longer needed now that LibTimeZone is included within LibC.
Remove the direct linkage so that others do not mistakenly copy-paste
the CMakeLists text elsewhere.
2022-01-23 12:48:26 +00:00
Linus Groh
1ce6c49f5e
LibJS: Make CreateTemporalDuration infallible in PlainYearMonthPrototype
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/05793a8
2022-01-23 00:22:10 +00:00
Linus Groh
e16821f460
LibJS: Avoid ambiguity in TimeZone production
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/87a6b0d
2022-01-23 00:22:10 +00:00
Linus Groh
0e3def1d0b
LibJS: Don't parse/re-format offset in parse_temporal_time_zone_string()
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/6abe146
2022-01-23 00:22:10 +00:00
Linus Groh
31283b5e64
LibJS: Pass valid offset string directly to CreateTemporalTimeZone
...
This is an editorial change in the Temporal spec.
See:
- https://github.com/tc39/proposal-temporal/commit/75490b9
- https://github.com/tc39/proposal-temporal/commit/8b70e4b
2022-01-23 00:22:10 +00:00
Linus Groh
6d744eb4a7
LibJS: Use consistent name for offset strings
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/17f8cdb
2022-01-23 00:22:10 +00:00
Emanuele Torre
191566fc97
LibJS: Avoid potential signed integer overflow in CyclicModule.cpp
...
`auto count = 0;` will declare `count` as a `signed int`.
We don't want that since `count` is used to count the occurence of an
element in an `AK::Vector` that can have up to `SIZE_MAX` elements;
`SIZE_MAX` can overflow a `signed int` more than 4 billion times.
2022-01-22 10:38:41 +01:00
davidot
986ad3ccf0
LibJS: Use HostImportModuleDynamically in ShadowRealmImportValue
...
Now that module loading is implemented this just works :^).
Since ShadowRealm explicitly passed a null ScriptOrModule we attempt to
get the top most ScriptOrModule in HostImportModuleDynamically.
This won't work in general as the web specifies other behavior but for
LibJS there must always be an active script to call
HostImportModuleDynamically.
2022-01-22 01:21:18 +00:00
davidot
91b3e5b31f
LibJS: Implement the ImportMeta MetaProperty
...
This "standard" implementation of this is to do nothing.
2022-01-22 01:21:18 +00:00
davidot
7cbf4b90e8
LibJS: Implement ImportCall and HostImportModuleDynamically
...
This allows us to load modules from scripts.
This can be dangerous as it can load arbitrary files. Because of that it
fails and throws by default. Currently, only js and JavaScriptTestRunner
enable the default hook.
This also adds tests to test-js which test module code. Because we
form a spec perspective can't "enter" a module this is the easiest way
to run tests without having to modify test-js to have special cases for
modules.
To specify modules in test-js we use the extension '.mjs' this is to
ensure the files are not executed. We do still want to lint these files
so the prettier scripts have changed to look for '.mjs' files as well.
2022-01-22 01:21:18 +00:00
davidot
023968a489
LibJS: Implement evaluation of im- and exports statements
2022-01-22 01:21:18 +00:00
davidot
779e677467
LibJS: Implement HostResolveImportedModule for LibJS
...
This loads modules with relative paths from the referencing module.
In this commit the only way to run a module is via the interpreter
which can link and evaluate a module (and all its dependencies).
2022-01-22 01:21:18 +00:00
davidot
1b8ccf9a66
LibJS: Implement Module linking and evaluating
2022-01-22 01:21:18 +00:00
davidot
be9d478d92
LibJS: Add host layering point related to modules to VM
...
Also make HostResolveImportedModule fail on the browser to prevent
module loading for now.
2022-01-22 01:21:18 +00:00
davidot
55366703d0
LibJS: Add Module Namespace Exotic Object
2022-01-22 01:21:18 +00:00
davidot
0cdbc03de0
LibJS: Add ModuleEnvironment
2022-01-22 01:21:18 +00:00
davidot
12c2f30c54
LibJS: Add filename tracking to Script and Module
...
This will allow us to resolve modules dynamically loaded from a script.
2022-01-22 01:21:18 +00:00
davidot
57c5a59cab
LibJS: Add ScriptOrModule to execution context and track it everywhere
2022-01-22 01:21:18 +00:00
davidot
99edf5b25a
LibJS: Track whether a program has a top level await statement
2022-01-22 01:21:18 +00:00