From c14173f651f5a50fdb86beb4b79487454a00f3f6 Mon Sep 17 00:00:00 2001 From: ayeteadoe Date: Sat, 28 Jun 2025 21:39:13 -0700 Subject: [PATCH] LibJS: Enable EXPLICIT_SYMBOL_EXPORT --- Libraries/LibJS/AST.h | 166 +++++++------- Libraries/LibJS/Bytecode/BasicBlock.h | 2 +- .../LibJS/Bytecode/CodeGenerationError.h | 2 +- Libraries/LibJS/Bytecode/Executable.h | 2 +- Libraries/LibJS/Bytecode/Generator.h | 6 +- Libraries/LibJS/Bytecode/IdentifierTable.h | 3 +- Libraries/LibJS/Bytecode/Instruction.h | 4 +- Libraries/LibJS/Bytecode/Interpreter.h | 2 +- Libraries/LibJS/Bytecode/Label.h | 3 +- Libraries/LibJS/Bytecode/Op.h | 208 +++++++++--------- Libraries/LibJS/Bytecode/Operand.h | 2 +- Libraries/LibJS/Bytecode/RegexTable.h | 3 +- Libraries/LibJS/Bytecode/Register.h | 3 +- Libraries/LibJS/Bytecode/ScopedOperand.h | 4 +- Libraries/LibJS/Bytecode/StringTable.h | 3 +- Libraries/LibJS/CMakeLists.txt | 2 +- Libraries/LibJS/Console.h | 4 +- Libraries/LibJS/Contrib/Test262/262Object.h | 2 +- Libraries/LibJS/Contrib/Test262/AgentObject.h | 2 +- Libraries/LibJS/Contrib/Test262/IsHTMLDDA.h | 2 +- Libraries/LibJS/CyclicModule.h | 8 +- Libraries/LibJS/Forward.h | 1 + Libraries/LibJS/Heap/Cell.h | 2 +- Libraries/LibJS/Lexer.h | 3 +- Libraries/LibJS/MarkupGenerator.h | 2 +- Libraries/LibJS/Module.h | 6 +- Libraries/LibJS/Parser.cpp | 4 +- Libraries/LibJS/Parser.h | 2 +- Libraries/LibJS/ParserError.h | 2 +- Libraries/LibJS/Print.h | 2 +- Libraries/LibJS/Runtime/AbstractOperations.h | 74 +++---- Libraries/LibJS/Runtime/Accessor.h | 2 +- Libraries/LibJS/Runtime/Agent.h | 4 +- Libraries/LibJS/Runtime/AggregateError.h | 2 +- .../LibJS/Runtime/AggregateErrorConstructor.h | 2 +- .../LibJS/Runtime/AggregateErrorPrototype.h | 2 +- Libraries/LibJS/Runtime/ArgumentsObject.h | 2 +- Libraries/LibJS/Runtime/Array.h | 6 +- Libraries/LibJS/Runtime/ArrayBuffer.h | 18 +- .../LibJS/Runtime/ArrayBufferConstructor.h | 2 +- .../LibJS/Runtime/ArrayBufferPrototype.h | 2 +- Libraries/LibJS/Runtime/ArrayConstructor.h | 2 +- Libraries/LibJS/Runtime/ArrayIterator.h | 2 +- .../LibJS/Runtime/ArrayIteratorPrototype.h | 2 +- Libraries/LibJS/Runtime/ArrayPrototype.h | 4 +- .../LibJS/Runtime/AsyncDisposableStack.h | 2 +- .../Runtime/AsyncDisposableStackConstructor.h | 2 +- .../Runtime/AsyncDisposableStackPrototype.h | 2 +- .../LibJS/Runtime/AsyncFromSyncIterator.h | 2 +- .../Runtime/AsyncFromSyncIteratorPrototype.h | 4 +- .../LibJS/Runtime/AsyncFunctionConstructor.h | 2 +- .../Runtime/AsyncFunctionDriverWrapper.h | 2 +- .../LibJS/Runtime/AsyncFunctionPrototype.h | 2 +- Libraries/LibJS/Runtime/AsyncGenerator.h | 2 +- .../AsyncGeneratorFunctionConstructor.h | 2 +- .../Runtime/AsyncGeneratorFunctionPrototype.h | 2 +- .../LibJS/Runtime/AsyncGeneratorPrototype.h | 2 +- .../LibJS/Runtime/AsyncIteratorPrototype.h | 2 +- Libraries/LibJS/Runtime/AtomicsObject.h | 2 +- Libraries/LibJS/Runtime/BigInt.h | 4 +- Libraries/LibJS/Runtime/BigIntConstructor.h | 2 +- Libraries/LibJS/Runtime/BigIntObject.h | 2 +- Libraries/LibJS/Runtime/BigIntPrototype.h | 2 +- Libraries/LibJS/Runtime/BooleanConstructor.h | 2 +- Libraries/LibJS/Runtime/BooleanObject.h | 2 +- Libraries/LibJS/Runtime/BooleanPrototype.h | 2 +- Libraries/LibJS/Runtime/BoundFunction.h | 2 +- Libraries/LibJS/Runtime/Completion.cpp | 3 +- Libraries/LibJS/Runtime/Completion.h | 6 +- Libraries/LibJS/Runtime/CompletionCell.h | 2 +- Libraries/LibJS/Runtime/ConsoleObject.h | 2 +- .../LibJS/Runtime/ConsoleObjectPrototype.h | 2 +- Libraries/LibJS/Runtime/DataView.h | 8 +- Libraries/LibJS/Runtime/DataViewConstructor.h | 2 +- Libraries/LibJS/Runtime/DataViewPrototype.h | 2 +- Libraries/LibJS/Runtime/Date.h | 64 +++--- Libraries/LibJS/Runtime/DateConstructor.h | 2 +- Libraries/LibJS/Runtime/DatePrototype.h | 12 +- .../LibJS/Runtime/DeclarativeEnvironment.h | 2 +- Libraries/LibJS/Runtime/DisposableStack.h | 2 +- .../Runtime/DisposableStackConstructor.h | 2 +- .../LibJS/Runtime/DisposableStackPrototype.h | 2 +- .../LibJS/Runtime/ECMAScriptFunctionObject.h | 2 +- Libraries/LibJS/Runtime/Environment.h | 2 +- Libraries/LibJS/Runtime/Error.h | 6 +- Libraries/LibJS/Runtime/ErrorConstructor.h | 2 +- Libraries/LibJS/Runtime/ErrorPrototype.h | 2 +- Libraries/LibJS/Runtime/ExecutionContext.h | 2 +- .../LibJS/Runtime/FinalizationRegistry.h | 2 +- .../Runtime/FinalizationRegistryConstructor.h | 2 +- .../Runtime/FinalizationRegistryPrototype.h | 2 +- Libraries/LibJS/Runtime/FunctionConstructor.h | 4 +- Libraries/LibJS/Runtime/FunctionEnvironment.h | 2 +- Libraries/LibJS/Runtime/FunctionObject.h | 2 +- Libraries/LibJS/Runtime/FunctionPrototype.h | 2 +- .../Runtime/GeneratorFunctionConstructor.h | 2 +- .../Runtime/GeneratorFunctionPrototype.h | 2 +- Libraries/LibJS/Runtime/GeneratorObject.h | 2 +- Libraries/LibJS/Runtime/GeneratorPrototype.h | 2 +- Libraries/LibJS/Runtime/GeneratorResult.h | 2 +- Libraries/LibJS/Runtime/GlobalEnvironment.h | 2 +- Libraries/LibJS/Runtime/GlobalObject.h | 4 +- Libraries/LibJS/Runtime/IndexedProperties.h | 10 +- .../LibJS/Runtime/Intl/AbstractOperations.h | 34 +-- Libraries/LibJS/Runtime/Intl/Collator.h | 2 +- .../Runtime/Intl/CollatorCompareFunction.h | 4 +- .../LibJS/Runtime/Intl/CollatorConstructor.h | 2 +- .../LibJS/Runtime/Intl/CollatorPrototype.h | 2 +- Libraries/LibJS/Runtime/Intl/DateTimeFormat.h | 42 ++-- .../Runtime/Intl/DateTimeFormatConstructor.h | 2 +- .../Runtime/Intl/DateTimeFormatFunction.h | 2 +- .../Runtime/Intl/DateTimeFormatPrototype.h | 2 +- Libraries/LibJS/Runtime/Intl/DisplayNames.h | 6 +- .../Runtime/Intl/DisplayNamesConstructor.h | 2 +- .../Runtime/Intl/DisplayNamesPrototype.h | 2 +- Libraries/LibJS/Runtime/Intl/DurationFormat.h | 28 +-- .../Runtime/Intl/DurationFormatConstructor.h | 2 +- .../Runtime/Intl/DurationFormatPrototype.h | 2 +- Libraries/LibJS/Runtime/Intl/Intl.h | 2 +- Libraries/LibJS/Runtime/Intl/IntlObject.h | 4 +- Libraries/LibJS/Runtime/Intl/ListFormat.h | 10 +- .../Runtime/Intl/ListFormatConstructor.h | 2 +- .../LibJS/Runtime/Intl/ListFormatPrototype.h | 2 +- Libraries/LibJS/Runtime/Intl/Locale.h | 22 +- .../LibJS/Runtime/Intl/LocaleConstructor.h | 2 +- .../LibJS/Runtime/Intl/LocalePrototype.h | 2 +- .../LibJS/Runtime/Intl/MathematicalValue.h | 2 +- Libraries/LibJS/Runtime/Intl/NumberFormat.h | 22 +- Libraries/LibJS/Runtime/Intrinsics.h | 4 +- Libraries/LibJS/Runtime/Iterator.h | 36 +-- Libraries/LibJS/Runtime/IteratorConstructor.h | 2 +- Libraries/LibJS/Runtime/IteratorHelper.h | 2 +- .../LibJS/Runtime/IteratorHelperPrototype.h | 2 +- Libraries/LibJS/Runtime/IteratorPrototype.h | 2 +- Libraries/LibJS/Runtime/JSONObject.h | 2 +- Libraries/LibJS/Runtime/JobCallback.h | 6 +- Libraries/LibJS/Runtime/KeyedCollections.h | 2 +- Libraries/LibJS/Runtime/Map.h | 2 +- Libraries/LibJS/Runtime/MapConstructor.h | 2 +- Libraries/LibJS/Runtime/MapIterator.h | 2 +- .../LibJS/Runtime/MapIteratorPrototype.h | 2 +- Libraries/LibJS/Runtime/MapPrototype.h | 2 +- Libraries/LibJS/Runtime/MathObject.h | 2 +- Libraries/LibJS/Runtime/ModuleEnvironment.h | 2 +- .../LibJS/Runtime/ModuleNamespaceObject.h | 2 +- Libraries/LibJS/Runtime/ModuleRequest.h | 2 +- Libraries/LibJS/Runtime/NativeFunction.h | 2 +- Libraries/LibJS/Runtime/NumberConstructor.h | 2 +- Libraries/LibJS/Runtime/NumberObject.h | 2 +- Libraries/LibJS/Runtime/NumberPrototype.h | 2 +- Libraries/LibJS/Runtime/Object.h | 2 +- Libraries/LibJS/Runtime/ObjectConstructor.h | 2 +- Libraries/LibJS/Runtime/ObjectEnvironment.h | 2 +- Libraries/LibJS/Runtime/ObjectPrototype.h | 2 +- Libraries/LibJS/Runtime/PrimitiveString.h | 2 +- Libraries/LibJS/Runtime/PrivateEnvironment.h | 4 +- Libraries/LibJS/Runtime/Promise.h | 2 +- Libraries/LibJS/Runtime/PromiseCapability.h | 4 +- Libraries/LibJS/Runtime/PromiseConstructor.h | 2 +- Libraries/LibJS/Runtime/PromiseJobs.h | 4 +- Libraries/LibJS/Runtime/PromisePrototype.h | 2 +- Libraries/LibJS/Runtime/PromiseReaction.h | 2 +- .../PromiseResolvingElementFunctions.h | 14 +- .../LibJS/Runtime/PromiseResolvingFunction.h | 4 +- Libraries/LibJS/Runtime/PropertyAttributes.h | 2 +- Libraries/LibJS/Runtime/PropertyDescriptor.h | 2 +- Libraries/LibJS/Runtime/PropertyKey.h | 2 +- Libraries/LibJS/Runtime/ProxyConstructor.h | 2 +- Libraries/LibJS/Runtime/ProxyObject.h | 2 +- Libraries/LibJS/Runtime/RawJSONObject.h | 2 +- Libraries/LibJS/Runtime/Realm.h | 2 +- Libraries/LibJS/Runtime/Reference.h | 2 +- Libraries/LibJS/Runtime/ReflectObject.h | 2 +- Libraries/LibJS/Runtime/RegExpConstructor.h | 2 +- .../Runtime/RegExpLegacyStaticProperties.h | 10 +- Libraries/LibJS/Runtime/RegExpObject.h | 12 +- Libraries/LibJS/Runtime/RegExpPrototype.h | 6 +- .../LibJS/Runtime/RegExpStringIterator.h | 2 +- .../Runtime/RegExpStringIteratorPrototype.h | 2 +- Libraries/LibJS/Runtime/Set.h | 6 +- Libraries/LibJS/Runtime/SetConstructor.h | 2 +- Libraries/LibJS/Runtime/SetIterator.h | 2 +- .../LibJS/Runtime/SetIteratorPrototype.h | 2 +- Libraries/LibJS/Runtime/SetPrototype.h | 2 +- Libraries/LibJS/Runtime/ShadowRealm.h | 2 +- .../LibJS/Runtime/ShadowRealmConstructor.h | 2 +- .../LibJS/Runtime/ShadowRealmPrototype.h | 2 +- Libraries/LibJS/Runtime/Shape.h | 4 +- .../Runtime/SharedArrayBufferConstructor.h | 2 +- .../Runtime/SharedArrayBufferPrototype.h | 2 +- Libraries/LibJS/Runtime/StringConstructor.h | 2 +- Libraries/LibJS/Runtime/StringIterator.h | 2 +- .../LibJS/Runtime/StringIteratorPrototype.h | 2 +- Libraries/LibJS/Runtime/StringObject.h | 2 +- Libraries/LibJS/Runtime/StringPrototype.h | 10 +- Libraries/LibJS/Runtime/SuppressedError.h | 2 +- .../Runtime/SuppressedErrorConstructor.h | 2 +- .../LibJS/Runtime/SuppressedErrorPrototype.h | 2 +- Libraries/LibJS/Runtime/Symbol.h | 2 +- Libraries/LibJS/Runtime/SymbolConstructor.h | 2 +- Libraries/LibJS/Runtime/SymbolObject.h | 2 +- Libraries/LibJS/Runtime/SymbolPrototype.h | 2 +- .../Runtime/Temporal/AbstractOperations.h | 78 +++---- Libraries/LibJS/Runtime/Temporal/Calendar.h | 48 ++-- .../LibJS/Runtime/Temporal/DateEquations.h | 21 +- Libraries/LibJS/Runtime/Temporal/Duration.h | 74 +++---- .../Runtime/Temporal/DurationConstructor.h | 2 +- .../Runtime/Temporal/DurationPrototype.h | 2 +- Libraries/LibJS/Runtime/Temporal/ISO8601.h | 4 +- Libraries/LibJS/Runtime/Temporal/Instant.h | 22 +- .../Runtime/Temporal/InstantConstructor.h | 2 +- .../LibJS/Runtime/Temporal/InstantPrototype.h | 2 +- Libraries/LibJS/Runtime/Temporal/Now.h | 8 +- Libraries/LibJS/Runtime/Temporal/PlainDate.h | 28 +-- .../Runtime/Temporal/PlainDateConstructor.h | 2 +- .../Runtime/Temporal/PlainDatePrototype.h | 2 +- .../LibJS/Runtime/Temporal/PlainDateTime.h | 32 +-- .../Temporal/PlainDateTimeConstructor.h | 2 +- .../Runtime/Temporal/PlainDateTimePrototype.h | 2 +- .../LibJS/Runtime/Temporal/PlainMonthDay.h | 8 +- .../Temporal/PlainMonthDayConstructor.h | 2 +- .../Runtime/Temporal/PlainMonthDayPrototype.h | 2 +- Libraries/LibJS/Runtime/Temporal/PlainTime.h | 38 ++-- .../Runtime/Temporal/PlainTimeConstructor.h | 2 +- .../Runtime/Temporal/PlainTimePrototype.h | 2 +- .../LibJS/Runtime/Temporal/PlainYearMonth.h | 16 +- .../Temporal/PlainYearMonthConstructor.h | 2 +- .../Temporal/PlainYearMonthPrototype.h | 2 +- Libraries/LibJS/Runtime/Temporal/Temporal.h | 2 +- Libraries/LibJS/Runtime/Temporal/TimeZone.h | 36 +-- .../LibJS/Runtime/Temporal/ZonedDateTime.h | 22 +- .../Temporal/ZonedDateTimeConstructor.h | 2 +- .../Runtime/Temporal/ZonedDateTimePrototype.h | 2 +- Libraries/LibJS/Runtime/TypedArray.h | 26 +-- .../LibJS/Runtime/TypedArrayConstructor.h | 2 +- Libraries/LibJS/Runtime/TypedArrayPrototype.h | 2 +- Libraries/LibJS/Runtime/Uint8Array.h | 14 +- Libraries/LibJS/Runtime/Utf16String.h | 4 +- Libraries/LibJS/Runtime/VM.h | 2 +- Libraries/LibJS/Runtime/Value.h | 84 +++---- Libraries/LibJS/Runtime/WeakMap.h | 2 +- Libraries/LibJS/Runtime/WeakMapConstructor.h | 2 +- Libraries/LibJS/Runtime/WeakMapPrototype.h | 2 +- Libraries/LibJS/Runtime/WeakRef.h | 2 +- Libraries/LibJS/Runtime/WeakRefConstructor.h | 2 +- Libraries/LibJS/Runtime/WeakRefPrototype.h | 2 +- Libraries/LibJS/Runtime/WeakSet.h | 2 +- Libraries/LibJS/Runtime/WeakSetConstructor.h | 2 +- Libraries/LibJS/Runtime/WeakSetPrototype.h | 2 +- .../Runtime/WrapForValidIteratorPrototype.h | 2 +- Libraries/LibJS/Runtime/WrappedFunction.h | 2 +- Libraries/LibJS/Script.h | 2 +- Libraries/LibJS/SourceCode.h | 2 +- Libraries/LibJS/SourceRange.h | 2 +- Libraries/LibJS/SourceTextModule.h | 2 +- Libraries/LibJS/SyntaxHighlighter.h | 3 +- Libraries/LibJS/SyntheticModule.h | 4 +- Libraries/LibJS/Token.h | 3 +- 258 files changed, 952 insertions(+), 941 deletions(-) diff --git a/Libraries/LibJS/AST.h b/Libraries/LibJS/AST.h index 450351644c7..2c0b878a31a 100644 --- a/Libraries/LibJS/AST.h +++ b/Libraries/LibJS/AST.h @@ -51,7 +51,7 @@ create_ast_node(SourceRange range, Args&&... args) return adopt_ref(*new T(move(range), forward(args)...)); } -class ASTNode : public RefCounted { +class JS_API ASTNode : public RefCounted { public: virtual ~ASTNode() = default; @@ -167,7 +167,7 @@ enum class DeclarationKind { Const, }; -class Statement : public ASTNode { +class JS_API Statement : public ASTNode { public: explicit Statement(SourceRange source_range) : ASTNode(move(source_range)) @@ -182,7 +182,7 @@ private: }; // 14.13 Labelled Statements, https://tc39.es/ecma262/#sec-labelled-statements -class LabelledStatement final : public Statement { +class JS_API LabelledStatement final : public Statement { public: LabelledStatement(SourceRange source_range, FlyString label, NonnullRefPtr labelled_item) : Statement(move(source_range)) @@ -206,7 +206,7 @@ private: NonnullRefPtr m_labelled_item; }; -class LabelableStatement : public Statement { +class JS_API LabelableStatement : public Statement { public: using Statement::Statement; @@ -217,7 +217,7 @@ protected: Vector m_labels; }; -class IterationStatement : public Statement { +class JS_API IterationStatement : public Statement { public: using Statement::Statement; @@ -227,7 +227,7 @@ private: virtual bool is_iteration_statement() const final { return true; } }; -class EmptyStatement final : public Statement { +class JS_API EmptyStatement final : public Statement { public: explicit EmptyStatement(SourceRange source_range) : Statement(move(source_range)) @@ -236,7 +236,7 @@ public: virtual Bytecode::CodeGenerationErrorOr> generate_bytecode(Bytecode::Generator&, Optional preferred_dst = {}) const override; }; -class ErrorStatement final : public Statement { +class JS_API ErrorStatement final : public Statement { public: explicit ErrorStatement(SourceRange source_range) : Statement(move(source_range)) @@ -244,7 +244,7 @@ public: } }; -class ExpressionStatement final : public Statement { +class JS_API ExpressionStatement final : public Statement { public: ExpressionStatement(SourceRange source_range, NonnullRefPtr expression) : Statement(move(source_range)) @@ -292,7 +292,7 @@ public: } }; -class ScopeNode : public Statement { +class JS_API ScopeNode : public Statement { public: template T& append(SourceRange range, Args&&... args) @@ -368,7 +368,7 @@ private: }; // ImportEntry Record, https://tc39.es/ecma262/#table-importentry-record-fields -struct ImportEntry { +struct JS_API ImportEntry { Optional import_name; // [[ImportName]]: stored string if Optional is not empty, NAMESPACE-OBJECT otherwise FlyString local_name; // [[LocalName]] @@ -391,7 +391,7 @@ private: ModuleRequest* m_module_request = nullptr; // [[ModuleRequest]] }; -class ImportStatement final : public Statement { +class JS_API ImportStatement final : public Statement { public: explicit ImportStatement(SourceRange source_range, ModuleRequest from_module, Vector entries = {}) : Statement(move(source_range)) @@ -482,7 +482,7 @@ public: } }; -class ExportStatement final : public Statement { +class JS_API ExportStatement final : public Statement { public: static FlyString local_name_for_default; @@ -528,7 +528,7 @@ private: Optional m_module_request; }; -class Program final : public ScopeNode { +class JS_API Program final : public ScopeNode { public: enum class Type { Script, @@ -580,7 +580,7 @@ private: bool m_has_top_level_await { false }; }; -class BlockStatement final : public ScopeNode { +class JS_API BlockStatement final : public ScopeNode { public: explicit BlockStatement(SourceRange source_range) : ScopeNode(move(source_range)) @@ -591,7 +591,7 @@ private: virtual bool is_block_statement() const override { return true; } }; -class FunctionBody final : public ScopeNode { +class JS_API FunctionBody final : public ScopeNode { public: explicit FunctionBody(SourceRange source_range) : ScopeNode(move(source_range)) @@ -608,7 +608,7 @@ private: bool m_in_strict_mode { false }; }; -class Expression : public ASTNode { +class JS_API Expression : public ASTNode { public: explicit Expression(SourceRange source_range) : ASTNode(move(source_range)) @@ -616,7 +616,7 @@ public: } }; -class Declaration : public Statement { +class JS_API Declaration : public Statement { public: explicit Declaration(SourceRange source_range) : Statement(move(source_range)) @@ -631,7 +631,7 @@ public: virtual bool is_lexical_declaration() const { return false; } }; -class ErrorDeclaration final : public Declaration { +class JS_API ErrorDeclaration final : public Declaration { public: explicit ErrorDeclaration(SourceRange source_range) : Declaration(move(source_range)) @@ -644,7 +644,7 @@ public: } }; -struct BindingPattern : RefCounted { +struct JS_API BindingPattern : RefCounted { // This covers both BindingProperty and BindingElement, hence the more generic name struct BindingEntry { // If this entry represents a BindingElement, then name will be Empty @@ -673,7 +673,7 @@ struct BindingPattern : RefCounted { Kind kind { Kind::Object }; }; -class Identifier final : public Expression { +class JS_API Identifier final : public Expression { public: explicit Identifier(SourceRange source_range, FlyString string) : Expression(move(source_range)) @@ -777,7 +777,7 @@ struct FunctionParsingInsights { bool might_need_arguments_object { false }; }; -class FunctionNode { +class JS_API FunctionNode { public: FlyString name() const { return m_name ? m_name->string() : ""_fly_string; } RefPtr name_identifier() const { return m_name; } @@ -824,7 +824,7 @@ private: mutable RefPtr m_shared_data; }; -class FunctionDeclaration final +class JS_API FunctionDeclaration final : public Declaration , public FunctionNode { public: @@ -854,7 +854,7 @@ private: bool m_is_hoisted { false }; }; -class FunctionExpression final +class JS_API FunctionExpression final : public Expression , public FunctionNode { public: @@ -881,7 +881,7 @@ private: virtual bool is_function_expression() const override { return true; } }; -class ErrorExpression final : public Expression { +class JS_API ErrorExpression final : public Expression { public: explicit ErrorExpression(SourceRange source_range) : Expression(move(source_range)) @@ -909,7 +909,7 @@ private: bool m_is_yield_from { false }; }; -class AwaitExpression final : public Expression { +class JS_API AwaitExpression final : public Expression { public: explicit AwaitExpression(SourceRange source_range, NonnullRefPtr argument) : Expression(move(source_range)) @@ -924,7 +924,7 @@ private: NonnullRefPtr m_argument; }; -class ReturnStatement final : public Statement { +class JS_API ReturnStatement final : public Statement { public: explicit ReturnStatement(SourceRange source_range, RefPtr argument) : Statement(move(source_range)) @@ -941,7 +941,7 @@ private: RefPtr m_argument; }; -class IfStatement final : public Statement { +class JS_API IfStatement final : public Statement { public: IfStatement(SourceRange source_range, NonnullRefPtr predicate, NonnullRefPtr consequent, RefPtr alternate) : Statement(move(source_range)) @@ -964,7 +964,7 @@ private: RefPtr m_alternate; }; -class WhileStatement final : public IterationStatement { +class JS_API WhileStatement final : public IterationStatement { public: WhileStatement(SourceRange source_range, NonnullRefPtr test, NonnullRefPtr body) : IterationStatement(move(source_range)) @@ -985,7 +985,7 @@ private: NonnullRefPtr m_body; }; -class DoWhileStatement final : public IterationStatement { +class JS_API DoWhileStatement final : public IterationStatement { public: DoWhileStatement(SourceRange source_range, NonnullRefPtr test, NonnullRefPtr body) : IterationStatement(move(source_range)) @@ -1006,7 +1006,7 @@ private: NonnullRefPtr m_body; }; -class WithStatement final : public Statement { +class JS_API WithStatement final : public Statement { public: WithStatement(SourceRange source_range, NonnullRefPtr object, NonnullRefPtr body) : Statement(move(source_range)) @@ -1026,7 +1026,7 @@ private: NonnullRefPtr m_body; }; -class ForStatement final : public IterationStatement { +class JS_API ForStatement final : public IterationStatement { public: ForStatement(SourceRange source_range, RefPtr init, RefPtr test, RefPtr update, NonnullRefPtr body) : IterationStatement(move(source_range)) @@ -1053,7 +1053,7 @@ private: NonnullRefPtr m_body; }; -class ForInStatement final : public IterationStatement { +class JS_API ForInStatement final : public IterationStatement { public: ForInStatement(SourceRange source_range, Variant, NonnullRefPtr> lhs, NonnullRefPtr rhs, NonnullRefPtr body) : IterationStatement(move(source_range)) @@ -1077,7 +1077,7 @@ private: NonnullRefPtr m_body; }; -class ForOfStatement final : public IterationStatement { +class JS_API ForOfStatement final : public IterationStatement { public: ForOfStatement(SourceRange source_range, Variant, NonnullRefPtr> lhs, NonnullRefPtr rhs, NonnullRefPtr body) : IterationStatement(move(source_range)) @@ -1101,7 +1101,7 @@ private: NonnullRefPtr m_body; }; -class ForAwaitOfStatement final : public IterationStatement { +class JS_API ForAwaitOfStatement final : public IterationStatement { public: ForAwaitOfStatement(SourceRange source_range, Variant, NonnullRefPtr> lhs, NonnullRefPtr rhs, NonnullRefPtr body) : IterationStatement(move(source_range)) @@ -1146,7 +1146,7 @@ enum class BinaryOp { InstanceOf, }; -class BinaryExpression final : public Expression { +class JS_API BinaryExpression final : public Expression { public: BinaryExpression(SourceRange source_range, BinaryOp op, NonnullRefPtr lhs, NonnullRefPtr rhs) : Expression(move(source_range)) @@ -1171,7 +1171,7 @@ enum class LogicalOp { NullishCoalescing, }; -class LogicalExpression final : public Expression { +class JS_API LogicalExpression final : public Expression { public: LogicalExpression(SourceRange source_range, LogicalOp op, NonnullRefPtr lhs, NonnullRefPtr rhs) : Expression(move(source_range)) @@ -1200,7 +1200,7 @@ enum class UnaryOp { Delete, }; -class UnaryExpression final : public Expression { +class JS_API UnaryExpression final : public Expression { public: UnaryExpression(SourceRange source_range, UnaryOp op, NonnullRefPtr lhs) : Expression(move(source_range)) @@ -1217,7 +1217,7 @@ private: NonnullRefPtr m_lhs; }; -class SequenceExpression final : public Expression { +class JS_API SequenceExpression final : public Expression { public: SequenceExpression(SourceRange source_range, Vector> expressions) : Expression(move(source_range)) @@ -1233,7 +1233,7 @@ private: Vector> m_expressions; }; -class PrimitiveLiteral : public Expression { +class JS_API PrimitiveLiteral : public Expression { public: virtual Value value() const = 0; @@ -1247,7 +1247,7 @@ private: virtual bool is_primitive_literal() const override { return true; } }; -class BooleanLiteral final : public PrimitiveLiteral { +class JS_API BooleanLiteral final : public PrimitiveLiteral { public: explicit BooleanLiteral(SourceRange source_range, bool value) : PrimitiveLiteral(move(source_range)) @@ -1266,7 +1266,7 @@ private: bool m_value { false }; }; -class NumericLiteral final : public PrimitiveLiteral { +class JS_API NumericLiteral final : public PrimitiveLiteral { public: explicit NumericLiteral(SourceRange source_range, double value) : PrimitiveLiteral(move(source_range)) @@ -1285,7 +1285,7 @@ private: Value m_value; }; -class BigIntLiteral final : public Expression { +class JS_API BigIntLiteral final : public Expression { public: explicit BigIntLiteral(SourceRange source_range, ByteString value) : Expression(move(source_range)) @@ -1300,7 +1300,7 @@ private: ByteString m_value; }; -class StringLiteral final : public Expression { +class JS_API StringLiteral final : public Expression { public: explicit StringLiteral(SourceRange source_range, String value) : Expression(move(source_range)) @@ -1319,7 +1319,7 @@ private: String m_value; }; -class NullLiteral final : public PrimitiveLiteral { +class JS_API NullLiteral final : public PrimitiveLiteral { public: explicit NullLiteral(SourceRange source_range) : PrimitiveLiteral(move(source_range)) @@ -1335,7 +1335,7 @@ private: virtual bool is_null_literal() const override { return true; } }; -class RegExpLiteral final : public Expression { +class JS_API RegExpLiteral final : public Expression { public: RegExpLiteral(SourceRange source_range, regex::Parser::Result parsed_regex, String parsed_pattern, regex::RegexOptions parsed_flags, String pattern, String flags) : Expression(move(source_range)) @@ -1364,7 +1364,7 @@ private: String m_flags; }; -class PrivateIdentifier final : public Expression { +class JS_API PrivateIdentifier final : public Expression { public: explicit PrivateIdentifier(SourceRange source_range, FlyString string) : Expression(move(source_range)) @@ -1382,7 +1382,7 @@ private: FlyString m_string; }; -class ClassElement : public ASTNode { +class JS_API ClassElement : public ASTNode { public: ClassElement(SourceRange source_range, bool is_static) : ASTNode(move(source_range)) @@ -1409,7 +1409,7 @@ private: bool m_is_static { false }; }; -class ClassMethod final : public ClassElement { +class JS_API ClassMethod final : public ClassElement { public: enum class Kind { Method, @@ -1440,7 +1440,7 @@ private: Kind m_kind; }; -class ClassField final : public ClassElement { +class JS_API ClassField final : public ClassElement { public: ClassField(SourceRange source_range, NonnullRefPtr key, RefPtr init, bool is_static) : ClassElement(move(source_range), is_static) @@ -1464,7 +1464,7 @@ private: RefPtr m_initializer; }; -class StaticInitializer final : public ClassElement { +class JS_API StaticInitializer final : public ClassElement { public: StaticInitializer(SourceRange source_range, NonnullRefPtr function_body) : ClassElement(move(source_range), true) @@ -1481,7 +1481,7 @@ private: NonnullRefPtr m_function_body; }; -class SuperExpression final : public Expression { +class JS_API SuperExpression final : public Expression { public: explicit SuperExpression(SourceRange source_range) : Expression(move(source_range)) @@ -1494,7 +1494,7 @@ public: virtual bool is_super_expression() const override { return true; } }; -class ClassExpression final : public Expression { +class JS_API ClassExpression final : public Expression { public: ClassExpression(SourceRange source_range, RefPtr name, ByteString source_text, RefPtr constructor, RefPtr super_class, Vector> elements) : Expression(move(source_range)) @@ -1531,7 +1531,7 @@ private: Vector> m_elements; }; -class ClassDeclaration final : public Declaration { +class JS_API ClassDeclaration final : public Declaration { public: ClassDeclaration(SourceRange source_range, NonnullRefPtr class_expression) : Declaration(move(source_range)) @@ -1558,7 +1558,7 @@ private: // We use this class to mimic Initializer : = AssignmentExpression of // 10.2.1.3 Runtime Semantics: EvaluateBody, https://tc39.es/ecma262/#sec-runtime-semantics-evaluatebody -class ClassFieldInitializerStatement final : public Statement { +class JS_API ClassFieldInitializerStatement final : public Statement { public: ClassFieldInitializerStatement(SourceRange source_range, NonnullRefPtr expression, FlyString field_name) : Statement(move(source_range)) @@ -1575,7 +1575,7 @@ private: FlyString m_class_field_identifier_name; // [[ClassFieldIdentifierName]] }; -class SpreadExpression final : public Expression { +class JS_API SpreadExpression final : public Expression { public: explicit SpreadExpression(SourceRange source_range, NonnullRefPtr target) : Expression(move(source_range)) @@ -1592,7 +1592,7 @@ private: NonnullRefPtr m_target; }; -class ThisExpression final : public Expression { +class JS_API ThisExpression final : public Expression { public: explicit ThisExpression(SourceRange source_range) : Expression(move(source_range)) @@ -1617,7 +1617,7 @@ enum InsideParenthesesEnum { NotInsideParentheses, }; -class CallExpression : public ASTNodeWithTailArray { +class JS_API CallExpression : public ASTNodeWithTailArray { friend class ASTNodeWithTailArray; InvocationStyleEnum m_invocation_style; @@ -1655,7 +1655,7 @@ protected: NonnullRefPtr m_callee; }; -class NewExpression final : public CallExpression { +class JS_API NewExpression final : public CallExpression { friend class ASTNodeWithTailArray; public: @@ -1672,7 +1672,7 @@ private: static_assert(sizeof(NewExpression) == sizeof(CallExpression), "Adding members to NewExpression will break CallExpression memory layout"); -class SuperCall final : public Expression { +class JS_API SuperCall final : public Expression { public: // This is here to be able to make a constructor like // constructor(...args) { super(...args); } which does not use @@iterator of %Array.prototype%. @@ -1723,7 +1723,7 @@ enum class AssignmentOp { NullishAssignment, }; -class AssignmentExpression final : public Expression { +class JS_API AssignmentExpression final : public Expression { public: AssignmentExpression(SourceRange source_range, AssignmentOp op, NonnullRefPtr lhs, NonnullRefPtr rhs) : Expression(move(source_range)) @@ -1755,7 +1755,7 @@ enum class UpdateOp { Decrement, }; -class UpdateExpression final : public Expression { +class JS_API UpdateExpression final : public Expression { public: UpdateExpression(SourceRange source_range, UpdateOp op, NonnullRefPtr argument, bool prefixed = false) : Expression(move(source_range)) @@ -1776,7 +1776,7 @@ private: bool m_prefixed; }; -class VariableDeclarator final : public ASTNode { +class JS_API VariableDeclarator final : public ASTNode { public: VariableDeclarator(SourceRange source_range, NonnullRefPtr id) : ASTNode(move(source_range)) @@ -1808,7 +1808,7 @@ private: RefPtr m_init; }; -class VariableDeclaration final : public Declaration { +class JS_API VariableDeclaration final : public Declaration { public: VariableDeclaration(SourceRange source_range, DeclarationKind declaration_kind, Vector> declarations) : Declaration(move(source_range)) @@ -1837,7 +1837,7 @@ private: Vector> m_declarations; }; -class UsingDeclaration final : public Declaration { +class JS_API UsingDeclaration final : public Declaration { public: UsingDeclaration(SourceRange source_range, Vector> declarations) : Declaration(move(source_range)) @@ -1859,7 +1859,7 @@ private: Vector> m_declarations; }; -class ObjectProperty final : public ASTNode { +class JS_API ObjectProperty final : public ASTNode { public: enum class Type : u8 { KeyValue, @@ -1897,7 +1897,7 @@ private: RefPtr m_value; }; -class ObjectExpression final : public Expression { +class JS_API ObjectExpression final : public Expression { public: explicit ObjectExpression(SourceRange source_range, Vector> properties = {}) : Expression(move(source_range)) @@ -1914,7 +1914,7 @@ private: Vector> m_properties; }; -class ArrayExpression final : public Expression { +class JS_API ArrayExpression final : public Expression { public: ArrayExpression(SourceRange source_range, Vector> elements) : Expression(move(source_range)) @@ -1933,7 +1933,7 @@ private: Vector> m_elements; }; -class TemplateLiteral final : public Expression { +class JS_API TemplateLiteral final : public Expression { public: TemplateLiteral(SourceRange source_range, Vector> expressions) : Expression(move(source_range)) @@ -1959,7 +1959,7 @@ private: Vector> const m_raw_strings; }; -class TaggedTemplateLiteral final : public Expression { +class JS_API TaggedTemplateLiteral final : public Expression { public: TaggedTemplateLiteral(SourceRange source_range, NonnullRefPtr tag, NonnullRefPtr template_literal) : Expression(move(source_range)) @@ -1976,7 +1976,7 @@ private: NonnullRefPtr const m_template_literal; }; -class MemberExpression final : public Expression { +class JS_API MemberExpression final : public Expression { public: MemberExpression(SourceRange source_range, NonnullRefPtr object, NonnullRefPtr property, bool computed = false) : Expression(move(source_range)) @@ -2005,7 +2005,7 @@ private: NonnullRefPtr m_property; }; -class OptionalChain final : public Expression { +class JS_API OptionalChain final : public Expression { public: enum class Mode { Optional, @@ -2051,7 +2051,7 @@ private: Vector m_references; }; -class MetaProperty final : public Expression { +class JS_API MetaProperty final : public Expression { public: enum class Type { NewTarget, @@ -2071,7 +2071,7 @@ private: Type m_type; }; -class ImportCall final : public Expression { +class JS_API ImportCall final : public Expression { public: ImportCall(SourceRange source_range, NonnullRefPtr specifier, RefPtr options) : Expression(move(source_range)) @@ -2090,7 +2090,7 @@ private: RefPtr m_options; }; -class ConditionalExpression final : public Expression { +class JS_API ConditionalExpression final : public Expression { public: ConditionalExpression(SourceRange source_range, NonnullRefPtr test, NonnullRefPtr consequent, NonnullRefPtr alternate) : Expression(move(source_range)) @@ -2109,7 +2109,7 @@ private: NonnullRefPtr m_alternate; }; -class CatchClause final : public ASTNode { +class JS_API CatchClause final : public ASTNode { public: CatchClause(SourceRange source_range, NonnullRefPtr parameter, NonnullRefPtr body) : ASTNode(move(source_range)) @@ -2142,7 +2142,7 @@ private: NonnullRefPtr m_body; }; -class TryStatement final : public Statement { +class JS_API TryStatement final : public Statement { public: TryStatement(SourceRange source_range, NonnullRefPtr block, RefPtr handler, RefPtr finalizer) : Statement(move(source_range)) @@ -2165,7 +2165,7 @@ private: RefPtr m_finalizer; }; -class ThrowStatement final : public Statement { +class JS_API ThrowStatement final : public Statement { public: explicit ThrowStatement(SourceRange source_range, NonnullRefPtr argument) : Statement(move(source_range)) @@ -2182,7 +2182,7 @@ private: NonnullRefPtr m_argument; }; -class SwitchCase final : public ScopeNode { +class JS_API SwitchCase final : public ScopeNode { public: SwitchCase(SourceRange source_range, RefPtr test) : ScopeNode(move(source_range)) @@ -2198,7 +2198,7 @@ private: RefPtr m_test; }; -class SwitchStatement final : public ScopeNode { +class JS_API SwitchStatement final : public ScopeNode { public: SwitchStatement(SourceRange source_range, NonnullRefPtr discriminant) : ScopeNode(move(source_range)) @@ -2217,7 +2217,7 @@ private: Vector> m_cases; }; -class BreakStatement final : public Statement { +class JS_API BreakStatement final : public Statement { public: BreakStatement(SourceRange source_range, Optional target_label) : Statement(move(source_range)) @@ -2232,7 +2232,7 @@ private: Optional m_target_label; }; -class ContinueStatement final : public Statement { +class JS_API ContinueStatement final : public Statement { public: ContinueStatement(SourceRange source_range, Optional target_label) : Statement(move(source_range)) @@ -2248,7 +2248,7 @@ private: Optional m_target_label; }; -class DebuggerStatement final : public Statement { +class JS_API DebuggerStatement final : public Statement { public: explicit DebuggerStatement(SourceRange source_range) : Statement(move(source_range)) @@ -2258,7 +2258,7 @@ public: virtual Bytecode::CodeGenerationErrorOr> generate_bytecode(Bytecode::Generator&, Optional preferred_dst = {}) const override; }; -class SyntheticReferenceExpression final : public Expression { +class JS_API SyntheticReferenceExpression final : public Expression { public: explicit SyntheticReferenceExpression(SourceRange source_range, Reference reference, Value value) : Expression(move(source_range)) diff --git a/Libraries/LibJS/Bytecode/BasicBlock.h b/Libraries/LibJS/Bytecode/BasicBlock.h index d9e0ff4bf87..4315aa65ee9 100644 --- a/Libraries/LibJS/Bytecode/BasicBlock.h +++ b/Libraries/LibJS/Bytecode/BasicBlock.h @@ -22,7 +22,7 @@ struct UnwindInfo { bool handler_called { false }; }; -class BasicBlock { +class JS_API BasicBlock { AK_MAKE_NONCOPYABLE(BasicBlock); public: diff --git a/Libraries/LibJS/Bytecode/CodeGenerationError.h b/Libraries/LibJS/Bytecode/CodeGenerationError.h index 5e23d71e09c..1f6e77080c6 100644 --- a/Libraries/LibJS/Bytecode/CodeGenerationError.h +++ b/Libraries/LibJS/Bytecode/CodeGenerationError.h @@ -13,7 +13,7 @@ namespace JS::Bytecode { -struct CodeGenerationError { +struct JS_API CodeGenerationError { ASTNode const* failing_node { nullptr }; StringView reason_literal; diff --git a/Libraries/LibJS/Bytecode/Executable.h b/Libraries/LibJS/Bytecode/Executable.h index ecffacf1df4..327f5ae5526 100644 --- a/Libraries/LibJS/Bytecode/Executable.h +++ b/Libraries/LibJS/Bytecode/Executable.h @@ -47,7 +47,7 @@ struct SourceRecord { u32 source_end_offset {}; }; -class Executable final : public Cell { +class JS_API Executable final : public Cell { GC_CELL(Executable, Cell); GC_DECLARE_ALLOCATOR(Executable); diff --git a/Libraries/LibJS/Bytecode/Generator.h b/Libraries/LibJS/Bytecode/Generator.h index e0cb070ac7d..a0d37b5daa6 100644 --- a/Libraries/LibJS/Bytecode/Generator.h +++ b/Libraries/LibJS/Bytecode/Generator.h @@ -23,7 +23,7 @@ namespace JS::Bytecode { -class Generator { +class JS_API Generator { public: VM& vm() { return m_vm; } @@ -55,7 +55,7 @@ public: [[nodiscard]] bool is_local_initialized(Identifier::Local const&) const; [[nodiscard]] bool is_local_lexically_declared(Identifier::Local const& local) const; - class SourceLocationScope { + class JS_API SourceLocationScope { public: SourceLocationScope(Generator&, ASTNode const& node); ~SourceLocationScope(); @@ -65,7 +65,7 @@ public: ASTNode const* m_previous_node { nullptr }; }; - class UnwindContext { + class JS_API UnwindContext { public: UnwindContext(Generator&, Optional