LibJS: Enable EXPLICIT_SYMBOL_EXPORT

This commit is contained in:
ayeteadoe 2025-06-28 21:39:13 -07:00 committed by Andrew Kaster
commit c14173f651
Notes: github-actions[bot] 2025-06-30 16:51:52 +00:00
258 changed files with 952 additions and 941 deletions

View file

@ -23,27 +23,27 @@
namespace JS {
GC::Ref<DeclarativeEnvironment> new_declarative_environment(Environment&);
GC::Ref<ObjectEnvironment> new_object_environment(Object&, bool is_with_environment, Environment*);
GC::Ref<FunctionEnvironment> new_function_environment(ECMAScriptFunctionObject&, Object* new_target);
GC::Ref<PrivateEnvironment> new_private_environment(VM& vm, PrivateEnvironment* outer);
GC::Ref<Environment> get_this_environment(VM&);
bool can_be_held_weakly(Value);
Object* get_super_constructor(VM&);
ThrowCompletionOr<Value> require_object_coercible(VM&, Value);
ThrowCompletionOr<Value> call_impl(VM&, Value function, Value this_value, ReadonlySpan<Value> arguments = {});
ThrowCompletionOr<Value> call_impl(VM&, FunctionObject& function, Value this_value, ReadonlySpan<Value> arguments = {});
ThrowCompletionOr<GC::Ref<Object>> construct_impl(VM&, FunctionObject&, ReadonlySpan<Value> arguments = {}, FunctionObject* new_target = nullptr);
ThrowCompletionOr<size_t> length_of_array_like(VM&, Object const&);
ThrowCompletionOr<GC::RootVector<Value>> create_list_from_array_like(VM&, Value, Function<ThrowCompletionOr<void>(Value)> = {});
ThrowCompletionOr<FunctionObject*> species_constructor(VM&, Object const&, FunctionObject& default_constructor);
ThrowCompletionOr<Realm*> get_function_realm(VM&, FunctionObject const&);
ThrowCompletionOr<void> initialize_bound_name(VM&, FlyString const&, Value, Environment*);
bool is_compatible_property_descriptor(bool extensible, PropertyDescriptor const&, Optional<PropertyDescriptor> const& current);
bool validate_and_apply_property_descriptor(Object*, PropertyKey const&, bool extensible, PropertyDescriptor const&, Optional<PropertyDescriptor> const& current);
ThrowCompletionOr<Object*> get_prototype_from_constructor(VM&, FunctionObject const& constructor, GC::Ref<Object> (Intrinsics::*intrinsic_default_prototype)());
Object* create_unmapped_arguments_object(VM&, ReadonlySpan<Value> arguments);
Object* create_mapped_arguments_object(VM&, FunctionObject&, NonnullRefPtr<FunctionParameters const> const&, ReadonlySpan<Value> arguments, Environment&);
JS_API GC::Ref<DeclarativeEnvironment> new_declarative_environment(Environment&);
JS_API GC::Ref<ObjectEnvironment> new_object_environment(Object&, bool is_with_environment, Environment*);
JS_API GC::Ref<FunctionEnvironment> new_function_environment(ECMAScriptFunctionObject&, Object* new_target);
JS_API GC::Ref<PrivateEnvironment> new_private_environment(VM& vm, PrivateEnvironment* outer);
JS_API GC::Ref<Environment> get_this_environment(VM&);
JS_API bool can_be_held_weakly(Value);
JS_API Object* get_super_constructor(VM&);
JS_API ThrowCompletionOr<Value> require_object_coercible(VM&, Value);
JS_API ThrowCompletionOr<Value> call_impl(VM&, Value function, Value this_value, ReadonlySpan<Value> arguments = {});
JS_API ThrowCompletionOr<Value> call_impl(VM&, FunctionObject& function, Value this_value, ReadonlySpan<Value> arguments = {});
JS_API ThrowCompletionOr<GC::Ref<Object>> construct_impl(VM&, FunctionObject&, ReadonlySpan<Value> arguments = {}, FunctionObject* new_target = nullptr);
JS_API ThrowCompletionOr<size_t> length_of_array_like(VM&, Object const&);
JS_API ThrowCompletionOr<GC::RootVector<Value>> create_list_from_array_like(VM&, Value, Function<ThrowCompletionOr<void>(Value)> = {});
JS_API ThrowCompletionOr<FunctionObject*> species_constructor(VM&, Object const&, FunctionObject& default_constructor);
JS_API ThrowCompletionOr<Realm*> get_function_realm(VM&, FunctionObject const&);
JS_API ThrowCompletionOr<void> initialize_bound_name(VM&, FlyString const&, Value, Environment*);
JS_API bool is_compatible_property_descriptor(bool extensible, PropertyDescriptor const&, Optional<PropertyDescriptor> const& current);
JS_API bool validate_and_apply_property_descriptor(Object*, PropertyKey const&, bool extensible, PropertyDescriptor const&, Optional<PropertyDescriptor> const& current);
JS_API ThrowCompletionOr<Object*> get_prototype_from_constructor(VM&, FunctionObject const& constructor, GC::Ref<Object> (Intrinsics::*intrinsic_default_prototype)());
JS_API Object* create_unmapped_arguments_object(VM&, ReadonlySpan<Value> arguments);
JS_API Object* create_mapped_arguments_object(VM&, FunctionObject&, NonnullRefPtr<FunctionParameters const> const&, ReadonlySpan<Value> arguments, Environment&);
// 2.1.1 DisposeCapability Records, https://tc39.es/proposal-explicit-resource-management/#sec-disposecapability-records
struct DisposeCapability {
@ -61,30 +61,30 @@ struct DisposableResource {
GC::Ptr<FunctionObject> dispose_method; // [[DisposeMethod]]
};
DisposeCapability new_dispose_capability();
ThrowCompletionOr<void> add_disposable_resource(VM&, DisposeCapability&, Value, Environment::InitializeBindingHint, GC::Ptr<FunctionObject> = {});
ThrowCompletionOr<DisposableResource> create_disposable_resource(VM&, Value, Environment::InitializeBindingHint, GC::Ptr<FunctionObject> = {});
ThrowCompletionOr<GC::Ptr<FunctionObject>> get_dispose_method(VM&, Value, Environment::InitializeBindingHint);
Completion dispose(VM&, Value, Environment::InitializeBindingHint, GC::Ptr<FunctionObject> method);
Completion dispose_resources(VM&, DisposeCapability&, Completion);
JS_API DisposeCapability new_dispose_capability();
JS_API ThrowCompletionOr<void> add_disposable_resource(VM&, DisposeCapability&, Value, Environment::InitializeBindingHint, GC::Ptr<FunctionObject> = {});
JS_API ThrowCompletionOr<DisposableResource> create_disposable_resource(VM&, Value, Environment::InitializeBindingHint, GC::Ptr<FunctionObject> = {});
JS_API ThrowCompletionOr<GC::Ptr<FunctionObject>> get_dispose_method(VM&, Value, Environment::InitializeBindingHint);
JS_API Completion dispose(VM&, Value, Environment::InitializeBindingHint, GC::Ptr<FunctionObject> method);
JS_API Completion dispose_resources(VM&, DisposeCapability&, Completion);
ThrowCompletionOr<Value> perform_import_call(VM&, Value specifier, Value options_value);
JS_API ThrowCompletionOr<Value> perform_import_call(VM&, Value specifier, Value options_value);
enum class CanonicalIndexMode {
DetectNumericRoundtrip,
IgnoreNumericRoundtrip,
};
[[nodiscard]] CanonicalIndex canonical_numeric_index_string(PropertyKey const&, CanonicalIndexMode needs_numeric);
ThrowCompletionOr<String> get_substitution(VM&, Utf16View const& matched, Utf16View const& str, size_t position, Span<Value> captures, Value named_captures, Value replacement);
[[nodiscard]] JS_API CanonicalIndex canonical_numeric_index_string(PropertyKey const&, CanonicalIndexMode needs_numeric);
JS_API ThrowCompletionOr<String> get_substitution(VM&, Utf16View const& matched, Utf16View const& str, size_t position, Span<Value> captures, Value named_captures, Value replacement);
enum class CallerMode {
Strict,
NonStrict
};
ThrowCompletionOr<Value> perform_eval(VM&, Value, CallerMode, EvalMode);
JS_API ThrowCompletionOr<Value> perform_eval(VM&, Value, CallerMode, EvalMode);
ThrowCompletionOr<void> eval_declaration_instantiation(VM& vm, Program const& program, Environment* variable_environment, Environment* lexical_environment, PrivateEnvironment* private_environment, bool strict);
JS_API ThrowCompletionOr<void> eval_declaration_instantiation(VM& vm, Program const& program, Environment* variable_environment, Environment* lexical_environment, PrivateEnvironment* private_environment, bool strict);
// 7.3.14 Call ( F, V [ , argumentsList ] ), https://tc39.es/ecma262/#sec-call
ALWAYS_INLINE ThrowCompletionOr<Value> call(VM& vm, Value function, Value this_value, ReadonlySpan<Value> arguments_list)
@ -342,8 +342,8 @@ enum class OptionType {
struct Required { };
using OptionDefault = Variant<Required, Empty, bool, StringView, double>;
ThrowCompletionOr<GC::Ref<Object>> get_options_object(VM&, Value options);
ThrowCompletionOr<Value> get_option(VM&, Object const& options, PropertyKey const& property, OptionType type, ReadonlySpan<StringView> values, OptionDefault const&);
JS_API ThrowCompletionOr<GC::Ref<Object>> get_options_object(VM&, Value options);
JS_API ThrowCompletionOr<Value> get_option(VM&, Object const& options, PropertyKey const& property, OptionType type, ReadonlySpan<StringView> values, OptionDefault const&);
template<size_t Size>
ThrowCompletionOr<Value> get_option(VM& vm, Object const& options, PropertyKey const& property, OptionType type, StringView const (&values)[Size], OptionDefault const& default_)
@ -364,9 +364,9 @@ enum class RoundingMode {
HalfEven,
};
ThrowCompletionOr<RoundingMode> get_rounding_mode_option(VM&, Object const& options, RoundingMode fallback);
ThrowCompletionOr<u64> get_rounding_increment_option(VM&, Object const& options);
JS_API ThrowCompletionOr<RoundingMode> get_rounding_mode_option(VM&, Object const& options, RoundingMode fallback);
JS_API ThrowCompletionOr<u64> get_rounding_increment_option(VM&, Object const& options);
Crypto::SignedBigInteger big_floor(Crypto::SignedBigInteger const& numerator, Crypto::UnsignedBigInteger const& denominator);
JS_API Crypto::SignedBigInteger big_floor(Crypto::SignedBigInteger const& numerator, Crypto::UnsignedBigInteger const& denominator);
}

View file

@ -13,7 +13,7 @@
namespace JS {
class Accessor final : public Cell {
class JS_API Accessor final : public Cell {
GC_CELL(Accessor, Cell);
GC_DECLARE_ALLOCATOR(Accessor);

View file

@ -14,7 +14,7 @@
namespace JS {
// https://tc39.es/ecma262/#sec-agents
class Agent {
class JS_API Agent {
public:
enum class CanBlock {
Yes,
@ -38,6 +38,6 @@ private:
CanBlock m_can_block { false };
};
bool agent_can_suspend(VM const&);
JS_API bool agent_can_suspend(VM const&);
}

View file

@ -11,7 +11,7 @@
namespace JS {
class AggregateError : public Error {
class JS_API AggregateError : public Error {
JS_OBJECT(AggregateError, Error);
GC_DECLARE_ALLOCATOR(AggregateError);

View file

@ -10,7 +10,7 @@
namespace JS {
class AggregateErrorConstructor final : public NativeFunction {
class JS_API AggregateErrorConstructor final : public NativeFunction {
JS_OBJECT(AggregateErrorConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(AggregateErrorConstructor);

View file

@ -10,7 +10,7 @@
namespace JS {
class AggregateErrorPrototype final : public Object {
class JS_API AggregateErrorPrototype final : public Object {
JS_OBJECT(AggregateErrorPrototype, Object);
GC_DECLARE_ALLOCATOR(AggregateErrorPrototype);

View file

@ -12,7 +12,7 @@
namespace JS {
class ArgumentsObject final : public Object {
class JS_API ArgumentsObject final : public Object {
JS_OBJECT(ArgumentsObject, Object);
GC_DECLARE_ALLOCATOR(ArgumentsObject);

View file

@ -19,7 +19,7 @@
namespace JS {
class Array : public Object {
class JS_API Array : public Object {
JS_OBJECT(Array, Object);
GC_DECLARE_ALLOCATOR(Array);
@ -81,7 +81,7 @@ enum class Holes {
ReadThroughHoles,
};
ThrowCompletionOr<GC::RootVector<Value>> sort_indexed_properties(VM&, Object const&, size_t length, Function<ThrowCompletionOr<double>(Value, Value)> const& sort_compare, Holes holes);
ThrowCompletionOr<double> compare_array_elements(VM&, Value x, Value y, FunctionObject* comparefn);
JS_API ThrowCompletionOr<GC::RootVector<Value>> sort_indexed_properties(VM&, Object const&, size_t length, Function<ThrowCompletionOr<double>(Value, Value)> const& sort_compare, Holes holes);
JS_API ThrowCompletionOr<double> compare_array_elements(VM&, Value x, Value y, FunctionObject* comparefn);
}

View file

@ -54,7 +54,7 @@ struct DataBlock {
Shared is_shared = { Shared::No };
};
class ArrayBuffer : public Object {
class JS_API ArrayBuffer : public Object {
JS_OBJECT(ArrayBuffer, Object);
GC_DECLARE_ALLOCATOR(ArrayBuffer);
@ -145,14 +145,14 @@ private:
Value m_detach_key;
};
ThrowCompletionOr<DataBlock> create_byte_data_block(VM& vm, size_t size);
void copy_data_block_bytes(ByteBuffer& to_block, u64 to_index, ByteBuffer const& from_block, u64 from_index, u64 count);
ThrowCompletionOr<ArrayBuffer*> allocate_array_buffer(VM&, FunctionObject& constructor, size_t byte_length, Optional<size_t> const& max_byte_length = {});
ThrowCompletionOr<ArrayBuffer*> array_buffer_copy_and_detach(VM&, ArrayBuffer& array_buffer, Value new_length, PreserveResizability preserve_resizability);
ThrowCompletionOr<void> detach_array_buffer(VM&, ArrayBuffer& array_buffer, Optional<Value> key = {});
ThrowCompletionOr<Optional<size_t>> get_array_buffer_max_byte_length_option(VM&, Value options);
ThrowCompletionOr<ArrayBuffer*> clone_array_buffer(VM&, ArrayBuffer& source_buffer, size_t source_byte_offset, size_t source_length);
ThrowCompletionOr<GC::Ref<ArrayBuffer>> allocate_shared_array_buffer(VM&, FunctionObject& constructor, size_t byte_length);
JS_API ThrowCompletionOr<DataBlock> create_byte_data_block(VM& vm, size_t size);
JS_API void copy_data_block_bytes(ByteBuffer& to_block, u64 to_index, ByteBuffer const& from_block, u64 from_index, u64 count);
JS_API ThrowCompletionOr<ArrayBuffer*> allocate_array_buffer(VM&, FunctionObject& constructor, size_t byte_length, Optional<size_t> const& max_byte_length = {});
JS_API ThrowCompletionOr<ArrayBuffer*> array_buffer_copy_and_detach(VM&, ArrayBuffer& array_buffer, Value new_length, PreserveResizability preserve_resizability);
JS_API ThrowCompletionOr<void> detach_array_buffer(VM&, ArrayBuffer& array_buffer, Optional<Value> key = {});
JS_API ThrowCompletionOr<Optional<size_t>> get_array_buffer_max_byte_length_option(VM&, Value options);
JS_API ThrowCompletionOr<ArrayBuffer*> clone_array_buffer(VM&, ArrayBuffer& source_buffer, size_t source_byte_offset, size_t source_length);
JS_API ThrowCompletionOr<GC::Ref<ArrayBuffer>> allocate_shared_array_buffer(VM&, FunctionObject& constructor, size_t byte_length);
// 25.1.3.2 ArrayBufferByteLength ( arrayBuffer, order ), https://tc39.es/ecma262/#sec-arraybufferbytelength
inline size_t array_buffer_byte_length(ArrayBuffer const& array_buffer, ArrayBuffer::Order)

View file

@ -10,7 +10,7 @@
namespace JS {
class ArrayBufferConstructor final : public NativeFunction {
class JS_API ArrayBufferConstructor final : public NativeFunction {
JS_OBJECT(ArrayBufferConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(ArrayBufferConstructor);

View file

@ -11,7 +11,7 @@
namespace JS {
class ArrayBufferPrototype final : public PrototypeObject<ArrayBufferPrototype, ArrayBuffer> {
class JS_API ArrayBufferPrototype final : public PrototypeObject<ArrayBufferPrototype, ArrayBuffer> {
JS_PROTOTYPE_OBJECT(ArrayBufferPrototype, ArrayBuffer, ArrayBuffer);
GC_DECLARE_ALLOCATOR(ArrayBufferPrototype);

View file

@ -10,7 +10,7 @@
namespace JS {
class ArrayConstructor final : public NativeFunction {
class JS_API ArrayConstructor final : public NativeFunction {
JS_OBJECT(ArrayConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(ArrayConstructor);

View file

@ -11,7 +11,7 @@
namespace JS {
class ArrayIterator final : public Object
class JS_API ArrayIterator final : public Object
, public BuiltinIterator {
JS_OBJECT(ArrayIterator, Object);
GC_DECLARE_ALLOCATOR(ArrayIterator);

View file

@ -11,7 +11,7 @@
namespace JS {
class ArrayIteratorPrototype final : public PrototypeObject<ArrayIteratorPrototype, ArrayIterator> {
class JS_API ArrayIteratorPrototype final : public PrototypeObject<ArrayIteratorPrototype, ArrayIterator> {
JS_PROTOTYPE_OBJECT(ArrayIteratorPrototype, ArrayIterator, ArrayIterator);
GC_DECLARE_ALLOCATOR(ArrayIteratorPrototype);

View file

@ -11,7 +11,7 @@
namespace JS {
class ArrayPrototype final : public Array {
class JS_API ArrayPrototype final : public Array {
JS_OBJECT(ArrayPrototype, Array);
GC_DECLARE_ALLOCATOR(ArrayPrototype);
@ -64,6 +64,6 @@ private:
JS_DECLARE_NATIVE_FUNCTION(with);
};
ThrowCompletionOr<void> array_merge_sort(VM&, Function<ThrowCompletionOr<double>(Value, Value)> const& compare_func, GC::RootVector<Value>& arr_to_sort);
JS_API ThrowCompletionOr<void> array_merge_sort(VM&, Function<ThrowCompletionOr<double>(Value, Value)> const& compare_func, GC::RootVector<Value>& arr_to_sort);
}

View file

@ -11,7 +11,7 @@
namespace JS {
class AsyncDisposableStack final : public Object {
class JS_API AsyncDisposableStack final : public Object {
JS_OBJECT(AsyncDisposableStack, Object);
GC_DECLARE_ALLOCATOR(AsyncDisposableStack);

View file

@ -10,7 +10,7 @@
namespace JS {
class AsyncDisposableStackConstructor final : public NativeFunction {
class JS_API AsyncDisposableStackConstructor final : public NativeFunction {
JS_OBJECT(AsyncDisposableStackConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(AsyncDisposableStackConstructor);

View file

@ -11,7 +11,7 @@
namespace JS {
class AsyncDisposableStackPrototype final : public PrototypeObject<AsyncDisposableStackPrototype, AsyncDisposableStack> {
class JS_API AsyncDisposableStackPrototype final : public PrototypeObject<AsyncDisposableStackPrototype, AsyncDisposableStack> {
JS_PROTOTYPE_OBJECT(AsyncDisposableStackPrototype, AsyncDisposableStack, AsyncDisposableStack);
GC_DECLARE_ALLOCATOR(AsyncDisposableStackPrototype);

View file

@ -13,7 +13,7 @@
namespace JS {
// 27.1.4.3 Properties of Async-from-Sync Iterator Instances, https://tc39.es/ecma262/#sec-properties-of-async-from-sync-iterator-instances
class AsyncFromSyncIterator final : public Object {
class JS_API AsyncFromSyncIterator final : public Object {
JS_OBJECT(AsyncFromSyncIterator, Object);
GC_DECLARE_ALLOCATOR(AsyncFromSyncIterator);

View file

@ -15,7 +15,7 @@
namespace JS {
// 27.1.4.2 The %AsyncFromSyncIteratorPrototype% Object, https://tc39.es/ecma262/#sec-%asyncfromsynciteratorprototype%-object
class AsyncFromSyncIteratorPrototype final : public PrototypeObject<AsyncFromSyncIteratorPrototype, AsyncFromSyncIterator> {
class JS_API AsyncFromSyncIteratorPrototype final : public PrototypeObject<AsyncFromSyncIteratorPrototype, AsyncFromSyncIterator> {
JS_PROTOTYPE_OBJECT(AsyncFromSyncIteratorPrototype, AsyncFromSyncIterator, AsyncFromSyncIterator);
GC_DECLARE_ALLOCATOR(AsyncFromSyncIteratorPrototype);
@ -31,6 +31,6 @@ private:
JS_DECLARE_NATIVE_FUNCTION(throw_);
};
GC::Ref<IteratorRecord> create_async_from_sync_iterator(VM&, GC::Ref<IteratorRecord> sync_iterator);
JS_API GC::Ref<IteratorRecord> create_async_from_sync_iterator(VM&, GC::Ref<IteratorRecord> sync_iterator);
}

View file

@ -10,7 +10,7 @@
namespace JS {
class AsyncFunctionConstructor final : public NativeFunction {
class JS_API AsyncFunctionConstructor final : public NativeFunction {
JS_OBJECT(AsyncFunctionConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(AsyncFunctionConstructor);

View file

@ -14,7 +14,7 @@
namespace JS {
class AsyncFunctionDriverWrapper final : public Promise {
class JS_API AsyncFunctionDriverWrapper final : public Promise {
JS_OBJECT(AsyncFunctionDriverWrapper, Promise);
GC_DECLARE_ALLOCATOR(AsyncFunctionDriverWrapper);

View file

@ -10,7 +10,7 @@
namespace JS {
class AsyncFunctionPrototype final : public Object {
class JS_API AsyncFunctionPrototype final : public Object {
JS_OBJECT(AsyncFunctionPrototype, Object);
GC_DECLARE_ALLOCATOR(AsyncFunctionPrototype);

View file

@ -15,7 +15,7 @@
namespace JS {
// 27.6.2 Properties of AsyncGenerator Instances, https://tc39.es/ecma262/#sec-properties-of-asyncgenerator-intances
class AsyncGenerator final : public Object {
class JS_API AsyncGenerator final : public Object {
JS_OBJECT(AsyncGenerator, Object);
GC_DECLARE_ALLOCATOR(AsyncGenerator);

View file

@ -10,7 +10,7 @@
namespace JS {
class AsyncGeneratorFunctionConstructor final : public NativeFunction {
class JS_API AsyncGeneratorFunctionConstructor final : public NativeFunction {
JS_OBJECT(AsyncGeneratorFunctionConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(AsyncGeneratorFunctionConstructor);

View file

@ -10,7 +10,7 @@
namespace JS {
class AsyncGeneratorFunctionPrototype final : public PrototypeObject<AsyncGeneratorFunctionPrototype, AsyncGeneratorFunction> {
class JS_API AsyncGeneratorFunctionPrototype final : public PrototypeObject<AsyncGeneratorFunctionPrototype, AsyncGeneratorFunction> {
JS_PROTOTYPE_OBJECT(AsyncGeneratorFunctionPrototype, AsyncGeneratorFunction, AsyncGeneratorFunction);
GC_DECLARE_ALLOCATOR(AsyncGeneratorFunctionPrototype);

View file

@ -12,7 +12,7 @@
namespace JS {
class AsyncGeneratorPrototype final : public PrototypeObject<AsyncGeneratorPrototype, AsyncGenerator> {
class JS_API AsyncGeneratorPrototype final : public PrototypeObject<AsyncGeneratorPrototype, AsyncGenerator> {
JS_PROTOTYPE_OBJECT(AsyncGeneratorPrototype, AsyncGenerator, AsyncGenerator)
GC_DECLARE_ALLOCATOR(AsyncGeneratorPrototype);

View file

@ -10,7 +10,7 @@
namespace JS {
class AsyncIteratorPrototype final : public Object {
class JS_API AsyncIteratorPrototype final : public Object {
JS_OBJECT(AsyncIteratorPrototype, Object)
GC_DECLARE_ALLOCATOR(AsyncIteratorPrototype);

View file

@ -10,7 +10,7 @@
namespace JS {
class AtomicsObject : public Object {
class JS_API AtomicsObject : public Object {
JS_OBJECT(AtomicsObject, Object);
GC_DECLARE_ALLOCATOR(AtomicsObject);

View file

@ -15,7 +15,7 @@
namespace JS {
class BigInt final : public Cell {
class JS_API BigInt final : public Cell {
GC_CELL(BigInt, Cell);
GC_DECLARE_ALLOCATOR(BigInt);
@ -35,6 +35,6 @@ private:
Crypto::SignedBigInteger m_big_integer;
};
ThrowCompletionOr<GC::Ref<BigInt>> number_to_bigint(VM&, Value);
JS_API ThrowCompletionOr<GC::Ref<BigInt>> number_to_bigint(VM&, Value);
}

View file

@ -10,7 +10,7 @@
namespace JS {
class BigIntConstructor final : public NativeFunction {
class JS_API BigIntConstructor final : public NativeFunction {
JS_OBJECT(BigIntConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(BigIntConstructor);

View file

@ -11,7 +11,7 @@
namespace JS {
class BigIntObject final : public Object {
class JS_API BigIntObject final : public Object {
JS_OBJECT(BigIntObject, Object);
GC_DECLARE_ALLOCATOR(BigIntObject);

View file

@ -10,7 +10,7 @@
namespace JS {
class BigIntPrototype final : public Object {
class JS_API BigIntPrototype final : public Object {
JS_OBJECT(BigIntPrototype, Object);
GC_DECLARE_ALLOCATOR(BigIntPrototype);

View file

@ -10,7 +10,7 @@
namespace JS {
class BooleanConstructor final : public NativeFunction {
class JS_API BooleanConstructor final : public NativeFunction {
JS_OBJECT(BooleanConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(BooleanConstructor);

View file

@ -10,7 +10,7 @@
namespace JS {
class BooleanObject : public Object {
class JS_API BooleanObject : public Object {
JS_OBJECT(BooleanObject, Object);
GC_DECLARE_ALLOCATOR(BooleanObject);

View file

@ -10,7 +10,7 @@
namespace JS {
class BooleanPrototype final : public BooleanObject {
class JS_API BooleanPrototype final : public BooleanObject {
JS_OBJECT(BooleanPrototype, BooleanObject);
GC_DECLARE_ALLOCATOR(BooleanPrototype);

View file

@ -11,7 +11,7 @@
namespace JS {
class BoundFunction final : public FunctionObject {
class JS_API BoundFunction final : public FunctionObject {
JS_OBJECT(BoundFunction, FunctionObject);
GC_DECLARE_ALLOCATOR(BoundFunction);

View file

@ -6,6 +6,7 @@
*/
#include <AK/TypeCasts.h>
#include <LibJS/Export.h>
#include <LibJS/Runtime/Agent.h>
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/NativeFunction.h>
@ -17,7 +18,7 @@
namespace JS {
bool g_log_all_js_exceptions = false;
JS_API bool g_log_all_js_exceptions = false;
Completion::Completion(ThrowCompletionOr<Value> const& throw_completion_or_value)
{

View file

@ -49,7 +49,7 @@ namespace JS {
})
// 6.2.3 The Completion Record Specification Type, https://tc39.es/ecma262/#sec-completion-record-specification-type
class [[nodiscard]] Completion {
class [[nodiscard]] JS_API Completion {
public:
enum class Type {
Empty,
@ -335,7 +335,7 @@ private:
Value m_value;
};
ThrowCompletionOr<Value> await(VM&, Value);
JS_API ThrowCompletionOr<Value> await(VM&, Value);
// 6.2.4.1 NormalCompletion ( value ), https://tc39.es/ecma262/#sec-normalcompletion
inline Completion normal_completion(Value value)
@ -345,6 +345,6 @@ inline Completion normal_completion(Value value)
}
// 6.2.4.2 ThrowCompletion ( value ), https://tc39.es/ecma262/#sec-throwcompletion
Completion throw_completion(Value);
JS_API Completion throw_completion(Value);
}

View file

@ -12,7 +12,7 @@
namespace JS {
class CompletionCell final : public Cell {
class JS_API CompletionCell final : public Cell {
GC_CELL(CompletionCell, Cell);
GC_DECLARE_ALLOCATOR(CompletionCell);

View file

@ -10,7 +10,7 @@
namespace JS {
class ConsoleObject final : public Object {
class JS_API ConsoleObject final : public Object {
JS_OBJECT(ConsoleObject, Object);
GC_DECLARE_ALLOCATOR(ConsoleObject);

View file

@ -10,7 +10,7 @@
namespace JS {
class ConsoleObjectPrototype final : public Object {
class JS_API ConsoleObjectPrototype final : public Object {
JS_OBJECT(ConsoleObjectPrototype, Object);
GC_DECLARE_ALLOCATOR(ConsoleObjectPrototype);

View file

@ -13,7 +13,7 @@
namespace JS {
class DataView : public Object {
class JS_API DataView : public Object {
JS_OBJECT(DataView, Object);
GC_DECLARE_ALLOCATOR(DataView);
@ -42,8 +42,8 @@ struct DataViewWithBufferWitness {
ByteLength cached_buffer_byte_length; // [[CachedBufferByteLength]]
};
DataViewWithBufferWitness make_data_view_with_buffer_witness_record(DataView const&, ArrayBuffer::Order);
u32 get_view_byte_length(DataViewWithBufferWitness const&);
bool is_view_out_of_bounds(DataViewWithBufferWitness const&);
JS_API DataViewWithBufferWitness make_data_view_with_buffer_witness_record(DataView const&, ArrayBuffer::Order);
JS_API u32 get_view_byte_length(DataViewWithBufferWitness const&);
JS_API bool is_view_out_of_bounds(DataViewWithBufferWitness const&);
}

View file

@ -10,7 +10,7 @@
namespace JS {
class DataViewConstructor final : public NativeFunction {
class JS_API DataViewConstructor final : public NativeFunction {
JS_OBJECT(DataViewConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(DataViewConstructor);

View file

@ -11,7 +11,7 @@
namespace JS {
class DataViewPrototype final : public PrototypeObject<DataViewPrototype, DataView> {
class JS_API DataViewPrototype final : public PrototypeObject<DataViewPrototype, DataView> {
JS_PROTOTYPE_OBJECT(DataViewPrototype, DataView, DataView);
GC_DECLARE_ALLOCATOR(DataViewPrototype);

View file

@ -13,7 +13,7 @@
namespace JS {
class Date final : public Object {
class JS_API Date final : public Object {
JS_OBJECT(Date, Object);
GC_DECLARE_ALLOCATOR(Date);
@ -63,36 +63,36 @@ constexpr inline double ms_per_day = 86'400'000;
constexpr inline double ns_per_day = 86'400'000'000'000;
extern Crypto::SignedBigInteger const ns_per_day_bigint;
double day(double);
double time_within_day(double);
u16 days_in_year(i32);
double day_from_year(i32);
double time_from_year(i32);
i32 year_from_time(double);
u16 day_within_year(double);
bool in_leap_year(double);
u8 month_from_time(double);
u8 date_from_time(double);
u8 week_day(double);
u8 hour_from_time(double);
u8 min_from_time(double);
u8 sec_from_time(double);
u16 ms_from_time(double);
Crypto::SignedBigInteger get_utc_epoch_nanoseconds(Temporal::ISODateTime const&);
Vector<Crypto::SignedBigInteger> get_named_time_zone_epoch_nanoseconds(StringView time_zone_identifier, Temporal::ISODateTime const&);
Unicode::TimeZoneOffset get_named_time_zone_offset_nanoseconds(StringView time_zone_identifier, Crypto::SignedBigInteger const& epoch_nanoseconds);
Unicode::TimeZoneOffset get_named_time_zone_offset_milliseconds(StringView time_zone_identifier, double epoch_milliseconds);
String system_time_zone_identifier();
void clear_system_time_zone_cache();
double local_time(double time);
double utc_time(double time);
double make_time(double hour, double min, double sec, double ms);
double make_day(double year, double month, double date);
double make_date(double day, double time);
double time_clip(double time);
bool is_offset_time_zone_identifier(StringView offset_string);
ThrowCompletionOr<double> parse_date_time_utc_offset(VM&, StringView offset_string);
double parse_date_time_utc_offset(StringView offset_string);
double parse_date_time_utc_offset(Temporal::TimeZoneOffset const&);
JS_API double day(double);
JS_API double time_within_day(double);
JS_API u16 days_in_year(i32);
JS_API double day_from_year(i32);
JS_API double time_from_year(i32);
JS_API i32 year_from_time(double);
JS_API u16 day_within_year(double);
JS_API bool in_leap_year(double);
JS_API u8 month_from_time(double);
JS_API u8 date_from_time(double);
JS_API u8 week_day(double);
JS_API u8 hour_from_time(double);
JS_API u8 min_from_time(double);
JS_API u8 sec_from_time(double);
JS_API u16 ms_from_time(double);
JS_API Crypto::SignedBigInteger get_utc_epoch_nanoseconds(Temporal::ISODateTime const&);
JS_API Vector<Crypto::SignedBigInteger> get_named_time_zone_epoch_nanoseconds(StringView time_zone_identifier, Temporal::ISODateTime const&);
JS_API Unicode::TimeZoneOffset get_named_time_zone_offset_nanoseconds(StringView time_zone_identifier, Crypto::SignedBigInteger const& epoch_nanoseconds);
JS_API Unicode::TimeZoneOffset get_named_time_zone_offset_milliseconds(StringView time_zone_identifier, double epoch_milliseconds);
JS_API String system_time_zone_identifier();
JS_API void clear_system_time_zone_cache();
JS_API double local_time(double time);
JS_API double utc_time(double time);
JS_API double make_time(double hour, double min, double sec, double ms);
JS_API double make_day(double year, double month, double date);
JS_API double make_date(double day, double time);
JS_API double time_clip(double time);
JS_API bool is_offset_time_zone_identifier(StringView offset_string);
JS_API ThrowCompletionOr<double> parse_date_time_utc_offset(VM&, StringView offset_string);
JS_API double parse_date_time_utc_offset(StringView offset_string);
JS_API double parse_date_time_utc_offset(Temporal::TimeZoneOffset const&);
}

View file

@ -10,7 +10,7 @@
namespace JS {
class DateConstructor final : public NativeFunction {
class JS_API DateConstructor final : public NativeFunction {
JS_OBJECT(DateConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(DateConstructor);

View file

@ -11,7 +11,7 @@
namespace JS {
class DatePrototype final : public PrototypeObject<DatePrototype, Date> {
class JS_API DatePrototype final : public PrototypeObject<DatePrototype, Date> {
JS_PROTOTYPE_OBJECT(DatePrototype, Date, Date);
GC_DECLARE_ALLOCATOR(DatePrototype);
@ -74,10 +74,10 @@ private:
JS_DECLARE_NATIVE_FUNCTION(symbol_to_primitive);
};
ThrowCompletionOr<double> this_time_value(VM&, Value value);
ByteString time_string(double time);
ByteString date_string(double time);
ByteString time_zone_string(double time);
ByteString to_date_string(double time);
JS_API ThrowCompletionOr<double> this_time_value(VM&, Value value);
JS_API ByteString time_string(double time);
JS_API ByteString date_string(double time);
JS_API ByteString time_zone_string(double time);
JS_API ByteString to_date_string(double time);
}

View file

@ -15,7 +15,7 @@
namespace JS {
class DeclarativeEnvironment : public Environment {
class JS_API DeclarativeEnvironment : public Environment {
JS_ENVIRONMENT(DeclarativeEnvironment, Environment);
GC_DECLARE_ALLOCATOR(DeclarativeEnvironment);

View file

@ -12,7 +12,7 @@
namespace JS {
class DisposableStack final : public Object {
class JS_API DisposableStack final : public Object {
JS_OBJECT(DisposableStack, Object);
GC_DECLARE_ALLOCATOR(DisposableStack);

View file

@ -10,7 +10,7 @@
namespace JS {
class DisposableStackConstructor final : public NativeFunction {
class JS_API DisposableStackConstructor final : public NativeFunction {
JS_OBJECT(DisposableStackConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(DisposableStackConstructor);

View file

@ -12,7 +12,7 @@
namespace JS {
class DisposableStackPrototype final : public PrototypeObject<DisposableStackPrototype, DisposableStack> {
class JS_API DisposableStackPrototype final : public PrototypeObject<DisposableStackPrototype, DisposableStack> {
JS_PROTOTYPE_OBJECT(DisposableStackPrototype, DisposableStack, DisposableStack);
GC_DECLARE_ALLOCATOR(DisposableStackPrototype);

View file

@ -98,7 +98,7 @@ public:
};
// 10.2 ECMAScript Function Objects, https://tc39.es/ecma262/#sec-ecmascript-function-objects
class ECMAScriptFunctionObject final : public FunctionObject {
class JS_API ECMAScriptFunctionObject final : public FunctionObject {
JS_OBJECT(ECMAScriptFunctionObject, FunctionObject);
GC_DECLARE_ALLOCATOR(ECMAScriptFunctionObject);

View file

@ -19,7 +19,7 @@ struct Variable {
#define JS_ENVIRONMENT(class_, base_class) GC_CELL(class_, base_class)
class Environment : public Cell {
class JS_API Environment : public Cell {
GC_CELL(Environment, Cell);
public:

View file

@ -14,7 +14,7 @@
namespace JS {
struct TracebackFrame {
struct JS_API TracebackFrame {
FlyString function_name;
[[nodiscard]] SourceRange const& source_range() const;
@ -26,7 +26,7 @@ enum CompactTraceback {
Yes,
};
class Error : public Object {
class JS_API Error : public Object {
JS_OBJECT(Error, Object);
GC_DECLARE_ALLOCATOR(Error);
@ -60,7 +60,7 @@ inline bool Object::fast_is<Error>() const { return is_error_object(); }
// our way of implementing the [[ErrorData]] internal slot, which is
// used in Object.prototype.toString().
#define DECLARE_NATIVE_ERROR(ClassName, snake_name, PrototypeName, ConstructorName) \
class ClassName final : public Error { \
class JS_API ClassName final : public Error { \
JS_OBJECT(ClassName, Error); \
GC_DECLARE_ALLOCATOR(ClassName); \
\

View file

@ -11,7 +11,7 @@
namespace JS {
class ErrorConstructor final : public NativeFunction {
class JS_API ErrorConstructor final : public NativeFunction {
JS_OBJECT(ErrorConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(ErrorConstructor);

View file

@ -12,7 +12,7 @@
namespace JS {
class ErrorPrototype final : public PrototypeObject<ErrorPrototype, Error> {
class JS_API ErrorPrototype final : public PrototypeObject<ErrorPrototype, Error> {
JS_PROTOTYPE_OBJECT(ErrorPrototype, Error, Error);
GC_DECLARE_ALLOCATOR(ErrorPrototype);

View file

@ -32,7 +32,7 @@ struct CachedSourceRange : public RefCounted<CachedSourceRange> {
};
// 9.4 Execution Contexts, https://tc39.es/ecma262/#sec-execution-contexts
struct ExecutionContext {
struct JS_API ExecutionContext {
static NonnullOwnPtr<ExecutionContext> create(u32 registers_and_constants_and_locals_count, u32 arguments_count);
[[nodiscard]] NonnullOwnPtr<ExecutionContext> copy() const;

View file

@ -17,7 +17,7 @@
namespace JS {
class FinalizationRegistry final
class JS_API FinalizationRegistry final
: public Object
, public GC::WeakContainer {
JS_OBJECT(FinalizationRegistry, Object);

View file

@ -10,7 +10,7 @@
namespace JS {
class FinalizationRegistryConstructor final : public NativeFunction {
class JS_API FinalizationRegistryConstructor final : public NativeFunction {
JS_OBJECT(FinalizationRegistryConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(FinalizationRegistryConstructor);

View file

@ -11,7 +11,7 @@
namespace JS {
class FinalizationRegistryPrototype final : public PrototypeObject<FinalizationRegistryPrototype, FinalizationRegistry> {
class JS_API FinalizationRegistryPrototype final : public PrototypeObject<FinalizationRegistryPrototype, FinalizationRegistry> {
JS_PROTOTYPE_OBJECT(FinalizationRegistryPrototype, FinalizationRegistry, FinalizationRegistry);
GC_DECLARE_ALLOCATOR(FinalizationRegistryPrototype);

View file

@ -16,9 +16,9 @@ struct ParameterArgumentsAndBody {
String body;
};
ThrowCompletionOr<ParameterArgumentsAndBody> extract_parameter_arguments_and_body(VM&, Span<Value> arguments);
JS_API ThrowCompletionOr<ParameterArgumentsAndBody> extract_parameter_arguments_and_body(VM&, Span<Value> arguments);
class FunctionConstructor final : public NativeFunction {
class JS_API FunctionConstructor final : public NativeFunction {
JS_OBJECT(FunctionConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(FunctionConstructor);

View file

@ -11,7 +11,7 @@
namespace JS {
class FunctionEnvironment final : public DeclarativeEnvironment {
class JS_API FunctionEnvironment final : public DeclarativeEnvironment {
JS_ENVIRONMENT(FunctionEnvironment, DeclarativeEnvironment);
GC_DECLARE_ALLOCATOR(FunctionEnvironment);

View file

@ -16,7 +16,7 @@
namespace JS {
class FunctionObject : public Object {
class JS_API FunctionObject : public Object {
JS_OBJECT(FunctionObject, Object);
public:

View file

@ -10,7 +10,7 @@
namespace JS {
class FunctionPrototype final : public FunctionObject {
class JS_API FunctionPrototype final : public FunctionObject {
JS_OBJECT(FunctionPrototype, FunctionObject);
GC_DECLARE_ALLOCATOR(FunctionPrototype);

View file

@ -11,7 +11,7 @@
namespace JS {
// 27.3.1 %GeneratorFunction%, https://tc39.es/ecma262/#sec-generatorfunction-constructor
class GeneratorFunctionConstructor final : public NativeFunction {
class JS_API GeneratorFunctionConstructor final : public NativeFunction {
JS_OBJECT(GeneratorFunctionConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(GeneratorFunctionConstructor);

View file

@ -12,7 +12,7 @@
namespace JS {
// 27.3.3 %GeneratorFunction.prototype%, https://tc39.es/ecma262/#sec-properties-of-the-generatorfunction-prototype-object
class GeneratorFunctionPrototype final : public Object {
class JS_API GeneratorFunctionPrototype final : public Object {
JS_OBJECT(GeneratorFunctionPrototype, Object);
GC_DECLARE_ALLOCATOR(GeneratorFunctionPrototype);

View file

@ -12,7 +12,7 @@
namespace JS {
class GeneratorObject : public Object {
class JS_API GeneratorObject : public Object {
JS_OBJECT(GeneratorObject, Object);
GC_DECLARE_ALLOCATOR(GeneratorObject);

View file

@ -12,7 +12,7 @@
namespace JS {
// 27.5.1 Properties of the Generator Prototype Object, https://tc39.es/ecma262/#sec-properties-of-generator-prototype
class GeneratorPrototype final : public PrototypeObject<GeneratorPrototype, GeneratorObject> {
class JS_API GeneratorPrototype final : public PrototypeObject<GeneratorPrototype, GeneratorObject> {
JS_PROTOTYPE_OBJECT(GeneratorPrototype, GeneratorObject, Generator);
GC_DECLARE_ALLOCATOR(GeneratorPrototype);

View file

@ -12,7 +12,7 @@
namespace JS {
class GeneratorResult final : public Cell {
class JS_API GeneratorResult final : public Cell {
GC_CELL(GeneratorResult, Cell);
GC_DECLARE_ALLOCATOR(GeneratorResult);

View file

@ -10,7 +10,7 @@
namespace JS {
class GlobalEnvironment final : public Environment {
class JS_API GlobalEnvironment final : public Environment {
JS_ENVIRONMENT(GlobalEnvironment, Environment);
GC_DECLARE_ALLOCATOR(GlobalEnvironment);

View file

@ -13,7 +13,7 @@
namespace JS {
class GlobalObject : public Object {
class JS_API GlobalObject : public Object {
JS_OBJECT(GlobalObject, Object);
GC_DECLARE_ALLOCATOR(GlobalObject);
@ -43,7 +43,7 @@ private:
JS_DECLARE_NATIVE_FUNCTION(unescape);
};
void set_default_global_bindings(Realm&);
JS_API void set_default_global_bindings(Realm&);
template<>
inline bool Object::fast_is<GlobalObject>() const { return is_global_object(); }

View file

@ -23,7 +23,7 @@ class IndexedProperties;
class IndexedPropertyIterator;
class GenericIndexedPropertyStorage;
class IndexedPropertyStorage {
class JS_API IndexedPropertyStorage {
public:
virtual ~IndexedPropertyStorage() = default;
@ -59,7 +59,7 @@ private:
bool m_is_simple_storage { false };
};
class SimpleIndexedPropertyStorage final : public IndexedPropertyStorage {
class JS_API SimpleIndexedPropertyStorage final : public IndexedPropertyStorage {
public:
SimpleIndexedPropertyStorage()
: IndexedPropertyStorage(IsSimpleStorage::Yes)
@ -103,7 +103,7 @@ private:
Vector<Value> m_packed_elements;
};
class GenericIndexedPropertyStorage final : public IndexedPropertyStorage {
class JS_API GenericIndexedPropertyStorage final : public IndexedPropertyStorage {
public:
explicit GenericIndexedPropertyStorage(SimpleIndexedPropertyStorage&&);
explicit GenericIndexedPropertyStorage()
@ -128,7 +128,7 @@ private:
HashMap<u32, ValueAndAttributes> m_sparse_elements;
};
class IndexedPropertyIterator {
class JS_API IndexedPropertyIterator {
public:
IndexedPropertyIterator(IndexedProperties const&, u32 starting_index, bool skip_empty);
@ -148,7 +148,7 @@ private:
bool m_skip_empty { false };
};
class IndexedProperties {
class JS_API IndexedProperties {
public:
IndexedProperties() = default;

View file

@ -63,23 +63,23 @@ AK_ENUM_BITWISE_OPERATORS(SpecialBehaviors);
using StringOrBoolean = Variant<StringView, bool>;
bool is_structurally_valid_language_tag(StringView locale);
String canonicalize_unicode_locale_id(StringView locale);
bool is_well_formed_currency_code(StringView currency);
Vector<TimeZoneIdentifier> const& available_named_time_zone_identifiers();
Optional<TimeZoneIdentifier const&> get_available_named_time_zone_identifier(StringView time_zone_identifier);
bool is_well_formed_unit_identifier(StringView unit_identifier);
ThrowCompletionOr<Vector<String>> canonicalize_locale_list(VM&, Value locales);
Optional<MatchedLocale> lookup_matching_locale_by_prefix(ReadonlySpan<String> requested_locales);
Optional<MatchedLocale> lookup_matching_locale_by_best_fit(ReadonlySpan<String> requested_locales);
String insert_unicode_extension_and_canonicalize(Unicode::LocaleID locale_id, Vector<String> attributes, Vector<Unicode::Keyword> keywords);
ResolvedLocale resolve_locale(ReadonlySpan<String> requested_locales, LocaleOptions const& options, ReadonlySpan<StringView> relevant_extension_keys);
ThrowCompletionOr<ResolvedOptions> resolve_options(VM& vm, IntlObject& object, Value locales, Value options_value, SpecialBehaviors special_behaviours = SpecialBehaviors::None, Function<void(LocaleOptions&)> modify_resolution_options = {});
ThrowCompletionOr<GC::Ref<Array>> filter_locales(VM& vm, ReadonlySpan<String> requested_locales, Value options);
ThrowCompletionOr<GC::Ref<Object>> coerce_options_to_object(VM&, Value options);
ThrowCompletionOr<StringOrBoolean> get_boolean_or_string_number_format_option(VM& vm, Object const& options, PropertyKey const& property, ReadonlySpan<StringView> string_values, StringOrBoolean fallback);
ThrowCompletionOr<Optional<int>> default_number_option(VM&, Value value, int minimum, int maximum, Optional<int> fallback);
ThrowCompletionOr<Optional<int>> get_number_option(VM&, Object const& options, PropertyKey const& property, int minimum, int maximum, Optional<int> fallback);
JS_API bool is_structurally_valid_language_tag(StringView locale);
JS_API String canonicalize_unicode_locale_id(StringView locale);
JS_API bool is_well_formed_currency_code(StringView currency);
JS_API Vector<TimeZoneIdentifier> const& available_named_time_zone_identifiers();
JS_API Optional<TimeZoneIdentifier const&> get_available_named_time_zone_identifier(StringView time_zone_identifier);
JS_API bool is_well_formed_unit_identifier(StringView unit_identifier);
JS_API ThrowCompletionOr<Vector<String>> canonicalize_locale_list(VM&, Value locales);
JS_API Optional<MatchedLocale> lookup_matching_locale_by_prefix(ReadonlySpan<String> requested_locales);
JS_API Optional<MatchedLocale> lookup_matching_locale_by_best_fit(ReadonlySpan<String> requested_locales);
JS_API String insert_unicode_extension_and_canonicalize(Unicode::LocaleID locale_id, Vector<String> attributes, Vector<Unicode::Keyword> keywords);
JS_API ResolvedLocale resolve_locale(ReadonlySpan<String> requested_locales, LocaleOptions const& options, ReadonlySpan<StringView> relevant_extension_keys);
JS_API ThrowCompletionOr<ResolvedOptions> resolve_options(VM& vm, IntlObject& object, Value locales, Value options_value, SpecialBehaviors special_behaviours = SpecialBehaviors::None, Function<void(LocaleOptions&)> modify_resolution_options = {});
JS_API ThrowCompletionOr<GC::Ref<Array>> filter_locales(VM& vm, ReadonlySpan<String> requested_locales, Value options);
JS_API ThrowCompletionOr<GC::Ref<Object>> coerce_options_to_object(VM&, Value options);
JS_API ThrowCompletionOr<StringOrBoolean> get_boolean_or_string_number_format_option(VM& vm, Object const& options, PropertyKey const& property, ReadonlySpan<StringView> string_values, StringOrBoolean fallback);
JS_API ThrowCompletionOr<Optional<int>> default_number_option(VM&, Value value, int minimum, int maximum, Optional<int> fallback);
JS_API ThrowCompletionOr<Optional<int>> get_number_option(VM&, Object const& options, PropertyKey const& property, int minimum, int maximum, Optional<int> fallback);
template<size_t Size>
ThrowCompletionOr<StringOrBoolean> get_boolean_or_string_number_format_option(VM& vm, Object const& options, PropertyKey const& property, StringView const (&string_values)[Size], StringOrBoolean fallback)

View file

@ -14,7 +14,7 @@
namespace JS::Intl {
class Collator final : public IntlObject {
class JS_API Collator final : public IntlObject {
JS_OBJECT(Collator, IntlObject);
GC_DECLARE_ALLOCATOR(Collator);

View file

@ -10,7 +10,7 @@
namespace JS::Intl {
class CollatorCompareFunction : public NativeFunction {
class JS_API CollatorCompareFunction : public NativeFunction {
JS_OBJECT(CollatorCompareFunction, NativeFunction);
GC_DECLARE_ALLOCATOR(CollatorCompareFunction);
@ -30,6 +30,6 @@ private:
GC::Ref<Collator> m_collator; // [[Collator]]
};
int compare_strings(Collator const&, StringView x, StringView y);
JS_API int compare_strings(Collator const&, StringView x, StringView y);
}

View file

@ -10,7 +10,7 @@
namespace JS::Intl {
class CollatorConstructor final : public NativeFunction {
class JS_API CollatorConstructor final : public NativeFunction {
JS_OBJECT(CollatorConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(CollatorConstructor);

View file

@ -11,7 +11,7 @@
namespace JS::Intl {
class CollatorPrototype final : public PrototypeObject<CollatorPrototype, Collator> {
class JS_API CollatorPrototype final : public PrototypeObject<CollatorPrototype, Collator> {
JS_PROTOTYPE_OBJECT(CollatorPrototype, Collator, Collator);
GC_DECLARE_ALLOCATOR(CollatorPrototype);

View file

@ -19,7 +19,7 @@
namespace JS::Intl {
class DateTimeFormat final : public IntlObject {
class JS_API DateTimeFormat final : public IntlObject {
JS_OBJECT(DateTimeFormat, IntlObject);
GC_DECLARE_ALLOCATOR(DateTimeFormat);
@ -135,27 +135,27 @@ struct ValueFormat {
double epoch_milliseconds { 0 }; // [[EpochNanoseconds]]
};
Vector<Unicode::DateTimeFormat::Partition> format_date_time_pattern(ValueFormat const&);
ThrowCompletionOr<Vector<Unicode::DateTimeFormat::Partition>> partition_date_time_pattern(VM&, DateTimeFormat&, FormattableDateTime const&);
ThrowCompletionOr<String> format_date_time(VM&, DateTimeFormat&, FormattableDateTime const&);
ThrowCompletionOr<GC::Ref<Array>> format_date_time_to_parts(VM&, DateTimeFormat&, FormattableDateTime const&);
ThrowCompletionOr<Vector<Unicode::DateTimeFormat::Partition>> partition_date_time_range_pattern(VM&, DateTimeFormat&, FormattableDateTime const& start, FormattableDateTime const& end);
ThrowCompletionOr<String> format_date_time_range(VM&, DateTimeFormat&, FormattableDateTime const& start, FormattableDateTime const& end);
ThrowCompletionOr<GC::Ref<Array>> format_date_time_range_to_parts(VM&, DateTimeFormat&, FormattableDateTime const& start, FormattableDateTime const& end);
JS_API Vector<Unicode::DateTimeFormat::Partition> format_date_time_pattern(ValueFormat const&);
JS_API ThrowCompletionOr<Vector<Unicode::DateTimeFormat::Partition>> partition_date_time_pattern(VM&, DateTimeFormat&, FormattableDateTime const&);
JS_API ThrowCompletionOr<String> format_date_time(VM&, DateTimeFormat&, FormattableDateTime const&);
JS_API ThrowCompletionOr<GC::Ref<Array>> format_date_time_to_parts(VM&, DateTimeFormat&, FormattableDateTime const&);
JS_API ThrowCompletionOr<Vector<Unicode::DateTimeFormat::Partition>> partition_date_time_range_pattern(VM&, DateTimeFormat&, FormattableDateTime const& start, FormattableDateTime const& end);
JS_API ThrowCompletionOr<String> format_date_time_range(VM&, DateTimeFormat&, FormattableDateTime const& start, FormattableDateTime const& end);
JS_API ThrowCompletionOr<GC::Ref<Array>> format_date_time_range_to_parts(VM&, DateTimeFormat&, FormattableDateTime const& start, FormattableDateTime const& end);
Optional<Unicode::CalendarPattern> get_date_time_format(Unicode::CalendarPattern const& options, OptionRequired, OptionDefaults, OptionInherit);
Unicode::CalendarPattern adjust_date_time_style_format(Unicode::CalendarPattern const& base_format, ReadonlySpan<Unicode::CalendarPattern::Field> allowed_options);
ThrowCompletionOr<FormattableDateTime> to_date_time_formattable(VM&, Value);
bool is_temporal_object(FormattableDateTime const&);
bool same_temporal_type(FormattableDateTime const&, FormattableDateTime const&);
ThrowCompletionOr<ValueFormat> handle_date_time_temporal_date(VM&, DateTimeFormat&, Temporal::PlainDate const&);
ThrowCompletionOr<ValueFormat> handle_date_time_temporal_year_month(VM&, DateTimeFormat&, Temporal::PlainYearMonth const&);
ThrowCompletionOr<ValueFormat> handle_date_time_temporal_month_day(VM&, DateTimeFormat&, Temporal::PlainMonthDay const&);
ThrowCompletionOr<ValueFormat> handle_date_time_temporal_time(VM&, DateTimeFormat&, Temporal::PlainTime const&);
ThrowCompletionOr<ValueFormat> handle_date_time_temporal_date_time(VM&, DateTimeFormat&, Temporal::PlainDateTime const&);
ValueFormat handle_date_time_temporal_instant(DateTimeFormat&, Temporal::Instant const&);
ThrowCompletionOr<ValueFormat> handle_date_time_others(VM&, DateTimeFormat&, double);
ThrowCompletionOr<ValueFormat> handle_date_time_value(VM&, DateTimeFormat&, FormattableDateTime const&);
JS_API Optional<Unicode::CalendarPattern> get_date_time_format(Unicode::CalendarPattern const& options, OptionRequired, OptionDefaults, OptionInherit);
JS_API Unicode::CalendarPattern adjust_date_time_style_format(Unicode::CalendarPattern const& base_format, ReadonlySpan<Unicode::CalendarPattern::Field> allowed_options);
JS_API ThrowCompletionOr<FormattableDateTime> to_date_time_formattable(VM&, Value);
JS_API bool is_temporal_object(FormattableDateTime const&);
JS_API bool same_temporal_type(FormattableDateTime const&, FormattableDateTime const&);
JS_API ThrowCompletionOr<ValueFormat> handle_date_time_temporal_date(VM&, DateTimeFormat&, Temporal::PlainDate const&);
JS_API ThrowCompletionOr<ValueFormat> handle_date_time_temporal_year_month(VM&, DateTimeFormat&, Temporal::PlainYearMonth const&);
JS_API ThrowCompletionOr<ValueFormat> handle_date_time_temporal_month_day(VM&, DateTimeFormat&, Temporal::PlainMonthDay const&);
JS_API ThrowCompletionOr<ValueFormat> handle_date_time_temporal_time(VM&, DateTimeFormat&, Temporal::PlainTime const&);
JS_API ThrowCompletionOr<ValueFormat> handle_date_time_temporal_date_time(VM&, DateTimeFormat&, Temporal::PlainDateTime const&);
JS_API ValueFormat handle_date_time_temporal_instant(DateTimeFormat&, Temporal::Instant const&);
JS_API ThrowCompletionOr<ValueFormat> handle_date_time_others(VM&, DateTimeFormat&, double);
JS_API ThrowCompletionOr<ValueFormat> handle_date_time_value(VM&, DateTimeFormat&, FormattableDateTime const&);
template<typename Callback>
ThrowCompletionOr<void> for_each_calendar_field(VM& vm, Unicode::CalendarPattern& pattern, Callback&& callback)

View file

@ -10,7 +10,7 @@
namespace JS::Intl {
class DateTimeFormatConstructor final : public NativeFunction {
class JS_API DateTimeFormatConstructor final : public NativeFunction {
JS_OBJECT(DateTimeFormatConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(DateTimeFormatConstructor);

View file

@ -12,7 +12,7 @@
namespace JS::Intl {
class DateTimeFormatFunction final : public NativeFunction {
class JS_API DateTimeFormatFunction final : public NativeFunction {
JS_OBJECT(DateTimeFormatFunction, NativeFunction);
GC_DECLARE_ALLOCATOR(DateTimeFormatFunction);

View file

@ -11,7 +11,7 @@
namespace JS::Intl {
class DateTimeFormatPrototype final : public PrototypeObject<DateTimeFormatPrototype, DateTimeFormat> {
class JS_API DateTimeFormatPrototype final : public PrototypeObject<DateTimeFormatPrototype, DateTimeFormat> {
JS_PROTOTYPE_OBJECT(DateTimeFormatPrototype, DateTimeFormat, Intl.DateTimeFormat);
GC_DECLARE_ALLOCATOR(DateTimeFormatPrototype);

View file

@ -15,7 +15,7 @@
namespace JS::Intl {
class DisplayNames final : public IntlObject {
class JS_API DisplayNames final : public IntlObject {
JS_OBJECT(DisplayNames, IntlObject);
GC_DECLARE_ALLOCATOR(DisplayNames);
@ -71,7 +71,7 @@ private:
Optional<Unicode::LanguageDisplay> m_language_display; // [[LanguageDisplay]]
};
ThrowCompletionOr<Value> canonical_code_for_display_names(VM&, DisplayNames::Type, StringView code);
bool is_valid_date_time_field_code(StringView field);
JS_API ThrowCompletionOr<Value> canonical_code_for_display_names(VM&, DisplayNames::Type, StringView code);
JS_API bool is_valid_date_time_field_code(StringView field);
}

View file

@ -10,7 +10,7 @@
namespace JS::Intl {
class DisplayNamesConstructor final : public NativeFunction {
class JS_API DisplayNamesConstructor final : public NativeFunction {
JS_OBJECT(DisplayNamesConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(DisplayNamesConstructor);

View file

@ -11,7 +11,7 @@
namespace JS::Intl {
class DisplayNamesPrototype final : public PrototypeObject<DisplayNamesPrototype, DisplayNames> {
class JS_API DisplayNamesPrototype final : public PrototypeObject<DisplayNamesPrototype, DisplayNames> {
JS_PROTOTYPE_OBJECT(DisplayNamesPrototype, DisplayNames, Intl.DisplayNames);
GC_DECLARE_ALLOCATOR(DisplayNamesPrototype);

View file

@ -16,7 +16,7 @@
namespace JS::Intl {
class DurationFormat final : public IntlObject {
class JS_API DurationFormat final : public IntlObject {
JS_OBJECT(DurationFormat, IntlObject);
GC_DECLARE_ALLOCATOR(DurationFormat);
@ -66,7 +66,7 @@ public:
};
// 13.5.6.1 Duration Unit Options Records, https://tc39.es/ecma402/#sec-durationformat-unit-options-record
struct DurationUnitOptions {
struct JS_API DurationUnitOptions {
ValueStyle style { ValueStyle::Long };
Display display { Display::Auto };
};
@ -148,7 +148,7 @@ private:
Optional<u8> m_fractional_digits; // [[FractionalDigits]]
};
struct DurationInstanceComponent {
struct JS_API DurationInstanceComponent {
double (Temporal::Duration::*value_slot)() const;
DurationFormat::DurationUnitOptions (DurationFormat::*get_internal_slot)() const;
void (DurationFormat::*set_internal_slot)(DurationFormat::DurationUnitOptions);
@ -176,21 +176,21 @@ static constexpr auto duration_instances_components = to_array<DurationInstanceC
{ &Temporal::Duration::nanoseconds, &DurationFormat::nanoseconds_options, &DurationFormat::set_nanoseconds_options, DurationFormat::Unit::Nanoseconds, sub_second_styles, DurationFormat::ValueStyle::Numeric },
});
struct DurationFormatPart {
struct JS_API DurationFormatPart {
StringView type;
String value;
StringView unit;
};
ThrowCompletionOr<DurationFormat::DurationUnitOptions> get_duration_unit_options(VM&, DurationFormat::Unit unit, Object const& options, DurationFormat::Style base_style, ReadonlySpan<StringView> styles_list, DurationFormat::ValueStyle digital_base, Optional<DurationFormat::ValueStyle> previous_style, bool two_digit_hours);
Crypto::BigFraction compute_fractional_digits(DurationFormat const&, Temporal::Duration const&);
bool next_unit_fractional(DurationFormat const&, DurationFormat::Unit unit);
Vector<DurationFormatPart> format_numeric_hours(VM&, DurationFormat const&, MathematicalValue const& hours_value, bool sign_displayed);
Vector<DurationFormatPart> format_numeric_minutes(VM&, DurationFormat const&, MathematicalValue const& minutes_value, bool hours_displayed, bool sign_displayed);
Vector<DurationFormatPart> format_numeric_seconds(VM&, DurationFormat const&, MathematicalValue const& seconds_value, bool minutes_displayed, bool sign_displayed);
Vector<DurationFormatPart> format_numeric_units(VM&, DurationFormat const&, Temporal::Duration const&, DurationFormat::Unit first_numeric_unit, bool sign_displayed);
bool is_fractional_second_unit_name(DurationFormat::Unit);
Vector<DurationFormatPart> list_format_parts(VM&, DurationFormat const&, Vector<Vector<DurationFormatPart>>& partitioned_parts_list);
Vector<DurationFormatPart> partition_duration_format_pattern(VM&, DurationFormat const&, Temporal::Duration const&);
JS_API ThrowCompletionOr<DurationFormat::DurationUnitOptions> get_duration_unit_options(VM&, DurationFormat::Unit unit, Object const& options, DurationFormat::Style base_style, ReadonlySpan<StringView> styles_list, DurationFormat::ValueStyle digital_base, Optional<DurationFormat::ValueStyle> previous_style, bool two_digit_hours);
JS_API Crypto::BigFraction compute_fractional_digits(DurationFormat const&, Temporal::Duration const&);
JS_API bool next_unit_fractional(DurationFormat const&, DurationFormat::Unit unit);
JS_API Vector<DurationFormatPart> format_numeric_hours(VM&, DurationFormat const&, MathematicalValue const& hours_value, bool sign_displayed);
JS_API Vector<DurationFormatPart> format_numeric_minutes(VM&, DurationFormat const&, MathematicalValue const& minutes_value, bool hours_displayed, bool sign_displayed);
JS_API Vector<DurationFormatPart> format_numeric_seconds(VM&, DurationFormat const&, MathematicalValue const& seconds_value, bool minutes_displayed, bool sign_displayed);
JS_API Vector<DurationFormatPart> format_numeric_units(VM&, DurationFormat const&, Temporal::Duration const&, DurationFormat::Unit first_numeric_unit, bool sign_displayed);
JS_API bool is_fractional_second_unit_name(DurationFormat::Unit);
JS_API Vector<DurationFormatPart> list_format_parts(VM&, DurationFormat const&, Vector<Vector<DurationFormatPart>>& partitioned_parts_list);
JS_API Vector<DurationFormatPart> partition_duration_format_pattern(VM&, DurationFormat const&, Temporal::Duration const&);
}

View file

@ -10,7 +10,7 @@
namespace JS::Intl {
class DurationFormatConstructor final : public NativeFunction {
class JS_API DurationFormatConstructor final : public NativeFunction {
JS_OBJECT(DurationFormatConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(DurationFormatConstructor);

View file

@ -11,7 +11,7 @@
namespace JS::Intl {
class DurationFormatPrototype final : public PrototypeObject<DurationFormatPrototype, DurationFormat> {
class JS_API DurationFormatPrototype final : public PrototypeObject<DurationFormatPrototype, DurationFormat> {
JS_PROTOTYPE_OBJECT(DurationFormatPrototype, DurationFormat, Intl.DurationFormat);
GC_DECLARE_ALLOCATOR(DurationFormatPrototype);

View file

@ -10,7 +10,7 @@
namespace JS::Intl {
class Intl final : public Object {
class JS_API Intl final : public Object {
JS_OBJECT(Intl, Object);
GC_DECLARE_ALLOCATOR(Intl);

View file

@ -15,14 +15,14 @@
namespace JS::Intl {
// https://tc39.es/ecma402/#resolution-option-descriptor
struct ResolutionOptionDescriptor {
struct JS_API ResolutionOptionDescriptor {
StringView key;
PropertyKey property;
OptionType type { OptionType::String };
ReadonlySpan<StringView> values {};
};
class IntlObject : public Object {
class JS_API IntlObject : public Object {
JS_OBJECT(IntlObject, Object);
public:

View file

@ -15,7 +15,7 @@
namespace JS::Intl {
class ListFormat final : public IntlObject {
class JS_API ListFormat final : public IntlObject {
JS_OBJECT(ListFormat, IntlObject);
GC_DECLARE_ALLOCATOR(ListFormat);
@ -57,9 +57,9 @@ private:
OwnPtr<Unicode::ListFormat> m_formatter;
};
Vector<Unicode::ListFormat::Partition> create_parts_from_list(ListFormat const&, ReadonlySpan<String> list);
String format_list(ListFormat const&, ReadonlySpan<String> list);
GC::Ref<Array> format_list_to_parts(VM&, ListFormat const&, ReadonlySpan<String> list);
ThrowCompletionOr<Vector<String>> string_list_from_iterable(VM&, Value iterable);
JS_API Vector<Unicode::ListFormat::Partition> create_parts_from_list(ListFormat const&, ReadonlySpan<String> list);
JS_API String format_list(ListFormat const&, ReadonlySpan<String> list);
JS_API GC::Ref<Array> format_list_to_parts(VM&, ListFormat const&, ReadonlySpan<String> list);
JS_API ThrowCompletionOr<Vector<String>> string_list_from_iterable(VM&, Value iterable);
}

View file

@ -10,7 +10,7 @@
namespace JS::Intl {
class ListFormatConstructor final : public NativeFunction {
class JS_API ListFormatConstructor final : public NativeFunction {
JS_OBJECT(ListFormatConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(ListFormatConstructor);

View file

@ -11,7 +11,7 @@
namespace JS::Intl {
class ListFormatPrototype final : public PrototypeObject<ListFormatPrototype, ListFormat> {
class JS_API ListFormatPrototype final : public PrototypeObject<ListFormatPrototype, ListFormat> {
JS_PROTOTYPE_OBJECT(ListFormatPrototype, ListFormat, Intl.ListFormat);
GC_DECLARE_ALLOCATOR(ListFormatPrototype);

View file

@ -18,7 +18,7 @@
namespace JS::Intl {
class Locale final : public Object {
class JS_API Locale final : public Object {
JS_OBJECT(Locale, Object);
GC_DECLARE_ALLOCATOR(Locale);
@ -85,21 +85,21 @@ private:
};
// Table 1: WeekInfo Record Fields, https://tc39.es/proposal-intl-locale-info/#table-locale-weekinfo-record
struct WeekInfo {
struct JS_API WeekInfo {
u8 minimal_days { 0 }; // [[MinimalDays]]
u8 first_day { 0 }; // [[FirstDay]]
Vector<u8> weekend; // [[Weekend]]
};
Optional<String> get_locale_variants(Unicode::LocaleID const&);
JS_API Optional<String> get_locale_variants(Unicode::LocaleID const&);
GC::Ref<Array> calendars_of_locale(VM&, Locale const&);
GC::Ref<Array> collations_of_locale(VM&, Locale const& locale);
GC::Ref<Array> hour_cycles_of_locale(VM&, Locale const& locale);
GC::Ref<Array> numbering_systems_of_locale(VM&, Locale const&);
GC::Ref<Array> time_zones_of_locale(VM&, Locale const&);
StringView weekday_to_string(StringView weekday);
Optional<u8> string_to_weekday_value(StringView weekday);
WeekInfo week_info_of_locale(Locale const&);
JS_API GC::Ref<Array> calendars_of_locale(VM&, Locale const&);
JS_API GC::Ref<Array> collations_of_locale(VM&, Locale const& locale);
JS_API GC::Ref<Array> hour_cycles_of_locale(VM&, Locale const& locale);
JS_API GC::Ref<Array> numbering_systems_of_locale(VM&, Locale const&);
JS_API GC::Ref<Array> time_zones_of_locale(VM&, Locale const&);
JS_API StringView weekday_to_string(StringView weekday);
JS_API Optional<u8> string_to_weekday_value(StringView weekday);
JS_API WeekInfo week_info_of_locale(Locale const&);
}

View file

@ -10,7 +10,7 @@
namespace JS::Intl {
class LocaleConstructor final : public NativeFunction {
class JS_API LocaleConstructor final : public NativeFunction {
JS_OBJECT(LocaleConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(LocaleConstructor);

View file

@ -11,7 +11,7 @@
namespace JS::Intl {
class LocalePrototype final : public PrototypeObject<LocalePrototype, Locale> {
class JS_API LocalePrototype final : public PrototypeObject<LocalePrototype, Locale> {
JS_PROTOTYPE_OBJECT(LocalePrototype, Locale, Intl.Locale);
GC_DECLARE_ALLOCATOR(LocalePrototype);

View file

@ -16,7 +16,7 @@
namespace JS::Intl {
// https://tc39.es/ecma402/#intl-mathematical-value
class MathematicalValue {
class JS_API MathematicalValue {
public:
enum class Symbol {
PositiveInfinity,

View file

@ -16,7 +16,7 @@
namespace JS::Intl {
class NumberFormatBase : public IntlObject {
class JS_API NumberFormatBase : public IntlObject {
JS_OBJECT(NumberFormatBase, IntlObject);
GC_DECLARE_ALLOCATOR(NumberFormatBase);
@ -108,7 +108,7 @@ private:
OwnPtr<Unicode::NumberFormat> m_formatter;
};
class NumberFormat final : public NumberFormatBase {
class JS_API NumberFormat final : public NumberFormatBase {
JS_OBJECT(NumberFormat, NumberFormatBase);
GC_DECLARE_ALLOCATOR(NumberFormat);
@ -179,14 +179,14 @@ private:
GC::Ptr<NativeFunction> m_bound_format; // [[BoundFormat]]
};
int currency_digits(StringView currency);
String format_numeric_to_string(NumberFormatBase const& intl_object, MathematicalValue const& number);
Vector<Unicode::NumberFormat::Partition> partition_number_pattern(NumberFormat const&, MathematicalValue const& number);
String format_numeric(NumberFormat const&, MathematicalValue const& number);
GC::Ref<Array> format_numeric_to_parts(VM&, NumberFormat const&, MathematicalValue const& number);
ThrowCompletionOr<MathematicalValue> to_intl_mathematical_value(VM&, Value value);
ThrowCompletionOr<Vector<Unicode::NumberFormat::Partition>> partition_number_range_pattern(VM&, NumberFormat const&, MathematicalValue const& start, MathematicalValue const& end);
ThrowCompletionOr<String> format_numeric_range(VM&, NumberFormat const&, MathematicalValue const& start, MathematicalValue const& end);
ThrowCompletionOr<GC::Ref<Array>> format_numeric_range_to_parts(VM&, NumberFormat const&, MathematicalValue const& start, MathematicalValue const& end);
JS_API int currency_digits(StringView currency);
JS_API String format_numeric_to_string(NumberFormatBase const& intl_object, MathematicalValue const& number);
JS_API Vector<Unicode::NumberFormat::Partition> partition_number_pattern(NumberFormat const&, MathematicalValue const& number);
JS_API String format_numeric(NumberFormat const&, MathematicalValue const& number);
JS_API GC::Ref<Array> format_numeric_to_parts(VM&, NumberFormat const&, MathematicalValue const& number);
JS_API ThrowCompletionOr<MathematicalValue> to_intl_mathematical_value(VM&, Value value);
JS_API ThrowCompletionOr<Vector<Unicode::NumberFormat::Partition>> partition_number_range_pattern(VM&, NumberFormat const&, MathematicalValue const& start, MathematicalValue const& end);
JS_API ThrowCompletionOr<String> format_numeric_range(VM&, NumberFormat const&, MathematicalValue const& start, MathematicalValue const& end);
JS_API ThrowCompletionOr<GC::Ref<Array>> format_numeric_range_to_parts(VM&, NumberFormat const&, MathematicalValue const& start, MathematicalValue const& end);
}

View file

@ -13,7 +13,7 @@
namespace JS {
class Intrinsics final : public Cell {
class JS_API Intrinsics final : public Cell {
GC_CELL(Intrinsics, Cell);
GC_DECLARE_ALLOCATOR(Intrinsics);
@ -251,6 +251,6 @@ private:
GC::Ptr<Intl::Collator> m_default_collator;
};
void add_restricted_function_properties(FunctionObject&, Realm&);
JS_API void add_restricted_function_properties(FunctionObject&, Realm&);
}

View file

@ -17,7 +17,7 @@
namespace JS {
// 7.4.1 Iterator Records, https://tc39.es/ecma262/#sec-iterator-records
class IteratorRecord final : public Cell {
class JS_API IteratorRecord final : public Cell {
GC_CELL(IteratorRecord, Cell);
GC_DECLARE_ALLOCATOR(IteratorRecord);
@ -42,7 +42,7 @@ private:
static_assert(sizeof(IteratorRecord) == 32);
#endif
class Iterator : public Object {
class JS_API Iterator : public Object {
JS_OBJECT(Iterator, Object);
GC_DECLARE_ALLOCATOR(Iterator);
@ -70,7 +70,7 @@ enum class PrimitiveHandling {
RejectPrimitives,
};
class BuiltinIterator {
class JS_API BuiltinIterator {
public:
virtual ~BuiltinIterator() = default;
virtual ThrowCompletionOr<void> next(VM&, bool& done, Value& value) = 0;
@ -101,22 +101,22 @@ using IterationResultOrDone = Variant<IterationResult, IterationDone>;
_temporary_try_or_close_result.release_value(); \
})
ThrowCompletionOr<GC::Ref<IteratorRecord>> get_iterator_direct(VM&, Object&);
ThrowCompletionOr<GC::Ref<IteratorRecord>> get_iterator_from_method(VM&, Value, GC::Ref<FunctionObject>);
ThrowCompletionOr<GC::Ref<IteratorRecord>> get_iterator(VM&, Value, IteratorHint);
ThrowCompletionOr<GC::Ref<IteratorRecord>> get_iterator_flattenable(VM&, Value, PrimitiveHandling);
ThrowCompletionOr<GC::Ref<Object>> iterator_next(VM&, IteratorRecord&, Optional<Value> = {});
ThrowCompletionOr<bool> iterator_complete(VM&, Object& iterator_result);
ThrowCompletionOr<Value> iterator_value(VM&, Object& iterator_result);
ThrowCompletionOr<IterationResultOrDone> iterator_step(VM&, IteratorRecord&);
ThrowCompletionOr<Optional<Value>> iterator_step_value(VM&, IteratorRecord&);
Completion iterator_close(VM&, IteratorRecord const&, Completion);
Completion async_iterator_close(VM&, IteratorRecord const&, Completion);
GC::Ref<Object> create_iterator_result_object(VM&, Value, bool done);
ThrowCompletionOr<GC::RootVector<Value>> iterator_to_list(VM&, IteratorRecord&);
ThrowCompletionOr<void> setter_that_ignores_prototype_properties(VM&, Value this_, Object const& home, PropertyKey const& property, Value value);
JS_API ThrowCompletionOr<GC::Ref<IteratorRecord>> get_iterator_direct(VM&, Object&);
JS_API ThrowCompletionOr<GC::Ref<IteratorRecord>> get_iterator_from_method(VM&, Value, GC::Ref<FunctionObject>);
JS_API ThrowCompletionOr<GC::Ref<IteratorRecord>> get_iterator(VM&, Value, IteratorHint);
JS_API ThrowCompletionOr<GC::Ref<IteratorRecord>> get_iterator_flattenable(VM&, Value, PrimitiveHandling);
JS_API ThrowCompletionOr<GC::Ref<Object>> iterator_next(VM&, IteratorRecord&, Optional<Value> = {});
JS_API ThrowCompletionOr<bool> iterator_complete(VM&, Object& iterator_result);
JS_API ThrowCompletionOr<Value> iterator_value(VM&, Object& iterator_result);
JS_API ThrowCompletionOr<IterationResultOrDone> iterator_step(VM&, IteratorRecord&);
JS_API ThrowCompletionOr<Optional<Value>> iterator_step_value(VM&, IteratorRecord&);
JS_API Completion iterator_close(VM&, IteratorRecord const&, Completion);
JS_API Completion async_iterator_close(VM&, IteratorRecord const&, Completion);
JS_API GC::Ref<Object> create_iterator_result_object(VM&, Value, bool done);
JS_API ThrowCompletionOr<GC::RootVector<Value>> iterator_to_list(VM&, IteratorRecord&);
JS_API ThrowCompletionOr<void> setter_that_ignores_prototype_properties(VM&, Value this_, Object const& home, PropertyKey const& property, Value value);
using IteratorValueCallback = Function<Optional<Completion>(Value)>;
Completion get_iterator_values(VM&, Value iterable, IteratorValueCallback callback);
JS_API Completion get_iterator_values(VM&, Value iterable, IteratorValueCallback callback);
}

Some files were not shown because too many files have changed in this diff Show more