(key, isStatic, generator, computed)
| 8390 | } |
| 8391 | |
| 8392 | function parseMethodDefinition(key, isStatic, generator, computed) { |
| 8393 | var token, param, propType, |
| 8394 | isAsync, typeParameters, tokenValue, returnType; |
| 8395 | |
| 8396 | propType = isStatic ? ClassPropertyType["static"] : ClassPropertyType.prototype; |
| 8397 | |
| 8398 | if (generator) { |
| 8399 | return delegate.createMethodDefinition( |
| 8400 | propType, |
| 8401 | '', |
| 8402 | key, |
| 8403 | parsePropertyMethodFunction({ generator: true }), |
| 8404 | computed |
| 8405 | ); |
| 8406 | } |
| 8407 | |
| 8408 | tokenValue = key.type === 'Identifier' && key.name; |
| 8409 | |
| 8410 | if (tokenValue === 'get' && !match('(')) { |
| 8411 | key = parseObjectPropertyKey(); |
| 8412 | |
| 8413 | expect('('); |
| 8414 | expect(')'); |
| 8415 | if (match(':')) { |
| 8416 | returnType = parseTypeAnnotation(); |
| 8417 | } |
| 8418 | return delegate.createMethodDefinition( |
| 8419 | propType, |
| 8420 | 'get', |
| 8421 | key, |
| 8422 | parsePropertyFunction({ generator: false, returnType: returnType }), |
| 8423 | computed |
| 8424 | ); |
| 8425 | } |
| 8426 | if (tokenValue === 'set' && !match('(')) { |
| 8427 | key = parseObjectPropertyKey(); |
| 8428 | |
| 8429 | expect('('); |
| 8430 | token = lookahead; |
| 8431 | param = [ parseTypeAnnotatableIdentifier() ]; |
| 8432 | expect(')'); |
| 8433 | if (match(':')) { |
| 8434 | returnType = parseTypeAnnotation(); |
| 8435 | } |
| 8436 | return delegate.createMethodDefinition( |
| 8437 | propType, |
| 8438 | 'set', |
| 8439 | key, |
| 8440 | parsePropertyFunction({ |
| 8441 | params: param, |
| 8442 | generator: false, |
| 8443 | name: token, |
| 8444 | returnType: returnType |
| 8445 | }), |
| 8446 | computed |
| 8447 | ); |
| 8448 | } |
| 8449 |
no test coverage detected