()
| 36644 | return withJSDoc(finishNode(node, pos), hasJSDoc); |
| 36645 | } |
| 36646 | function isClassMemberStart() { |
| 36647 | var idToken; |
| 36648 | if (token() === 59 /* SyntaxKind.AtToken */) { |
| 36649 | return true; |
| 36650 | } |
| 36651 | // Eat up all modifiers, but hold on to the last one in case it is actually an identifier. |
| 36652 | while (ts.isModifierKind(token())) { |
| 36653 | idToken = token(); |
| 36654 | // If the idToken is a class modifier (protected, private, public, and static), it is |
| 36655 | // certain that we are starting to parse class member. This allows better error recovery |
| 36656 | // Example: |
| 36657 | // public foo() ... // true |
| 36658 | // public @dec blah ... // true; we will then report an error later |
| 36659 | // export public ... // true; we will then report an error later |
| 36660 | if (ts.isClassMemberModifier(idToken)) { |
| 36661 | return true; |
| 36662 | } |
| 36663 | nextToken(); |
| 36664 | } |
| 36665 | if (token() === 41 /* SyntaxKind.AsteriskToken */) { |
| 36666 | return true; |
| 36667 | } |
| 36668 | // Try to get the first property-like token following all modifiers. |
| 36669 | // This can either be an identifier or the 'get' or 'set' keywords. |
| 36670 | if (isLiteralPropertyName()) { |
| 36671 | idToken = token(); |
| 36672 | nextToken(); |
| 36673 | } |
| 36674 | // Index signatures and computed properties are class members; we can parse. |
| 36675 | if (token() === 22 /* SyntaxKind.OpenBracketToken */) { |
| 36676 | return true; |
| 36677 | } |
| 36678 | // If we were able to get any potential identifier... |
| 36679 | if (idToken !== undefined) { |
| 36680 | // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. |
| 36681 | if (!ts.isKeyword(idToken) || idToken === 149 /* SyntaxKind.SetKeyword */ || idToken === 136 /* SyntaxKind.GetKeyword */) { |
| 36682 | return true; |
| 36683 | } |
| 36684 | // If it *is* a keyword, but not an accessor, check a little farther along |
| 36685 | // to see if it should actually be parsed as a class member. |
| 36686 | switch (token()) { |
| 36687 | case 20 /* SyntaxKind.OpenParenToken */: // Method declaration |
| 36688 | case 29 /* SyntaxKind.LessThanToken */: // Generic Method declaration |
| 36689 | case 53 /* SyntaxKind.ExclamationToken */: // Non-null assertion on property name |
| 36690 | case 58 /* SyntaxKind.ColonToken */: // Type Annotation for declaration |
| 36691 | case 63 /* SyntaxKind.EqualsToken */: // Initializer for declaration |
| 36692 | case 57 /* SyntaxKind.QuestionToken */: // Not valid, but permitted so that it gets caught later on. |
| 36693 | return true; |
| 36694 | default: |
| 36695 | // Covers |
| 36696 | // - Semicolons (declaration termination) |
| 36697 | // - Closing braces (end-of-class, must be declaration) |
| 36698 | // - End-of-files (not valid, but permitted so that it gets caught later on) |
| 36699 | // - Line-breaks (enabling *automatic semicolon insertion*) |
| 36700 | return canParseSemicolon(); |
| 36701 | } |
| 36702 | } |
| 36703 | return false; |
nothing calls this directly
no test coverage detected