1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 06:44:58 +00:00

LibJS: Move "strict mode" state to the call stack

Each call frame now knows whether it's executing in strict mode.
It's no longer necessary to access the scope stack to find this mode.
This commit is contained in:
Andreas Kling 2020-10-04 13:54:44 +02:00
parent f41b5a4535
commit a007b3c379
15 changed files with 49 additions and 37 deletions

View file

@ -50,6 +50,9 @@ public:
virtual const FlyString& name() const override { return m_name; };
void set_name(const FlyString& name) { m_name = name; };
protected:
virtual bool is_strict_mode() const final { return m_is_strict; }
private:
virtual bool is_script_function() const override { return true; }
virtual LexicalEnvironment* create_environment() override;
@ -62,9 +65,9 @@ private:
NonnullRefPtr<Statement> m_body;
const Vector<FunctionNode::Parameter> m_parameters;
LexicalEnvironment* m_parent_environment { nullptr };
i32 m_function_length;
bool m_is_strict;
bool m_is_arrow_function;
i32 m_function_length { 0 };
bool m_is_strict { false };
bool m_is_arrow_function { false };
};
}