()
| 9606 | } |
| 9607 | |
| 9608 | function parseDeclareModule() { |
| 9609 | var body = [], bodyMarker, id, idMarker, marker = markerCreate(), token; |
| 9610 | expectContextualKeyword('declare'); |
| 9611 | expectContextualKeyword('module'); |
| 9612 | |
| 9613 | if (lookahead.type === Token.StringLiteral) { |
| 9614 | if (strict && lookahead.octal) { |
| 9615 | throwErrorTolerant(lookahead, Messages.StrictOctalLiteral); |
| 9616 | } |
| 9617 | idMarker = markerCreate(); |
| 9618 | id = markerApply(idMarker, delegate.createLiteral(lex())); |
| 9619 | } else { |
| 9620 | id = parseVariableIdentifier(); |
| 9621 | } |
| 9622 | |
| 9623 | bodyMarker = markerCreate(); |
| 9624 | expect('{'); |
| 9625 | while (index < length && !match('}')) { |
| 9626 | token = lookahead2(); |
| 9627 | switch (token.value) { |
| 9628 | case 'class': |
| 9629 | body.push(parseDeclareClass()); |
| 9630 | break; |
| 9631 | case 'function': |
| 9632 | body.push(parseDeclareFunction()); |
| 9633 | break; |
| 9634 | case 'var': |
| 9635 | body.push(parseDeclareVariable()); |
| 9636 | break; |
| 9637 | default: |
| 9638 | throwUnexpected(lookahead); |
| 9639 | } |
| 9640 | } |
| 9641 | expect('}'); |
| 9642 | |
| 9643 | return markerApply(marker, delegate.createDeclareModule( |
| 9644 | id, |
| 9645 | markerApply(bodyMarker, delegate.createBlockStatement(body)) |
| 9646 | )); |
| 9647 | } |
| 9648 | |
| 9649 | function collectToken() { |
| 9650 | var loc, token, range, value, entry; |
no test coverage detected