mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibJS: Use PropertyName::from_value() in MemberExpression::computed_property_name()
No need for duplicating this logic.
This commit is contained in:
parent
bc78e4b7da
commit
5feb7e8d28
Notes:
sideshowbarker
2024-07-19 01:58:39 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/5feb7e8d288 Pull-request: https://github.com/SerenityOS/serenity/pull/3713 Issue: https://github.com/SerenityOS/serenity/issues/3712
1 changed files with 3 additions and 16 deletions
|
@ -1549,8 +1549,6 @@ Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_o
|
|||
continue;
|
||||
}
|
||||
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
auto value = property.value().execute(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
|
@ -1595,22 +1593,11 @@ PropertyName MemberExpression::computed_property_name(Interpreter& interpreter,
|
|||
ASSERT(m_property->is_identifier());
|
||||
return static_cast<const Identifier&>(*m_property).string();
|
||||
}
|
||||
auto index = m_property->execute(interpreter, global_object);
|
||||
auto value = m_property->execute(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
|
||||
ASSERT(!index.is_empty());
|
||||
|
||||
if (index.is_integer() && index.as_i32() >= 0)
|
||||
return index.as_i32();
|
||||
|
||||
if (index.is_symbol())
|
||||
return &index.as_symbol();
|
||||
|
||||
auto index_string = index.to_string(global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
return index_string;
|
||||
ASSERT(!value.is_empty());
|
||||
return PropertyName::from_value(global_object, value);
|
||||
}
|
||||
|
||||
String MemberExpression::to_string_approximation() const
|
||||
|
|
Loading…
Reference in a new issue