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

Function parseObjectInitialiser

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

Source from the content-addressed store, hash-verified

5680 }
5681
5682 function parseObjectInitialiser() {
5683 var properties = [], property, name, kind, storedKind, map = new StringMap(),
5684 marker = markerCreate(), toString = String;
5685
5686 expect('{');
5687
5688 while (!match('}')) {
5689 if (match('...')) {
5690 property = parseObjectSpreadProperty();
5691 } else {
5692 property = parseObjectProperty();
5693
5694 if (property.key.type === Syntax.Identifier) {
5695 name = property.key.name;
5696 } else {
5697 name = toString(property.key.value);
5698 }
5699 kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set;
5700
5701 if (map.has(name)) {
5702 storedKind = map.get(name);
5703 if (storedKind === PropertyKind.Data) {
5704 if (strict && kind === PropertyKind.Data) {
5705 throwErrorTolerant({}, Messages.StrictDuplicateProperty);
5706 } else if (kind !== PropertyKind.Data) {
5707 throwErrorTolerant({}, Messages.AccessorDataProperty);
5708 }
5709 } else {
5710 if (kind === PropertyKind.Data) {
5711 throwErrorTolerant({}, Messages.AccessorDataProperty);
5712 } else if (storedKind & kind) {
5713 throwErrorTolerant({}, Messages.AccessorGetSet);
5714 }
5715 }
5716 map.set(name, storedKind | kind);
5717 } else {
5718 map.set(name, kind);
5719 }
5720 }
5721
5722 properties.push(property);
5723
5724 if (!match('}')) {
5725 expect(',');
5726 }
5727 }
5728
5729 expect('}');
5730
5731 return markerApply(marker, delegate.createObjectExpression(properties));
5732 }
5733
5734 function parseTemplateElement(option) {
5735 var marker = markerCreate(),

Callers 4

parsePrimaryExpressionFunction · 0.85
parseVariableDeclarationFunction · 0.85
parseExportDeclarationFunction · 0.85
parseParamFunction · 0.85

Calls 8

markerCreateFunction · 0.85
expectFunction · 0.85
matchFunction · 0.85
parseObjectPropertyFunction · 0.85
toStringFunction · 0.85
throwErrorTolerantFunction · 0.85
markerApplyFunction · 0.85

Tested by

no test coverage detected