mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibJS: Convert GeneratorObject's [[GeneratorBrand]] to a StringView
This optional parameter is not currently set by any caller, but will be for the Iterator Helpers proposal. In all specs, this parameter is a static string, so we can just use a StringView rather than allocating a (Deprecated)String on each invocation. This also changes this optional parameter to be passed by const-ref, as it does not need to be copied.
This commit is contained in:
parent
f8cb4f9686
commit
60adeb11c9
Notes:
sideshowbarker
2024-07-18 05:01:22 +09:00
Author: https://github.com/trflynn89
Commit: 60adeb11c9
Pull-request: https://github.com/SerenityOS/serenity/pull/20057
2 changed files with 8 additions and 8 deletions
|
@ -20,8 +20,8 @@ public:
|
|||
virtual ~GeneratorObject() override = default;
|
||||
void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
ThrowCompletionOr<Value> resume(VM&, Value value, Optional<DeprecatedString> generator_brand);
|
||||
ThrowCompletionOr<Value> resume_abrupt(VM&, JS::Completion abrupt_completion, Optional<DeprecatedString> generator_brand);
|
||||
ThrowCompletionOr<Value> resume(VM&, Value value, Optional<StringView> const& generator_brand);
|
||||
ThrowCompletionOr<Value> resume_abrupt(VM&, JS::Completion abrupt_completion, Optional<StringView> const& generator_brand);
|
||||
|
||||
private:
|
||||
GeneratorObject(Realm&, Object& prototype, ExecutionContext);
|
||||
|
@ -33,7 +33,7 @@ private:
|
|||
Completed,
|
||||
};
|
||||
|
||||
ThrowCompletionOr<GeneratorState> validate(VM&, Optional<DeprecatedString> const& generator_brand);
|
||||
ThrowCompletionOr<GeneratorState> validate(VM&, Optional<StringView> const& generator_brand);
|
||||
ThrowCompletionOr<Value> execute(VM&, JS::Completion const& completion);
|
||||
|
||||
ExecutionContext m_execution_context;
|
||||
|
@ -41,7 +41,7 @@ private:
|
|||
Value m_previous_value;
|
||||
Optional<Bytecode::RegisterWindow> m_frame;
|
||||
GeneratorState m_generator_state { GeneratorState::SuspendedStart };
|
||||
Optional<DeprecatedString> m_generator_brand;
|
||||
Optional<StringView> m_generator_brand;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue