MCPcopy Index your code
hub / github.com/reactjs/react-rails / parseDeclareModule

Function parseDeclareModule

lib/assets/javascripts/JSXTransformer.js:9608–9647  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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;

Callers 1

parseSourceElementFunction · 0.85

Calls 13

markerCreateFunction · 0.85
expectContextualKeywordFunction · 0.85
throwErrorTolerantFunction · 0.85
markerApplyFunction · 0.85
lexFunction · 0.85
parseVariableIdentifierFunction · 0.85
expectFunction · 0.85
matchFunction · 0.85
lookahead2Function · 0.85
parseDeclareClassFunction · 0.85
parseDeclareFunctionFunction · 0.85
parseDeclareVariableFunction · 0.85

Tested by

no test coverage detected