mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 09:14:58 +00:00
LibJS: Support empty values in array expression
This commit is contained in:
parent
d30db07048
commit
cea950fd70
4 changed files with 44 additions and 10 deletions
|
@ -473,9 +473,12 @@ NonnullRefPtr<ArrayExpression> Parser::parse_array_expression()
|
|||
{
|
||||
consume(TokenType::BracketOpen);
|
||||
|
||||
NonnullRefPtrVector<Expression> elements;
|
||||
while (match_expression()) {
|
||||
elements.append(parse_expression(0));
|
||||
Vector<RefPtr<Expression>> elements;
|
||||
while (match_expression() || match(TokenType::Comma)) {
|
||||
RefPtr<Expression> expression;
|
||||
if (match_expression())
|
||||
expression = parse_expression(0);
|
||||
elements.append(expression);
|
||||
if (!match(TokenType::Comma))
|
||||
break;
|
||||
consume(TokenType::Comma);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue