mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 17:07:35 +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
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