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
commit e3ef849838
Notes: sideshowbarker 2024-07-16 23:54:15 +09:00
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;