summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp
AgeCommit message (Collapse)Author
2021-10-29LibJS: Convert BigIntConstructor functions to ThrowCompletionOrIdan Horowitz
2021-10-23LibJS: Convert the NumberToBigInt AO to ThrowCompletionOrIdan Horowitz
2021-10-21LibJS: Convert NativeFunction::{call,construct}() to ThrowCompletionOrLinus Groh
Both at the same time because many of them call construct() in call() and I'm not keen on adding a bunch of temporary plumbing to turn exceptions into throw completions. Also changes the return value of construct() to Object* instead of Value as it always needs to return an object; allowing an arbitrary Value is a massive foot gun.
2021-10-20LibJS: Rename define_native_function => define_old_native_functionIdan Horowitz
This method will eventually be removed once all native functions are converted to ThrowCompletionOr
2021-10-20LibJS: Add ThrowCompletionOr versions of the JS native function macrosIdan Horowitz
The old versions were renamed to JS_DECLARE_OLD_NATIVE_FUNCTION and JS_DEFINE_OLD_NATIVE_FUNCTION, and will be eventually removed once all native functions were converted to the new format.
2021-10-17LibJS: Convert to_bigint() to ThrowCompletionOrIdan Horowitz
2021-10-13LibJS: Convert to_primitive() to ThrowCompletionOrLinus Groh
2021-07-08LibJS: Reorder and add missing name & length properties to Built-insIdan Horowitz
The specification dicatates that each built-in will have a length and name property. (defined in that order)
2021-07-08LibJS: Split out NumberToBigInt from the BigInt constructorLinus Groh
This is supposed to be its own AO, but since it was only used in one place, we inlined it. Now that it's also being used in the Temporal proposal (Date.prototype.toTemporalInstant() specifically), it makes sense to have it as a standalone function. A small difference is that we now construct the SignedBigInteger without casting to i32 but instead take the (known to be integral) double and cast it to i64. Not perfect, but slightly better. Also clean up the BigInt constructor a bit while we're here and sprinkle some spec comments.
2021-07-06LibJS: Add define_direct_property and remove the define_property helperIdan Horowitz
This removes all usages of the non-standard define_property helper method and replaces all it's usages with the specification required alternative or with define_direct_property where appropriate.
2021-06-28LibJS: Accept FlyStrings in the NativeFunction constructorsIdan Horowitz
This makes the implicit run-time assertion in PropertyName::to_string() into an explicit compile-time requirement, removes a wasteful FlyString -> PropertyName -> FlyString construction from NativeFunction::create() and allows setting the function name to a null string for anonymous native functions.
2021-06-27LibJS: Rename Function => FunctionObjectAndreas Kling
2021-06-16LibJS: Rename Value::{is_integer => is_integral_number}Idan Horowitz
The implementation matches the specification, so lets match the name as well. :^)
2021-06-13LibJS: Add ECMA-262 section/title/URL comments almost everywhereLinus Groh
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-02LibJS: Remove declarations of some TODO()'d BigInt and Promise functionsLinus Groh
In hindsight declaring these prematurely wasn't the greatest idea - that just makes any script checking for their existence believe they'll work, and what follows next is a crash of the js or WebContent process. If we omit the declarations, a polyfill can be provided instead. This also affects the test262, which tests these - instead of reporting a bunch of assertion crash errors, we should simply report test failure for 'not a function', which in turn makes it easier to spot any actual bugs causing crashes.
2021-04-22Everywhere: Use linusg@serenityos.org for my copyright headersLinus Groh
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
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-03-03LibJS: Support @@toPrimitive in ToPrimitive abstract operationLinus Groh
Fixes #3961.
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling