1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

LibJS: Make Function and CallFrame aware of their function name

This commit is contained in:
Linus Groh 2020-04-11 12:56:20 +01:00 committed by Andreas Kling
parent 4eceea7c62
commit eece424694
11 changed files with 39 additions and 22 deletions

View file

@ -32,7 +32,7 @@ namespace JS {
class ScriptFunction final : public Function {
public:
ScriptFunction(const Statement& body, Vector<FlyString> parameters = {});
ScriptFunction(const FlyString& name, const Statement& body, Vector<FlyString> parameters = {});
virtual ~ScriptFunction();
const Statement& body() const { return m_body; }
@ -41,6 +41,8 @@ public:
virtual Value call(Interpreter&) override;
virtual Value construct(Interpreter&) override;
virtual const FlyString& name() const override { return m_name; };
private:
virtual bool is_script_function() const final { return true; }
virtual const char* class_name() const override { return "ScriptFunction"; }
@ -48,6 +50,7 @@ private:
static Value length_getter(Interpreter&);
static void length_setter(Interpreter&, Value);
FlyString m_name;
NonnullRefPtr<Statement> m_body;
const Vector<FlyString> m_parameters;
};