Parse more types in JSDoc function() syntax

Also some cleanup from PR comments
This commit is contained in:
Nathan Shively-Sanders
2017-07-14 14:34:32 -07:00
parent bdc3f1f3f7
commit 172db13306
10 changed files with 30 additions and 86 deletions

View File

@@ -6866,6 +6866,10 @@ namespace ts {
}
}
function isJSDocTypeReference(node: TypeReferenceType): node is TypeReferenceNode {
return node.flags & NodeFlags.JSDoc && node.kind === SyntaxKind.TypeReference;
}
function getPrimitiveTypeFromJSDocTypeReference(node: TypeReferenceNode): Type {
if (isIdentifier(node.typeName)) {
switch (node.typeName.text) {

View File

@@ -2199,7 +2199,11 @@ namespace ts {
}
function isStartOfParameter(): boolean {
return token() === SyntaxKind.DotDotDotToken || isIdentifierOrPattern() || isModifierKind(token()) || token() === SyntaxKind.AtToken || token() === SyntaxKind.ThisKeyword || token() === SyntaxKind.NewKeyword;
return token() === SyntaxKind.DotDotDotToken ||
isIdentifierOrPattern() ||
isModifierKind(token()) ||
token() === SyntaxKind.AtToken || token() === SyntaxKind.ThisKeyword || token() === SyntaxKind.NewKeyword ||
token() === SyntaxKind.StringLiteral || token() === SyntaxKind.NumericLiteral;
}
function parseParameter(): ParameterDeclaration {

View File

@@ -3302,10 +3302,6 @@ namespace ts {
return false;
}
export function isJSDocTypeReference(node: TypeReferenceType): node is TypeReferenceNode {
return node.flags & NodeFlags.JSDoc && node.kind === SyntaxKind.TypeReference;
}
/**
* Formats an enum value as a string for debugging and debug assertions.
*/