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

Function parseObjectType

lib/assets/javascripts/JSXTransformer.js:6702–6765  ·  view source on GitHub ↗
(allowStatic)

Source from the content-addressed store, hash-verified

6700 }
6701
6702 function parseObjectType(allowStatic) {
6703 var callProperties = [], indexers = [], marker, optional = false,
6704 properties = [], propertyKey, propertyTypeAnnotation,
6705 token, isStatic, matchStatic;
6706
6707 expect('{');
6708
6709 while (!match('}')) {
6710 marker = markerCreate();
6711 matchStatic =
6712 strict
6713 ? matchKeyword('static')
6714 : matchContextualKeyword('static');
6715
6716 if (allowStatic && matchStatic) {
6717 token = lex();
6718 isStatic = true;
6719 }
6720
6721 if (match('[')) {
6722 indexers.push(parseObjectTypeIndexer(marker, isStatic));
6723 } else if (match('(') || match('<')) {
6724 callProperties.push(parseObjectTypeCallProperty(marker, allowStatic));
6725 } else {
6726 if (isStatic && match(':')) {
6727 propertyKey = markerApply(marker, delegate.createIdentifier(token));
6728 throwErrorTolerant(token, Messages.StrictReservedWord);
6729 } else {
6730 propertyKey = parseObjectPropertyKey();
6731 }
6732 if (match('<') || match('(')) {
6733 // This is a method property
6734 properties.push(parseObjectTypeMethod(marker, isStatic, propertyKey));
6735 } else {
6736 if (match('?')) {
6737 lex();
6738 optional = true;
6739 }
6740 expect(':');
6741 propertyTypeAnnotation = parseType();
6742 properties.push(markerApply(marker, delegate.createObjectTypeProperty(
6743 propertyKey,
6744 propertyTypeAnnotation,
6745 optional,
6746 isStatic
6747 )));
6748 }
6749 }
6750
6751 if (match(';')) {
6752 lex();
6753 } else if (!match('}')) {
6754 throwUnexpected(lookahead);
6755 }
6756 }
6757
6758 expect('}');
6759

Callers 2

parsePrimaryTypeFunction · 0.85
parseInterfaceishFunction · 0.85

Calls 14

expectFunction · 0.85
matchFunction · 0.85
markerCreateFunction · 0.85
matchKeywordFunction · 0.85
matchContextualKeywordFunction · 0.85
lexFunction · 0.85
parseObjectTypeIndexerFunction · 0.85
markerApplyFunction · 0.85
throwErrorTolerantFunction · 0.85
parseObjectPropertyKeyFunction · 0.85
parseObjectTypeMethodFunction · 0.85

Tested by

no test coverage detected