|
@@ -63,10 +63,9 @@ public:
|
|
Throw,
|
|
Throw,
|
|
};
|
|
};
|
|
|
|
|
|
- ALWAYS_INLINE Completion(Type type, Optional<Value> value, Optional<DeprecatedFlyString> target)
|
|
|
|
|
|
+ ALWAYS_INLINE Completion(Type type, Optional<Value> value)
|
|
: m_type(type)
|
|
: m_type(type)
|
|
, m_value(move(value))
|
|
, m_value(move(value))
|
|
- , m_target(move(target))
|
|
|
|
{
|
|
{
|
|
VERIFY(type != Type::Empty);
|
|
VERIFY(type != Type::Empty);
|
|
if (m_value.has_value())
|
|
if (m_value.has_value())
|
|
@@ -78,12 +77,12 @@ public:
|
|
// 5.2.3.1 Implicit Completion Values, https://tc39.es/ecma262/#sec-implicit-completion-values
|
|
// 5.2.3.1 Implicit Completion Values, https://tc39.es/ecma262/#sec-implicit-completion-values
|
|
// Not `explicit` on purpose.
|
|
// Not `explicit` on purpose.
|
|
ALWAYS_INLINE Completion(Value value)
|
|
ALWAYS_INLINE Completion(Value value)
|
|
- : Completion(Type::Normal, value, {})
|
|
|
|
|
|
+ : Completion(Type::Normal, value)
|
|
{
|
|
{
|
|
}
|
|
}
|
|
|
|
|
|
ALWAYS_INLINE Completion(Optional<Value> value)
|
|
ALWAYS_INLINE Completion(Optional<Value> value)
|
|
- : Completion(Type::Normal, move(value), {})
|
|
|
|
|
|
+ : Completion(Type::Normal, move(value))
|
|
{
|
|
{
|
|
}
|
|
}
|
|
|
|
|
|
@@ -104,8 +103,6 @@ public:
|
|
}
|
|
}
|
|
[[nodiscard]] Optional<Value>& value() { return m_value; }
|
|
[[nodiscard]] Optional<Value>& value() { return m_value; }
|
|
[[nodiscard]] Optional<Value> const& value() const { return m_value; }
|
|
[[nodiscard]] Optional<Value> const& value() const { return m_value; }
|
|
- [[nodiscard]] Optional<DeprecatedFlyString>& target() { return m_target; }
|
|
|
|
- [[nodiscard]] Optional<DeprecatedFlyString> const& target() const { return m_target; }
|
|
|
|
|
|
|
|
// "abrupt completion refers to any completion with a [[Type]] value other than normal"
|
|
// "abrupt completion refers to any completion with a [[Type]] value other than normal"
|
|
[[nodiscard]] bool is_abrupt() const { return m_type != Type::Normal; }
|
|
[[nodiscard]] bool is_abrupt() const { return m_type != Type::Normal; }
|
|
@@ -117,7 +114,7 @@ public:
|
|
{
|
|
{
|
|
VERIFY(is_error());
|
|
VERIFY(is_error());
|
|
VERIFY(m_value.has_value());
|
|
VERIFY(m_value.has_value());
|
|
- return { m_type, release_value(), move(m_target) };
|
|
|
|
|
|
+ return { m_type, release_value() };
|
|
}
|
|
}
|
|
|
|
|
|
// 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
|
|
@@ -132,7 +129,7 @@ public:
|
|
return *this;
|
|
return *this;
|
|
|
|
|
|
// 3. Return Completion Record { [[Type]]: completionRecord.[[Type]], [[Value]]: value, [[Target]]: completionRecord.[[Target]] }.
|
|
// 3. Return Completion Record { [[Type]]: completionRecord.[[Type]], [[Value]]: value, [[Target]]: completionRecord.[[Target]] }.
|
|
- return { m_type, move(value), m_target };
|
|
|
|
|
|
+ return { m_type, move(value) };
|
|
}
|
|
}
|
|
|
|
|
|
private:
|
|
private:
|
|
@@ -150,9 +147,9 @@ private:
|
|
return m_type == Type::Empty;
|
|
return m_type == Type::Empty;
|
|
}
|
|
}
|
|
|
|
|
|
- Type m_type { Type::Normal }; // [[Type]]
|
|
|
|
- Optional<Value> m_value; // [[Value]]
|
|
|
|
- Optional<DeprecatedFlyString> m_target; // [[Target]]
|
|
|
|
|
|
+ Type m_type { Type::Normal }; // [[Type]]
|
|
|
|
+ Optional<Value> m_value; // [[Value]]
|
|
|
|
+ // NOTE: We don't need the [[Target]] slot since control flow is handled in bytecode.
|
|
};
|
|
};
|
|
|
|
|
|
}
|
|
}
|
|
@@ -354,7 +351,7 @@ ThrowCompletionOr<Value> await(VM&, Value);
|
|
inline Completion normal_completion(Optional<Value> value)
|
|
inline Completion normal_completion(Optional<Value> value)
|
|
{
|
|
{
|
|
// 1. Return Completion Record { [[Type]]: normal, [[Value]]: value, [[Target]]: empty }.
|
|
// 1. Return Completion Record { [[Type]]: normal, [[Value]]: value, [[Target]]: empty }.
|
|
- return { Completion::Type::Normal, move(value), {} };
|
|
|
|
|
|
+ return { Completion::Type::Normal, move(value) };
|
|
}
|
|
}
|
|
|
|
|
|
// 6.2.4.2 ThrowCompletion ( value ), https://tc39.es/ecma262/#sec-throwcompletion
|
|
// 6.2.4.2 ThrowCompletion ( value ), https://tc39.es/ecma262/#sec-throwcompletion
|