1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 11:18:13 +00:00

LibJS: Track whether ScriptFunctions and FunctionExpressions are arrow

functions
This commit is contained in:
Jack Karamanian 2020-05-30 00:10:42 -05:00 committed by Andreas Kling
parent 5243e9974d
commit c12125fa81
5 changed files with 13 additions and 8 deletions

View file

@ -223,8 +223,9 @@ class FunctionExpression final
public:
static bool must_have_name() { return false; }
FunctionExpression(const FlyString& name, NonnullRefPtr<Statement> body, Vector<Parameter> parameters, i32 function_length, NonnullRefPtrVector<VariableDeclaration> variables)
FunctionExpression(const FlyString& name, NonnullRefPtr<Statement> body, Vector<Parameter> parameters, i32 function_length, NonnullRefPtrVector<VariableDeclaration> variables, bool is_arrow_function = false)
: FunctionNode(name, move(body), move(parameters), function_length, move(variables))
, m_is_arrow_function(is_arrow_function)
{
}
@ -233,6 +234,8 @@ public:
private:
virtual const char* class_name() const override { return "FunctionExpression"; }
bool m_is_arrow_function;
};
class ErrorExpression final : public Expression {