Commit Graph

11 Commits

Author SHA1 Message Date
Linus Groh
8f6ac0db1c LibJS: Use OrdinaryCreateFromConstructor() in a bunch of constructors
Resolves various FIXMEs :^)
2021-06-20 12:12:39 +02:00
Linus Groh
fba3c77a04 LibJS: Add missing exception checks to Number() constructor 2021-06-19 02:03:37 +01:00
Linus Groh
8e26c7a1dd LibJS: Make Number() constructor spec compliant
By using to_numeric() and adding BigInt handling, we get support for
`Number(123n)`.

Fixes #8125.
2021-06-19 01:34:17 +01:00
Luke
02de3cbce3 LibJS: Add Number.parseInt
This is initialized to be the same function object as the initial value
of the parseInt function on the global object.
2021-06-18 10:29:33 +01:00
Idan Horowitz
9127d83927 LibJS: Rename Value::{is_integer => is_integral_number}
The implementation matches the specification, so lets match the name
as well. :^)
2021-06-16 12:57:55 +01:00
Linus Groh
a40e5b579a LibJS: Fix Number.parseFloat() attributes
This was missing an 'attr' and falling back to the default attributes.
2021-06-13 00:59:33 +01:00
Linus Groh
7327a28ccc LibJS: Add ECMA-262 section/title/URL comments almost everywhere
As mentioned on Discord earlier, we'll add these to all new functions
going forward - this is the backfill. Reasons:

- It makes you look at the spec, implementing based on MDN or V8
  behavior is a no-go
- It makes finding the various functions that are non-compliant easier,
  in the future everything should either have such a comment or, if it's
  not from the spec at all, a comment explaining why that is the case
- It makes it easier to check whether a certain abstract operation is
  implemented in LibJS, not all of them use the same name as the spec.
  E.g. RejectPromise() is Promise::reject()
- It makes it easier to reason about vm.arguments(), e.g. when the
  function has a rest parameter
- It makes it easier to see whether a certain function is from a
  proposal or Annex B

Also:

- Add arguments to all functions and abstract operations that already
  had a comment
- Fix some outdated section numbers
- Replace some ecma-international.org URLs with tc39.es
2021-06-13 00:33:28 +01:00
Idan Horowitz
0f8ed6183b LibJS: Add the Number.{MAX, MIN}_VALUE constants 2021-06-05 02:38:37 +01:00
Linus Groh
ebdeed087c Everywhere: Use linusg@serenityos.org for my copyright headers 2021-04-22 22:51:19 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00