Commit Graph

29996 Commits

Author SHA1 Message Date
Luke Wilde
a9ad993e78 LibJS: Implement Temporal.ZonedDateTime.prototype.toString 2021-11-10 12:56:56 +00:00
Luke Wilde
dc72d416b2 LibJS: Implement the required AOs for ZonedDateTime stringifiers 2021-11-10 12:56:56 +00:00
Idan Horowitz
04253c3254 LibJS: Add tests for async functions and await expressions 2021-11-10 08:48:27 +00:00
Idan Horowitz
46dabf02ec LibJS: Add support for await expressions 2021-11-10 08:48:27 +00:00
Idan Horowitz
681787de76 LibJS: Add support for async functions
This commit adds support for the most bare bones version of async
functions, support for async generator functions, async arrow functions
and await expressions are TODO.
2021-11-10 08:48:27 +00:00
Luke Wilde
05c3320da3 LibJS: Mark RoundTemporalInstant as infallible
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/0b4141c

This also allows us to get rid of two old exception checks.
2021-11-09 23:42:34 +02:00
Linus Groh
e9f66d1c2a LibJS: Mark DaysUntil as infallible
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/30a8939
2021-11-09 20:37:17 +00:00
Timothy Flynn
03c023d7e9 LibUnicode: Upgrade to CLDR version 40.0.0
Release notes:
https://github.com/unicode-org/cldr-json/releases/tag/40.0.0
2021-11-09 20:44:52 +01:00
Timothy Flynn
357c97dfa8 LibUnicode: Parse the CLDR's defaultContent.json locale list
This file contains the list of locales which default to their parent
locale's values. In the core CLDR dataset, these locales have their own
files, but they are empty (except for identity data). For example:

https://github.com/unicode-org/cldr/blob/main/common/main/en_US.xml

In the JSON export, these files are excluded, so we currently are not
recognizing these locales just by iterating the locale files.

This is a prerequisite for upgrading to CLDR version 40. One of these
default-content locales is the popular "en-US" locale, which defaults to
"en" values. We were previously inferring the existence of this locale
from the "en-US-POSIX" locale (many implementations, including ours,
strip variants such as POSIX). However, v40 removes the "en-US-POSIX"
locale entirely, meaning that without this change, we wouldn't know that
"en-US" exists (we would default to "en").

For more detail on this and other v40 changes, see:
https://cldr.unicode.org/index/downloads/cldr-40#h.nssoo2lq3cba
2021-11-09 20:44:52 +01:00
Idan Horowitz
91881be4b0 LibJS: Convert GeneratorObject to ThrowCompletionOr 2021-11-09 20:32:51 +02:00
Idan Horowitz
11a90700df LibJS: Convert the IntegerIndexedElementSet AO to ThrowCompletionOr 2021-11-09 20:32:51 +02:00
Idan Horowitz
ba55d77665 LibJS: Remove leftover exception check in OrdinaryHasProperty 2021-11-09 20:32:51 +02:00
faxe1008
100e25d1d3 pape: Add set-random option 2021-11-08 16:36:02 -08:00
Simon Woertz
1476f02f99 SoundPlayer: Fix stack-use-after-scope when playing file in loop mode
The path returned by GUI:FilePicker is stored on the stack when the
callback is executed. The player only stored a StringView to the path
however it should take ownership of the path instead since the path is
accessed even after the file menu open action has returned.
2021-11-08 16:34:03 -08:00
Brendan Coles
1e48cd35a1 UserspaceEmulator: Add support for SC_uname and SC_sysconf syscalls 2021-11-08 16:30:32 -08:00
kleines Filmröllchen
61d9082da6 LibAudio: Replace log_pan with a constant power panning algoritm
This little functional change uses the most common algorithm for panning
audio, known as constant power panning. It makes it so that the total
output power (not directly the sample value, i.e. the peak) stays the
same no matter how the audio is panned.
2021-11-08 16:29:25 -08:00
kleines Filmröllchen
8945cc8358 LibAudio: Improve local variable names
This makes the code easier to read.
2021-11-08 16:29:25 -08:00
David Isaksson
b6d075bb01 LibAudio: Rename Audio::Frame -> Audio::Sample
"Frame" is an MPEG term, which is not only unintuitive but also
overloaded with different meaning by other codecs (e.g. FLAC).
Therefore, use the standard term Sample for the central audio structure.

The class is also extracted to its own file, because it's becoming quite
large. Bundling these two changes means not distributing similar
modifications (changing names and paths) across commits.

Co-authored-by: kleines Filmröllchen <malu.bertsch@gmail.com>
2021-11-08 16:29:25 -08:00
David Isaksson
fa4255bcf1 LibAudio: Refactor out linear_to_log function and add its inverse
The conversion from a linear scale (how we think about audio) to a
logarithmic scale (how audio actually works) will be useful for other
operations, so let's extract it to its own utility function. Its inverse
will also allow reversible operations to be written more easily.
2021-11-08 16:29:25 -08:00
Linus Groh
1e3e0477cb LibJS: Implement Temporal.PlainMonthDay.prototype.with() 2021-11-08 22:19:45 +00:00
Linus Groh
fa1d5feec0 LibJS: Implement Temporal.PlainYearMonth.prototype.with() 2021-11-08 22:19:45 +00:00
Linus Groh
aca2ef9e1c LibJS: Implement Temporal.PlainDateTime.prototype.with() 2021-11-08 22:19:45 +00:00
Linus Groh
c3c9ac93d0 LibJS: Implement Temporal.PlainDate.prototype.with()
With one caveat: in the PreparePartialTemporalFields AO I made a change
to fix a spec issue that would require the input object to always have a
month or monthCode property.
This is tracked in https://github.com/tc39/proposal-temporal/issues/1910
and may get accepted as-is, in which case we simply need to remove the
NOTE comment.
2021-11-08 22:19:45 +00:00
Linus Groh
310016aee4 LibJS/Tests: Fix Temporal.PlainDate.prototype.equals() tests
Just calling "expect()" doesn't do anything!
2021-11-08 19:12:54 +00:00
Linus Groh
46d7c34028 LibJS: Use StringView literals in prepare_temporal_fields() 2021-11-08 19:12:47 +00:00
Tim Schumacher
22562b4b17 CMake: Assume working compiler instead of using static linking
We were previously using TRY_COMPILE_TARGET_TYPE to bypass the compiler
check at the beginning of the CMake build, since we don't have LibC
available and therefore can't link at that point.

However, this breaks a lot of assumptions in try_compile when it comes
to library checks. While this was the main idea behind our usage of the
flag, it also has some really nasty side effects when software wants
to find out what library a symbol is in.

Instead, just manually tell CMake that our compiler works as intended
and keep the target type setting at its default.
2021-11-07 20:11:23 -08:00
Daniel Bertalan
20bea3feff LibC: Fix huge libc.a file size due to the use of llvm-ar -q
Before this change, we would generate the static C library by running
the command `ar -qcs` to collect the various `*.o` files into a single
archive.

The `q` option stands for "quick append", which simply appends new files
to the archive, without replacing any pre-existing entries for the same
file. The problem with this is obvious: each LibC rebuild would add
approximately 1 MB (the size of a cleanly built libc.a) to the size of
the file. It got so bad on my machine that the total file size ended up
being 3 gigabytes.

Note that this did not affect the GNU toolchain, because, as the `ar(1)`
manpage says:
> Note - GNU ar treats the command qs as a synonym for r - replacing
> already existing files in the archive and appending new ones at the
> end.
2021-11-08 01:39:07 +01:00
Daniel Bertalan
05cb72e2c3 Ports: Unbreak and update oksh
This port has been broken since the introduction of `sys_signame` (which
was almost 3 months ago), as oksh provided a conflicting definition for
it.

This commit also cleans up some of the patches, defining the appropriate
config macro instead of commenting out code.

When I opened this program's GitHub releases page, I noticed that a new
version was available, so I also did the update.
2021-11-08 01:36:54 +01:00
Timothy Flynn
2530b6adf0 LibJS: Create the RegExpExec result's "input" field last
We move the input string into this field to avoid a string copy, so we
must do this step last to avoid using any views into it (note that
match.view here is a view into this string).
2021-11-08 01:36:29 +01:00
Andreas Kling
79fa9765ca Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace!
This was a slightly tedious refactoring that took a long time, so it's
not unlikely that some bugs crept in.

Nevertheless, it does pass basic functionality testing, and it's just
real nice to finally see the same pattern in all contexts. :^)
2021-11-08 01:10:53 +01:00
Andreas Kling
7ee10c6926 AK: Add some more ways to construct Error and ErrorOr<T>
This is preparation for using Error in the kernel instead of KResult.
2021-11-08 00:36:35 +01:00
Andreas Kling
5e473a63d3 AK: Make Error.h pull in Try.h
Users of this API will want TRY().
2021-11-08 00:36:19 +01:00
Andreas Kling
72f3fd824e LibSQL: Replace Result<T, E> use with ErrorOr<T> 2021-11-08 00:35:27 +01:00
Andreas Kling
fbe8f185b5 Profiler: Replace Result<T, E> use with ErrorOr<T> 2021-11-08 00:35:27 +01:00
Andreas Kling
e841f3c283 AK: Add a variant of adopt_nonnull_own_or_enomem() for userspace
This variant returns ErrorOr<NonnullOwnPtr<T>> instead of KResultOr.
Eventually the KResultOr variant should go away once the kernel adopts
Error and ErrorOr<T>.
2021-11-08 00:35:27 +01:00
Andreas Kling
2c70c479ab LibIPC: Replace Result<T, E> use with ErrorOr<T> 2021-11-08 00:35:27 +01:00
Andreas Kling
0b0c4e82b9 LibCore: Replace Result<T, E> use with ErrorOr<T> in Core::FileWatcher 2021-11-08 00:35:27 +01:00
Andreas Kling
4eeab4cfc8 LibCore: Replace Result<T, E> use with ErrorOr<T> in Core::Account 2021-11-08 00:35:27 +01:00
Andreas Kling
01a6a4f7c4 RequestServer: Replace Result<T, E> use with ErrorOr<T> 2021-11-08 00:35:27 +01:00
Andreas Kling
fbbb87d517 DHCPClient: Replace Result<T, E> use with ErrorOr<T> 2021-11-08 00:35:27 +01:00
Andreas Kling
d1477bcb8e Shell: Replace Result<T, E> use with ErrorOr<T> 2021-11-08 00:35:27 +01:00
Andreas Kling
184810a581 AK: Remove now-unused OSError class
This has been superseded by the more generally useful AK::Error :^)
2021-11-08 00:35:27 +01:00
Andreas Kling
c6cc0a88a1 LibKeyboard: Use ErrorOr<T> for CharacterMap::fetch_system_map() 2021-11-08 00:35:27 +01:00
Andreas Kling
e76b21a66f LibCore: Use ErrorOr<T> for Core::get_password() 2021-11-08 00:35:27 +01:00
Andreas Kling
801d46d02c PixelPaint: Use ErrorOr<T> for Image and Layer creation helpers 2021-11-08 00:35:27 +01:00
Andreas Kling
9268ed9605 PixelPaint: Use ErrorOr<T> for Image::try_compose_bitmap() 2021-11-08 00:35:27 +01:00
Andreas Kling
77fd4625b5 PixelPaint: Use ErrorOr<T> for Image writing/exporting functions 2021-11-08 00:35:27 +01:00
Andreas Kling
a7f1f1c34b LibCore: Use ErrorOr<T> for Core::File::open() 2021-11-08 00:35:27 +01:00
Andreas Kling
fac2550143 LibCore: Use ErrorOr<T> for Core::File::size() 2021-11-08 00:35:27 +01:00
Andreas Kling
4a2b718ba2 LibCore: Use ErrorOr<T> for Core::File::copy_file() 2021-11-08 00:35:27 +01:00