mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:27:34 +00:00
LibJS: Remove variables from FunctionNode
They weren't consumed anywhere outside the AST and went against the usual concept of having declaration in ScopeNode.
This commit is contained in:
parent
e0c9f58b0c
commit
72f8d90dc5
3 changed files with 9 additions and 21 deletions
|
@ -257,11 +257,10 @@ public:
|
|||
FunctionKind kind() const { return m_kind; }
|
||||
|
||||
protected:
|
||||
FunctionNode(FlyString name, NonnullRefPtr<Statement> body, Vector<Parameter> parameters, i32 function_length, NonnullRefPtrVector<VariableDeclaration> variables, FunctionKind kind, bool is_strict_mode, bool is_arrow_function)
|
||||
FunctionNode(FlyString name, NonnullRefPtr<Statement> body, Vector<Parameter> parameters, i32 function_length, FunctionKind kind, bool is_strict_mode, bool is_arrow_function)
|
||||
: m_name(move(name))
|
||||
, m_body(move(body))
|
||||
, m_parameters(move(parameters))
|
||||
, m_variables(move(variables))
|
||||
, m_function_length(function_length)
|
||||
, m_kind(kind)
|
||||
, m_is_strict_mode(is_strict_mode)
|
||||
|
@ -271,8 +270,6 @@ protected:
|
|||
|
||||
void dump(int indent, String const& class_name) const;
|
||||
|
||||
NonnullRefPtrVector<VariableDeclaration> const& variables() const { return m_variables; }
|
||||
|
||||
protected:
|
||||
void set_name(FlyString name)
|
||||
{
|
||||
|
@ -284,7 +281,6 @@ private:
|
|||
FlyString m_name;
|
||||
NonnullRefPtr<Statement> m_body;
|
||||
Vector<Parameter> const m_parameters;
|
||||
NonnullRefPtrVector<VariableDeclaration> m_variables;
|
||||
const i32 m_function_length;
|
||||
FunctionKind m_kind;
|
||||
bool m_is_strict_mode;
|
||||
|
@ -297,9 +293,9 @@ class FunctionDeclaration final
|
|||
public:
|
||||
static bool must_have_name() { return true; }
|
||||
|
||||
FunctionDeclaration(SourceRange source_range, FlyString const& name, NonnullRefPtr<Statement> body, Vector<Parameter> parameters, i32 function_length, NonnullRefPtrVector<VariableDeclaration> variables, FunctionKind kind, bool is_strict_mode = false)
|
||||
FunctionDeclaration(SourceRange source_range, FlyString const& name, NonnullRefPtr<Statement> body, Vector<Parameter> parameters, i32 function_length, FunctionKind kind, bool is_strict_mode = false)
|
||||
: Declaration(source_range)
|
||||
, FunctionNode(name, move(body), move(parameters), function_length, move(variables), kind, is_strict_mode, false)
|
||||
, FunctionNode(name, move(body), move(parameters), function_length, kind, is_strict_mode, false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -314,9 +310,9 @@ class FunctionExpression final
|
|||
public:
|
||||
static bool must_have_name() { return false; }
|
||||
|
||||
FunctionExpression(SourceRange source_range, FlyString const& name, NonnullRefPtr<Statement> body, Vector<Parameter> parameters, i32 function_length, NonnullRefPtrVector<VariableDeclaration> variables, FunctionKind kind, bool is_strict_mode, bool is_arrow_function = false)
|
||||
FunctionExpression(SourceRange source_range, FlyString const& name, NonnullRefPtr<Statement> body, Vector<Parameter> parameters, i32 function_length, FunctionKind kind, bool is_strict_mode, bool is_arrow_function = false)
|
||||
: Expression(source_range)
|
||||
, FunctionNode(name, move(body), move(parameters), function_length, move(variables), kind, is_strict_mode, is_arrow_function)
|
||||
, FunctionNode(name, move(body), move(parameters), function_length, kind, is_strict_mode, is_arrow_function)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue