()
| 2054 | } |
| 2055 | |
| 2056 | function parseObjectProperty() { |
| 2057 | var token, key, id, value, param, startToken; |
| 2058 | |
| 2059 | token = lookahead; |
| 2060 | startToken = lookahead; |
| 2061 | |
| 2062 | if (token.type === Token.Identifier) { |
| 2063 | |
| 2064 | id = parseObjectPropertyKey(); |
| 2065 | |
| 2066 | // Property Assignment: Getter and Setter. |
| 2067 | |
| 2068 | if (token.value === 'get' && !match(':')) { |
| 2069 | key = parseObjectPropertyKey(); |
| 2070 | expect('('); |
| 2071 | expect(')'); |
| 2072 | value = parsePropertyFunction([]); |
| 2073 | return delegate.markEnd(delegate.createProperty('get', key, value), startToken); |
| 2074 | } |
| 2075 | if (token.value === 'set' && !match(':')) { |
| 2076 | key = parseObjectPropertyKey(); |
| 2077 | expect('('); |
| 2078 | token = lookahead; |
| 2079 | if (token.type !== Token.Identifier) { |
| 2080 | expect(')'); |
| 2081 | throwErrorTolerant(token, Messages.UnexpectedToken, token.value); |
| 2082 | value = parsePropertyFunction([]); |
| 2083 | } else { |
| 2084 | param = [ parseVariableIdentifier() ]; |
| 2085 | expect(')'); |
| 2086 | value = parsePropertyFunction(param, token); |
| 2087 | } |
| 2088 | return delegate.markEnd(delegate.createProperty('set', key, value), startToken); |
| 2089 | } |
| 2090 | expect(':'); |
| 2091 | value = parseAssignmentExpression(); |
| 2092 | return delegate.markEnd(delegate.createProperty('init', id, value), startToken); |
| 2093 | } |
| 2094 | if (token.type === Token.EOF || token.type === Token.Punctuator) { |
| 2095 | throwUnexpected(token); |
| 2096 | } else { |
| 2097 | key = parseObjectPropertyKey(); |
| 2098 | expect(':'); |
| 2099 | value = parseAssignmentExpression(); |
| 2100 | return delegate.markEnd(delegate.createProperty('init', key, value), startToken); |
| 2101 | } |
| 2102 | } |
| 2103 | |
| 2104 | function parseObjectInitialiser() { |
| 2105 | var properties = [], property, name, key, kind, map = {}, toString = String, startToken; |
no test coverage detected