mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:17:35 +00:00
LibJS: Allow functions to take arguments (#1405)
This commit is contained in:
parent
425fd3ce51
commit
01133733dd
7 changed files with 46 additions and 14 deletions
|
@ -33,11 +33,12 @@ namespace JS {
|
|||
|
||||
class Function : public Object {
|
||||
public:
|
||||
Function(String name, const ScopeNode& body);
|
||||
Function(String name, const ScopeNode& body, Vector<String> parameters = {});
|
||||
virtual ~Function();
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
const ScopeNode& body() const { return m_body; }
|
||||
const Vector<String>& parameters() const { return m_parameters; };
|
||||
|
||||
protected:
|
||||
virtual const char* class_name() const override { return "Function"; }
|
||||
|
@ -47,6 +48,7 @@ private:
|
|||
|
||||
String m_name;
|
||||
const ScopeNode& m_body;
|
||||
const Vector<String> m_parameters;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue