(inStartOfParameter bool)
| 6208 | } |
| 6209 | |
| 6210 | func (p *Parser) isStartOfType(inStartOfParameter bool) bool { |
| 6211 | switch p.token { |
| 6212 | case ast.KindAnyKeyword, ast.KindUnknownKeyword, ast.KindStringKeyword, ast.KindNumberKeyword, ast.KindBigIntKeyword, |
| 6213 | ast.KindBooleanKeyword, ast.KindReadonlyKeyword, ast.KindSymbolKeyword, ast.KindUniqueKeyword, ast.KindVoidKeyword, |
| 6214 | ast.KindUndefinedKeyword, ast.KindNullKeyword, ast.KindThisKeyword, ast.KindTypeOfKeyword, ast.KindNeverKeyword, |
| 6215 | ast.KindOpenBraceToken, ast.KindOpenBracketToken, ast.KindLessThanToken, ast.KindBarToken, ast.KindAmpersandToken, |
| 6216 | ast.KindNewKeyword, ast.KindStringLiteral, ast.KindNumericLiteral, ast.KindBigIntLiteral, ast.KindTrueKeyword, |
| 6217 | ast.KindFalseKeyword, ast.KindObjectKeyword, ast.KindAsteriskToken, ast.KindQuestionToken, ast.KindExclamationToken, |
| 6218 | ast.KindDotDotDotToken, ast.KindInferKeyword, ast.KindImportKeyword, ast.KindAssertsKeyword, ast.KindNoSubstitutionTemplateLiteral, |
| 6219 | ast.KindTemplateHead: |
| 6220 | return true |
| 6221 | case ast.KindFunctionKeyword: |
| 6222 | return !inStartOfParameter |
| 6223 | case ast.KindMinusToken: |
| 6224 | return !inStartOfParameter && p.lookAhead((*Parser).nextTokenIsNumericOrBigIntLiteral) |
| 6225 | case ast.KindOpenParenToken: |
| 6226 | // Only consider '(' the start of a type if followed by ')', '...', an identifier, a modifier, |
| 6227 | // or something that starts a type. We don't want to consider things like '(1)' a type. |
| 6228 | return !inStartOfParameter && p.lookAhead((*Parser).nextIsParenthesizedOrFunctionType) |
| 6229 | } |
| 6230 | return p.isIdentifier() |
| 6231 | } |
| 6232 | |
| 6233 | func (p *Parser) nextTokenIsNumericOrBigIntLiteral() bool { |
| 6234 | p.nextToken() |
no test coverage detected