mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-13 03:29:49 +00:00
LibJS: Implement private identifiers in optional chains
This commit is contained in:
parent
4c8090a45d
commit
2d48529073
Notes:
sideshowbarker
2024-07-18 02:07:45 +09:00
Author: https://github.com/davidot
Commit: 2d48529073
Pull-request: https://github.com/SerenityOS/serenity/pull/10470
Issue: https://github.com/SerenityOS/serenity/issues/7044
Issue: https://github.com/SerenityOS/serenity/issues/8574
Reviewed-by: https://github.com/linusg
3 changed files with 35 additions and 2 deletions
|
@ -2704,6 +2704,11 @@ void OptionalChain::dump(int indent) const
|
|||
print_indent(indent + 1);
|
||||
outln("MemberReference({})", ref.mode == Mode::Optional ? "Optional" : "Not Optional");
|
||||
ref.identifier->dump(indent + 2);
|
||||
},
|
||||
[&](PrivateMemberReference const& ref) {
|
||||
print_indent(indent + 1);
|
||||
outln("PrivateMemberReference({})", ref.mode == Mode::Optional ? "Optional" : "Not Optional");
|
||||
ref.private_identifier->dump(indent + 2);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -2738,6 +2743,12 @@ Optional<OptionalChain::ReferenceAndValue> OptionalChain::to_reference_and_value
|
|||
create_ast_node<SyntheticReferenceExpression>(source_range(), *base_reference, base),
|
||||
ref.identifier,
|
||||
false);
|
||||
},
|
||||
[&](PrivateMemberReference const& ref) -> NonnullRefPtr<Expression> {
|
||||
return create_ast_node<MemberExpression>(source_range(),
|
||||
create_ast_node<SyntheticReferenceExpression>(source_range(), *base_reference, base),
|
||||
ref.private_identifier,
|
||||
false);
|
||||
});
|
||||
if (is<CallExpression>(*expression)) {
|
||||
base_reference = JS::Reference {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue