LibJS: Support string literal expressions in nullish object exceptions

This commit is contained in:
Timothy Flynn
2024-04-01 22:06:03 -04:00
committed by Andreas Kling
parent e7f2af6ff4
commit e3ef849838
2 changed files with 19 additions and 0 deletions

View File

@@ -458,6 +458,11 @@ static Optional<ByteString> expression_identifier(Expression const& expression)
return literal.value().to_string_without_side_effects().to_byte_string();
}
if (expression.is_string_literal()) {
auto const& literal = static_cast<StringLiteral const&>(expression);
return ByteString::formatted("'{}'", literal.value());
}
if (expression.is_member_expression()) {
auto const& member_expression = static_cast<MemberExpression const&>(expression);
StringBuilder builder;