1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 18:17:44 +00:00

LibJS: Use ClassFieldInitializerStatement for class fields

This is necessary as we might have to perform named evaluation with the
field name.
Ideally we would also skip some setup parts of the function like
function_declaration_instantiation however this would require bigger
changes to ECMAScriptFunctionObject.
This commit is contained in:
davidot 2021-10-13 19:59:38 +02:00 committed by Linus Groh
parent 7e8724db71
commit 4c8090a45d
4 changed files with 48 additions and 5 deletions

View file

@ -1085,10 +1085,11 @@ private:
class ClassField final : public ClassElement {
public:
ClassField(SourceRange source_range, NonnullRefPtr<Expression> key, RefPtr<Expression> init, bool is_static)
ClassField(SourceRange source_range, NonnullRefPtr<Expression> key, RefPtr<Expression> init, bool contains_direct_call_to_eval, bool is_static)
: ClassElement(source_range, is_static)
, m_key(move(key))
, m_initializer(move(init))
, m_contains_direct_call_to_eval(contains_direct_call_to_eval)
{
}
@ -1105,6 +1106,7 @@ public:
private:
NonnullRefPtr<Expression> m_key;
RefPtr<Expression> m_initializer;
bool m_contains_direct_call_to_eval { false };
};
class StaticInitializer final : public ClassElement {