1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:27:43 +00:00

LibJS: Use Identifier to represent name of ClassExpression

By using Identifier class to represent the name of a class expression,
it becomes possible to consistently store information within the
identifier object, indicating whether the name refers to a local
variable or not.
This commit is contained in:
Aliaksandr Kalenik 2023-06-30 16:51:39 +03:00 committed by Andreas Kling
parent 4a83fb1b12
commit c734f2b5e6
4 changed files with 20 additions and 14 deletions

View file

@ -1852,7 +1852,7 @@ Completion ClassExpression::execute(Interpreter& interpreter) const
// 1. Let className be StringValue of BindingIdentifier.
// 2. Let value be ? ClassDefinitionEvaluation of ClassTail with arguments className and className.
auto* value = TRY(class_definition_evaluation(interpreter.vm(), m_name, m_name.is_null() ? "" : m_name));
auto* value = TRY(class_definition_evaluation(interpreter.vm(), name(), name()));
// 3. Set value.[[SourceText]] to the source text matched by ClassExpression.
value->set_source_text(m_source_text);
@ -2311,7 +2311,7 @@ ThrowCompletionOr<void> ClassDeclaration::for_each_bound_name(ThrowCompletionOrV
void ClassExpression::dump(int indent) const
{
print_indent(indent);
outln("ClassExpression: \"{}\"", m_name);
outln("ClassExpression: \"{}\"", name());
print_indent(indent);
outln("(Constructor)");