mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:27:45 +00:00
LibJS: Let Completion::update_empty() take an Optional<Value>
It also needs to be able to take what the spec calls 'empty', which is an Optional<Value> in this case (*not* an empty JS::Value). The common use case is updating a completion with another completion, that may also have an empty [[Value]] slot.
This commit is contained in:
parent
13777d4886
commit
7565b1fda8
1 changed files with 2 additions and 2 deletions
|
@ -80,7 +80,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6.2.3.4 UpdateEmpty ( completionRecord, value ), https://tc39.es/ecma262/#sec-updateempty
|
// 6.2.3.4 UpdateEmpty ( completionRecord, value ), https://tc39.es/ecma262/#sec-updateempty
|
||||||
Completion update_empty(Value value) const
|
Completion update_empty(Optional<Value> value) const
|
||||||
{
|
{
|
||||||
// 1. Assert: If completionRecord.[[Type]] is either return or throw, then completionRecord.[[Value]] is not empty.
|
// 1. Assert: If completionRecord.[[Type]] is either return or throw, then completionRecord.[[Value]] is not empty.
|
||||||
if (m_type == Type::Return || m_type == Type::Throw)
|
if (m_type == Type::Return || m_type == Type::Throw)
|
||||||
|
@ -91,7 +91,7 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
// 3. Return Completion { [[Type]]: completionRecord.[[Type]], [[Value]]: value, [[Target]]: completionRecord.[[Target]] }.
|
// 3. Return Completion { [[Type]]: completionRecord.[[Type]], [[Value]]: value, [[Target]]: completionRecord.[[Target]] }.
|
||||||
return { m_type, value, m_target };
|
return { m_type, move(value), m_target };
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue