summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
AgeCommit message (Collapse)Author
2022-07-10LibJS: Fix typos in Temporal spec commentsLinus Groh
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/b0411b4
2022-07-10LibJS: Add Add IsValidISODate assertionsLinus Groh
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/46f97ea
2022-07-08LibJS: Use Intl.PluralRules within Intl.NumberFormatTimothy Flynn
This also allows removing a bit of a BigInt hack to resolve plurality of BigInt numbers (because the AOs used in ResolvePlural support BigInt, wherease the naive Unicode::select_pattern_with_plurality did not). We use cardinal form here; the number format patterns in the CLDR align with the cardinal form of the plural rules.
2022-07-08LibJS: Add an overload of ResolvePlural for use without PluralRulesTimothy Flynn
The NumberFormat spec casually indicates the need for a PluralRules object without explicity saying so, with text such as: "which may depend on x in languages having different plural forms." Other implementations actually do create a PluralRules object to resolve those cases with ResolvePlural. However, ResolvePlural doesn't need much from PluralRules to operate, so this can be abstracted out for use in NumberFormat without the need to allocate a PluralRules instance.
2022-07-08LibJS: Use Intl.PluralRules within Intl.DurationFormatTimothy Flynn
2022-07-08LibJS+LibUnicode: Do not generate the PluralCategory enumTimothy Flynn
The PluralCategory enum is currently generated for plural rules. Instead of generating it, this moves the enum to the public LibUnicode header. While it was nice to auto-discover these values, they are well defined by TR-35, and we will need their values from within the number format code generator (which can't rely on the plural rules generator having run yet). Further, number format will require additional values in the enum that plural rules doesn't know about.
2022-07-08LibJS: Use Intl.PluralRules within Intl.RelativeFormatTimothy Flynn
The Polish test cases added here cover previous failures from test262, due to the way that 0 is specified to be "many" in Polish.
2022-07-08LibJS: Implement Intl.PluralRules.prototype.selectTimothy Flynn
2022-07-08LibJS: Populate pluralCategories in Intl.PluralRules.resolvedOptionsTimothy Flynn
2022-07-08LibJS: Replace JS::Intl::PluralRules::Type with Unicode::PluralFormTimothy Flynn
The JS::Intl enum was added when implementing the PluralRules constructor. Now that LibUnicode has a plural rules implementation, replace the JS::Intl enum with the analagous Unicode enum.
2022-07-08LibJS: Mark the NumberFormat parameter of FormatNumericToString as constTimothy Flynn
Not critical, but in subsequent commits this will be invoked from a constant context.
2022-07-06LibJS: Implement Intl.Locale.prototype.weekInfo propertyTimothy Flynn
2022-07-06LibJS: Implement Intl.Locale.prototype.textInfo propertyTimothy Flynn
2022-07-06LibJS: Implement Intl.Locale.prototype.timeZones propertyTimothy Flynn
2022-07-06LibJS: Implement Intl.Locale.prototype.numberingSystems propertyTimothy Flynn
2022-07-06LibJS: Implement Intl.Locale.prototype.hourCycles propertyTimothy Flynn
2022-07-06LibJS: Partially implement Intl.Locale.prototype.collations propertyTimothy Flynn
We do not yet parse collation data from the CLDR. This stubs out the collations property, analogous to Intl.supportedValuesOf.
2022-07-06LibJS: Implement Intl.Locale.prototype.calendars propertyTimothy Flynn
2022-07-06LibJS: Revert partial resizable ArrayBuffer implementationLinus Groh
This is a manual but clean revert of all commits from #12595. Adding a partial implementation of the resizable ArrayBuffer proposal without implementing all the updates to TypedArray infrastructure that is also covered by the spec introduced a bunch of crashes, so we decided to revert it for now until a full implementation is completed.
2022-07-06LibJS: Make AST.cpp compile with -O0Linus Groh
2022-07-06LibJS: Properly compute the line for source location hintsDexesTTP
These were obvious wrong uses of the old default "only first occurence" parameter that was used in String::replace.
2022-07-06AK: Use an enum instead of a bool for String::replace(all_occurences)DexesTTP
This commit has no behavior changes. In particular, this does not fix any of the wrong uses of the previous default parameter (which used to be 'false', meaning "only replace the first occurence in the string"). It simply replaces the default uses by String::replace(..., ReplaceMode::FirstOnly), leaving them incorrect.
2022-07-05LibJS: Rename TimeHourMinuteBasicFormatNotAmbiguousLinus Groh
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/70de75b
2022-07-05LibJS: Rename TimeZoneNumericUTCOffsetNotAmbiguousAllowedNegativeLinus Groh
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/9ddd57e
2022-07-05LibJS: Rename TimeZoneNumericUTCOffsetNotAmbiguousLinus Groh
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/5ebd34b
2022-07-05LibJS: Simplify TimeZoneNumericUTCOffsetNotAmbiguousLinus Groh
This is an editorial change in the Temporal spec. See: - https://github.com/tc39/proposal-temporal/commit/ccef468 - https://github.com/tc39/proposal-temporal/commit/5b38ab4
2022-07-05LibJS: Consistently check Temporal overflow optionsLinus Groh
This is a normative change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/c8ee2bd
2022-07-05LibJS: Remove unnecessary checks for undefined before ToPositiveIntegerLinus Groh
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/9f3bf53
2022-07-04LibJS: Explicitly instantiate Parser::parse_function_nodeDaniel Bertalan
Due to macOS visibility rules, this function did not end up being exported from liblagom-js.dylib, causing LagomWeb to fail to link.
2022-07-04LibJS/Tests: Disable one Array.prototype.toSpliced test for nowLinus Groh
It keeps failing on i686, and will until we've updated a bunch of size_t APIs in the codebase to u64.
2022-07-04LibJS: Let Array.prototype.toSpliced throw RangeError for len <= 2^53-1Linus Groh
This aligns it with the spec again, it was clarified that the additional range check before ArrayCreate is intentional: https://github.com/tc39/proposal-change-array-by-copy/issues/94 Also cast the final variable to an u64 instead of size_t after we have determined that it is safe to do so, as that's what Array::create() takes now.
2022-07-04LibJS: Use u64 for the length parameter in Array::create()Linus Groh
This doesn't matter per se as the value is immediately validated to be in the 0 to 2^32 - 1 range, but it avoids having to cast a number that potentially doesn't fit into a size_t into one at the call site. More often than not, array-like lengths are only validated to be <= 2^52 - 1, i.e. MAX_SAFE_INTEGER. This is fully backwards compatible with existing code as a size_t always fits into an u64, but an u64 might not always fit into a size_t.
2022-07-04LibJS: Add spec comments to ArrayCreateLinus Groh
2022-07-04LibJS: Use a template for 'Value from integral number' constructorsLinus Groh
This also allows constructing from other integral types like u64, which would have been ambiguous before (at least on i686): ``` error: call of overloaded 'Value(u64&)' is ambiguous note: candidate: 'JS::Value::Value(i32)' 175 | explicit Value(i32 value) | ^~~~~ note: candidate: 'JS::Value::Value(unsigned int)' 164 | explicit Value(unsigned value) | ^~~~~ note: candidate: 'JS::Value::Value(long unsigned int)' 153 | explicit Value(unsigned long value) | ^~~~~ note: candidate: 'JS::Value::Value(double)' 141 | explicit Value(double value) | ^~~~~ ```
2022-07-03LibJS: Avoid potential overflow in Array.prototype.toSpliced()Linus Groh
The implementation no longer matches the spec text, but I believe that's a bug anyway. No point in allowing array lengths up to 2^53 - 1 when the ArrayCreate AO rejects anything above 2^32 - 1.
2022-07-03LibJS: Add tests for %TypedArray%.prototype.toReversedObinna Ikeh
2022-07-03LibJS: Add %TypedArray%.prototype.toReversedObinna Ikeh
2022-07-02LibJS: Set both {minimum, maximum}FractionDigits in Intl.DurationFormatIdan Horowitz
This is a normative change in the Intl.DurationFormat spec. See: https://github.com/tc39/proposal-intl-duration-format/commit/b293603e
2022-07-02LibJS: Disallow mixed-sign durations in Intl.DurationFormatIdan Horowitz
This is a normative change in the Intl.DurationFormat spec. See: https://github.com/tc39/proposal-intl-duration-format/commit/89ab1855
2022-07-01LibJS: Implement Intl.DurationFormat.prototype.formatToPartsIdan Horowitz
2022-07-01LibJS: Implement Intl.DurationFormat.prototype.formatIdan Horowitz
2022-07-01LibJS: Implement the PartitionDurationFormatPattern abstract operationIdan Horowitz
2022-07-01LibUnicode: Generate data about DurationFormat-required units as wellIdan Horowitz
2022-07-01LibJS: Implement the ToDurationRecord abstract operationIdan Horowitz
2022-07-01LibJS: Implement Intl.DurationFormat.prototype.resolvedOptionsIdan Horowitz
2022-07-01LibJS: Implement Intl.DurationFormat.supportedLocalesOfIdan Horowitz
2022-07-01LibJS: Start implementing the stage 3 Intl.DurationFormat proposalIdan Horowitz
2022-06-30LibJS: Fix incorrect ErrorType in Temporal.PlainMonthDay constructorLinus Groh
2022-06-30LibJS/Bytecode: End the for variable scope at the start of its end blockLuke Wilde
If the for loop's body is not block terminated, we will generate a Jump to the end block which will block terminate the body. Then, we ended the lexical variable scope if needed. However, since the body is now block terminated, the "LeaveLexicalEnvironment" instruction that is generated by end_variable_scope is now dropped on the floor. This fixes this by moving it to the beginning of the end block.
2022-06-30LibJS/Bytecode: Make for, do/while and while always switch to end blockLuke Wilde
Previously we only did this if the body block was not terminated. If it was, all future codegen would happen in this block terminated body block until another switch occurred, dropping all generated instructions in this time on the floor.