mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
LibJS: Don't update names of resulting functions in object expression
The only cases where the name should be set is if the function comes from a direct anonymous function expression.
This commit is contained in:
parent
897c7f7cc2
commit
2bbea62176
4 changed files with 63 additions and 10 deletions
|
@ -1779,7 +1779,10 @@ NonnullRefPtr<ObjectExpression> Parser::parse_object_expression()
|
|||
}
|
||||
if (is_proto && property_type == ObjectProperty::Type::KeyValue)
|
||||
property_type = ObjectProperty::Type::ProtoSetter;
|
||||
properties.append(create_ast_node<ObjectProperty>({ m_source_code, rule_start.position(), position() }, *property_key, parse_expression(2), property_type, false));
|
||||
|
||||
auto rhs_expression = parse_expression(2);
|
||||
bool is_method = is<FunctionExpression>(*rhs_expression);
|
||||
properties.append(create_ast_node<ObjectProperty>({ m_source_code, rule_start.position(), position() }, *property_key, move(rhs_expression), property_type, is_method));
|
||||
} else if (property_key && property_value) {
|
||||
if (m_state.strict_mode && is<StringLiteral>(*property_key)) {
|
||||
auto& string_literal = static_cast<StringLiteral const&>(*property_key);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue