Merge pull request #5597 from Microsoft/typesCleanup

Types cleanup
This commit is contained in:
Ron Buckton
2015-11-17 10:54:50 -08:00
5 changed files with 368 additions and 122 deletions
+1 -1
View File
@@ -9879,7 +9879,7 @@ namespace ts {
return type;
}
function checkFunctionExpressionOrObjectLiteralMethodBody(node: FunctionExpression | MethodDeclaration) {
function checkFunctionExpressionOrObjectLiteralMethodBody(node: ArrowFunction | FunctionExpression | MethodDeclaration) {
Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
const isAsync = isAsyncFunctionLike(node);
+26 -26
View File
@@ -1157,7 +1157,7 @@ namespace ts {
}
function parseAnyContextualModifier(): boolean {
return isModifier(token) && tryParse(nextTokenCanFollowModifier);
return isModifierKind(token) && tryParse(nextTokenCanFollowModifier);
}
function canFollowModifier(): boolean {
@@ -2004,7 +2004,7 @@ namespace ts {
}
function isStartOfParameter(): boolean {
return token === SyntaxKind.DotDotDotToken || isIdentifierOrPattern() || isModifier(token) || token === SyntaxKind.AtToken;
return token === SyntaxKind.DotDotDotToken || isIdentifierOrPattern() || isModifierKind(token) || token === SyntaxKind.AtToken;
}
function setModifiers(node: Node, modifiers: ModifiersArray) {
@@ -2025,7 +2025,7 @@ namespace ts {
node.name = parseIdentifierOrPattern();
if (getFullWidth(node.name) === 0 && node.flags === 0 && isModifier(token)) {
if (getFullWidth(node.name) === 0 && node.flags === 0 && isModifierKind(token)) {
// in cases like
// 'use strict'
// function foo(static)
@@ -2132,8 +2132,8 @@ namespace ts {
parseSemicolon();
}
function parseSignatureMember(kind: SyntaxKind): SignatureDeclaration {
const node = <SignatureDeclaration>createNode(kind);
function parseSignatureMember(kind: SyntaxKind): CallSignatureDeclaration | ConstructSignatureDeclaration {
const node = <CallSignatureDeclaration | ConstructSignatureDeclaration>createNode(kind);
if (kind === SyntaxKind.ConstructSignature) {
parseExpected(SyntaxKind.NewKeyword);
}
@@ -2172,7 +2172,7 @@ namespace ts {
return true;
}
if (isModifier(token)) {
if (isModifierKind(token)) {
nextToken();
if (isIdentifier()) {
return true;
@@ -2215,13 +2215,13 @@ namespace ts {
return finishNode(node);
}
function parsePropertyOrMethodSignature(): Declaration {
function parsePropertyOrMethodSignature(): PropertySignature | MethodSignature {
const fullStart = scanner.getStartPos();
const name = parsePropertyName();
const questionToken = parseOptionalToken(SyntaxKind.QuestionToken);
if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
const method = <MethodDeclaration>createNode(SyntaxKind.MethodSignature, fullStart);
const method = <MethodSignature>createNode(SyntaxKind.MethodSignature, fullStart);
method.name = name;
method.questionToken = questionToken;
@@ -2232,7 +2232,7 @@ namespace ts {
return finishNode(method);
}
else {
const property = <PropertyDeclaration>createNode(SyntaxKind.PropertySignature, fullStart);
const property = <PropertySignature>createNode(SyntaxKind.PropertySignature, fullStart);
property.name = name;
property.questionToken = questionToken;
property.type = parseTypeAnnotation();
@@ -2248,7 +2248,7 @@ namespace ts {
case SyntaxKind.OpenBracketToken: // Both for indexers and computed properties
return true;
default:
if (isModifier(token)) {
if (isModifierKind(token)) {
const result = lookAhead(isStartOfIndexSignatureDeclaration);
if (result) {
return result;
@@ -2260,7 +2260,7 @@ namespace ts {
}
function isStartOfIndexSignatureDeclaration() {
while (isModifier(token)) {
while (isModifierKind(token)) {
nextToken();
}
@@ -2276,7 +2276,7 @@ namespace ts {
canParseSemicolon();
}
function parseTypeMember(): Declaration {
function parseTypeMember(): TypeElement {
switch (token) {
case SyntaxKind.OpenParenToken:
case SyntaxKind.LessThanToken:
@@ -2301,7 +2301,7 @@ namespace ts {
// when incrementally parsing as the parser will produce the Index declaration
// if it has the same text regardless of whether it is inside a class or an
// object type.
if (isModifier(token)) {
if (isModifierKind(token)) {
const result = tryParse(parseIndexSignatureWithModifiers);
if (result) {
return result;
@@ -2334,14 +2334,14 @@ namespace ts {
return finishNode(node);
}
function parseObjectTypeMembers(): NodeArray<Declaration> {
let members: NodeArray<Declaration>;
function parseObjectTypeMembers(): NodeArray<TypeElement> {
let members: NodeArray<TypeElement>;
if (parseExpected(SyntaxKind.OpenBraceToken)) {
members = parseList(ParsingContext.TypeMembers, parseTypeMember);
parseExpected(SyntaxKind.CloseBraceToken);
}
else {
members = createMissingList<Declaration>();
members = createMissingList<TypeElement>();
}
return members;
@@ -2483,11 +2483,11 @@ namespace ts {
// ( ...
return true;
}
if (isIdentifier() || isModifier(token)) {
if (isIdentifier() || isModifierKind(token)) {
nextToken();
if (token === SyntaxKind.ColonToken || token === SyntaxKind.CommaToken ||
token === SyntaxKind.QuestionToken || token === SyntaxKind.EqualsToken ||
isIdentifier() || isModifier(token)) {
isIdentifier() || isModifierKind(token)) {
// ( id :
// ( id ,
// ( id ?
@@ -2894,7 +2894,7 @@ namespace ts {
}
// This *could* be a parenthesized arrow function.
// Return Unknown to const the caller know.
// Return Unknown to let the caller know.
return Tristate.Unknown;
}
else {
@@ -2993,7 +2993,7 @@ namespace ts {
// user meant to supply a block. For example, if the user wrote:
//
// a =>
// const v = 0;
// let v = 0;
// }
//
// they may be missing an open brace. Check to see if that's the case so we can
@@ -3220,7 +3220,7 @@ namespace ts {
/**
* Parse ES7 unary expression and await expression
*
*
* ES7 UnaryExpression:
* 1) SimpleUnaryExpression[?yield]
* 2) IncrementExpression[?yield] ** UnaryExpression[?yield]
@@ -4720,7 +4720,7 @@ namespace ts {
return finishNode(node);
}
function parseMethodDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, asteriskToken: Node, name: DeclarationName, questionToken: Node, diagnosticMessage?: DiagnosticMessage): MethodDeclaration {
function parseMethodDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, asteriskToken: Node, name: PropertyName, questionToken: Node, diagnosticMessage?: DiagnosticMessage): MethodDeclaration {
const method = <MethodDeclaration>createNode(SyntaxKind.MethodDeclaration, fullStart);
method.decorators = decorators;
setModifiers(method, modifiers);
@@ -4734,7 +4734,7 @@ namespace ts {
return finishNode(method);
}
function parsePropertyDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, name: DeclarationName, questionToken: Node): ClassElement {
function parsePropertyDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, name: PropertyName, questionToken: Node): ClassElement {
const property = <PropertyDeclaration>createNode(SyntaxKind.PropertyDeclaration, fullStart);
property.decorators = decorators;
setModifiers(property, modifiers);
@@ -4808,7 +4808,7 @@ namespace ts {
}
// Eat up all modifiers, but hold on to the last one in case it is actually an identifier.
while (isModifier(token)) {
while (isModifierKind(token)) {
idToken = token;
// If the idToken is a class modifier (protected, private, public, and static), it is
// certain that we are starting to parse class member. This allows better error recovery
@@ -5018,8 +5018,8 @@ namespace ts {
// implements is a future reserved word so
// 'class implements' might mean either
// - class expression with omitted name, 'implements' starts heritage clause
// - class with name 'implements'
// 'isImplementsClause' helps to disambiguate between these two cases
// - class with name 'implements'
// 'isImplementsClause' helps to disambiguate between these two cases
return isIdentifier() && !isImplementsClause()
? parseIdentifier()
: undefined;
+291 -45
View File
@@ -348,7 +348,7 @@ namespace ts {
LastKeyword = OfKeyword,
FirstFutureReservedWord = ImplementsKeyword,
LastFutureReservedWord = YieldKeyword,
FirstTypeNode = TypeReference,
FirstTypeNode = TypePredicate,
LastTypeNode = ParenthesizedType,
FirstPunctuation = OpenBraceToken,
LastPunctuation = CaretEqualsToken,
@@ -474,15 +474,29 @@ namespace ts {
hasTrailingComma?: boolean;
}
export interface ModifiersArray extends NodeArray<Node> {
export interface ModifiersArray extends NodeArray<Modifier> {
flags: number;
}
// @kind(SyntaxKind.AbstractKeyword)
// @kind(SyntaxKind.AsyncKeyword)
// @kind(SyntaxKind.ConstKeyword)
// @kind(SyntaxKind.DeclareKeyword)
// @kind(SyntaxKind.DefaultKeyword)
// @kind(SyntaxKind.ExportKeyword)
// @kind(SyntaxKind.PublicKeyword)
// @kind(SyntaxKind.PrivateKeyword)
// @kind(SyntaxKind.ProtectedKeyword)
// @kind(SyntaxKind.StaticKeyword)
export interface Modifier extends Node { }
// @kind(SyntaxKind.Identifier)
export interface Identifier extends PrimaryExpression {
text: string; // Text of identifier (with escapes converted to characters)
originalKeywordKind?: SyntaxKind; // Original syntaxKind which get set so that we can report an error later
}
// @kind(SyntaxKind.QualifiedName)
export interface QualifiedName extends Node {
// Must have same layout as PropertyAccess
left: EntityName;
@@ -492,6 +506,7 @@ namespace ts {
export type EntityName = Identifier | QualifiedName;
export type PropertyName = Identifier | LiteralExpression | ComputedPropertyName;
export type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern;
export interface Declaration extends Node {
@@ -499,14 +514,21 @@ namespace ts {
name?: DeclarationName;
}
export interface DeclarationStatement extends Declaration, Statement {
name?: Identifier;
}
// @kind(SyntaxKind.ComputedPropertyName)
export interface ComputedPropertyName extends Node {
expression: Expression;
}
// @kind(SyntaxKind.Decorator)
export interface Decorator extends Node {
expression: LeftHandSideExpression;
}
// @kind(SyntaxKind.TypeParameter)
export interface TypeParameterDeclaration extends Declaration {
name: Identifier;
constraint?: TypeNode;
@@ -516,12 +538,19 @@ namespace ts {
}
export interface SignatureDeclaration extends Declaration {
name?: PropertyName;
typeParameters?: NodeArray<TypeParameterDeclaration>;
parameters: NodeArray<ParameterDeclaration>;
type?: TypeNode;
}
// SyntaxKind.VariableDeclaration
// @kind(SyntaxKind.CallSignature)
export interface CallSignatureDeclaration extends SignatureDeclaration, TypeElement { }
// @kind(SyntaxKind.ConstructSignature)
export interface ConstructSignatureDeclaration extends SignatureDeclaration, TypeElement { }
// @kind(SyntaxKind.VariableDeclaration)
export interface VariableDeclaration extends Declaration {
parent?: VariableDeclarationList;
name: Identifier | BindingPattern; // Declared variable name
@@ -529,11 +558,12 @@ namespace ts {
initializer?: Expression; // Optional initializer
}
// @kind(SyntaxKind.VariableDeclarationList)
export interface VariableDeclarationList extends Node {
declarations: NodeArray<VariableDeclaration>;
}
// SyntaxKind.Parameter
// @kind(SyntaxKind.Parameter)
export interface ParameterDeclaration extends Declaration {
dotDotDotToken?: Node; // Present on rest parameter
name: Identifier | BindingPattern; // Declared parameter name
@@ -542,7 +572,7 @@ namespace ts {
initializer?: Expression; // Optional initializer
}
// SyntaxKind.BindingElement
// @kind(SyntaxKind.BindingElement)
export interface BindingElement extends Declaration {
propertyName?: PropertyName; // Binding property name (in object binding pattern)
dotDotDotToken?: Node; // Present on rest binding element
@@ -550,27 +580,35 @@ namespace ts {
initializer?: Expression; // Optional initializer
}
// SyntaxKind.Property
export interface PropertyDeclaration extends Declaration, ClassElement {
name: DeclarationName; // Declared property name
// @kind(SyntaxKind.PropertySignature)
export interface PropertySignature extends TypeElement {
name: PropertyName; // Declared property name
questionToken?: Node; // Present on optional property
type?: TypeNode; // Optional type annotation
}
// @kind(SyntaxKind.PropertyDeclaration)
export interface PropertyDeclaration extends ClassElement {
questionToken?: Node; // Present for use with reporting a grammar error
name: PropertyName;
type?: TypeNode;
initializer?: Expression; // Optional initializer
}
export interface ObjectLiteralElement extends Declaration {
_objectLiteralBrandBrand: any;
}
name?: PropertyName;
}
// SyntaxKind.PropertyAssignment
// @kind(SyntaxKind.PropertyAssignment)
export interface PropertyAssignment extends ObjectLiteralElement {
_propertyAssignmentBrand: any;
name: DeclarationName;
name: PropertyName;
questionToken?: Node;
initializer: Expression;
}
// SyntaxKind.ShorthandPropertyAssignment
// @kind(SyntaxKind.ShorthandPropertyAssignment)
export interface ShorthandPropertyAssignment extends ObjectLiteralElement {
name: Identifier;
questionToken?: Node;
@@ -596,10 +634,20 @@ namespace ts {
initializer?: Expression;
}
export interface PropertyLikeDeclaration extends Declaration {
name: PropertyName;
}
export interface BindingPattern extends Node {
elements: NodeArray<BindingElement>;
}
// @kind(SyntaxKind.ObjectBindingPattern)
export interface ObjectBindingPattern extends BindingPattern { }
// @kind(SyntaxKind.ArrayBindingPattern)
export interface ArrayBindingPattern extends BindingPattern { }
/**
* Several node kinds share function-like features such as a signature,
* a name, and a body. These nodes should extend FunctionLikeDeclaration.
@@ -616,9 +664,15 @@ namespace ts {
body?: Block | Expression;
}
export interface FunctionDeclaration extends FunctionLikeDeclaration, Statement {
// @kind(SyntaxKind.FunctionDeclaration)
export interface FunctionDeclaration extends FunctionLikeDeclaration, DeclarationStatement {
name?: Identifier;
body?: Block;
body?: FunctionBody;
}
// @kind(SyntaxKind.MethodSignature)
export interface MethodSignature extends SignatureDeclaration, TypeElement {
name: PropertyName;
}
// Note that a MethodDeclaration is considered both a ClassElement and an ObjectLiteralElement.
@@ -630,15 +684,19 @@ namespace ts {
// Because of this, it may be necessary to determine what sort of MethodDeclaration you have
// at later stages of the compiler pipeline. In that case, you can either check the parent kind
// of the method, or use helpers like isObjectLiteralMethodDeclaration
// @kind(SyntaxKind.MethodDeclaration)
export interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
body?: Block;
name: PropertyName;
body?: FunctionBody;
}
// @kind(SyntaxKind.Constructor)
export interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
body?: Block;
body?: FunctionBody;
}
// For when we encounter a semicolon in a class declaration. ES6 allows these as class elements.
// @kind(SyntaxKind.SemicolonClassElement)
export interface SemicolonClassElement extends ClassElement {
_semicolonClassElementBrand: any;
}
@@ -647,13 +705,27 @@ namespace ts {
// ClassElement and an ObjectLiteralElement.
export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
_accessorDeclarationBrand: any;
body: Block;
name: PropertyName;
body: FunctionBody;
}
export interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement {
// @kind(SyntaxKind.GetAccessor)
export interface GetAccessorDeclaration extends AccessorDeclaration { }
// @kind(SyntaxKind.SetAccessor)
export interface SetAccessorDeclaration extends AccessorDeclaration { }
// @kind(SyntaxKind.IndexSignature)
export interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement {
_indexSignatureDeclarationBrand: any;
}
// @kind(SyntaxKind.AnyKeyword)
// @kind(SyntaxKind.NumberKeyword)
// @kind(SyntaxKind.BooleanKeyword)
// @kind(SyntaxKind.StringKeyword)
// @kind(SyntaxKind.SymbolKeyword)
// @kind(SyntaxKind.VoidKeyword)
export interface TypeNode extends Node {
_typeNodeBrand: any;
}
@@ -662,29 +734,41 @@ namespace ts {
_functionOrConstructorTypeNodeBrand: any;
}
// @kind(SyntaxKind.FunctionType)
export interface FunctionTypeNode extends FunctionOrConstructorTypeNode { }
// @kind(SyntaxKind.ConstructorType)
export interface ConstructorTypeNode extends FunctionOrConstructorTypeNode { }
// @kind(SyntaxKind.TypeReference)
export interface TypeReferenceNode extends TypeNode {
typeName: EntityName;
typeArguments?: NodeArray<TypeNode>;
}
// @kind(SyntaxKind.TypePredicate)
export interface TypePredicateNode extends TypeNode {
parameterName: Identifier;
type: TypeNode;
}
// @kind(SyntaxKind.TypeQuery)
export interface TypeQueryNode extends TypeNode {
exprName: EntityName;
}
// A TypeLiteral is the declaration node for an anonymous symbol.
// @kind(SyntaxKind.TypeLiteral)
export interface TypeLiteralNode extends TypeNode, Declaration {
members: NodeArray<Node>;
members: NodeArray<TypeElement>;
}
// @kind(SyntaxKind.ArrayType)
export interface ArrayTypeNode extends TypeNode {
elementType: TypeNode;
}
// @kind(SyntaxKind.TupleType)
export interface TupleTypeNode extends TypeNode {
elementTypes: NodeArray<TypeNode>;
}
@@ -693,16 +777,20 @@ namespace ts {
types: NodeArray<TypeNode>;
}
// @kind(SyntaxKind.UnionType)
export interface UnionTypeNode extends UnionOrIntersectionTypeNode { }
// @kind(SyntaxKind.IntersectionType)
export interface IntersectionTypeNode extends UnionOrIntersectionTypeNode { }
// @kind(SyntaxKind.ParenthesizedType)
export interface ParenthesizedTypeNode extends TypeNode {
type: TypeNode;
}
// Note that a StringLiteral AST node is both an Expression and a TypeNode. The latter is
// because string literals can appear in type annotations as well.
// @kind(SyntaxKind.StringLiteral)
export interface StringLiteral extends LiteralExpression, TypeNode {
_stringLiteralBrand: any;
}
@@ -719,6 +807,9 @@ namespace ts {
contextualType?: Type; // Used to temporarily assign a contextual type during overload resolution
}
// @kind(SyntaxKind.OmittedExpression)
export interface OmittedExpression extends Expression { }
export interface UnaryExpression extends Expression {
_unaryExpressionBrand: any;
}
@@ -727,11 +818,13 @@ namespace ts {
_incrementExpressionBrand: any;
}
// @kind(SyntaxKind.PrefixUnaryExpression)
export interface PrefixUnaryExpression extends IncrementExpression {
operator: SyntaxKind;
operand: UnaryExpression;
}
// @kind(SyntaxKind.PostfixUnaryExpression)
export interface PostfixUnaryExpression extends IncrementExpression {
operand: LeftHandSideExpression;
operator: SyntaxKind;
@@ -749,31 +842,42 @@ namespace ts {
_memberExpressionBrand: any;
}
// @kind(SyntaxKind.TrueKeyword)
// @kind(SyntaxKind.FalseKeyword)
// @kind(SyntaxKind.NullKeyword)
// @kind(SyntaxKind.ThisKeyword)
// @kind(SyntaxKind.SuperKeyword)
export interface PrimaryExpression extends MemberExpression {
_primaryExpressionBrand: any;
}
// @kind(SyntaxKind.DeleteExpression)
export interface DeleteExpression extends UnaryExpression {
expression: UnaryExpression;
}
// @kind(SyntaxKind.TypeOfExpression)
export interface TypeOfExpression extends UnaryExpression {
expression: UnaryExpression;
}
// @kind(SyntaxKind.VoidExpression)
export interface VoidExpression extends UnaryExpression {
expression: UnaryExpression;
}
// @kind(SyntaxKind.AwaitExpression)
export interface AwaitExpression extends UnaryExpression {
expression: UnaryExpression;
}
// @kind(SyntaxKind.YieldExpression)
export interface YieldExpression extends Expression {
asteriskToken?: Node;
expression?: Expression;
}
// @kind(SyntaxKind.BinaryExpression)
// Binary expressions can be declarations if they are 'exports.foo = bar' expressions in JS files
export interface BinaryExpression extends Expression, Declaration {
left: Expression;
@@ -781,6 +885,7 @@ namespace ts {
right: Expression;
}
// @kind(SyntaxKind.ConditionalExpression)
export interface ConditionalExpression extends Expression {
condition: Expression;
questionToken: Node;
@@ -789,24 +894,37 @@ namespace ts {
whenFalse: Expression;
}
export type FunctionBody = Block;
export type ConciseBody = FunctionBody | Expression;
// @kind(SyntaxKind.FunctionExpression)
export interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration {
name?: Identifier;
body: Block | Expression; // Required, whereas the member inherited from FunctionDeclaration is optional
body: FunctionBody; // Required, whereas the member inherited from FunctionDeclaration is optional
}
// @kind(SyntaxKind.ArrowFunction)
export interface ArrowFunction extends Expression, FunctionLikeDeclaration {
equalsGreaterThanToken: Node;
body: ConciseBody;
}
// The text property of a LiteralExpression stores the interpreted value of the literal in text form. For a StringLiteral,
// or any literal of a template, this means quotes have been removed and escapes have been converted to actual characters.
// For a NumericLiteral, the stored value is the toString() representation of the number. For example 1, 1.00, and 1e0 are all stored as just "1".
// @kind(SyntaxKind.NumericLiteral)
// @kind(SyntaxKind.RegularExpressionLiteral)
// @kind(SyntaxKind.NoSubstitutionTemplateLiteral)
// @kind(SyntaxKind.TemplateHead)
// @kind(SyntaxKind.TemplateMiddle)
// @kind(SyntaxKind.TemplateTail)
export interface LiteralExpression extends PrimaryExpression {
text: string;
isUnterminated?: boolean;
hasExtendedUnicodeEscape?: boolean;
}
// @kind(SyntaxKind.TemplateExpression)
export interface TemplateExpression extends PrimaryExpression {
head: LiteralExpression;
templateSpans: NodeArray<TemplateSpan>;
@@ -814,52 +932,63 @@ namespace ts {
// Each of these corresponds to a substitution expression and a template literal, in that order.
// The template literal must have kind TemplateMiddleLiteral or TemplateTailLiteral.
// @kind(SyntaxKind.TemplateSpan)
export interface TemplateSpan extends Node {
expression: Expression;
literal: LiteralExpression;
}
// @kind(SyntaxKind.ParenthesizedExpression)
export interface ParenthesizedExpression extends PrimaryExpression {
expression: Expression;
}
// @kind(SyntaxKind.ArrayLiteralExpression)
export interface ArrayLiteralExpression extends PrimaryExpression {
elements: NodeArray<Expression>;
}
// @kind(SyntaxKind.SpreadElementExpression)
export interface SpreadElementExpression extends Expression {
expression: Expression;
}
// An ObjectLiteralExpression is the declaration node for an anonymous symbol.
// @kind(SyntaxKind.ObjectLiteralExpression)
export interface ObjectLiteralExpression extends PrimaryExpression, Declaration {
properties: NodeArray<ObjectLiteralElement>;
}
// @kind(SyntaxKind.PropertyAccessExpression)
export interface PropertyAccessExpression extends MemberExpression, Declaration {
expression: LeftHandSideExpression;
dotToken: Node;
name: Identifier;
}
// @kind(SyntaxKind.ElementAccessExpression)
export interface ElementAccessExpression extends MemberExpression {
expression: LeftHandSideExpression;
argumentExpression?: Expression;
}
// @kind(SyntaxKind.CallExpression)
export interface CallExpression extends LeftHandSideExpression {
expression: LeftHandSideExpression;
typeArguments?: NodeArray<TypeNode>;
arguments: NodeArray<Expression>;
}
// @kind(SyntaxKind.ExpressionWithTypeArguments)
export interface ExpressionWithTypeArguments extends TypeNode {
expression: LeftHandSideExpression;
typeArguments?: NodeArray<TypeNode>;
}
// @kind(SyntaxKind.NewExpression)
export interface NewExpression extends CallExpression, PrimaryExpression { }
// @kind(SyntaxKind.TaggedTemplateExpression)
export interface TaggedTemplateExpression extends MemberExpression {
tag: LeftHandSideExpression;
template: LiteralExpression | TemplateExpression;
@@ -867,11 +996,13 @@ namespace ts {
export type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
// @kind(SyntaxKind.AsExpression)
export interface AsExpression extends Expression {
expression: Expression;
type: TypeNode;
}
// @kind(SyntaxKind.TypeAssertionExpression)
export interface TypeAssertion extends UnaryExpression {
type: TypeNode;
expression: UnaryExpression;
@@ -880,6 +1011,7 @@ namespace ts {
export type AssertionExpression = TypeAssertion | AsExpression;
/// A JSX expression of the form <TagName attrs>...</TagName>
// @kind(SyntaxKind.JsxElement)
export interface JsxElement extends PrimaryExpression {
openingElement: JsxOpeningElement;
children: NodeArray<JsxChild>;
@@ -887,6 +1019,7 @@ namespace ts {
}
/// The opening element of a <Tag>...</Tag> JsxElement
// @kind(SyntaxKind.JsxOpeningElement)
export interface JsxOpeningElement extends Expression {
_openingElementBrand?: any;
tagName: EntityName;
@@ -894,6 +1027,7 @@ namespace ts {
}
/// A JSX expression of the form <TagName attrs />
// @kind(SyntaxKind.JsxSelfClosingElement)
export interface JsxSelfClosingElement extends PrimaryExpression, JsxOpeningElement {
_selfClosingElementBrand?: any;
}
@@ -901,24 +1035,29 @@ namespace ts {
/// Either the opening tag in a <Tag>...</Tag> pair, or the lone <Tag /> in a self-closing form
export type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement;
// @kind(SyntaxKind.JsxAttribute)
export interface JsxAttribute extends Node {
name: Identifier;
/// JSX attribute initializers are optional; <X y /> is sugar for <X y={true} />
initializer?: Expression;
}
// @kind(SyntaxKind.JsxSpreadAttribute)
export interface JsxSpreadAttribute extends Node {
expression: Expression;
}
// @kind(SyntaxKind.JsxClosingElement)
export interface JsxClosingElement extends Node {
tagName: EntityName;
}
// @kind(SyntaxKind.JsxExpression)
export interface JsxExpression extends Expression {
expression?: Expression;
}
// @kind(SyntaxKind.JsxText)
export interface JsxText extends Node {
_jsxTextExpressionBrand: any;
}
@@ -929,18 +1068,36 @@ namespace ts {
_statementBrand: any;
}
// @kind(SyntaxKind.EmptyStatement)
export interface EmptyStatement extends Statement { }
// @kind(SyntaxKind.DebuggerStatement)
export interface DebuggerStatement extends Statement { }
// @kind(SyntaxKind.MissingDeclaration)
// @factoryhidden("name", true)
export interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement {
name?: Identifier;
}
export type BlockLike = SourceFile | Block | ModuleBlock | CaseClause;
// @kind(SyntaxKind.Block)
export interface Block extends Statement {
statements: NodeArray<Statement>;
}
// @kind(SyntaxKind.VariableStatement)
export interface VariableStatement extends Statement {
declarationList: VariableDeclarationList;
}
// @kind(SyntaxKind.ExpressionStatement)
export interface ExpressionStatement extends Statement {
expression: Expression;
}
// @kind(SyntaxKind.IfStatement)
export interface IfStatement extends Statement {
expression: Expression;
thenStatement: Statement;
@@ -951,78 +1108,101 @@ namespace ts {
statement: Statement;
}
// @kind(SyntaxKind.DoStatement)
export interface DoStatement extends IterationStatement {
expression: Expression;
}
// @kind(SyntaxKind.WhileStatement)
export interface WhileStatement extends IterationStatement {
expression: Expression;
}
// @kind(SyntaxKind.ForStatement)
export interface ForStatement extends IterationStatement {
initializer?: VariableDeclarationList | Expression;
condition?: Expression;
incrementor?: Expression;
}
// @kind(SyntaxKind.ForInStatement)
export interface ForInStatement extends IterationStatement {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
// @kind(SyntaxKind.ForOfStatement)
export interface ForOfStatement extends IterationStatement {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
export interface BreakOrContinueStatement extends Statement {
// @kind(SyntaxKind.BreakStatement)
export interface BreakStatement extends Statement {
label?: Identifier;
}
// @kind(SyntaxKind.ContinueStatement)
export interface ContinueStatement extends Statement {
label?: Identifier;
}
export type BreakOrContinueStatement = BreakStatement | ContinueStatement;
// @kind(SyntaxKind.ReturnStatement)
export interface ReturnStatement extends Statement {
expression?: Expression;
}
// @kind(SyntaxKind.WithStatement)
export interface WithStatement extends Statement {
expression: Expression;
statement: Statement;
}
// @kind(SyntaxKind.SwitchStatement)
export interface SwitchStatement extends Statement {
expression: Expression;
caseBlock: CaseBlock;
}
// @kind(SyntaxKind.CaseBlock)
export interface CaseBlock extends Node {
clauses: NodeArray<CaseOrDefaultClause>;
}
// @kind(SyntaxKind.CaseClause)
export interface CaseClause extends Node {
expression?: Expression;
statements: NodeArray<Statement>;
}
// @kind(SyntaxKind.DefaultClause)
export interface DefaultClause extends Node {
statements: NodeArray<Statement>;
}
export type CaseOrDefaultClause = CaseClause | DefaultClause;
// @kind(SyntaxKind.LabeledStatement)
export interface LabeledStatement extends Statement {
label: Identifier;
statement: Statement;
}
// @kind(SyntaxKind.ThrowStatement)
export interface ThrowStatement extends Statement {
expression: Expression;
}
// @kind(SyntaxKind.TryStatement)
export interface TryStatement extends Statement {
tryBlock: Block;
catchClause?: CatchClause;
finallyBlock?: Block;
}
// @kind(SyntaxKind.CatchClause)
export interface CatchClause extends Node {
variableDeclaration: VariableDeclaration;
block: Block;
@@ -1035,34 +1215,49 @@ namespace ts {
members: NodeArray<ClassElement>;
}
export interface ClassDeclaration extends ClassLikeDeclaration, Statement {
// @kind(SyntaxKind.ClassDeclaration)
export interface ClassDeclaration extends ClassLikeDeclaration, DeclarationStatement {
name?: Identifier;
}
// @kind(SyntaxKind.ClassExpression)
export interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
}
export interface ClassElement extends Declaration {
_classElementBrand: any;
name?: PropertyName;
}
export interface InterfaceDeclaration extends Declaration, Statement {
export interface TypeElement extends Declaration {
_typeElementBrand: any;
name?: PropertyName;
// @factoryparam
questionToken?: Node;
}
// @kind(SyntaxKind.InterfaceDeclaration)
export interface InterfaceDeclaration extends DeclarationStatement {
name: Identifier;
typeParameters?: NodeArray<TypeParameterDeclaration>;
heritageClauses?: NodeArray<HeritageClause>;
members: NodeArray<Declaration>;
members: NodeArray<TypeElement>;
}
// @kind(SyntaxKind.HeritageClause)
export interface HeritageClause extends Node {
token: SyntaxKind;
types?: NodeArray<ExpressionWithTypeArguments>;
}
export interface TypeAliasDeclaration extends Declaration, Statement {
// @kind(SyntaxKind.TypeAliasDeclaration)
export interface TypeAliasDeclaration extends DeclarationStatement {
name: Identifier;
typeParameters?: NodeArray<TypeParameterDeclaration>;
type: TypeNode;
}
// @kind(SyntaxKind.EnumMember)
export interface EnumMember extends Declaration {
// This does include ComputedPropertyName, but the parser will give an error
// if it parses a ComputedPropertyName in an EnumMember
@@ -1070,21 +1265,27 @@ namespace ts {
initializer?: Expression;
}
export interface EnumDeclaration extends Declaration, Statement {
// @kind(SyntaxKind.EnumDeclaration)
export interface EnumDeclaration extends DeclarationStatement {
name: Identifier;
members: NodeArray<EnumMember>;
}
export interface ModuleDeclaration extends Declaration, Statement {
export type ModuleBody = ModuleBlock | ModuleDeclaration;
// @kind(SyntaxKind.ModuleDeclaration)
export interface ModuleDeclaration extends DeclarationStatement {
name: Identifier | LiteralExpression;
body: ModuleBlock | ModuleDeclaration;
}
// @kind(SyntaxKind.ModuleBlock)
export interface ModuleBlock extends Node, Statement {
statements: NodeArray<Statement>;
}
export interface ImportEqualsDeclaration extends Declaration, Statement {
// @kind(SyntaxKind.ImportEqualsDeclaration)
export interface ImportEqualsDeclaration extends DeclarationStatement {
name: Identifier;
// 'EntityName' for an internal module reference, 'ExternalModuleReference' for an external
@@ -1092,6 +1293,7 @@ namespace ts {
moduleReference: EntityName | ExternalModuleReference;
}
// @kind(SyntaxKind.ExternalModuleReference)
export interface ExternalModuleReference extends Node {
expression?: Expression;
}
@@ -1100,6 +1302,7 @@ namespace ts {
// import "mod" => importClause = undefined, moduleSpecifier = "mod"
// In rest of the cases, module specifier is string literal corresponding to module
// ImportClause information is shown at its declaration below.
// @kind(SyntaxKind.ImportDeclaration)
export interface ImportDeclaration extends Statement {
importClause?: ImportClause;
moduleSpecifier: Expression;
@@ -1111,36 +1314,51 @@ namespace ts {
// import d, * as ns from "mod" => name = d, namedBinding: NamespaceImport = { name: ns }
// import { a, b as x } from "mod" => name = undefined, namedBinding: NamedImports = { elements: [{ name: a }, { name: x, propertyName: b}]}
// import d, { a, b as x } from "mod" => name = d, namedBinding: NamedImports = { elements: [{ name: a }, { name: x, propertyName: b}]}
// @kind(SyntaxKind.ImportClause)
export interface ImportClause extends Declaration {
name?: Identifier; // Default binding
namedBindings?: NamespaceImport | NamedImports;
}
// @kind(SyntaxKind.NamespaceImport)
export interface NamespaceImport extends Declaration {
name: Identifier;
}
export interface ExportDeclaration extends Declaration, Statement {
// @kind(SyntaxKind.ExportDeclaration)
export interface ExportDeclaration extends DeclarationStatement {
exportClause?: NamedExports;
moduleSpecifier?: Expression;
}
export interface NamedImportsOrExports extends Node {
elements: NodeArray<ImportOrExportSpecifier>;
// @kind(SyntaxKind.NamedImports)
export interface NamedImports extends Node {
elements: NodeArray<ImportSpecifier>;
}
export type NamedImports = NamedImportsOrExports;
export type NamedExports = NamedImportsOrExports;
// @kind(SyntaxKind.NamedExports)
export interface NamedExports extends Node {
elements: NodeArray<ExportSpecifier>;
}
export interface ImportOrExportSpecifier extends Declaration {
export type NamedImportsOrExports = NamedImports | NamedExports;
// @kind(SyntaxKind.ImportSpecifier)
export interface ImportSpecifier extends Declaration {
propertyName?: Identifier; // Name preceding "as" keyword (or undefined when "as" is absent)
name: Identifier; // Declared name
}
export type ImportSpecifier = ImportOrExportSpecifier;
export type ExportSpecifier = ImportOrExportSpecifier;
// @kind(SyntaxKind.ExportSpecifier)
export interface ExportSpecifier extends Declaration {
propertyName?: Identifier; // Name preceding "as" keyword (or undefined when "as" is absent)
name: Identifier; // Declared name
}
export interface ExportAssignment extends Declaration, Statement {
export type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier;
// @kind(SyntaxKind.ExportAssignment)
export interface ExportAssignment extends DeclarationStatement {
isExportEquals?: boolean;
expression: Expression;
}
@@ -1155,6 +1373,7 @@ namespace ts {
}
// represents a top level: { type } expression in a JSDoc comment.
// @kind(SyntaxKind.JSDocTypeExpression)
export interface JSDocTypeExpression extends Node {
type: JSDocType;
}
@@ -1163,90 +1382,111 @@ namespace ts {
_jsDocTypeBrand: any;
}
// @kind(SyntaxKind.JSDocAllType)
export interface JSDocAllType extends JSDocType {
_JSDocAllTypeBrand: any;
}
// @kind(SyntaxKind.JSDocUnknownType)
export interface JSDocUnknownType extends JSDocType {
_JSDocUnknownTypeBrand: any;
}
// @kind(SyntaxKind.JSDocArrayType)
export interface JSDocArrayType extends JSDocType {
elementType: JSDocType;
}
// @kind(SyntaxKind.JSDocUnionType)
export interface JSDocUnionType extends JSDocType {
types: NodeArray<JSDocType>;
}
// @kind(SyntaxKind.JSDocTupleType)
export interface JSDocTupleType extends JSDocType {
types: NodeArray<JSDocType>;
}
// @kind(SyntaxKind.JSDocNonNullableType)
export interface JSDocNonNullableType extends JSDocType {
type: JSDocType;
}
// @kind(SyntaxKind.JSDocNullableType)
export interface JSDocNullableType extends JSDocType {
type: JSDocType;
}
// @kind(SyntaxKind.JSDocRecordType)
export interface JSDocRecordType extends JSDocType, TypeLiteralNode {
members: NodeArray<JSDocRecordMember>;
}
// @kind(SyntaxKind.JSDocTypeReference)
export interface JSDocTypeReference extends JSDocType {
name: EntityName;
typeArguments: NodeArray<JSDocType>;
}
// @kind(SyntaxKind.JSDocOptionalType)
export interface JSDocOptionalType extends JSDocType {
type: JSDocType;
}
// @kind(SyntaxKind.JSDocFunctionType)
export interface JSDocFunctionType extends JSDocType, SignatureDeclaration {
parameters: NodeArray<ParameterDeclaration>;
type: JSDocType;
}
// @kind(SyntaxKind.JSDocVariadicType)
export interface JSDocVariadicType extends JSDocType {
type: JSDocType;
}
// @kind(SyntaxKind.JSDocConstructorType)
export interface JSDocConstructorType extends JSDocType {
type: JSDocType;
}
// @kind(SyntaxKind.JSDocThisType)
export interface JSDocThisType extends JSDocType {
type: JSDocType;
}
export interface JSDocRecordMember extends PropertyDeclaration {
// @kind(SyntaxKind.JSDocRecordMember)
export interface JSDocRecordMember extends PropertySignature {
name: Identifier | LiteralExpression;
type?: JSDocType;
}
// @kind(SyntaxKind.JSDocComment)
export interface JSDocComment extends Node {
tags: NodeArray<JSDocTag>;
}
// @kind(SyntaxKind.JSDocTag)
export interface JSDocTag extends Node {
atToken: Node;
tagName: Identifier;
}
// @kind(SyntaxKind.JSDocTemplateTag)
export interface JSDocTemplateTag extends JSDocTag {
typeParameters: NodeArray<TypeParameterDeclaration>;
}
// @kind(SyntaxKind.JSDocReturnTag)
export interface JSDocReturnTag extends JSDocTag {
typeExpression: JSDocTypeExpression;
}
// @kind(SyntaxKind.JSDocTypeTag)
export interface JSDocTypeTag extends JSDocTag {
typeExpression: JSDocTypeExpression;
}
// @kind(SyntaxKind.JSDocParameterTag)
export interface JSDocParameterTag extends JSDocTag {
preParameterName?: Identifier;
typeExpression?: JSDocTypeExpression;
@@ -1254,7 +1494,13 @@ namespace ts {
isBracketed: boolean;
}
export interface AmdDependency {
path: string;
name: string;
}
// Source files are declarations when they are external modules.
// @kind(SyntaxKind.SourceFile)
export interface SourceFile extends Declaration {
statements: NodeArray<Statement>;
endOfFileToken: Node;
@@ -1263,7 +1509,7 @@ namespace ts {
/* internal */ path: Path;
text: string;
amdDependencies: {path: string; name: string}[];
amdDependencies: AmdDependency[];
moduleName: string;
referencedFiles: FileReference[];
languageVariant: LanguageVariant;
@@ -2341,7 +2587,7 @@ namespace ts {
export interface ModuleResolutionHost {
fileExists(fileName: string): boolean;
// readFile function is used to read arbitrary text files on disk, i.e. when resolution procedure needs the content of 'package.json'
// to determine location of bundled typings for node module
// to determine location of bundled typings for node module
readFile(fileName: string): string;
}
@@ -2349,7 +2595,7 @@ namespace ts {
resolvedFileName: string;
/*
* Denotes if 'resolvedFileName' is isExternalLibraryImport and thus should be proper external module:
* - be a .d.ts file
* - be a .d.ts file
* - use top level imports\exports
* - don't use tripleslash references
*/
@@ -2372,11 +2618,11 @@ namespace ts {
getNewLine(): string;
/*
* CompilerHost must either implement resolveModuleNames (in case if it wants to be completely in charge of
* module name resolution) or provide implementation for methods from ModuleResolutionHost (in this case compiler
* CompilerHost must either implement resolveModuleNames (in case if it wants to be completely in charge of
* module name resolution) or provide implementation for methods from ModuleResolutionHost (in this case compiler
* will appply built-in module resolution logic and use members of ModuleResolutionHost to ask host specific questions).
* If resolveModuleNames is implemented then implementation for members from ModuleResolutionHost can be just
* 'throw new Error("NotImplemented")'
* If resolveModuleNames is implemented then implementation for members from ModuleResolutionHost can be just
* 'throw new Error("NotImplemented")'
*/
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
}
+2 -2
View File
@@ -1327,7 +1327,7 @@ namespace ts {
}
// True if the given identifier, string literal, or number literal is the name of a declaration node
export function isDeclarationName(name: Node): boolean {
export function isDeclarationName(name: Node): name is Identifier | StringLiteral | LiteralExpression {
if (name.kind !== SyntaxKind.Identifier && name.kind !== SyntaxKind.StringLiteral && name.kind !== SyntaxKind.NumericLiteral) {
return false;
}
@@ -1545,7 +1545,7 @@ namespace ts {
return node.kind === SyntaxKind.Identifier && (<Identifier>node).text === "Symbol";
}
export function isModifier(token: SyntaxKind): boolean {
export function isModifierKind(token: SyntaxKind): boolean {
switch (token) {
case SyntaxKind.AbstractKeyword:
case SyntaxKind.AsyncKeyword:
+48 -48
View File
@@ -132,43 +132,43 @@ namespace ts {
let scanner: Scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true);
let emptyArray: any[] = [];
const jsDocTagNames = [
"augments",
"author",
"argument",
"borrows",
"class",
"constant",
"constructor",
"constructs",
"default",
"deprecated",
"description",
"event",
"example",
"extends",
"field",
"fileOverview",
"function",
"ignore",
"inner",
"lends",
"link",
"memberOf",
"name",
"namespace",
"param",
"private",
"property",
"public",
"requires",
"returns",
"see",
"since",
"static",
"throws",
"type",
"augments",
"author",
"argument",
"borrows",
"class",
"constant",
"constructor",
"constructs",
"default",
"deprecated",
"description",
"event",
"example",
"extends",
"field",
"fileOverview",
"function",
"ignore",
"inner",
"lends",
"link",
"memberOf",
"name",
"namespace",
"param",
"private",
"property",
"public",
"requires",
"returns",
"see",
"since",
"static",
"throws",
"type",
"version"
];
let jsDocCompletionEntries: CompletionEntry[];
@@ -817,7 +817,7 @@ namespace ts {
constructor(kind: SyntaxKind, pos: number, end: number) {
super(kind, pos, end)
}
public update(newText: string, textChangeRange: TextChangeRange): SourceFile {
return updateSourceFile(this, newText, textChangeRange);
}
@@ -1031,7 +1031,7 @@ namespace ts {
/*
* LS host can optionally implement this method if it wants to be completely in charge of module name resolution.
* if implementation is omitted then language service will use built-in module resolution logic and get answers to
* if implementation is omitted then language service will use built-in module resolution logic and get answers to
* host specific questions using 'getScriptSnapshot'.
*/
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
@@ -1861,7 +1861,7 @@ namespace ts {
* - allowNonTsExtensions = true
* - noLib = true
* - noResolve = true
*/
*/
export function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput {
let options = transpileOptions.compilerOptions ? clone(transpileOptions.compilerOptions) : getDefaultCompilerOptions();
@@ -2670,7 +2670,7 @@ namespace ts {
}
}
export function createLanguageService(host: LanguageServiceHost,
export function createLanguageService(host: LanguageServiceHost,
documentRegistry: DocumentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory())): LanguageService {
let syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host);
@@ -2758,10 +2758,10 @@ namespace ts {
getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
writeFile: (fileName, data, writeByteOrderMark) => { },
getCurrentDirectory: () => currentDirectory,
fileExists: (fileName): boolean => {
fileExists: (fileName): boolean => {
// stub missing host functionality
Debug.assert(!host.resolveModuleNames);
return hostCache.getOrCreateEntry(fileName) !== undefined;
return hostCache.getOrCreateEntry(fileName) !== undefined;
},
readFile: (fileName): string => {
// stub missing host functionality
@@ -3167,7 +3167,7 @@ namespace ts {
log("getCompletionData: Is inside comment: " + (new Date().getTime() - start));
if (insideComment) {
// The current position is next to the '@' sign, when no tag name being provided yet.
// The current position is next to the '@' sign, when no tag name being provided yet.
// Provide a full list of tag names
if (hasDocComment(sourceFile, position) && sourceFile.text.charCodeAt(position - 1) === CharacterCodes.at) {
isJsDocTagName = true;
@@ -3200,7 +3200,7 @@ namespace ts {
}
if (!insideJsDocTagExpression) {
// Proceed if the current position is in jsDoc tag expression; otherwise it is a normal
// Proceed if the current position is in jsDoc tag expression; otherwise it is a normal
// comment or the plain text part of a jsDoc comment, so no completion should be available
log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.");
return undefined;
@@ -3721,8 +3721,8 @@ namespace ts {
case SyntaxKind.CloseBraceToken:
if (parent &&
parent.kind === SyntaxKind.JsxExpression &&
parent.parent &&
parent.kind === SyntaxKind.JsxExpression &&
parent.parent &&
(parent.parent.kind === SyntaxKind.JsxAttribute)) {
return <JsxOpeningLikeElement>parent.parent.parent;
}
@@ -3771,7 +3771,7 @@ namespace ts {
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A<T, |
containingNodeKind === SyntaxKind.ArrayBindingPattern || // var [x, y|
containingNodeKind === SyntaxKind.TypeAliasDeclaration; // type Map, K, |
case SyntaxKind.DotToken:
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [.|
@@ -5006,7 +5006,7 @@ namespace ts {
}
break;
default:
if (isModifier(node.kind) && node.parent &&
if (isModifierKind(node.kind) && node.parent &&
(isDeclaration(node.parent) || node.parent.kind === SyntaxKind.VariableStatement)) {
return getModifierOccurrences(node.kind, node.parent);
}