()
| 2102 | } |
| 2103 | |
| 2104 | function parseObjectInitialiser() { |
| 2105 | var properties = [], property, name, key, kind, map = {}, toString = String, startToken; |
| 2106 | |
| 2107 | startToken = lookahead; |
| 2108 | |
| 2109 | expect('{'); |
| 2110 | |
| 2111 | while (!match('}')) { |
| 2112 | property = parseObjectProperty(); |
| 2113 | |
| 2114 | if (property.key.type === Syntax.Identifier) { |
| 2115 | name = property.key.name; |
| 2116 | } else { |
| 2117 | name = toString(property.key.value); |
| 2118 | } |
| 2119 | kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set; |
| 2120 | |
| 2121 | key = '$' + name; |
| 2122 | if (Object.prototype.hasOwnProperty.call(map, key)) { |
| 2123 | if (map[key] === PropertyKind.Data) { |
| 2124 | if (strict && kind === PropertyKind.Data) { |
| 2125 | throwErrorTolerant({}, Messages.StrictDuplicateProperty); |
| 2126 | } else if (kind !== PropertyKind.Data) { |
| 2127 | throwErrorTolerant({}, Messages.AccessorDataProperty); |
| 2128 | } |
| 2129 | } else { |
| 2130 | if (kind === PropertyKind.Data) { |
| 2131 | throwErrorTolerant({}, Messages.AccessorDataProperty); |
| 2132 | } else if (map[key] & kind) { |
| 2133 | throwErrorTolerant({}, Messages.AccessorGetSet); |
| 2134 | } |
| 2135 | } |
| 2136 | map[key] |= kind; |
| 2137 | } else { |
| 2138 | map[key] = kind; |
| 2139 | } |
| 2140 | |
| 2141 | properties.push(property); |
| 2142 | |
| 2143 | if (!match('}')) { |
| 2144 | expect(','); |
| 2145 | } |
| 2146 | } |
| 2147 | |
| 2148 | expect('}'); |
| 2149 | |
| 2150 | return delegate.markEnd(delegate.createObjectExpression(properties), startToken); |
| 2151 | } |
| 2152 | |
| 2153 | // 11.1.6 The Grouping Operator |
| 2154 |
no test coverage detected