mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
LibJS: Ensure get_new_target() never returns an empty value
Also add spec comments and remove a redundant exception check while we're here :^)
This commit is contained in:
parent
8d70a50aed
commit
451149df0b
4 changed files with 17 additions and 12 deletions
|
@ -25,22 +25,22 @@ public:
|
|||
explicit FunctionEnvironment(Environment* parent_scope);
|
||||
virtual ~FunctionEnvironment() override;
|
||||
|
||||
// [[ThisValue]]
|
||||
Value this_value() const { return m_this_value; }
|
||||
void set_this_value(Value value) { m_this_value = value; }
|
||||
|
||||
// [[ThisBindingStatus]]
|
||||
ThisBindingStatus this_binding_status() const { return m_this_binding_status; }
|
||||
void set_this_binding_status(ThisBindingStatus status) { m_this_binding_status = status; }
|
||||
|
||||
// [[FunctionObject]]
|
||||
ECMAScriptFunctionObject& function_object() { return *m_function_object; }
|
||||
ECMAScriptFunctionObject const& function_object() const { return *m_function_object; }
|
||||
void set_function_object(ECMAScriptFunctionObject& function) { m_function_object = &function; }
|
||||
|
||||
// [[NewTarget]]
|
||||
Value new_target() const { return m_new_target; }
|
||||
void set_new_target(Value new_target) { m_new_target = new_target; }
|
||||
void set_new_target(Value new_target)
|
||||
{
|
||||
VERIFY(!new_target.is_empty());
|
||||
m_new_target = new_target;
|
||||
}
|
||||
|
||||
// Abstract operations
|
||||
ThrowCompletionOr<Value> get_super_base() const;
|
||||
|
@ -53,10 +53,10 @@ private:
|
|||
virtual bool is_function_environment() const override { return true; }
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
Value m_this_value;
|
||||
ThisBindingStatus m_this_binding_status { ThisBindingStatus::Uninitialized };
|
||||
ECMAScriptFunctionObject* m_function_object { nullptr };
|
||||
Value m_new_target;
|
||||
Value m_this_value; // [[ThisValue]]
|
||||
ThisBindingStatus m_this_binding_status { ThisBindingStatus::Uninitialized }; // [[ThisBindingStatus]]
|
||||
ECMAScriptFunctionObject* m_function_object { nullptr }; // [[FunctionObject]]
|
||||
Value m_new_target { js_undefined() }; // [[NewTarget]]
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue