mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 04:52:23 +00:00
LibJS: Allow member expressions in binding patterns
Also allows literal string and numbers as property names in object binding patterns.
This commit is contained in:
parent
9cb5700398
commit
bfc1b4ba61
Notes:
sideshowbarker
2024-07-18 03:18:19 +09:00
Author: https://github.com/davidot
Commit: bfc1b4ba61
Pull-request: https://github.com/SerenityOS/serenity/pull/10181
Reviewed-by: https://github.com/Dexesttp
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/linusg
6 changed files with 177 additions and 77 deletions
|
@ -42,7 +42,18 @@ public:
|
|||
template<typename FunctionNodeType>
|
||||
NonnullRefPtr<FunctionNodeType> parse_function_node(u8 parse_options = FunctionNodeParseOptions::CheckForFunctionAndName);
|
||||
Vector<FunctionNode::Parameter> parse_formal_parameters(int& function_length, u8 parse_options = 0);
|
||||
RefPtr<BindingPattern> parse_binding_pattern(bool strict_checks = false);
|
||||
|
||||
enum class AllowDuplicates {
|
||||
Yes,
|
||||
No
|
||||
};
|
||||
|
||||
enum class AllowMemberExpressions {
|
||||
Yes,
|
||||
No
|
||||
};
|
||||
|
||||
RefPtr<BindingPattern> parse_binding_pattern(AllowDuplicates is_var_declaration = AllowDuplicates::No, AllowMemberExpressions allow_member_expressions = AllowMemberExpressions::No);
|
||||
|
||||
struct PrimaryExpressionParseResult {
|
||||
NonnullRefPtr<Expression> result;
|
||||
|
@ -179,6 +190,8 @@ private:
|
|||
void discard_saved_state();
|
||||
Position position() const;
|
||||
|
||||
RefPtr<BindingPattern> synthesize_binding_pattern(Expression const& expression);
|
||||
|
||||
Token next_token();
|
||||
|
||||
void check_identifier_name_for_assignment_validity(StringView, bool force_strict = false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue