()
| 2542 | // 11.1.6 The Grouping Operator |
| 2543 | |
| 2544 | function parseGroupExpression() { |
| 2545 | var expr, expressions, startToken, isValidArrowParameter = true; |
| 2546 | |
| 2547 | expect('('); |
| 2548 | |
| 2549 | if (match(')')) { |
| 2550 | lex(); |
| 2551 | if (!match('=>')) { |
| 2552 | expect('=>'); |
| 2553 | } |
| 2554 | return { |
| 2555 | type: PlaceHolders.ArrowParameterPlaceHolder, |
| 2556 | params: [] |
| 2557 | }; |
| 2558 | } |
| 2559 | |
| 2560 | startToken = lookahead; |
| 2561 | if (match('...')) { |
| 2562 | expr = parseRestElement(); |
| 2563 | expect(')'); |
| 2564 | if (!match('=>')) { |
| 2565 | expect('=>'); |
| 2566 | } |
| 2567 | return { |
| 2568 | type: PlaceHolders.ArrowParameterPlaceHolder, |
| 2569 | params: [expr] |
| 2570 | }; |
| 2571 | } |
| 2572 | |
| 2573 | if (match('(')) { |
| 2574 | isValidArrowParameter = false; |
| 2575 | } |
| 2576 | |
| 2577 | expr = parseAssignmentExpression(); |
| 2578 | |
| 2579 | if (match(',')) { |
| 2580 | expressions = [expr]; |
| 2581 | |
| 2582 | while (startIndex < length) { |
| 2583 | if (!match(',')) { |
| 2584 | break; |
| 2585 | } |
| 2586 | lex(); |
| 2587 | |
| 2588 | if (match('...')) { |
| 2589 | if (!isValidArrowParameter) { |
| 2590 | throwUnexpectedToken(lookahead); |
| 2591 | } |
| 2592 | expressions.push(parseRestElement()); |
| 2593 | expect(')'); |
| 2594 | if (!match('=>')) { |
| 2595 | expect('=>'); |
| 2596 | } |
| 2597 | return { |
| 2598 | type: PlaceHolders.ArrowParameterPlaceHolder, |
| 2599 | params: expressions |
| 2600 | }; |
| 2601 | } else if (match('(')) { |
no test coverage detected