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

Function parseVariableDeclaration

lib/assets/javascripts/JSXTransformer.js:7075–7115  ·  view source on GitHub ↗
(kind)

Source from the content-addressed store, hash-verified

7073 }
7074
7075 function parseVariableDeclaration(kind) {
7076 var id,
7077 marker = markerCreate(),
7078 init = null,
7079 typeAnnotationMarker = markerCreate();
7080 if (match('{')) {
7081 id = parseObjectInitialiser();
7082 reinterpretAsAssignmentBindingPattern(id);
7083 if (match(':')) {
7084 id.typeAnnotation = parseTypeAnnotation();
7085 markerApply(typeAnnotationMarker, id);
7086 }
7087 } else if (match('[')) {
7088 id = parseArrayInitialiser();
7089 reinterpretAsAssignmentBindingPattern(id);
7090 if (match(':')) {
7091 id.typeAnnotation = parseTypeAnnotation();
7092 markerApply(typeAnnotationMarker, id);
7093 }
7094 } else {
7095 /* istanbul ignore next */
7096 id = state.allowKeyword ? parseNonComputedProperty() : parseTypeAnnotatableIdentifier();
7097 // 12.2.1
7098 if (strict && isRestrictedWord(id.name)) {
7099 throwErrorTolerant({}, Messages.StrictVarName);
7100 }
7101 }
7102
7103 if (kind === 'const') {
7104 if (!match('=')) {
7105 throwError({}, Messages.NoUninitializedConst);
7106 }
7107 expect('=');
7108 init = parseAssignmentExpression();
7109 } else if (match('=')) {
7110 lex();
7111 init = parseAssignmentExpression();
7112 }
7113
7114 return markerApply(marker, delegate.createVariableDeclarator(id, init));
7115 }
7116
7117 function parseVariableDeclarationList(kind) {
7118 var list = [];

Callers 1

Calls 15

markerCreateFunction · 0.85
matchFunction · 0.85
parseObjectInitialiserFunction · 0.85
parseTypeAnnotationFunction · 0.85
markerApplyFunction · 0.85
parseArrayInitialiserFunction · 0.85
parseNonComputedPropertyFunction · 0.85
isRestrictedWordFunction · 0.85
throwErrorTolerantFunction · 0.85
throwErrorFunction · 0.85

Tested by

no test coverage detected