Merge branch 'master' of https://github.com/Microsoft/TypeScript into iterators

This commit is contained in:
Jason Freeman
2015-02-23 13:51:16 -08:00
1157 changed files with 53778 additions and 17101 deletions
+4 -1
View File
@@ -65,8 +65,10 @@ var servicesSources = [
return path.join(compilerDirectory, f);
}).concat([
"breakpoints.ts",
"navigateTo.ts",
"navigationBar.ts",
"outliningElementsCollector.ts",
"patternMatcher.ts",
"services.ts",
"shims.ts",
"signatureHelp.ts",
@@ -138,7 +140,8 @@ var harnessSources = [
"incrementalParser.ts",
"services/colorization.ts",
"services/documentRegistry.ts",
"services/preProcessFile.ts"
"services/preProcessFile.ts",
"services/patternMatcher.ts"
].map(function (f) {
return path.join(unittestsDirectory, f);
})).concat([
+39 -39
View File
@@ -1164,7 +1164,7 @@ interface ArrayConstructor {
}
declare var Array: ArrayConstructor;
declare type PropertyKey = string | number | Symbol;
declare type PropertyKey = string | number | symbol;
interface Symbol {
/** Returns a string representation of an object. */
@@ -1173,7 +1173,7 @@ interface Symbol {
/** Returns the primitive value of the specified object. */
valueOf(): Object;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface SymbolConstructor {
@@ -1186,21 +1186,21 @@ interface SymbolConstructor {
* Returns a new unique Symbol value.
* @param description Description of the new Symbol object.
*/
(description?: string|number): Symbol;
(description?: string|number): symbol;
/**
* Returns a Symbol object from the global symbol registry matching the given key if found.
* Otherwise, returns a new symbol with this key.
* @param key key to search for.
*/
for(key: string): Symbol;
for(key: string): symbol;
/**
* Returns a key from the global symbol registry matching the given Symbol if found.
* Otherwise, returns a undefined.
* @param sym Symbol to find the key for.
*/
keyFor(sym: Symbol): string;
keyFor(sym: symbol): string;
// Well-known Symbols
@@ -1208,42 +1208,42 @@ interface SymbolConstructor {
* A method that determines if a constructor object recognizes an object as one of the
* constructors instances. Called by the semantics of the instanceof operator.
*/
hasInstance: Symbol;
hasInstance: symbol;
/**
* A Boolean value that if true indicates that an object should flatten to its array elements
* by Array.prototype.concat.
*/
isConcatSpreadable: Symbol;
isConcatSpreadable: symbol;
/**
* A Boolean value that if true indicates that an object may be used as a regular expression.
*/
isRegExp: Symbol;
isRegExp: symbol;
/**
* A method that returns the default iterator for an object.Called by the semantics of the
* for-of statement.
*/
iterator: Symbol;
iterator: symbol;
/**
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
* abstract operation.
*/
toPrimitive: Symbol;
toPrimitive: symbol;
/**
* A String value that is used in the creation of the default string description of an object.
* Called by the built- in method Object.prototype.toString.
*/
toStringTag: Symbol;
toStringTag: symbol;
/**
* An Object whose own property names are property names that are excluded from the with
* environment bindings of the associated objects.
*/
unscopables: Symbol;
unscopables: symbol;
}
declare var Symbol: SymbolConstructor;
@@ -1274,7 +1274,7 @@ interface ObjectConstructor {
* Returns an array of all symbol properties found directly on object o.
* @param o Object to retrieve the symbols from.
*/
getOwnPropertySymbols(o: any): Symbol[];
getOwnPropertySymbols(o: any): symbol[];
/**
* Returns true if the values are the same value, false otherwise.
@@ -1396,7 +1396,7 @@ interface ArrayLike<T> {
interface Array<T> {
/** Iterator */
// [Symbol.iterator] (): Iterator<T>;
[Symbol.iterator] (): Iterator<T>;
/**
* Returns an array of key, value pairs for every entry in the array
@@ -1495,7 +1495,7 @@ interface ArrayConstructor {
interface String {
/** Iterator */
// [Symbol.iterator] (): Iterator<string>;
[Symbol.iterator] (): Iterator<string>;
/**
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
@@ -1613,12 +1613,12 @@ interface IteratorResult<T> {
}
interface Iterator<T> {
//[Symbol.iterator](): Iterator<T>;
[Symbol.iterator](): Iterator<T>;
next(): IteratorResult<T>;
}
interface Iterable<T> {
//[Symbol.iterator](): Iterator<T>;
[Symbol.iterator](): Iterator<T>;
}
interface GeneratorFunction extends Function {
@@ -1640,7 +1640,7 @@ interface Generator<T> extends Iterator<T> {
next(value?: any): IteratorResult<T>;
throw (exception: any): IteratorResult<T>;
return (value: T): IteratorResult<T>;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface Math {
@@ -1754,11 +1754,11 @@ interface Math {
*/
cbrt(x: number): number;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface RegExp {
// [Symbol.isRegExp]: boolean;
[Symbol.isRegExp]: boolean;
/**
* Matches a string with a regular expression, and returns an array containing the results of
@@ -1815,8 +1815,8 @@ interface Map<K, V> {
set(key: K, value?: V): Map<K, V>;
size: number;
values(): Iterator<V>;
// [Symbol.iterator]():Iterator<[K,V]>;
// [Symbol.toStringTag]: string;
[Symbol.iterator]():Iterator<[K,V]>;
[Symbol.toStringTag]: string;
}
interface MapConstructor {
@@ -1832,7 +1832,7 @@ interface WeakMap<K, V> {
get(key: K): V;
has(key: K): boolean;
set(key: K, value?: V): WeakMap<K, V>;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface WeakMapConstructor {
@@ -1852,8 +1852,8 @@ interface Set<T> {
keys(): Iterator<T>;
size: number;
values(): Iterator<T>;
// [Symbol.iterator]():Iterator<T>;
// [Symbol.toStringTag]: string;
[Symbol.iterator]():Iterator<T>;
[Symbol.toStringTag]: string;
}
interface SetConstructor {
@@ -1868,7 +1868,7 @@ interface WeakSet<T> {
clear(): void;
delete(value: T): boolean;
has(value: T): boolean;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface WeakSetConstructor {
@@ -1879,7 +1879,7 @@ interface WeakSetConstructor {
declare var WeakSet: WeakSetConstructor;
interface JSON {
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
/**
@@ -1899,7 +1899,7 @@ interface ArrayBuffer {
*/
slice(begin: number, end?: number): ArrayBuffer;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface ArrayBufferConstructor {
@@ -2036,7 +2036,7 @@ interface DataView {
*/
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface DataViewConstructor {
@@ -2303,7 +2303,7 @@ interface Int8Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Int8ArrayConstructor {
@@ -2593,7 +2593,7 @@ interface Uint8Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Uint8ArrayConstructor {
@@ -2883,7 +2883,7 @@ interface Uint8ClampedArray {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Uint8ClampedArrayConstructor {
@@ -3173,7 +3173,7 @@ interface Int16Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Int16ArrayConstructor {
@@ -3463,7 +3463,7 @@ interface Uint16Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Uint16ArrayConstructor {
@@ -3753,7 +3753,7 @@ interface Int32Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Int32ArrayConstructor {
@@ -4043,7 +4043,7 @@ interface Uint32Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Uint32ArrayConstructor {
@@ -4333,7 +4333,7 @@ interface Float32Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Float32ArrayConstructor {
@@ -4623,7 +4623,7 @@ interface Float64Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Float64ArrayConstructor {
@@ -4687,7 +4687,7 @@ declare var Reflect: {
getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
getPrototypeOf(target: any): any;
has(target: any, propertyKey: string): boolean;
has(target: any, propertyKey: Symbol): boolean;
has(target: any, propertyKey: symbol): boolean;
isExtensible(target: any): boolean;
ownKeys(target: any): Array<PropertyKey>;
preventExtensions(target: any): boolean;
+39 -39
View File
@@ -1164,7 +1164,7 @@ interface ArrayConstructor {
}
declare var Array: ArrayConstructor;
declare type PropertyKey = string | number | Symbol;
declare type PropertyKey = string | number | symbol;
interface Symbol {
/** Returns a string representation of an object. */
@@ -1173,7 +1173,7 @@ interface Symbol {
/** Returns the primitive value of the specified object. */
valueOf(): Object;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface SymbolConstructor {
@@ -1186,21 +1186,21 @@ interface SymbolConstructor {
* Returns a new unique Symbol value.
* @param description Description of the new Symbol object.
*/
(description?: string|number): Symbol;
(description?: string|number): symbol;
/**
* Returns a Symbol object from the global symbol registry matching the given key if found.
* Otherwise, returns a new symbol with this key.
* @param key key to search for.
*/
for(key: string): Symbol;
for(key: string): symbol;
/**
* Returns a key from the global symbol registry matching the given Symbol if found.
* Otherwise, returns a undefined.
* @param sym Symbol to find the key for.
*/
keyFor(sym: Symbol): string;
keyFor(sym: symbol): string;
// Well-known Symbols
@@ -1208,42 +1208,42 @@ interface SymbolConstructor {
* A method that determines if a constructor object recognizes an object as one of the
* constructors instances. Called by the semantics of the instanceof operator.
*/
hasInstance: Symbol;
hasInstance: symbol;
/**
* A Boolean value that if true indicates that an object should flatten to its array elements
* by Array.prototype.concat.
*/
isConcatSpreadable: Symbol;
isConcatSpreadable: symbol;
/**
* A Boolean value that if true indicates that an object may be used as a regular expression.
*/
isRegExp: Symbol;
isRegExp: symbol;
/**
* A method that returns the default iterator for an object.Called by the semantics of the
* for-of statement.
*/
iterator: Symbol;
iterator: symbol;
/**
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
* abstract operation.
*/
toPrimitive: Symbol;
toPrimitive: symbol;
/**
* A String value that is used in the creation of the default string description of an object.
* Called by the built- in method Object.prototype.toString.
*/
toStringTag: Symbol;
toStringTag: symbol;
/**
* An Object whose own property names are property names that are excluded from the with
* environment bindings of the associated objects.
*/
unscopables: Symbol;
unscopables: symbol;
}
declare var Symbol: SymbolConstructor;
@@ -1274,7 +1274,7 @@ interface ObjectConstructor {
* Returns an array of all symbol properties found directly on object o.
* @param o Object to retrieve the symbols from.
*/
getOwnPropertySymbols(o: any): Symbol[];
getOwnPropertySymbols(o: any): symbol[];
/**
* Returns true if the values are the same value, false otherwise.
@@ -1396,7 +1396,7 @@ interface ArrayLike<T> {
interface Array<T> {
/** Iterator */
// [Symbol.iterator] (): Iterator<T>;
[Symbol.iterator] (): Iterator<T>;
/**
* Returns an array of key, value pairs for every entry in the array
@@ -1495,7 +1495,7 @@ interface ArrayConstructor {
interface String {
/** Iterator */
// [Symbol.iterator] (): Iterator<string>;
[Symbol.iterator] (): Iterator<string>;
/**
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
@@ -1613,12 +1613,12 @@ interface IteratorResult<T> {
}
interface Iterator<T> {
//[Symbol.iterator](): Iterator<T>;
[Symbol.iterator](): Iterator<T>;
next(): IteratorResult<T>;
}
interface Iterable<T> {
//[Symbol.iterator](): Iterator<T>;
[Symbol.iterator](): Iterator<T>;
}
interface GeneratorFunction extends Function {
@@ -1640,7 +1640,7 @@ interface Generator<T> extends Iterator<T> {
next(value?: any): IteratorResult<T>;
throw (exception: any): IteratorResult<T>;
return (value: T): IteratorResult<T>;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface Math {
@@ -1754,11 +1754,11 @@ interface Math {
*/
cbrt(x: number): number;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface RegExp {
// [Symbol.isRegExp]: boolean;
[Symbol.isRegExp]: boolean;
/**
* Matches a string with a regular expression, and returns an array containing the results of
@@ -1815,8 +1815,8 @@ interface Map<K, V> {
set(key: K, value?: V): Map<K, V>;
size: number;
values(): Iterator<V>;
// [Symbol.iterator]():Iterator<[K,V]>;
// [Symbol.toStringTag]: string;
[Symbol.iterator]():Iterator<[K,V]>;
[Symbol.toStringTag]: string;
}
interface MapConstructor {
@@ -1832,7 +1832,7 @@ interface WeakMap<K, V> {
get(key: K): V;
has(key: K): boolean;
set(key: K, value?: V): WeakMap<K, V>;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface WeakMapConstructor {
@@ -1852,8 +1852,8 @@ interface Set<T> {
keys(): Iterator<T>;
size: number;
values(): Iterator<T>;
// [Symbol.iterator]():Iterator<T>;
// [Symbol.toStringTag]: string;
[Symbol.iterator]():Iterator<T>;
[Symbol.toStringTag]: string;
}
interface SetConstructor {
@@ -1868,7 +1868,7 @@ interface WeakSet<T> {
clear(): void;
delete(value: T): boolean;
has(value: T): boolean;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface WeakSetConstructor {
@@ -1879,7 +1879,7 @@ interface WeakSetConstructor {
declare var WeakSet: WeakSetConstructor;
interface JSON {
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
/**
@@ -1899,7 +1899,7 @@ interface ArrayBuffer {
*/
slice(begin: number, end?: number): ArrayBuffer;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface ArrayBufferConstructor {
@@ -2036,7 +2036,7 @@ interface DataView {
*/
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
// [Symbol.toStringTag]: string;
[Symbol.toStringTag]: string;
}
interface DataViewConstructor {
@@ -2303,7 +2303,7 @@ interface Int8Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Int8ArrayConstructor {
@@ -2593,7 +2593,7 @@ interface Uint8Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Uint8ArrayConstructor {
@@ -2883,7 +2883,7 @@ interface Uint8ClampedArray {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Uint8ClampedArrayConstructor {
@@ -3173,7 +3173,7 @@ interface Int16Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Int16ArrayConstructor {
@@ -3463,7 +3463,7 @@ interface Uint16Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Uint16ArrayConstructor {
@@ -3753,7 +3753,7 @@ interface Int32Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Int32ArrayConstructor {
@@ -4043,7 +4043,7 @@ interface Uint32Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Uint32ArrayConstructor {
@@ -4333,7 +4333,7 @@ interface Float32Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Float32ArrayConstructor {
@@ -4623,7 +4623,7 @@ interface Float64Array {
values(): Iterator<number>;
[index: number]: number;
// [Symbol.iterator] (): Iterator<number>;
[Symbol.iterator] (): Iterator<number>;
}
interface Float64ArrayConstructor {
@@ -4687,7 +4687,7 @@ declare var Reflect: {
getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
getPrototypeOf(target: any): any;
has(target: any, propertyKey: string): boolean;
has(target: any, propertyKey: Symbol): boolean;
has(target: any, propertyKey: symbol): boolean;
isExtensible(target: any): boolean;
ownKeys(target: any): Array<PropertyKey>;
preventExtensions(target: any): boolean;
+2507 -1795
View File
File diff suppressed because it is too large Load Diff
+136 -104
View File
@@ -142,110 +142,113 @@ declare module "typescript" {
NumberKeyword = 117,
SetKeyword = 118,
StringKeyword = 119,
TypeKeyword = 120,
QualifiedName = 121,
ComputedPropertyName = 122,
TypeParameter = 123,
Parameter = 124,
PropertySignature = 125,
PropertyDeclaration = 126,
MethodSignature = 127,
MethodDeclaration = 128,
Constructor = 129,
GetAccessor = 130,
SetAccessor = 131,
CallSignature = 132,
ConstructSignature = 133,
IndexSignature = 134,
TypeReference = 135,
FunctionType = 136,
ConstructorType = 137,
TypeQuery = 138,
TypeLiteral = 139,
ArrayType = 140,
TupleType = 141,
UnionType = 142,
ParenthesizedType = 143,
ObjectBindingPattern = 144,
ArrayBindingPattern = 145,
BindingElement = 146,
ArrayLiteralExpression = 147,
ObjectLiteralExpression = 148,
PropertyAccessExpression = 149,
ElementAccessExpression = 150,
CallExpression = 151,
NewExpression = 152,
TaggedTemplateExpression = 153,
TypeAssertionExpression = 154,
ParenthesizedExpression = 155,
FunctionExpression = 156,
ArrowFunction = 157,
DeleteExpression = 158,
TypeOfExpression = 159,
VoidExpression = 160,
PrefixUnaryExpression = 161,
PostfixUnaryExpression = 162,
BinaryExpression = 163,
ConditionalExpression = 164,
TemplateExpression = 165,
YieldExpression = 166,
SpreadElementExpression = 167,
OmittedExpression = 168,
TemplateSpan = 169,
Block = 170,
VariableStatement = 171,
EmptyStatement = 172,
ExpressionStatement = 173,
IfStatement = 174,
DoStatement = 175,
WhileStatement = 176,
ForStatement = 177,
ForInStatement = 178,
ContinueStatement = 179,
BreakStatement = 180,
ReturnStatement = 181,
WithStatement = 182,
SwitchStatement = 183,
LabeledStatement = 184,
ThrowStatement = 185,
TryStatement = 186,
DebuggerStatement = 187,
VariableDeclaration = 188,
VariableDeclarationList = 189,
FunctionDeclaration = 190,
ClassDeclaration = 191,
InterfaceDeclaration = 192,
TypeAliasDeclaration = 193,
EnumDeclaration = 194,
ModuleDeclaration = 195,
ModuleBlock = 196,
ImportDeclaration = 197,
ExportAssignment = 198,
ExternalModuleReference = 199,
CaseClause = 200,
DefaultClause = 201,
HeritageClause = 202,
CatchClause = 203,
PropertyAssignment = 204,
ShorthandPropertyAssignment = 205,
EnumMember = 206,
SourceFile = 207,
SyntaxList = 208,
Count = 209,
SymbolKeyword = 120,
TypeKeyword = 121,
OfKeyword = 122,
QualifiedName = 123,
ComputedPropertyName = 124,
TypeParameter = 125,
Parameter = 126,
PropertySignature = 127,
PropertyDeclaration = 128,
MethodSignature = 129,
MethodDeclaration = 130,
Constructor = 131,
GetAccessor = 132,
SetAccessor = 133,
CallSignature = 134,
ConstructSignature = 135,
IndexSignature = 136,
TypeReference = 137,
FunctionType = 138,
ConstructorType = 139,
TypeQuery = 140,
TypeLiteral = 141,
ArrayType = 142,
TupleType = 143,
UnionType = 144,
ParenthesizedType = 145,
ObjectBindingPattern = 146,
ArrayBindingPattern = 147,
BindingElement = 148,
ArrayLiteralExpression = 149,
ObjectLiteralExpression = 150,
PropertyAccessExpression = 151,
ElementAccessExpression = 152,
CallExpression = 153,
NewExpression = 154,
TaggedTemplateExpression = 155,
TypeAssertionExpression = 156,
ParenthesizedExpression = 157,
FunctionExpression = 158,
ArrowFunction = 159,
DeleteExpression = 160,
TypeOfExpression = 161,
VoidExpression = 162,
PrefixUnaryExpression = 163,
PostfixUnaryExpression = 164,
BinaryExpression = 165,
ConditionalExpression = 166,
TemplateExpression = 167,
YieldExpression = 168,
SpreadElementExpression = 169,
OmittedExpression = 170,
TemplateSpan = 171,
Block = 172,
VariableStatement = 173,
EmptyStatement = 174,
ExpressionStatement = 175,
IfStatement = 176,
DoStatement = 177,
WhileStatement = 178,
ForStatement = 179,
ForInStatement = 180,
ForOfStatement = 181,
ContinueStatement = 182,
BreakStatement = 183,
ReturnStatement = 184,
WithStatement = 185,
SwitchStatement = 186,
LabeledStatement = 187,
ThrowStatement = 188,
TryStatement = 189,
DebuggerStatement = 190,
VariableDeclaration = 191,
VariableDeclarationList = 192,
FunctionDeclaration = 193,
ClassDeclaration = 194,
InterfaceDeclaration = 195,
TypeAliasDeclaration = 196,
EnumDeclaration = 197,
ModuleDeclaration = 198,
ModuleBlock = 199,
ImportDeclaration = 200,
ExportAssignment = 201,
ExternalModuleReference = 202,
CaseClause = 203,
DefaultClause = 204,
HeritageClause = 205,
CatchClause = 206,
PropertyAssignment = 207,
ShorthandPropertyAssignment = 208,
EnumMember = 209,
SourceFile = 210,
SyntaxList = 211,
Count = 212,
FirstAssignment = 52,
LastAssignment = 63,
FirstReservedWord = 65,
LastReservedWord = 100,
FirstKeyword = 65,
LastKeyword = 120,
LastKeyword = 122,
FirstFutureReservedWord = 101,
LastFutureReservedWord = 109,
FirstTypeNode = 135,
LastTypeNode = 143,
FirstTypeNode = 137,
LastTypeNode = 145,
FirstPunctuation = 14,
LastPunctuation = 63,
FirstToken = 0,
LastToken = 120,
LastToken = 122,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -254,7 +257,7 @@ declare module "typescript" {
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 63,
FirstNode = 121,
FirstNode = 123,
}
const enum NodeFlags {
Export = 1,
@@ -487,7 +490,7 @@ declare module "typescript" {
}
interface BinaryExpression extends Expression {
left: Expression;
operator: SyntaxKind;
operatorToken: Node;
right: Expression;
}
interface ConditionalExpression extends Expression {
@@ -585,6 +588,10 @@ declare module "typescript" {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
interface ForOfStatement extends IterationStatement {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
interface BreakOrContinueStatement extends Statement {
label?: Identifier;
}
@@ -994,8 +1001,9 @@ declare module "typescript" {
ObjectLiteral = 131072,
ContainsUndefinedOrNull = 262144,
ContainsObjectLiteral = 524288,
Intrinsic = 127,
Primitive = 510,
ESSymbol = 1048576,
Intrinsic = 1048703,
Primitive = 1049086,
StringLike = 258,
NumberLike = 132,
ObjectType = 48128,
@@ -1281,6 +1289,7 @@ declare module "typescript" {
equals = 61,
exclamation = 33,
greaterThan = 62,
hash = 35,
lessThan = 60,
minus = 45,
openBrace = 123,
@@ -1347,8 +1356,8 @@ declare module "typescript" {
}
function tokenToString(t: SyntaxKind): string;
function computeLineStarts(text: string): number[];
function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number;
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
function getLineStarts(sourceFile: SourceFile): number[];
function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): {
line: number;
@@ -1432,9 +1441,9 @@ declare module "typescript" {
scriptSnapshot: IScriptSnapshot;
nameTable: Map<string>;
getNamedDeclarations(): Declaration[];
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
getLineStarts(): number[];
getPositionFromLineAndCharacter(line: number, character: number): number;
getPositionOfLineAndCharacter(line: number, character: number): number;
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
}
/**
@@ -1496,7 +1505,7 @@ declare module "typescript" {
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getNavigateToItems(searchValue: string): NavigateToItem[];
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
getNavigationBarItems(fileName: string): NavigationBarItem[];
getOutliningSpans(fileName: string): OutliningSpan[];
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
@@ -1571,6 +1580,7 @@ declare module "typescript" {
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
PlaceOpenBraceOnNewLineForFunctions: boolean;
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
[s: string]: boolean | number | string;
}
interface DefinitionInfo {
fileName: string;
@@ -1704,6 +1714,9 @@ declare module "typescript" {
InMultiLineCommentTrivia = 1,
InSingleQuoteStringLiteral = 2,
InDoubleQuoteStringLiteral = 3,
InTemplateHeadOrNoSubstitutionTemplate = 4,
InTemplateMiddleOrTail = 5,
InTemplateSubstitutionPosition = 6,
}
enum TokenClass {
Punctuation = 0,
@@ -1725,7 +1738,26 @@ declare module "typescript" {
classification: TokenClass;
}
interface Classifier {
getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult;
/**
* Gives lexical classifications of tokens on a line without any syntactic context.
* For instance, a token consisting of the text 'string' can be either an identifier
* named 'string' or the keyword 'string', however, because this classifier is not aware,
* it relies on certain heuristics to give acceptable results. For classifications where
* speed trumps accuracy, this function is preferable; however, for true accuracy, the
* syntactic classifier is ideal. In fact, in certain editing scenarios, combining the
* lexical, syntactic, and semantic classifiers may issue the best user experience.
*
* @param text The text of a line to classify.
* @param lexState The state of the lexical classifier at the end of the previous line.
* @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier.
* If there is no syntactic classifier (syntacticClassifierAbsent=true),
* certain heuristics may be used in its place; however, if there is a
* syntactic classifier (syntacticClassifierAbsent=false), certain
* classifications which may be incorrectly categorized will be given
* back as Identifiers in order to allow the syntactic classifier to
* subsume the classification.
*/
getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
}
/**
* The document registry represents a store of SourceFile objects that can be shared between
+30159
View File
File diff suppressed because one or more lines are too long
+136 -104
View File
@@ -142,110 +142,113 @@ declare module ts {
NumberKeyword = 117,
SetKeyword = 118,
StringKeyword = 119,
TypeKeyword = 120,
QualifiedName = 121,
ComputedPropertyName = 122,
TypeParameter = 123,
Parameter = 124,
PropertySignature = 125,
PropertyDeclaration = 126,
MethodSignature = 127,
MethodDeclaration = 128,
Constructor = 129,
GetAccessor = 130,
SetAccessor = 131,
CallSignature = 132,
ConstructSignature = 133,
IndexSignature = 134,
TypeReference = 135,
FunctionType = 136,
ConstructorType = 137,
TypeQuery = 138,
TypeLiteral = 139,
ArrayType = 140,
TupleType = 141,
UnionType = 142,
ParenthesizedType = 143,
ObjectBindingPattern = 144,
ArrayBindingPattern = 145,
BindingElement = 146,
ArrayLiteralExpression = 147,
ObjectLiteralExpression = 148,
PropertyAccessExpression = 149,
ElementAccessExpression = 150,
CallExpression = 151,
NewExpression = 152,
TaggedTemplateExpression = 153,
TypeAssertionExpression = 154,
ParenthesizedExpression = 155,
FunctionExpression = 156,
ArrowFunction = 157,
DeleteExpression = 158,
TypeOfExpression = 159,
VoidExpression = 160,
PrefixUnaryExpression = 161,
PostfixUnaryExpression = 162,
BinaryExpression = 163,
ConditionalExpression = 164,
TemplateExpression = 165,
YieldExpression = 166,
SpreadElementExpression = 167,
OmittedExpression = 168,
TemplateSpan = 169,
Block = 170,
VariableStatement = 171,
EmptyStatement = 172,
ExpressionStatement = 173,
IfStatement = 174,
DoStatement = 175,
WhileStatement = 176,
ForStatement = 177,
ForInStatement = 178,
ContinueStatement = 179,
BreakStatement = 180,
ReturnStatement = 181,
WithStatement = 182,
SwitchStatement = 183,
LabeledStatement = 184,
ThrowStatement = 185,
TryStatement = 186,
DebuggerStatement = 187,
VariableDeclaration = 188,
VariableDeclarationList = 189,
FunctionDeclaration = 190,
ClassDeclaration = 191,
InterfaceDeclaration = 192,
TypeAliasDeclaration = 193,
EnumDeclaration = 194,
ModuleDeclaration = 195,
ModuleBlock = 196,
ImportDeclaration = 197,
ExportAssignment = 198,
ExternalModuleReference = 199,
CaseClause = 200,
DefaultClause = 201,
HeritageClause = 202,
CatchClause = 203,
PropertyAssignment = 204,
ShorthandPropertyAssignment = 205,
EnumMember = 206,
SourceFile = 207,
SyntaxList = 208,
Count = 209,
SymbolKeyword = 120,
TypeKeyword = 121,
OfKeyword = 122,
QualifiedName = 123,
ComputedPropertyName = 124,
TypeParameter = 125,
Parameter = 126,
PropertySignature = 127,
PropertyDeclaration = 128,
MethodSignature = 129,
MethodDeclaration = 130,
Constructor = 131,
GetAccessor = 132,
SetAccessor = 133,
CallSignature = 134,
ConstructSignature = 135,
IndexSignature = 136,
TypeReference = 137,
FunctionType = 138,
ConstructorType = 139,
TypeQuery = 140,
TypeLiteral = 141,
ArrayType = 142,
TupleType = 143,
UnionType = 144,
ParenthesizedType = 145,
ObjectBindingPattern = 146,
ArrayBindingPattern = 147,
BindingElement = 148,
ArrayLiteralExpression = 149,
ObjectLiteralExpression = 150,
PropertyAccessExpression = 151,
ElementAccessExpression = 152,
CallExpression = 153,
NewExpression = 154,
TaggedTemplateExpression = 155,
TypeAssertionExpression = 156,
ParenthesizedExpression = 157,
FunctionExpression = 158,
ArrowFunction = 159,
DeleteExpression = 160,
TypeOfExpression = 161,
VoidExpression = 162,
PrefixUnaryExpression = 163,
PostfixUnaryExpression = 164,
BinaryExpression = 165,
ConditionalExpression = 166,
TemplateExpression = 167,
YieldExpression = 168,
SpreadElementExpression = 169,
OmittedExpression = 170,
TemplateSpan = 171,
Block = 172,
VariableStatement = 173,
EmptyStatement = 174,
ExpressionStatement = 175,
IfStatement = 176,
DoStatement = 177,
WhileStatement = 178,
ForStatement = 179,
ForInStatement = 180,
ForOfStatement = 181,
ContinueStatement = 182,
BreakStatement = 183,
ReturnStatement = 184,
WithStatement = 185,
SwitchStatement = 186,
LabeledStatement = 187,
ThrowStatement = 188,
TryStatement = 189,
DebuggerStatement = 190,
VariableDeclaration = 191,
VariableDeclarationList = 192,
FunctionDeclaration = 193,
ClassDeclaration = 194,
InterfaceDeclaration = 195,
TypeAliasDeclaration = 196,
EnumDeclaration = 197,
ModuleDeclaration = 198,
ModuleBlock = 199,
ImportDeclaration = 200,
ExportAssignment = 201,
ExternalModuleReference = 202,
CaseClause = 203,
DefaultClause = 204,
HeritageClause = 205,
CatchClause = 206,
PropertyAssignment = 207,
ShorthandPropertyAssignment = 208,
EnumMember = 209,
SourceFile = 210,
SyntaxList = 211,
Count = 212,
FirstAssignment = 52,
LastAssignment = 63,
FirstReservedWord = 65,
LastReservedWord = 100,
FirstKeyword = 65,
LastKeyword = 120,
LastKeyword = 122,
FirstFutureReservedWord = 101,
LastFutureReservedWord = 109,
FirstTypeNode = 135,
LastTypeNode = 143,
FirstTypeNode = 137,
LastTypeNode = 145,
FirstPunctuation = 14,
LastPunctuation = 63,
FirstToken = 0,
LastToken = 120,
LastToken = 122,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -254,7 +257,7 @@ declare module ts {
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 63,
FirstNode = 121,
FirstNode = 123,
}
const enum NodeFlags {
Export = 1,
@@ -487,7 +490,7 @@ declare module ts {
}
interface BinaryExpression extends Expression {
left: Expression;
operator: SyntaxKind;
operatorToken: Node;
right: Expression;
}
interface ConditionalExpression extends Expression {
@@ -585,6 +588,10 @@ declare module ts {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
interface ForOfStatement extends IterationStatement {
initializer: VariableDeclarationList | Expression;
expression: Expression;
}
interface BreakOrContinueStatement extends Statement {
label?: Identifier;
}
@@ -994,8 +1001,9 @@ declare module ts {
ObjectLiteral = 131072,
ContainsUndefinedOrNull = 262144,
ContainsObjectLiteral = 524288,
Intrinsic = 127,
Primitive = 510,
ESSymbol = 1048576,
Intrinsic = 1048703,
Primitive = 1049086,
StringLike = 258,
NumberLike = 132,
ObjectType = 48128,
@@ -1281,6 +1289,7 @@ declare module ts {
equals = 61,
exclamation = 33,
greaterThan = 62,
hash = 35,
lessThan = 60,
minus = 45,
openBrace = 123,
@@ -1347,8 +1356,8 @@ declare module ts {
}
function tokenToString(t: SyntaxKind): string;
function computeLineStarts(text: string): number[];
function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number;
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
function getLineStarts(sourceFile: SourceFile): number[];
function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): {
line: number;
@@ -1432,9 +1441,9 @@ declare module ts {
scriptSnapshot: IScriptSnapshot;
nameTable: Map<string>;
getNamedDeclarations(): Declaration[];
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
getLineStarts(): number[];
getPositionFromLineAndCharacter(line: number, character: number): number;
getPositionOfLineAndCharacter(line: number, character: number): number;
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
}
/**
@@ -1496,7 +1505,7 @@ declare module ts {
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getNavigateToItems(searchValue: string): NavigateToItem[];
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
getNavigationBarItems(fileName: string): NavigationBarItem[];
getOutliningSpans(fileName: string): OutliningSpan[];
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
@@ -1571,6 +1580,7 @@ declare module ts {
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
PlaceOpenBraceOnNewLineForFunctions: boolean;
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
[s: string]: boolean | number | string;
}
interface DefinitionInfo {
fileName: string;
@@ -1704,6 +1714,9 @@ declare module ts {
InMultiLineCommentTrivia = 1,
InSingleQuoteStringLiteral = 2,
InDoubleQuoteStringLiteral = 3,
InTemplateHeadOrNoSubstitutionTemplate = 4,
InTemplateMiddleOrTail = 5,
InTemplateSubstitutionPosition = 6,
}
enum TokenClass {
Punctuation = 0,
@@ -1725,7 +1738,26 @@ declare module ts {
classification: TokenClass;
}
interface Classifier {
getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult;
/**
* Gives lexical classifications of tokens on a line without any syntactic context.
* For instance, a token consisting of the text 'string' can be either an identifier
* named 'string' or the keyword 'string', however, because this classifier is not aware,
* it relies on certain heuristics to give acceptable results. For classifications where
* speed trumps accuracy, this function is preferable; however, for true accuracy, the
* syntactic classifier is ideal. In fact, in certain editing scenarios, combining the
* lexical, syntactic, and semantic classifiers may issue the best user experience.
*
* @param text The text of a line to classify.
* @param lexState The state of the lexical classifier at the end of the previous line.
* @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier.
* If there is no syntactic classifier (syntacticClassifierAbsent=true),
* certain heuristics may be used in its place; however, if there is a
* syntactic classifier (syntacticClassifierAbsent=false), certain
* classifications which may be incorrectly categorized will be given
* back as Identifiers in order to allow the syntactic classifier to
* subsume the classification.
*/
getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
}
/**
* The document registry represents a store of SourceFile objects that can be shared between
+4059 -2684
View File
File diff suppressed because it is too large Load Diff
+22 -2
View File
@@ -159,6 +159,7 @@ declare module ts {
function getFullWidth(node: Node): number;
function containsParseError(node: Node): boolean;
function getSourceFileOfNode(node: Node): SourceFile;
function getStartPositionOfLine(line: number, sourceFile: SourceFile): number;
function nodePosToString(node: Node): string;
function getStartPosOfNode(node: Node): number;
function nodeIsMissing(node: Node): boolean;
@@ -216,6 +217,26 @@ declare module ts {
function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult;
function isKeyword(token: SyntaxKind): boolean;
function isTrivia(token: SyntaxKind): boolean;
/**
* A declaration has a dynamic name if both of the following are true:
* 1. The declaration has a computed property name
* 2. The computed name is *not* expressed as Symbol.<name>, where name
* is a property of the Symbol constructor that denotes a built in
* Symbol.
*/
function hasDynamicName(declaration: Declaration): boolean;
/**
* Checks if the expression is of the form:
* Symbol.name
* where Symbol is literally the word "Symbol", and name is any identifierName
*/
function isWellKnownSymbolSyntactically(node: Expression): boolean;
function getPropertyNameForPropertyNameNode(name: DeclarationName): string;
function getPropertyNameForKnownSymbolName(symbolName: string): string;
/**
* Includes the word "Symbol" with unicode escapes
*/
function isESSymbolIdentifier(node: Node): boolean;
function isModifier(token: SyntaxKind): boolean;
function textSpanEnd(span: TextSpan): number;
function textSpanIsEmpty(span: TextSpan): boolean;
@@ -255,8 +276,7 @@ declare module ts {
list: Node;
}
function getEndLinePosition(line: number, sourceFile: SourceFile): number;
function getStartPositionOfLine(line: number, sourceFile: SourceFile): number;
function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number;
function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number;
function rangeContainsRange(r1: TextRange, r2: TextRange): boolean;
function startEndContainsRange(start: number, end: number, range: TextRange): boolean;
function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean;
+22 -2
View File
@@ -159,6 +159,7 @@ declare module "typescript" {
function getFullWidth(node: Node): number;
function containsParseError(node: Node): boolean;
function getSourceFileOfNode(node: Node): SourceFile;
function getStartPositionOfLine(line: number, sourceFile: SourceFile): number;
function nodePosToString(node: Node): string;
function getStartPosOfNode(node: Node): number;
function nodeIsMissing(node: Node): boolean;
@@ -216,6 +217,26 @@ declare module "typescript" {
function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult;
function isKeyword(token: SyntaxKind): boolean;
function isTrivia(token: SyntaxKind): boolean;
/**
* A declaration has a dynamic name if both of the following are true:
* 1. The declaration has a computed property name
* 2. The computed name is *not* expressed as Symbol.<name>, where name
* is a property of the Symbol constructor that denotes a built in
* Symbol.
*/
function hasDynamicName(declaration: Declaration): boolean;
/**
* Checks if the expression is of the form:
* Symbol.name
* where Symbol is literally the word "Symbol", and name is any identifierName
*/
function isWellKnownSymbolSyntactically(node: Expression): boolean;
function getPropertyNameForPropertyNameNode(name: DeclarationName): string;
function getPropertyNameForKnownSymbolName(symbolName: string): string;
/**
* Includes the word "Symbol" with unicode escapes
*/
function isESSymbolIdentifier(node: Node): boolean;
function isModifier(token: SyntaxKind): boolean;
function textSpanEnd(span: TextSpan): number;
function textSpanIsEmpty(span: TextSpan): boolean;
@@ -255,8 +276,7 @@ declare module "typescript" {
list: Node;
}
function getEndLinePosition(line: number, sourceFile: SourceFile): number;
function getStartPositionOfLine(line: number, sourceFile: SourceFile): number;
function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number;
function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number;
function rangeContainsRange(r1: TextRange, r2: TextRange): boolean;
function startEndContainsRange(start: number, end: number, range: TextRange): boolean;
function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean;
+50 -31
View File
@@ -15,12 +15,12 @@ module ts {
if (node.kind === SyntaxKind.InterfaceDeclaration || node.kind === SyntaxKind.TypeAliasDeclaration) {
return ModuleInstanceState.NonInstantiated;
}
// 2. const enum declarations don't make module instantiated
// 2. const enum declarations
else if (isConstEnumDeclaration(node)) {
return ModuleInstanceState.ConstEnumOnly;
}
// 3. non - exported import declarations
else if (node.kind === SyntaxKind.ImportDeclaration && !(node.flags & NodeFlags.Export)) {
// 3. non-exported import declarations
else if ((node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ImportEqualsDeclaration) && !(node.flags & NodeFlags.Export)) {
return ModuleInstanceState.NonInstantiated;
}
// 4. other uninstantiated module declarations.
@@ -179,41 +179,39 @@ module ts {
}
function declareModuleMember(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags) {
// Exported module members are given 2 symbols: A local symbol that is classified with an ExportValue,
// ExportType, or ExportContainer flag, and an associated export symbol with all the correct flags set
// on it. There are 2 main reasons:
//
// 1. We treat locals and exports of the same name as mutually exclusive within a container.
// That means the binder will issue a Duplicate Identifier error if you mix locals and exports
// with the same name in the same container.
// TODO: Make this a more specific error and decouple it from the exclusion logic.
// 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol,
// but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way
// when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope.
var exportKind = 0;
if (symbolKind & SymbolFlags.Value) {
exportKind |= SymbolFlags.ExportValue;
var hasExportModifier = getCombinedNodeFlags(node) & NodeFlags.Export;
if (symbolKind & SymbolFlags.Import) {
if (node.kind === SyntaxKind.ExportSpecifier || (node.kind === SyntaxKind.ImportEqualsDeclaration && hasExportModifier)) {
declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes);
}
else {
declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes);
}
}
if (symbolKind & SymbolFlags.Type) {
exportKind |= SymbolFlags.ExportType;
}
if (symbolKind & SymbolFlags.Namespace) {
exportKind |= SymbolFlags.ExportNamespace;
}
if (getCombinedNodeFlags(node) & NodeFlags.Export || (node.kind !== SyntaxKind.ImportDeclaration && isAmbientContext(container))) {
if (exportKind) {
else {
// Exported module members are given 2 symbols: A local symbol that is classified with an ExportValue,
// ExportType, or ExportContainer flag, and an associated export symbol with all the correct flags set
// on it. There are 2 main reasons:
//
// 1. We treat locals and exports of the same name as mutually exclusive within a container.
// That means the binder will issue a Duplicate Identifier error if you mix locals and exports
// with the same name in the same container.
// TODO: Make this a more specific error and decouple it from the exclusion logic.
// 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol,
// but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way
// when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope.
if (hasExportModifier || isAmbientContext(container)) {
var exportKind = (symbolKind & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) |
(symbolKind & SymbolFlags.Type ? SymbolFlags.ExportType : 0) |
(symbolKind & SymbolFlags.Namespace ? SymbolFlags.ExportNamespace : 0);
var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes);
local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes);
node.localSymbol = local;
}
else {
declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes);
declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes);
}
}
else {
declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes);
}
}
// All container nodes are kept on a linked list in declaration order. This list is used by the getLocalNameOfContainer function
@@ -312,6 +310,13 @@ module ts {
}
}
function bindExportDeclaration(node: ExportDeclaration) {
if (!node.exportClause) {
((<ExportContainer>container).exportStars || ((<ExportContainer>container).exportStars = [])).push(node);
}
bindChildren(node, 0, /*isBlockScopeContainer*/ false);
}
function bindFunctionOrConstructorType(node: SignatureDeclaration) {
// For a given function symbol "<...>(...) => T" we want to generate a symbol identical
// to the one we would get for: { <...>(...): T }
@@ -467,9 +472,23 @@ module ts {
case SyntaxKind.ModuleDeclaration:
bindModuleDeclaration(<ModuleDeclaration>node);
break;
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.NamespaceImport:
case SyntaxKind.ImportSpecifier:
case SyntaxKind.ExportSpecifier:
bindDeclaration(<Declaration>node, SymbolFlags.Import, SymbolFlags.ImportExcludes, /*isBlockScopeContainer*/ false);
break;
case SyntaxKind.ExportDeclaration:
bindExportDeclaration(<ExportDeclaration>node);
break;
case SyntaxKind.ImportClause:
if ((<ImportClause>node).name) {
bindDeclaration(<Declaration>node, SymbolFlags.Import, SymbolFlags.ImportExcludes, /*isBlockScopeContainer*/ false);
}
else {
bindChildren(node, 0, /*isBlockScopeContainer*/ false);
}
break;
case SyntaxKind.SourceFile:
if (isExternalModule(<SourceFile>node)) {
bindAnonymousDeclaration(<SourceFile>node, SymbolFlags.ValueModule, '"' + removeFileExtension((<SourceFile>node).fileName) + '"', /*isBlockScopeContainer*/ true);
+459 -180
View File
File diff suppressed because it is too large Load Diff
@@ -150,6 +150,10 @@ module ts {
Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...of' statement." },
The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...in' statement cannot have an initializer." },
The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." },
An_import_declaration_cannot_have_modifiers: { code: 1191, category: DiagnosticCategory.Error, key: "An import declaration cannot have modifiers." },
External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: DiagnosticCategory.Error, key: "External module '{0}' has no default export or export assignment." },
An_export_declaration_cannot_have_modifiers: { code: 1193, category: DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." },
Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: DiagnosticCategory.Error, key: "Export declarations are not permitted in an internal module." },
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
@@ -278,7 +282,7 @@ module ts {
Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: DiagnosticCategory.Error, key: "Ambient external module declaration cannot specify relative module name." },
Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" },
Import_name_cannot_be_0: { code: 2438, category: DiagnosticCategory.Error, key: "Import name cannot be '{0}'" },
Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: DiagnosticCategory.Error, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." },
Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: DiagnosticCategory.Error, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." },
Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: DiagnosticCategory.Error, key: "Import declaration conflicts with local declaration of '{0}'" },
Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." },
Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: DiagnosticCategory.Error, key: "Types have separate declarations of a private property '{0}'." },
@@ -322,6 +326,7 @@ module ts {
Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." },
for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." },
The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." },
Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: DiagnosticCategory.Error, key: "Export declaration conflicts with exported declaration of '{0}'" },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
+21 -1
View File
@@ -591,6 +591,22 @@
"category": "Error",
"code": 1190
},
"An import declaration cannot have modifiers.": {
"category": "Error",
"code": 1191
},
"External module '{0}' has no default export or export assignment.": {
"category": "Error",
"code": 1192
},
"An export declaration cannot have modifiers.": {
"category": "Error",
"code": 1193
},
"Export declarations are not permitted in an internal module.": {
"category": "Error",
"code": 1194
},
"Duplicate identifier '{0}'.": {
"category": "Error",
@@ -1104,7 +1120,7 @@
"category": "Error",
"code": 2438
},
"Import declaration in an ambient external module declaration cannot reference external module through relative external module name.": {
"Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name.": {
"category": "Error",
"code": 2439
},
@@ -1280,6 +1296,10 @@
"category": "Error",
"code": 2483
},
"Export declaration conflicts with exported declaration of '{0}'": {
"category": "Error",
"code": 2484
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
+816 -219
View File
File diff suppressed because it is too large Load Diff
+267 -81
View File
@@ -152,6 +152,7 @@ module ts {
return visitNode(cbNode, (<PostfixUnaryExpression>node).operand);
case SyntaxKind.BinaryExpression:
return visitNode(cbNode, (<BinaryExpression>node).left) ||
visitNode(cbNode, (<BinaryExpression>node).operatorToken) ||
visitNode(cbNode, (<BinaryExpression>node).right);
case SyntaxKind.ConditionalExpression:
return visitNode(cbNode, (<ConditionalExpression>node).condition) ||
@@ -251,10 +252,30 @@ module ts {
return visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<ModuleDeclaration>node).name) ||
visitNode(cbNode, (<ModuleDeclaration>node).body);
case SyntaxKind.ImportEqualsDeclaration:
return visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<ImportEqualsDeclaration>node).name) ||
visitNode(cbNode, (<ImportEqualsDeclaration>node).moduleReference);
case SyntaxKind.ImportDeclaration:
return visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<ImportDeclaration>node).name) ||
visitNode(cbNode, (<ImportDeclaration>node).moduleReference);
visitNode(cbNode, (<ImportDeclaration>node).importClause) ||
visitNode(cbNode, (<ImportDeclaration>node).moduleSpecifier);
case SyntaxKind.ImportClause:
return visitNode(cbNode, (<ImportClause>node).name) ||
visitNode(cbNode, (<ImportClause>node).namedBindings);
case SyntaxKind.NamespaceImport:
return visitNode(cbNode, (<NamespaceImport>node).name);
case SyntaxKind.NamedImports:
case SyntaxKind.NamedExports:
return visitNodes(cbNodes, (<NamedImportsOrExports>node).elements);
case SyntaxKind.ExportDeclaration:
return visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<ExportDeclaration>node).exportClause) ||
visitNode(cbNode, (<ExportDeclaration>node).moduleSpecifier);
case SyntaxKind.ImportSpecifier:
case SyntaxKind.ExportSpecifier:
return visitNode(cbNode, (<ImportOrExportSpecifier>node).propertyName) ||
visitNode(cbNode, (<ImportOrExportSpecifier>node).name);
case SyntaxKind.ExportAssignment:
return visitNodes(cbNodes, node.modifiers) ||
visitNode(cbNode, (<ExportAssignment>node).exportName);
@@ -272,27 +293,28 @@ module ts {
}
const enum ParsingContext {
SourceElements, // Elements in source file
ModuleElements, // Elements in module declaration
BlockStatements, // Statements in block
SwitchClauses, // Clauses in switch statement
SwitchClauseStatements, // Statements in switch clause
TypeMembers, // Members in interface or type literal
ClassMembers, // Members in class declaration
EnumMembers, // Members in enum declaration
TypeReferences, // Type references in extends or implements clause
VariableDeclarations, // Variable declarations in variable statement
ObjectBindingElements, // Binding elements in object binding list
ArrayBindingElements, // Binding elements in array binding list
ArgumentExpressions, // Expressions in argument list
ObjectLiteralMembers, // Members in object literal
ArrayLiteralMembers, // Members in array literal
Parameters, // Parameters in parameter list
TypeParameters, // Type parameters in type parameter list
TypeArguments, // Type arguments in type argument list
TupleElementTypes, // Element types in tuple element type list
HeritageClauses, // Heritage clauses for a class or interface declaration.
Count // Number of parsing contexts
SourceElements, // Elements in source file
ModuleElements, // Elements in module declaration
BlockStatements, // Statements in block
SwitchClauses, // Clauses in switch statement
SwitchClauseStatements, // Statements in switch clause
TypeMembers, // Members in interface or type literal
ClassMembers, // Members in class declaration
EnumMembers, // Members in enum declaration
TypeReferences, // Type references in extends or implements clause
VariableDeclarations, // Variable declarations in variable statement
ObjectBindingElements, // Binding elements in object binding list
ArrayBindingElements, // Binding elements in array binding list
ArgumentExpressions, // Expressions in argument list
ObjectLiteralMembers, // Members in object literal
ArrayLiteralMembers, // Members in array literal
Parameters, // Parameters in parameter list
TypeParameters, // Type parameters in type parameter list
TypeArguments, // Type arguments in type argument list
TupleElementTypes, // Element types in tuple element type list
HeritageClauses, // Heritage clauses for a class or interface declaration.
ImportOrExportSpecifiers, // Named import clause's import specifier list
Count // Number of parsing contexts
}
const enum Tristate {
@@ -303,26 +325,27 @@ module ts {
function parsingContextErrors(context: ParsingContext): DiagnosticMessage {
switch (context) {
case ParsingContext.SourceElements: return Diagnostics.Declaration_or_statement_expected;
case ParsingContext.ModuleElements: return Diagnostics.Declaration_or_statement_expected;
case ParsingContext.BlockStatements: return Diagnostics.Statement_expected;
case ParsingContext.SwitchClauses: return Diagnostics.case_or_default_expected;
case ParsingContext.SwitchClauseStatements: return Diagnostics.Statement_expected;
case ParsingContext.TypeMembers: return Diagnostics.Property_or_signature_expected;
case ParsingContext.ClassMembers: return Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected;
case ParsingContext.EnumMembers: return Diagnostics.Enum_member_expected;
case ParsingContext.TypeReferences: return Diagnostics.Type_reference_expected;
case ParsingContext.VariableDeclarations: return Diagnostics.Variable_declaration_expected;
case ParsingContext.ObjectBindingElements: return Diagnostics.Property_destructuring_pattern_expected;
case ParsingContext.ArrayBindingElements: return Diagnostics.Array_element_destructuring_pattern_expected;
case ParsingContext.ArgumentExpressions: return Diagnostics.Argument_expression_expected;
case ParsingContext.ObjectLiteralMembers: return Diagnostics.Property_assignment_expected;
case ParsingContext.ArrayLiteralMembers: return Diagnostics.Expression_or_comma_expected;
case ParsingContext.Parameters: return Diagnostics.Parameter_declaration_expected;
case ParsingContext.TypeParameters: return Diagnostics.Type_parameter_declaration_expected;
case ParsingContext.TypeArguments: return Diagnostics.Type_argument_expected;
case ParsingContext.TupleElementTypes: return Diagnostics.Type_expected;
case ParsingContext.HeritageClauses: return Diagnostics.Unexpected_token_expected;
case ParsingContext.SourceElements: return Diagnostics.Declaration_or_statement_expected;
case ParsingContext.ModuleElements: return Diagnostics.Declaration_or_statement_expected;
case ParsingContext.BlockStatements: return Diagnostics.Statement_expected;
case ParsingContext.SwitchClauses: return Diagnostics.case_or_default_expected;
case ParsingContext.SwitchClauseStatements: return Diagnostics.Statement_expected;
case ParsingContext.TypeMembers: return Diagnostics.Property_or_signature_expected;
case ParsingContext.ClassMembers: return Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected;
case ParsingContext.EnumMembers: return Diagnostics.Enum_member_expected;
case ParsingContext.TypeReferences: return Diagnostics.Type_reference_expected;
case ParsingContext.VariableDeclarations: return Diagnostics.Variable_declaration_expected;
case ParsingContext.ObjectBindingElements: return Diagnostics.Property_destructuring_pattern_expected;
case ParsingContext.ArrayBindingElements: return Diagnostics.Array_element_destructuring_pattern_expected;
case ParsingContext.ArgumentExpressions: return Diagnostics.Argument_expression_expected;
case ParsingContext.ObjectLiteralMembers: return Diagnostics.Property_assignment_expected;
case ParsingContext.ArrayLiteralMembers: return Diagnostics.Expression_or_comma_expected;
case ParsingContext.Parameters: return Diagnostics.Parameter_declaration_expected;
case ParsingContext.TypeParameters: return Diagnostics.Type_parameter_declaration_expected;
case ParsingContext.TypeArguments: return Diagnostics.Type_argument_expected;
case ParsingContext.TupleElementTypes: return Diagnostics.Type_expected;
case ParsingContext.HeritageClauses: return Diagnostics.Unexpected_token_expected;
case ParsingContext.ImportOrExportSpecifiers: return Diagnostics.Identifier_expected;
}
};
@@ -1311,6 +1334,12 @@ module ts {
return undefined;
}
function parseTokenNode<T extends Node>(): T {
var node = <T>createNode(token);
nextToken();
return finishNode(node);
}
function canParseSemicolon() {
// If there's a real semicolon, then we can always parse it out.
if (token === SyntaxKind.SemicolonToken) {
@@ -1469,7 +1498,10 @@ module ts {
// 'const' is only a modifier if followed by 'enum'.
return nextToken() === SyntaxKind.EnumKeyword;
}
if (token === SyntaxKind.ExportKeyword) {
nextToken();
return token !== SyntaxKind.AsteriskToken && token !== SyntaxKind.OpenBraceToken && canFollowModifier();
}
nextToken();
return canFollowModifier();
}
@@ -1529,6 +1561,8 @@ module ts {
return token === SyntaxKind.CommaToken || isStartOfType();
case ParsingContext.HeritageClauses:
return isHeritageClause();
case ParsingContext.ImportOrExportSpecifiers:
return isIdentifierOrKeyword();
}
Debug.fail("Non-exhaustive case in 'isListElement'.");
@@ -1565,6 +1599,7 @@ module ts {
case ParsingContext.EnumMembers:
case ParsingContext.ObjectLiteralMembers:
case ParsingContext.ObjectBindingElements:
case ParsingContext.ImportOrExportSpecifiers:
return token === SyntaxKind.CloseBraceToken;
case ParsingContext.SwitchClauseStatements:
return token === SyntaxKind.CloseBraceToken || token === SyntaxKind.CaseKeyword || token === SyntaxKind.DefaultKeyword;
@@ -1590,7 +1625,6 @@ module ts {
return token === SyntaxKind.GreaterThanToken || token === SyntaxKind.OpenParenToken;
case ParsingContext.HeritageClauses:
return token === SyntaxKind.OpenBraceToken || token === SyntaxKind.CloseBraceToken;
}
}
@@ -1825,6 +1859,8 @@ module ts {
if (node) {
switch (node.kind) {
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.ExportDeclaration:
case SyntaxKind.ExportAssignment:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
@@ -2084,14 +2120,6 @@ module ts {
return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
}
function parseTokenNode<T extends Node>(): T {
var node = <T>createNode(token);
nextToken();
return finishNode(node);
}
function parseTemplateExpression(): TemplateExpression {
var template = <TemplateExpression>createNode(SyntaxKind.TemplateExpression);
@@ -2801,8 +2829,9 @@ module ts {
// Expression[in] , AssignmentExpression[in]
var expr = parseAssignmentExpressionOrHigher();
while (parseOptional(SyntaxKind.CommaToken)) {
expr = makeBinaryExpression(expr, SyntaxKind.CommaToken, parseAssignmentExpressionOrHigher());
var operatorToken: Node;
while ((operatorToken = parseOptionalToken(SyntaxKind.CommaToken))) {
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher());
}
return expr;
}
@@ -2881,9 +2910,7 @@ module ts {
// Note: we call reScanGreaterToken so that we get an appropriately merged token
// for cases like > > = becoming >>=
if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) {
var operator = token;
nextToken();
return makeBinaryExpression(expr, operator, parseAssignmentExpressionOrHigher());
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher());
}
// It wasn't an assignment or a lambda. This is a conditional expression:
@@ -3187,9 +3214,7 @@ module ts {
break;
}
var operator = token;
nextToken();
leftOperand = makeBinaryExpression(leftOperand, operator, parseBinaryExpressionOrHigher(newPrecedence));
leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence));
}
return leftOperand;
@@ -3245,10 +3270,10 @@ module ts {
return -1;
}
function makeBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression): BinaryExpression {
function makeBinaryExpression(left: Expression, operatorToken: Node, right: Expression): BinaryExpression {
var node = <BinaryExpression>createNode(SyntaxKind.BinaryExpression, left.pos);
node.left = left;
node.operator = operator;
node.operatorToken = operatorToken;
node.right = right;
return finishNode(node);
}
@@ -4626,15 +4651,75 @@ module ts {
return nextToken() === SyntaxKind.OpenParenToken;
}
function parseImportDeclaration(fullStart: number, modifiers: ModifiersArray): ImportDeclaration {
var node = <ImportDeclaration>createNode(SyntaxKind.ImportDeclaration, fullStart);
setModifiers(node, modifiers);
function nextTokenIsCommaOrFromKeyword() {
nextToken();
return token === SyntaxKind.CommaToken ||
token === SyntaxKind.FromKeyword;
}
function parseImportDeclarationOrImportEqualsDeclaration(fullStart: number, modifiers: ModifiersArray): ImportEqualsDeclaration | ImportDeclaration {
parseExpected(SyntaxKind.ImportKeyword);
node.name = parseIdentifier();
parseExpected(SyntaxKind.EqualsToken);
node.moduleReference = parseModuleReference();
var afterImportPos = scanner.getStartPos();
var identifier: Identifier;
if (isIdentifier()) {
identifier = parseIdentifier();
if (token !== SyntaxKind.CommaToken && token !== SyntaxKind.FromKeyword) {
// ImportEquals declaration of type:
// import x = require("mod"); or
// import x = M.x;
var importEqualsDeclaration = <ImportEqualsDeclaration>createNode(SyntaxKind.ImportEqualsDeclaration, fullStart);
setModifiers(importEqualsDeclaration, modifiers);
importEqualsDeclaration.name = identifier;
parseExpected(SyntaxKind.EqualsToken);
importEqualsDeclaration.moduleReference = parseModuleReference();
parseSemicolon();
return finishNode(importEqualsDeclaration);
}
}
// Import statement
var importDeclaration = <ImportDeclaration>createNode(SyntaxKind.ImportDeclaration, fullStart);
setModifiers(importDeclaration, modifiers);
// ImportDeclaration:
// import ImportClause from ModuleSpecifier ;
// import ModuleSpecifier;
if (identifier || // import id
token === SyntaxKind.AsteriskToken || // import *
token === SyntaxKind.OpenBraceToken) { // import {
importDeclaration.importClause = parseImportClause(identifier, afterImportPos);
parseExpected(SyntaxKind.FromKeyword);
}
importDeclaration.moduleSpecifier = parseModuleSpecifier();
parseSemicolon();
return finishNode(node);
return finishNode(importDeclaration);
}
function parseImportClause(identifier: Identifier, fullStart: number) {
//ImportClause:
// ImportedDefaultBinding
// NameSpaceImport
// NamedImports
// ImportedDefaultBinding, NameSpaceImport
// ImportedDefaultBinding, NamedImports
var importClause = <ImportClause>createNode(SyntaxKind.ImportClause, fullStart);
if (identifier) {
// ImportedDefaultBinding:
// ImportedBinding
importClause.name = identifier;
}
// If there was no default import or if there is comma token after default import
// parse namespace or named imports
if (!importClause.name ||
parseOptional(SyntaxKind.CommaToken)) {
importClause.namedBindings = token === SyntaxKind.AsteriskToken ? parseNamespaceImport() : parseNamedImportsOrExports(SyntaxKind.NamedImports);
}
return finishNode(importClause);
}
function parseModuleReference() {
@@ -4647,19 +4732,102 @@ module ts {
var node = <ExternalModuleReference>createNode(SyntaxKind.ExternalModuleReference);
parseExpected(SyntaxKind.RequireKeyword);
parseExpected(SyntaxKind.OpenParenToken);
node.expression = parseModuleSpecifier();
parseExpected(SyntaxKind.CloseParenToken);
return finishNode(node);
}
function parseModuleSpecifier(): Expression {
// We allow arbitrary expressions here, even though the grammar only allows string
// literals. We check to ensure that it is only a string literal later in the grammar
// walker.
node.expression = parseExpression();
var result = parseExpression();
// Ensure the string being required is in our 'identifier' table. This will ensure
// that features like 'find refs' will look inside this file when search for its name.
if (node.expression.kind === SyntaxKind.StringLiteral) {
internIdentifier((<LiteralExpression>node.expression).text);
if (result.kind === SyntaxKind.StringLiteral) {
internIdentifier((<LiteralExpression>result).text);
}
return result;
}
function parseNamespaceImport(): NamespaceImport {
// NameSpaceImport:
// * as ImportedBinding
var namespaceImport = <NamespaceImport>createNode(SyntaxKind.NamespaceImport);
parseExpected(SyntaxKind.AsteriskToken);
parseExpected(SyntaxKind.AsKeyword);
namespaceImport.name = parseIdentifier();
return finishNode(namespaceImport);
}
function parseNamedImportsOrExports(kind: SyntaxKind): NamedImportsOrExports {
var node = <NamedImports>createNode(kind);
// NamedImports:
// { }
// { ImportsList }
// { ImportsList, }
// ImportsList:
// ImportSpecifier
// ImportsList, ImportSpecifier
node.elements = parseBracketedList(ParsingContext.ImportOrExportSpecifiers,
kind === SyntaxKind.NamedImports ? parseImportSpecifier : parseExportSpecifier,
SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken);
return finishNode(node);
}
function parseExportSpecifier() {
return parseImportOrExportSpecifier(SyntaxKind.ExportSpecifier);
}
function parseImportSpecifier() {
return parseImportOrExportSpecifier(SyntaxKind.ImportSpecifier);
}
function parseImportOrExportSpecifier(kind: SyntaxKind): ImportOrExportSpecifier {
var node = <ImportSpecifier>createNode(kind);
// ImportSpecifier:
// ImportedBinding
// IdentifierName as ImportedBinding
var isFirstIdentifierNameNotAnIdentifier = isKeyword(token) && !isIdentifier();
var start = scanner.getTokenPos();
var identifierName = parseIdentifierName();
if (token === SyntaxKind.AsKeyword) {
node.propertyName = identifierName;
parseExpected(SyntaxKind.AsKeyword);
if (isIdentifier()) {
node.name = parseIdentifierName();
}
else {
parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
}
}
else {
node.name = identifierName;
if (isFirstIdentifierNameNotAnIdentifier) {
// Report error identifier expected
parseErrorAtPosition(start, identifierName.end - start, Diagnostics.Identifier_expected);
}
}
parseExpected(SyntaxKind.CloseParenToken);
return finishNode(node);
}
function parseExportDeclaration(fullStart: number, modifiers: ModifiersArray): ExportDeclaration {
var node = <ExportDeclaration>createNode(SyntaxKind.ExportDeclaration, fullStart);
setModifiers(node, modifiers);
if (parseOptional(SyntaxKind.AsteriskToken)) {
parseExpected(SyntaxKind.FromKeyword);
node.moduleSpecifier = parseModuleSpecifier();
}
else {
node.exportClause = parseNamedImportsOrExports(SyntaxKind.NamedExports);
if (parseOptional(SyntaxKind.FromKeyword)) {
node.moduleSpecifier = parseModuleSpecifier();
}
}
parseSemicolon();
return finishNode(node);
}
@@ -4688,16 +4856,18 @@ module ts {
case SyntaxKind.ClassKeyword:
case SyntaxKind.InterfaceKeyword:
case SyntaxKind.EnumKeyword:
case SyntaxKind.ImportKeyword:
case SyntaxKind.TypeKeyword:
// Not true keywords so ensure an identifier follows
return lookAhead(nextTokenIsIdentifierOrKeyword);
case SyntaxKind.ImportKeyword:
// Not true keywords so ensure an identifier follows or is string literal or asterisk or open brace
return lookAhead(nextTokenCanFollowImportKeyword);
case SyntaxKind.ModuleKeyword:
// Not a true keyword so ensure an identifier or string literal follows
return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral);
case SyntaxKind.ExportKeyword:
// Check for export assignment or modifier on source element
return lookAhead(nextTokenIsEqualsTokenOrDeclarationStart);
return lookAhead(nextTokenCanFollowExportKeyword);
case SyntaxKind.DeclareKeyword:
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
@@ -4722,9 +4892,16 @@ module ts {
return isIdentifierOrKeyword() || token === SyntaxKind.StringLiteral;
}
function nextTokenIsEqualsTokenOrDeclarationStart() {
function nextTokenCanFollowImportKeyword() {
nextToken();
return token === SyntaxKind.EqualsToken || isDeclarationStart();
return isIdentifierOrKeyword() || token === SyntaxKind.StringLiteral ||
token === SyntaxKind.AsteriskToken || token === SyntaxKind.OpenBraceToken;
}
function nextTokenCanFollowExportKeyword() {
nextToken();
return token === SyntaxKind.EqualsToken || token === SyntaxKind.AsteriskToken ||
token === SyntaxKind.OpenBraceToken || isDeclarationStart();
}
function nextTokenIsDeclarationStart() {
@@ -4732,6 +4909,10 @@ module ts {
return isDeclarationStart();
}
function nextTokenIsAsKeyword() {
return nextToken() === SyntaxKind.AsKeyword;
}
function parseDeclaration(): ModuleElement {
var fullStart = getNodePos();
var modifiers = parseModifiers();
@@ -4740,6 +4921,9 @@ module ts {
if (parseOptional(SyntaxKind.EqualsToken)) {
return parseExportAssignmentTail(fullStart, modifiers);
}
if (token === SyntaxKind.AsteriskToken || token === SyntaxKind.OpenBraceToken) {
return parseExportDeclaration(fullStart, modifiers);
}
}
switch (token) {
@@ -4760,7 +4944,7 @@ module ts {
case SyntaxKind.ModuleKeyword:
return parseModuleDeclaration(fullStart, modifiers);
case SyntaxKind.ImportKeyword:
return parseImportDeclaration(fullStart, modifiers);
return parseImportDeclarationOrImportEqualsDeclaration(fullStart, modifiers);
default:
Debug.fail("Mismatch between isDeclarationStart and parseDeclaration");
}
@@ -4850,8 +5034,10 @@ module ts {
function setExternalModuleIndicator(sourceFile: SourceFile) {
sourceFile.externalModuleIndicator = forEach(sourceFile.statements, node =>
node.flags & NodeFlags.Export
|| node.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node).moduleReference.kind === SyntaxKind.ExternalModuleReference
|| node.kind === SyntaxKind.ImportEqualsDeclaration && (<ImportEqualsDeclaration>node).moduleReference.kind === SyntaxKind.ExternalModuleReference
|| node.kind === SyntaxKind.ImportDeclaration
|| node.kind === SyntaxKind.ExportAssignment
|| node.kind === SyntaxKind.ExportDeclaration
? node
: undefined);
}
+20 -21
View File
@@ -351,24 +351,23 @@ module ts {
function processImportedModules(file: SourceFile, basePath: string) {
forEach(file.statements, node => {
if (isExternalModuleImportDeclaration(node) &&
getExternalModuleImportDeclarationExpression(node).kind === SyntaxKind.StringLiteral) {
var nameLiteral = <LiteralExpression>getExternalModuleImportDeclarationExpression(node);
var moduleName = nameLiteral.text;
if (moduleName) {
var searchPath = basePath;
while (true) {
var searchName = normalizePath(combinePaths(searchPath, moduleName));
if (findModuleSourceFile(searchName + ".ts", nameLiteral) || findModuleSourceFile(searchName + ".d.ts", nameLiteral)) {
break;
if (node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ImportEqualsDeclaration || node.kind === SyntaxKind.ExportDeclaration) {
var moduleNameExpr = getExternalModuleName(node);
if (moduleNameExpr && moduleNameExpr.kind === SyntaxKind.StringLiteral) {
var moduleNameText = (<LiteralExpression>moduleNameExpr).text;
if (moduleNameText) {
var searchPath = basePath;
while (true) {
var searchName = normalizePath(combinePaths(searchPath, moduleNameText));
if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) {
break;
}
var parentPath = getDirectoryPath(searchPath);
if (parentPath === searchPath) {
break;
}
searchPath = parentPath;
}
var parentPath = getDirectoryPath(searchPath);
if (parentPath === searchPath) {
break;
}
searchPath = parentPath;
}
}
}
@@ -379,10 +378,10 @@ module ts {
// The StringLiteral must specify a top - level external module name.
// Relative external module names are not permitted
forEachChild((<ModuleDeclaration>node).body, node => {
if (isExternalModuleImportDeclaration(node) &&
getExternalModuleImportDeclarationExpression(node).kind === SyntaxKind.StringLiteral) {
if (isExternalModuleImportEqualsDeclaration(node) &&
getExternalModuleImportEqualsDeclarationExpression(node).kind === SyntaxKind.StringLiteral) {
var nameLiteral = <LiteralExpression>getExternalModuleImportDeclarationExpression(node);
var nameLiteral = <LiteralExpression>getExternalModuleImportEqualsDeclarationExpression(node);
var moduleName = nameLiteral.text;
if (moduleName) {
// TypeScript 1.0 spec (April 2014): 12.1.6
@@ -399,7 +398,7 @@ module ts {
}
});
function findModuleSourceFile(fileName: string, nameLiteral: LiteralExpression) {
function findModuleSourceFile(fileName: string, nameLiteral: Expression) {
return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos);
}
}
+11 -9
View File
@@ -38,6 +38,7 @@ module ts {
var textToToken: Map<SyntaxKind> = {
"any": SyntaxKind.AnyKeyword,
"as": SyntaxKind.AsKeyword,
"boolean": SyntaxKind.BooleanKeyword,
"break": SyntaxKind.BreakKeyword,
"case": SyntaxKind.CaseKeyword,
@@ -58,6 +59,7 @@ module ts {
"false": SyntaxKind.FalseKeyword,
"finally": SyntaxKind.FinallyKeyword,
"for": SyntaxKind.ForKeyword,
"from": SyntaxKind.FromKeyword,
"function": SyntaxKind.FunctionKeyword,
"get": SyntaxKind.GetKeyword,
"if": SyntaxKind.IfKeyword,
@@ -225,7 +227,7 @@ module ts {
return false;
}
function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget) {
/* @internal */ export function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget) {
return languageVersion >= ScriptTarget.ES5 ?
lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
lookupInUnicodeMap(code, unicodeES3IdentifierStart);
@@ -280,13 +282,13 @@ module ts {
return result;
}
export function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number {
return computePositionFromLineAndCharacter(getLineStarts(sourceFile), line, character);
export function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number {
return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character);
}
export function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number {
Debug.assert(line > 0 && line <= lineStarts.length);
return lineStarts[line - 1] + character - 1;
export function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number {
Debug.assert(line >= 0 && line < lineStarts.length);
return lineStarts[line] + character;
}
export function getLineStarts(sourceFile: SourceFile): number[] {
@@ -300,11 +302,11 @@ module ts {
// the binary search returns the negative value of the next line start
// e.g. if the line starts at [5, 10, 23, 80] and the position requested was 20
// then the search will return -2
lineNumber = (~lineNumber) - 1;
lineNumber = ~lineNumber - 1;
}
return {
line: lineNumber + 1,
character: position - lineStarts[lineNumber] + 1
line: lineNumber,
character: position - lineStarts[lineNumber]
};
}
+3 -3
View File
@@ -72,7 +72,7 @@ module ts {
function countLines(program: Program): number {
var count = 0;
forEach(program.getSourceFiles(), file => {
count += getLineAndCharacterOfPosition(file, file.end).line;
count += getLineStarts(file).length;
});
return count;
}
@@ -88,11 +88,11 @@ module ts {
if (diagnostic.file) {
var loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
output += diagnostic.file.fileName + "(" + loc.line + "," + loc.character + "): ";
output += `${ diagnostic.file.fileName }(${ loc.line + 1 },${ loc.character + 1 }): `;
}
var category = DiagnosticCategory[diagnostic.category].toLowerCase();
output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) + sys.newLine;
output += `${ category } TS${ diagnostic.code }: ${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }${ sys.newLine }`;
sys.write(output);
}
+82 -20
View File
@@ -120,6 +120,8 @@ module ts {
WhileKeyword,
WithKeyword,
// Strict mode reserved words
AsKeyword,
FromKeyword,
ImplementsKeyword,
InterfaceKeyword,
LetKeyword,
@@ -230,8 +232,16 @@ module ts {
EnumDeclaration,
ModuleDeclaration,
ModuleBlock,
ImportEqualsDeclaration,
ImportDeclaration,
ImportClause,
NamespaceImport,
NamedImports,
ImportSpecifier,
ExportAssignment,
ExportDeclaration,
NamedExports,
ExportSpecifier,
// Module references
ExternalModuleReference,
@@ -344,13 +354,13 @@ module ts {
// Specific context the parser was in when this node was created. Normally undefined.
// Only set when the parser was in some interesting context (like async/yield).
parserContextFlags?: ParserContextFlags;
modifiers?: ModifiersArray; // Array of modifiers
id?: number; // Unique id (used to look up NodeLinks)
parent?: Node; // Parent node (initialized by binding)
symbol?: Symbol; // Symbol declared by node (initialized by binding)
locals?: SymbolTable; // Locals associated with node (initialized by binding)
nextContainer?: Node; // Next container in declaration order (initialized by binding)
localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes)
modifiers?: ModifiersArray; // Array of modifiers
}
export interface NodeArray<T> extends Array<T>, TextRange {
@@ -623,7 +633,7 @@ module ts {
export interface BinaryExpression extends Expression {
left: Expression;
operator: SyntaxKind;
operatorToken: Node;
right: Expression;
}
@@ -853,7 +863,11 @@ module ts {
members: NodeArray<EnumMember>;
}
export interface ModuleDeclaration extends Declaration, ModuleElement {
export interface ExportContainer {
exportStars?: ExportDeclaration[]; // List of 'export *' statements (initialized by binding)
}
export interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer {
name: Identifier | LiteralExpression;
body: ModuleBlock | ModuleDeclaration;
}
@@ -862,7 +876,7 @@ module ts {
statements: NodeArray<ModuleElement>
}
export interface ImportDeclaration extends Declaration, ModuleElement {
export interface ImportEqualsDeclaration extends Declaration, ModuleElement {
name: Identifier;
// 'EntityName' for an internal module reference, 'ExternalModuleReference' for an external
@@ -874,6 +888,50 @@ module ts {
expression?: Expression;
}
// In case of:
// 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.
export interface ImportDeclaration extends Statement, ModuleElement {
importClause?: ImportClause;
moduleSpecifier: Expression;
}
// In case of:
// import d from "mod" => name = d, namedBinding = undefined
// import * as ns from "mod" => name = undefined, namedBinding: NamespaceImport = { name: ns }
// 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}]}
export interface ImportClause extends Declaration {
name?: Identifier; // Default binding
namedBindings?: NamespaceImport | NamedImports;
}
export interface NamespaceImport extends Declaration {
name: Identifier;
}
export interface ExportDeclaration extends Statement, ModuleElement {
exportClause?: NamedExports;
moduleSpecifier?: Expression;
}
export interface NamedImportsOrExports extends Node {
elements: NodeArray<ImportOrExportSpecifier>;
}
export type NamedImports = NamedImportsOrExports;
export type NamedExports = NamedImportsOrExports;
export interface ImportOrExportSpecifier 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;
export interface ExportAssignment extends Statement, ModuleElement {
exportName: Identifier;
}
@@ -887,7 +945,7 @@ module ts {
}
// Source files are declarations when they are external modules.
export interface SourceFile extends Declaration {
export interface SourceFile extends Declaration, ExportContainer {
statements: NodeArray<ModuleElement>;
endOfFileToken: Node;
@@ -1120,7 +1178,7 @@ module ts {
export interface SymbolVisibilityResult {
accessibility: SymbolAccessibility;
aliasesToMakeVisible?: ImportDeclaration[]; // aliases that need to have this symbol visible
aliasesToMakeVisible?: ImportEqualsDeclaration[]; // aliases that need to have this symbol visible
errorSymbolName?: string; // Optional symbol name that results in error
errorNode?: Node; // optional node that results in error
}
@@ -1130,11 +1188,11 @@ module ts {
}
export interface EmitResolver {
getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string;
getExpressionNamePrefix(node: Identifier): string;
getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string;
getExpressionNameSubstitution(node: Identifier): string;
getExportAssignmentName(node: SourceFile): string;
isReferencedImportDeclaration(node: ImportDeclaration): boolean;
isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean;
isReferencedImportDeclaration(node: Node): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
@@ -1237,18 +1295,20 @@ module ts {
members?: SymbolTable; // Class, interface or literal instance members
exports?: SymbolTable; // Module exports
exportSymbol?: Symbol; // Exported symbol associated with this symbol
valueDeclaration?: Declaration // First value declaration of the symbol,
constEnumOnlyModule?: boolean // For modules - if true - module contains only const enums or other modules with only const enums.
valueDeclaration?: Declaration // First value declaration of the symbol
constEnumOnlyModule?: boolean // True if module contains only const enums or other modules with only const enums
}
export interface SymbolLinks {
target?: Symbol; // Resolved (non-alias) target of an alias
type?: Type; // Type of value symbol
declaredType?: Type; // Type of class, interface, enum, or type parameter
mapper?: TypeMapper; // Type mapper for instantiation alias
referenced?: boolean; // True if alias symbol has been referenced as a value
exportAssignSymbol?: Symbol; // Symbol exported from external module
unionType?: UnionType; // Containing union type for union property
target?: Symbol; // Resolved (non-alias) target of an alias
type?: Type; // Type of value symbol
declaredType?: Type; // Type of class, interface, enum, or type parameter
mapper?: TypeMapper; // Type mapper for instantiation alias
referenced?: boolean; // True if alias symbol has been referenced as a value
exportAssignmentChecked?: boolean; // True if export assignment was checked
exportAssignmentSymbol?: Symbol; // Symbol exported from external module
unionType?: UnionType; // Containing union type for union property
resolvedExports?: SymbolTable; // Resolved exports of module
}
export interface TransientSymbol extends Symbol, SymbolLinks { }
@@ -1278,7 +1338,8 @@ module ts {
enumMemberValue?: number; // Constant value of enum member
isIllegalTypeReferenceInConstraint?: boolean; // Is type reference in constraint refers to the type parameter from the same list
isVisible?: boolean; // Is this node visible
localModuleName?: string; // Local name for module instance
generatedName?: string; // Generated name for module, enum, or import declaration
generatedNames?: Map<string>; // Generated names table for source file
assignmentChecks?: Map<boolean>; // Cache of assignment checks
hasReportedStatementInAmbientContext?: boolean; // Cache boolean if we report statements in ambient context
importOnRightSide?: Symbol; // for import declarations - import that appear on the right side
@@ -1646,6 +1707,7 @@ module ts {
equals = 0x3D, // =
exclamation = 0x21, // !
greaterThan = 0x3E, // >
hash = 0x23, // #
lessThan = 0x3C, // <
minus = 0x2D, // -
openBrace = 0x7B, // {
+44 -38
View File
@@ -105,11 +105,16 @@ module ts {
return <SourceFile>node;
}
export function getStartPositionOfLine(line: number, sourceFile: SourceFile): number {
Debug.assert(line >= 0);
return getLineStarts(sourceFile)[line];
}
// This is a useful function for debugging purposes.
export function nodePosToString(node: Node): string {
var file = getSourceFileOfNode(node);
var loc = getLineAndCharacterOfPosition(file, node.pos);
return file.fileName + "(" + loc.line + "," + loc.character + ")";
return `${ file.fileName }(${ loc.line + 1 },${ loc.character + 1 })`;
}
export function getStartPosOfNode(node: Node): number {
@@ -181,6 +186,12 @@ module ts {
return identifier.length >= 3 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ && identifier.charCodeAt(2) === CharacterCodes._ ? identifier.substr(1) : identifier;
}
// Make an identifier from an external module name by extracting the string after the last "/" and replacing
// all non-alphanumeric characters with underscores
export function makeIdentifierFromModuleName(moduleName: string): string {
return getBaseFileName(moduleName).replace(/\W/g, "_");
}
// Return display name of an identifier
// Computed property names will just be emitted as "[<expr>]", where <expr> is the source
// text of the expression in the computed property.
@@ -586,17 +597,32 @@ module ts {
(preserveConstEnums && moduleState === ModuleInstanceState.ConstEnumOnly);
}
export function isExternalModuleImportDeclaration(node: Node) {
return node.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node).moduleReference.kind === SyntaxKind.ExternalModuleReference;
export function isExternalModuleImportEqualsDeclaration(node: Node) {
return node.kind === SyntaxKind.ImportEqualsDeclaration && (<ImportEqualsDeclaration>node).moduleReference.kind === SyntaxKind.ExternalModuleReference;
}
export function getExternalModuleImportDeclarationExpression(node: Node) {
Debug.assert(isExternalModuleImportDeclaration(node));
return (<ExternalModuleReference>(<ImportDeclaration>node).moduleReference).expression;
export function getExternalModuleImportEqualsDeclarationExpression(node: Node) {
Debug.assert(isExternalModuleImportEqualsDeclaration(node));
return (<ExternalModuleReference>(<ImportEqualsDeclaration>node).moduleReference).expression;
}
export function isInternalModuleImportDeclaration(node: Node) {
return node.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node).moduleReference.kind !== SyntaxKind.ExternalModuleReference;
export function isInternalModuleImportEqualsDeclaration(node: Node) {
return node.kind === SyntaxKind.ImportEqualsDeclaration && (<ImportEqualsDeclaration>node).moduleReference.kind !== SyntaxKind.ExternalModuleReference;
}
export function getExternalModuleName(node: Node): Expression {
if (node.kind === SyntaxKind.ImportDeclaration) {
return (<ImportDeclaration>node).moduleSpecifier;
}
if (node.kind === SyntaxKind.ImportEqualsDeclaration) {
var reference = (<ImportEqualsDeclaration>node).moduleReference;
if (reference.kind === SyntaxKind.ExternalModuleReference) {
return (<ExternalModuleReference>reference).expression;
}
}
if (node.kind === SyntaxKind.ExportDeclaration) {
return (<ExportDeclaration>node).moduleSpecifier;
}
}
export function hasDotDotDotToken(node: Node) {
@@ -675,7 +701,11 @@ module ts {
case SyntaxKind.TypeAliasDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.ImportClause:
case SyntaxKind.ImportSpecifier:
case SyntaxKind.NamespaceImport:
case SyntaxKind.ExportSpecifier:
return true;
}
return false;
@@ -762,36 +792,12 @@ module ts {
}
export function getAncestor(node: Node, kind: SyntaxKind): Node {
switch (kind) {
// special-cases that can be come first
case SyntaxKind.ClassDeclaration:
while (node) {
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
return <ClassDeclaration>node;
case SyntaxKind.EnumDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.TypeAliasDeclaration:
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.ImportDeclaration:
// early exit cases - declarations cannot be nested in classes
return undefined;
default:
node = node.parent;
continue;
}
}
break;
default:
while (node) {
if (node.kind === kind) {
return node;
}
node = node.parent;
}
break;
while (node) {
if (node.kind === kind) {
return node;
}
node = node.parent;
}
return undefined;
}
+19 -27
View File
@@ -398,7 +398,7 @@ module FourSlash {
var lineStarts = ts.computeLineStarts(this.getFileContent(this.activeFile.fileName));
var lineCharPos = ts.computeLineAndCharacterOfPosition(lineStarts, pos);
this.scenarioActions.push('<MoveCaretToLineAndChar LineNumber="' + lineCharPos.line + '" CharNumber="' + lineCharPos.character + '" />');
this.scenarioActions.push(`<MoveCaretToLineAndChar LineNumber=${ lineCharPos.line + 1 } CharNumber=${ lineCharPos.character + 1 } />`);
}
public moveCaretRight(count = 1) {
@@ -2015,39 +2015,31 @@ module FourSlash {
// Get the text of the entire line the caret is currently at
private getCurrentLineContent() {
// The current caret position (in line/col terms)
var line = this.getCurrentCaretFilePosition().line;
// The line/col of the start of this line
var pos = this.languageServiceAdapterHost.lineColToPosition(this.activeFile.fileName, line, 1);
// The index of the current file
var text = this.getFileContent(this.activeFile.fileName)
// The text from the start of the line to the end of the file
var text = this.getFileContent(this.activeFile.fileName).substring(pos);
var pos = this.currentCaretPosition;
var startPos = pos, endPos = pos;
// Truncate to the first newline
var newlinePos = text.indexOf('\n');
if (newlinePos === -1) {
return text;
}
else {
if (text.charAt(newlinePos - 1) === '\r') {
newlinePos--;
while (startPos > 0) {
var ch = text.charCodeAt(startPos - 1);
if (ch === ts.CharacterCodes.carriageReturn || ch === ts.CharacterCodes.lineFeed) {
break;
}
return text.substr(0, newlinePos);
}
}
private getCurrentCaretFilePosition() {
var result = this.languageServiceAdapterHost.positionToZeroBasedLineCol(this.activeFile.fileName, this.currentCaretPosition);
if (result.line >= 0) {
result.line++;
startPos--;
}
if (result.character >= 0) {
result.character++;
while (endPos < text.length) {
var ch = text.charCodeAt(endPos);
if (ch === ts.CharacterCodes.carriageReturn || ch === ts.CharacterCodes.lineFeed) {
break;
}
endPos++;
}
return result;
return text.substring(startPos, endPos);
}
private assertItemInCompletionList(items: ts.CompletionEntry[], name: string, text?: string, documentation?: string, kind?: string) {
@@ -2125,7 +2117,7 @@ module FourSlash {
}
private getLineColStringAtPosition(position: number) {
var pos = this.languageServiceAdapterHost.positionToZeroBasedLineCol(this.activeFile.fileName, position);
var pos = this.languageServiceAdapterHost.positionToLineAndCharacter(this.activeFile.fileName, position);
return 'line ' + (pos.line + 1) + ', col ' + pos.character;
}
+3 -3
View File
@@ -1185,13 +1185,13 @@ module Harness {
}
export function getMinimalDiagnostic(err: ts.Diagnostic): HarnessDiagnostic {
var errorLineInfo = err.file ? err.file.getLineAndCharacterFromPosition(err.start) : { line: 0, character: 0 };
var errorLineInfo = err.file ? err.file.getLineAndCharacterOfPosition(err.start) : { line: -1, character: -1 };
return {
fileName: err.file && err.file.fileName,
start: err.start,
end: err.start + err.length,
line: errorLineInfo.line,
character: errorLineInfo.character,
line: errorLineInfo.line + 1,
character: errorLineInfo.character + 1,
message: ts.flattenDiagnosticMessageText(err.messageText, ts.sys.newLine),
category: ts.DiagnosticCategory[err.category].toLowerCase(),
code: err.code
+32 -50
View File
@@ -159,32 +159,15 @@ module Harness.LanguageService {
public openFile(fileName: string): void {
}
/**
* @param line 1 based index
* @param col 1 based index
*/
public lineColToPosition(fileName: string, line: number, col: number): number {
var script: ScriptInfo = this.fileNameToScript[fileName];
assert.isNotNull(script);
assert.isTrue(line >= 1);
assert.isTrue(col >= 1);
return ts.computePositionFromLineAndCharacter(script.lineMap, line, col);
}
/**
* @param line 0 based index
* @param col 0 based index
*/
public positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter {
public positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter {
var script: ScriptInfo = this.fileNameToScript[fileName];
assert.isNotNull(script);
var result = ts.computeLineAndCharacterOfPosition(script.lineMap, position);
assert.isTrue(result.line >= 1);
assert.isTrue(result.character >= 1);
return { line: result.line - 1, character: result.character - 1 };
return ts.computeLineAndCharacterOfPosition(script.lineMap, position);
}
}
@@ -231,8 +214,7 @@ module Harness.LanguageService {
getScriptInfo(fileName: string): ScriptInfo { return this.nativeHost.getScriptInfo(fileName); }
addScript(fileName: string, content: string): void { this.nativeHost.addScript(fileName, content); }
editScript(fileName: string, start: number, end: number, newText: string): void { this.nativeHost.editScript(fileName, start, end, newText); }
lineColToPosition(fileName: string, line: number, col: number): number { return this.nativeHost.lineColToPosition(fileName, line, col); }
positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToZeroBasedLineCol(fileName, position); }
positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToLineAndCharacter(fileName, position); }
getCompilationSettings(): string { return JSON.stringify(this.nativeHost.getCompilationSettings()); }
getCancellationToken(): ts.CancellationToken { return this.nativeHost.getCancellationToken(); }
@@ -471,10 +453,10 @@ module Harness.LanguageService {
args: string[] = [];
newLine: string;
useCaseSensitiveFileNames: boolean = false;
constructor(private host: NativeLanguageServiceHost) {
this.newLine = this.host.getNewLine();
}
constructor(private host: NativeLanguageServiceHost) {
this.newLine = this.host.getNewLine();
}
onMessage(message: string): void {
@@ -515,9 +497,9 @@ module Harness.LanguageService {
return "";
}
exit(exitCode: number): void {
}
exit(exitCode: number): void {
}
createDirectory(directoryName: string): void {
throw new Error("Not Implemented Yet.");
}
@@ -529,30 +511,30 @@ module Harness.LanguageService {
readDirectory(path: string, extension?: string): string[] {
throw new Error("Not implemented Yet.");
}
watchFile(fileName: string, callback: (fileName: string) => void): ts.FileWatcher {
return { close() { } };
}
close(): void {
}
watchFile(fileName: string, callback: (fileName: string) => void): ts.FileWatcher {
return { close() { } };
}
close(): void {
}
info(message: string): void {
return this.host.log(message);
}
msg(message: string) {
return this.host.log(message);
}
endGroup(): void {
}
return this.host.log(message);
}
msg(message: string) {
return this.host.log(message);
}
endGroup(): void {
}
perftrc(message: string): void {
return this.host.log(message);
}
startGroup(): void {
return this.host.log(message);
}
startGroup(): void {
}
}
+5 -3
View File
@@ -85,15 +85,17 @@ class TypeWriterWalker {
private log(node: ts.Node, type: ts.Type): void {
var actualPos = ts.skipTrivia(this.currentSourceFile.text, node.pos);
var lineAndCharacter = this.currentSourceFile.getLineAndCharacterFromPosition(actualPos);
var lineAndCharacter = this.currentSourceFile.getLineAndCharacterOfPosition(actualPos);
var sourceText = ts.getTextOfNodeFromSourceText(this.currentSourceFile.text, node);
// If we got an unknown type, we temporarily want to fall back to just pretending the name
// (source text) of the node is the type. This is to align with the old typeWriter to make
// baseline comparisons easier. In the long term, we will want to just call typeToString
this.results.push({
line: lineAndCharacter.line - 1,
column: lineAndCharacter.character,
line: lineAndCharacter.line,
// todo(cyrusn): Not sure why column is one-based for type-writer. But I'm preserving
// that behavior to prevent having a lot of baselines to fix up.
column: lineAndCharacter.character + 1,
syntaxKind: node.kind,
sourceText: sourceText,
type: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.WriteOwnNameForAnyLike)
+5 -5
View File
@@ -47,14 +47,14 @@ module ts.server {
}
private lineColToPosition(fileName: string, lineCol: protocol.Location): number {
return ts.computePositionFromLineAndCharacter(this.getLineMap(fileName), lineCol.line, lineCol.col);
return ts.computePositionOfLineAndCharacter(this.getLineMap(fileName), lineCol.line - 1, lineCol.col - 1);
}
private positionToOneBasedLineCol(fileName: string, position: number): protocol.Location {
var lineCol = ts.computeLineAndCharacterOfPosition(this.getLineMap(fileName), position);
return {
line: lineCol.line,
col: lineCol.character
line: lineCol.line + 1,
col: lineCol.character + 1
};
}
@@ -208,9 +208,9 @@ module ts.server {
return response.body[0];
}
getNavigateToItems(searchTerm: string): NavigateToItem[] {
getNavigateToItems(searchValue: string): NavigateToItem[] {
var args: protocol.NavtoRequestArgs = {
searchTerm,
searchValue,
file: this.host.getScriptFileNames()[0]
};
+59 -10
View File
@@ -65,6 +65,7 @@ module ts.server {
ls: ts.LanguageService = null;
compilationSettings: ts.CompilerOptions;
filenameToScript: ts.Map<ScriptInfo> = {};
roots: ScriptInfo[] = [];
constructor(public host: ServerHost, public project: Project) {
}
@@ -144,7 +145,7 @@ module ts.server {
var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName);
if (!scriptInfo) {
this.filenameToScript[info.fileName] = info;
return info;
this.roots.push(info);
}
}
@@ -286,10 +287,12 @@ module ts.server {
return this.filenameToSourceFile[info.fileName];
}
getSourceFileFromName(filename: string) {
getSourceFileFromName(filename: string, requireOpen?: boolean) {
var info = this.projectService.getScriptInfo(filename);
if (info) {
return this.getSourceFile(info);
if ((!requireOpen) || info.isOpen) {
return this.getSourceFile(info);
}
}
}
@@ -324,7 +327,7 @@ module ts.server {
// add a root file to project
addRoot(info: ScriptInfo) {
info.defaultProject = this;
return this.compilerService.host.addRoot(info);
this.compilerService.host.addRoot(info);
}
filesToString() {
@@ -360,7 +363,7 @@ module ts.server {
}
interface ProjectServiceEventHandler {
(eventName: string, project: Project): void;
(eventName: string, project: Project, fileName: string): void;
}
export class ProjectService {
@@ -392,7 +395,6 @@ module ts.server {
}
}
log(msg: string, type = "Err") {
this.psLogger.msg(msg, type);
}
@@ -423,7 +425,20 @@ module ts.server {
for (var i = 0, len = referencingProjects.length; i < len; i++) {
referencingProjects[i].removeReferencedFile(info);
}
for (var j = 0, flen = this.openFileRoots.length; j < flen; j++) {
var openFile = this.openFileRoots[j];
if (this.eventHandler) {
this.eventHandler("context", openFile.defaultProject, openFile.fileName);
}
}
for (var j = 0, flen = this.openFilesReferenced.length; j < flen; j++) {
var openFile = this.openFilesReferenced[j];
if (this.eventHandler) {
this.eventHandler("context", openFile.defaultProject, openFile.fileName);
}
}
}
this.printProjects();
}
@@ -503,19 +518,52 @@ module ts.server {
info.close();
}
findReferencingProjects(info: ScriptInfo) {
findReferencingProjects(info: ScriptInfo, excludedProject?: Project) {
var referencingProjects: Project[] = [];
info.defaultProject = undefined;
for (var i = 0, len = this.inferredProjects.length; i < len; i++) {
this.inferredProjects[i].updateGraph();
if (this.inferredProjects[i].getSourceFile(info)) {
info.defaultProject = this.inferredProjects[i];
referencingProjects.push(this.inferredProjects[i]);
if (this.inferredProjects[i] != excludedProject) {
if (this.inferredProjects[i].getSourceFile(info)) {
info.defaultProject = this.inferredProjects[i];
referencingProjects.push(this.inferredProjects[i]);
}
}
}
return referencingProjects;
}
updateProjectStructure() {
this.log("updating project structure from ...", "Info");
this.printProjects();
for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) {
var refdFile = this.openFilesReferenced[i];
refdFile.defaultProject.updateGraph();
var sourceFile = refdFile.defaultProject.getSourceFile(refdFile);
if (!sourceFile) {
this.openFilesReferenced = copyListRemovingItem(refdFile, this.openFilesReferenced);
this.addOpenFile(refdFile);
}
}
var openFileRoots: ScriptInfo[] = [];
for (var i = 0, len = this.openFileRoots.length; i < len; i++) {
var rootFile = this.openFileRoots[i];
var rootedProject = rootFile.defaultProject;
var referencingProjects = this.findReferencingProjects(rootFile, rootedProject);
if (referencingProjects.length == 0) {
rootFile.defaultProject = rootedProject;
openFileRoots.push(rootFile);
}
else {
// remove project from inferred projects list
this.inferredProjects = copyListRemovingItem(rootedProject, this.inferredProjects);
this.openFilesReferenced.push(rootFile);
}
}
this.openFileRoots = openFileRoots;
this.printProjects();
}
getScriptInfo(filename: string) {
filename = ts.normalizePath(filename);
return ts.lookUp(this.filenameToScriptInfo, filename);
@@ -621,6 +669,7 @@ module ts.server {
this.psLogger.startGroup();
for (var i = 0, len = this.inferredProjects.length; i < len; i++) {
var project = this.inferredProjects[i];
project.updateGraph();
this.psLogger.info("Project " + i.toString());
this.psLogger.info(project.filesToString());
this.psLogger.info("-----------------------------------------------");
+5 -1
View File
@@ -676,7 +676,11 @@ declare module ts.server.protocol {
* Search term to navigate to from current location; term can
* be '.*' or an identifier prefix.
*/
searchTerm: string;
searchValue: string;
/**
* Optional limit on the number of items to return.
*/
maxResultCount?: number;
}
/**
+1 -8
View File
@@ -82,7 +82,6 @@ module ts.server {
private watchedFiles: WatchedFile[] = [];
private nextFileToCheck = 0;
private watchTimer: NodeJS.Timer;
private static fileDeleted = 34;
// average async stat takes about 30 microseconds
// set chunk size to do 30 files in < 1 millisecond
@@ -111,13 +110,7 @@ module ts.server {
fs.stat(watchedFile.fileName,(err, stats) => {
if (err) {
var msg = err.message;
if (err.errno) {
msg += " errno: " + err.errno.toString();
}
if (err.errno == WatchedFileSet.fileDeleted) {
watchedFile.callback(watchedFile.fileName);
}
watchedFile.callback(watchedFile.fileName);
}
else if (watchedFile.mtime.getTime() != stats.mtime.getTime()) {
watchedFile.mtime = WatchedFileSet.getModifiedTime(watchedFile.fileName);
+50 -42
View File
@@ -52,30 +52,6 @@ module ts.server {
return 1;
}
}
function sortNavItems(items: ts.NavigateToItem[]) {
return items.sort((a, b) => {
if (a.matchKind < b.matchKind) {
return -1;
}
else if (a.matchKind == b.matchKind) {
var lowa = a.name.toLowerCase();
var lowb = b.name.toLowerCase();
if (lowa < lowb) {
return -1;
}
else if (lowa == lowb) {
return 0;
}
else {
return 1;
}
}
else {
return 1;
}
})
}
function formatDiag(fileName: string, project: Project, diag: ts.Diagnostic) {
return {
@@ -122,7 +98,6 @@ module ts.server {
module Errors {
export var NoProject = new Error("No Project.");
export var NoContent = new Error("No Content.");
}
export interface ServerHost extends ts.System {
@@ -138,7 +113,18 @@ module ts.server {
changeSeq = 0;
constructor(private host: ServerHost, private logger: Logger) {
this.projectService = new ProjectService(host, logger);
this.projectService =
new ProjectService(host, logger, (eventName,project,fileName) => {
this.handleEvent(eventName, project, fileName);
});
}
handleEvent(eventName: string, project: Project, fileName: string) {
if (eventName == "context") {
this.projectService.log("got context event, updating diagnostics for" + fileName, "Info");
this.updateErrorCheck([{ fileName, project }], this.changeSeq,
(n) => n == this.changeSeq, 100);
}
}
logError(err: Error, cmd: string) {
@@ -215,6 +201,14 @@ module ts.server {
this.semanticCheck(file, project);
}
updateProjectStructure(seq: number, matchSeq: (seq: number) => boolean, ms = 1500) {
setTimeout(() => {
if (matchSeq(seq)) {
this.projectService.updateProjectStructure();
}
}, ms);
}
updateErrorCheck(checkList: PendingErrorCheck[], seq: number,
matchSeq: (seq: number) => boolean, ms = 1500, followMs = 200) {
if (followMs > ms) {
@@ -231,7 +225,7 @@ module ts.server {
var checkOne = () => {
if (matchSeq(seq)) {
var checkSpec = checkList[index++];
if (checkSpec.project.getSourceFileFromName(checkSpec.fileName)) {
if (checkSpec.project.getSourceFileFromName(checkSpec.fileName, true)) {
this.syntacticCheck(checkSpec.fileName, checkSpec.project);
this.immediateId = setImmediate(() => {
this.semanticCheck(checkSpec.fileName, checkSpec.project);
@@ -263,7 +257,7 @@ module ts.server {
var definitions = compilerService.languageService.getDefinitionAtPosition(file, position);
if (!definitions) {
throw Errors.NoContent;
return undefined;
}
return definitions.map(def => ({
@@ -284,7 +278,7 @@ module ts.server {
var position = compilerService.host.lineColToPosition(file, line, col);
var renameInfo = compilerService.languageService.getRenameInfo(file, position);
if (!renameInfo) {
throw Errors.NoContent;
return undefined;
}
if (!renameInfo.canRename) {
@@ -296,7 +290,7 @@ module ts.server {
var renameLocations = compilerService.languageService.findRenameLocations(file, position, findInStrings, findInComments);
if (!renameLocations) {
throw Errors.NoContent;
return undefined;
}
var bakedRenameLocs = renameLocations.map(location => (<protocol.FileSpan>{
@@ -355,12 +349,12 @@ module ts.server {
var references = compilerService.languageService.getReferencesAtPosition(file, position);
if (!references) {
throw Errors.NoContent;
return undefined;
}
var nameInfo = compilerService.languageService.getQuickInfoAtPosition(file, position);
if (!nameInfo) {
throw Errors.NoContent;
return undefined;
}
var displayString = ts.displayPartsToString(nameInfo.displayParts);
@@ -404,7 +398,7 @@ module ts.server {
var position = compilerService.host.lineColToPosition(file, line, col);
var quickInfo = compilerService.languageService.getQuickInfoAtPosition(file, position);
if (!quickInfo) {
throw Errors.NoContent;
return undefined;
}
var displayString = ts.displayPartsToString(quickInfo.displayParts);
@@ -433,7 +427,7 @@ module ts.server {
// TODO: avoid duplicate code (with formatonkey)
var edits = compilerService.languageService.getFormattingEditsForRange(file, startPosition, endPosition, compilerService.formatCodeOptions);
if (!edits) {
throw Errors.NoContent;
return undefined;
}
return edits.map((edit) => {
@@ -473,7 +467,7 @@ module ts.server {
}
if (!edits) {
throw Errors.NoContent;
return undefined;
}
return edits.map((edit) => {
@@ -502,7 +496,7 @@ module ts.server {
var completions = compilerService.languageService.getCompletionsAtPosition(file, position);
if (!completions) {
throw Errors.NoContent;
return undefined;
}
return completions.entries.reduce((result: protocol.CompletionEntry[], entry: ts.CompletionEntry) => {
@@ -559,6 +553,10 @@ module ts.server {
compilerService.host.editScript(file, start, end, insertString);
this.changeSeq++;
}
// update project structure on idle commented out
// until we can have the host return only the root files
// from getScriptFileNames()
//this.updateProjectStructure(this.changeSeq, (n) => n == this.changeSeq);
}
}
@@ -619,13 +617,13 @@ module ts.server {
var compilerService = project.compilerService;
var items = compilerService.languageService.getNavigationBarItems(file);
if (!items) {
throw Errors.NoContent;
return undefined;
}
return this.decorateNavigationBarItem(project, fileName, items);
}
getNavigateToItems(searchTerm: string, fileName: string): protocol.NavtoItem[] {
getNavigateToItems(searchValue: string, fileName: string, maxResultCount?: number): protocol.NavtoItem[] {
var file = ts.normalizePath(fileName);
var project = this.projectService.getProjectForFile(file);
if (!project) {
@@ -633,9 +631,9 @@ module ts.server {
}
var compilerService = project.compilerService;
var navItems = sortNavItems(compilerService.languageService.getNavigateToItems(searchTerm));
var navItems = compilerService.languageService.getNavigateToItems(searchValue, maxResultCount);
if (!navItems) {
throw Errors.NoContent;
return undefined;
}
return navItems.map((navItem) => {
@@ -677,7 +675,7 @@ module ts.server {
var spans = compilerService.languageService.getBraceMatchingAtPosition(file, position);
if (!spans) {
throw Errors.NoContent;
return undefined;
}
return spans.map(span => ({
@@ -690,6 +688,8 @@ module ts.server {
try {
var request = <protocol.Request>JSON.parse(message);
var response: any;
var errorMessage: string;
var responseRequired = true;
switch (request.command) {
case CommandNames.Definition: {
var defArgs = <protocol.FileLocationRequestArgs>request.arguments;
@@ -709,6 +709,7 @@ module ts.server {
case CommandNames.Open: {
var openArgs = <protocol.FileRequestArgs>request.arguments;
this.openClientFile(openArgs.file);
responseRequired = false;
break;
}
case CommandNames.Quickinfo: {
@@ -740,12 +741,14 @@ module ts.server {
case CommandNames.Geterr: {
var geterrArgs = <protocol.GeterrRequestArgs>request.arguments;
response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files);
responseRequired = false;
break;
}
case CommandNames.Change: {
var changeArgs = <protocol.ChangeRequestArgs>request.arguments;
this.change(changeArgs.line, changeArgs.col, changeArgs.endLine, changeArgs.endCol,
changeArgs.insertString, changeArgs.file);
responseRequired = false;
break;
}
case CommandNames.Reload: {
@@ -756,16 +759,18 @@ module ts.server {
case CommandNames.Saveto: {
var savetoArgs = <protocol.SavetoRequestArgs>request.arguments;
this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile);
responseRequired = false;
break;
}
case CommandNames.Close: {
var closeArgs = <protocol.FileRequestArgs>request.arguments;
this.closeClientFile(closeArgs.file);
responseRequired = false;
break;
}
case CommandNames.Navto: {
var navtoArgs = <protocol.NavtoRequestArgs>request.arguments;
response = this.getNavigateToItems(navtoArgs.searchTerm, navtoArgs.file);
response = this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount);
break;
}
case CommandNames.Brace: {
@@ -788,6 +793,9 @@ module ts.server {
if (response) {
this.output(response, request.command, request.seq);
}
else if (responseRequired) {
this.output(undefined, request.command, request.seq, "No content available.");
}
} catch (err) {
if (err instanceof OperationCanceledException) {
+8 -8
View File
@@ -14,17 +14,17 @@ module ts.BreakpointResolver {
}
var tokenAtLocation = getTokenAtPosition(sourceFile, position);
var lineOfPosition = sourceFile.getLineAndCharacterFromPosition(position).line;
if (sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getStart()).line > lineOfPosition) {
var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) {
// Get previous token if the token is returned starts on new line
// eg: var x =10; |--- curser is here
// eg: var x =10; |--- cursor is here
// var y = 10;
// token at position will return var keyword on second line as the token but we would like to use
// token on same line if trailing trivia (comments or white spaces on same line) part of the last token on that line
tokenAtLocation = findPrecedingToken(tokenAtLocation.pos, sourceFile);
// Its a blank line
if (!tokenAtLocation || sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) {
if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) {
return undefined;
}
}
@@ -42,7 +42,7 @@ module ts.BreakpointResolver {
}
function spanInNodeIfStartsOnSameLine(node: Node, otherwiseOnNode?: Node): TextSpan {
if (node && lineOfPosition === sourceFile.getLineAndCharacterFromPosition(node.getStart()).line) {
if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart()).line) {
return spanInNode(node);
}
return spanInNode(otherwiseOnNode);
@@ -69,7 +69,7 @@ module ts.BreakpointResolver {
return textSpan(node);
}
if (node.parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>node.parent).operator === SyntaxKind.CommaToken) {
if (node.parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>node.parent).operatorToken.kind === SyntaxKind.CommaToken) {
// if this is comma expression, the breakpoint is possible in this expression
return textSpan(node);
}
@@ -176,9 +176,9 @@ module ts.BreakpointResolver {
// span on export = id
return textSpan(node, (<ExportAssignment>node).exportName);
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ImportEqualsDeclaration:
// import statement without including semicolon
return textSpan(node,(<ImportDeclaration>node).moduleReference);
return textSpan(node,(<ImportEqualsDeclaration>node).moduleReference);
case SyntaxKind.ModuleDeclaration:
// span on complete module if it is instantiated
+19 -19
View File
@@ -67,8 +67,8 @@ module ts.formatting {
}
export function formatOnEnter(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] {
var line = sourceFile.getLineAndCharacterFromPosition(position).line;
if (line === 1) {
var line = sourceFile.getLineAndCharacterOfPosition(position).line;
if (line === 0) {
return [];
}
// get the span for the previous\current line
@@ -100,7 +100,7 @@ module ts.formatting {
export function formatSelection(start: number, end: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] {
// format from the beginning of the line
var span = {
pos: getStartLinePositionForPosition(start, sourceFile),
pos: getLineStartPositionForPosition(start, sourceFile),
end: end
};
return formatSpan(span, sourceFile, options, rulesProvider, FormattingRequestKind.FormatSelection);
@@ -112,7 +112,7 @@ module ts.formatting {
return [];
}
var span = {
pos: getStartLinePositionForPosition(parent.getStart(sourceFile), sourceFile),
pos: getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile),
end: parent.end
};
return formatSpan(span, sourceFile, options, rulesProvider, requestKind);
@@ -283,7 +283,7 @@ module ts.formatting {
var previousLine = Constants.Unknown;
var childKind = SyntaxKind.Unknown;
while (n) {
var line = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)).line;
var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line;
if (previousLine !== Constants.Unknown && line !== previousLine) {
break;
}
@@ -327,7 +327,7 @@ module ts.formatting {
formattingScanner.advance();
if (formattingScanner.isOnToken()) {
var startLine = sourceFile.getLineAndCharacterFromPosition(enclosingNode.getStart(sourceFile)).line;
var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line;
var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile);
processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta);
}
@@ -357,8 +357,8 @@ module ts.formatting {
}
}
else {
var startLine = sourceFile.getLineAndCharacterFromPosition(startPos).line;
var startLinePosition = getStartLinePositionForPosition(startPos, sourceFile);
var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line;
var startLinePosition = getLineStartPositionForPosition(startPos, sourceFile);
var column = SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options);
if (startLine !== parentStartLine || startPos === column) {
return column
@@ -521,7 +521,7 @@ module ts.formatting {
var childStartPos = child.getStart(sourceFile);
var childStart = sourceFile.getLineAndCharacterFromPosition(childStartPos);
var childStart = sourceFile.getLineAndCharacterOfPosition(childStartPos);
// if child is a list item - try to get its indentation
var childIndentationAmount = Constants.Unknown;
@@ -594,7 +594,7 @@ module ts.formatting {
}
else if (tokenInfo.token.kind === listStartToken) {
// consume list start token
startLine = sourceFile.getLineAndCharacterFromPosition(tokenInfo.token.pos).line;
startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;
var indentation =
computeIndentation(tokenInfo.token, startLine, Constants.Unknown, parent, parentDynamicIndentation, startLine);
@@ -641,7 +641,7 @@ module ts.formatting {
var lineAdded: boolean;
var isTokenInRange = rangeContainsRange(originalRange, currentTokenInfo.token);
var tokenStart = sourceFile.getLineAndCharacterFromPosition(currentTokenInfo.token.pos);
var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos);
if (isTokenInRange) {
var rangeHasError = rangeContainsError(currentTokenInfo.token);
// save prevStartLine since processRange will overwrite this value with current ones
@@ -674,7 +674,7 @@ module ts.formatting {
continue;
}
var triviaStartLine = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos).line;
var triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line;
switch (triviaItem.kind) {
case SyntaxKind.MultiLineCommentTrivia:
var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind);
@@ -712,7 +712,7 @@ module ts.formatting {
for (var i = 0, len = trivia.length; i < len; ++i) {
var triviaItem = trivia[i];
if (isComment(triviaItem.kind) && rangeContainsRange(originalRange, triviaItem)) {
var triviaItemStart = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos);
var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos);
processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation);
}
}
@@ -729,7 +729,7 @@ module ts.formatting {
if (!rangeHasError && !previousRangeHasError) {
if (!previousRange) {
// trim whitespaces starting from the beginning of the span up to the current line
var originalStart = sourceFile.getLineAndCharacterFromPosition(originalRange.pos);
var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos);
trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line);
}
else {
@@ -807,18 +807,18 @@ module ts.formatting {
recordReplace(pos, 0, indentationString);
}
else {
var tokenStart = sourceFile.getLineAndCharacterFromPosition(pos);
if (indentation !== tokenStart.character - 1) {
var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos);
if (indentation !== tokenStart.character) {
var startLinePosition = getStartPositionOfLine(tokenStart.line, sourceFile);
recordReplace(startLinePosition, tokenStart.character - 1, indentationString);
recordReplace(startLinePosition, tokenStart.character, indentationString);
}
}
}
function indentMultilineComment(commentRange: TextRange, indentation: number, firstLineIsIndented: boolean) {
// split comment in lines
var startLine = sourceFile.getLineAndCharacterFromPosition(commentRange.pos).line;
var endLine = sourceFile.getLineAndCharacterFromPosition(commentRange.end).line;
var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line;
var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line;
if (startLine === endLine) {
if (!firstLineIsIndented) {
+6 -6
View File
@@ -71,8 +71,8 @@ module ts.formatting {
public TokensAreOnSameLine(): boolean {
if (this.tokensAreOnSameLine === undefined) {
var startLine = this.sourceFile.getLineAndCharacterFromPosition(this.currentTokenSpan.pos).line;
var endLine = this.sourceFile.getLineAndCharacterFromPosition(this.nextTokenSpan.pos).line;
var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line;
var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line;
this.tokensAreOnSameLine = (startLine == endLine);
}
@@ -96,8 +96,8 @@ module ts.formatting {
}
private NodeIsOnOneLine(node: Node): boolean {
var startLine = this.sourceFile.getLineAndCharacterFromPosition(node.getStart(this.sourceFile)).line;
var endLine = this.sourceFile.getLineAndCharacterFromPosition(node.getEnd()).line;
var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line;
var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line;
return startLine == endLine;
}
@@ -105,8 +105,8 @@ module ts.formatting {
var openBrace = findChildOfKind(node, SyntaxKind.OpenBraceToken, this.sourceFile);
var closeBrace = findChildOfKind(node, SyntaxKind.CloseBraceToken, this.sourceFile);
if (openBrace && closeBrace) {
var startLine = this.sourceFile.getLineAndCharacterFromPosition(openBrace.getEnd()).line;
var endLine = this.sourceFile.getLineAndCharacterFromPosition(closeBrace.getStart(this.sourceFile)).line;
var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line;
var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line;
return startLine === endLine;
}
return false;
+11 -12
View File
@@ -93,17 +93,16 @@ module ts.formatting {
savedPos = scanner.getStartPos();
}
function shouldRescanGreaterThanToken(container: Node): boolean {
if (container.kind !== SyntaxKind.BinaryExpression) {
return false;
}
switch ((<BinaryExpression>container).operator) {
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
return true;
function shouldRescanGreaterThanToken(node: Node): boolean {
if (node) {
switch (node.kind) {
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
return true;
}
}
return false;
@@ -164,7 +163,7 @@ module ts.formatting {
if (expectedScanAction === ScanAction.RescanGreaterThanToken && currentToken === SyntaxKind.GreaterThanToken) {
currentToken = scanner.reScanGreaterToken();
Debug.assert((<BinaryExpression>n).operator === currentToken);
Debug.assert(n.kind === currentToken);
lastScanAction = ScanAction.RescanGreaterThanToken;
}
else if (expectedScanAction === ScanAction.RescanSlashToken && startsWithSlashToken(currentToken)) {
+1 -1
View File
@@ -452,7 +452,7 @@ module ts.formatting {
return true;
// equal in import a = module('a');
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ImportEqualsDeclaration:
// equal in var a = 0;
case SyntaxKind.VariableDeclaration:
// equal in p = 0;
+7 -8
View File
@@ -24,7 +24,7 @@ module ts.formatting {
return 0;
}
var lineAtPosition = sourceFile.getLineAndCharacterFromPosition(position).line;
var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
if (precedingToken.kind === SyntaxKind.CommaToken && precedingToken.parent.kind !== SyntaxKind.BinaryExpression) {
// previous token is comma that separates items in list - find the previous item and try to derive indentation from it
@@ -74,7 +74,7 @@ module ts.formatting {
}
export function getIndentationForNode(n: Node, ignoreActualIndentationRange: TextRange, sourceFile: SourceFile, options: FormatCodeOptions): number {
var start = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile));
var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));
return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, /*indentationDelta*/ 0, sourceFile, options);
}
@@ -135,10 +135,10 @@ module ts.formatting {
function getParentStart(parent: Node, child: Node, sourceFile: SourceFile): LineAndCharacter {
var containingList = getContainingList(child, sourceFile);
if (containingList) {
return sourceFile.getLineAndCharacterFromPosition(containingList.pos);
return sourceFile.getLineAndCharacterOfPosition(containingList.pos);
}
return sourceFile.getLineAndCharacterFromPosition(parent.getStart(sourceFile));
return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile));
}
/*
@@ -204,7 +204,7 @@ module ts.formatting {
}
function getStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter {
return sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile));
return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));
}
function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean {
@@ -279,7 +279,6 @@ module ts.formatting {
}
}
function deriveActualIndentationFromList(list: Node[], index: number, sourceFile: SourceFile, options: EditorOptions): number {
Debug.assert(index >= 0 && index < list.length);
var node = list[index];
@@ -292,7 +291,7 @@ module ts.formatting {
continue;
}
// skip list items that ends on the same line with the current list element
var prevEndLine = sourceFile.getLineAndCharacterFromPosition(list[i].end).line;
var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line;
if (prevEndLine !== lineAndCharacter.line) {
return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options);
}
@@ -303,7 +302,7 @@ module ts.formatting {
}
function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter: LineAndCharacter, sourceFile: SourceFile, options: EditorOptions): number {
var lineStart = sourceFile.getPositionFromLineAndCharacter(lineAndCharacter.line, 1);
var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0);
return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options);
}
+117
View File
@@ -0,0 +1,117 @@
module ts.NavigateTo {
type RawNavigateToItem = { name: string; fileName: string; matchKind: MatchKind; declaration: Declaration };
enum MatchKind {
none = 0,
exact = 1,
substring = 2,
prefix = 3
}
export function getNavigateToItems(program: Program, cancellationToken: CancellationTokenObject, searchValue: string, maxResultCount: number): NavigateToItem[]{
// Split search value in terms array
var terms = searchValue.split(" ");
// default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version
var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t }));
var rawItems: RawNavigateToItem[] = [];
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
forEach(program.getSourceFiles(), sourceFile => {
cancellationToken.throwIfCancellationRequested();
var fileName = sourceFile.fileName;
var declarations = sourceFile.getNamedDeclarations();
for (var i = 0, n = declarations.length; i < n; i++) {
var declaration = declarations[i];
// TODO(jfreeman): Skip this declaration if it has a computed name
var name = (<Identifier>declaration.name).text;
var matchKind = getMatchKind(searchTerms, name);
if (matchKind !== MatchKind.none) {
rawItems.push({ name, fileName, matchKind, declaration });
}
}
});
rawItems.sort(compareNavigateToItems);
if (maxResultCount !== undefined) {
rawItems = rawItems.slice(0, maxResultCount);
}
var items = map(rawItems, createNavigateToItem);
return items;
// This means "compare in a case insensitive manner."
var baseSensitivity: Intl.CollatorOptions = { sensitivity: "base" };
function compareNavigateToItems(i1: RawNavigateToItem, i2: RawNavigateToItem) {
// TODO(cyrusn): get the gamut of comparisons that VS already uses here.
// Right now we just sort by kind first, and then by name of the item.
// We first sort case insensitively. So "Aaa" will come before "bar".
// Then we sort case sensitively, so "aaa" will come before "Aaa".
return i1.matchKind - i2.matchKind ||
i1.name.localeCompare(i2.name, undefined, baseSensitivity) ||
i1.name.localeCompare(i2.name);
}
function createNavigateToItem(rawItem: RawNavigateToItem): NavigateToItem {
var declaration = rawItem.declaration;
var container = <Declaration>getContainerNode(declaration);
return {
name: rawItem.name,
kind: getNodeKind(declaration),
kindModifiers: getNodeModifiers(declaration),
matchKind: MatchKind[rawItem.matchKind],
fileName: rawItem.fileName,
textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()),
// TODO(jfreeman): What should be the containerName when the container has a computed name?
containerName: container && container.name ? (<Identifier>container.name).text : "",
containerKind: container && container.name ? getNodeKind(container) : ""
};
}
function hasAnyUpperCaseCharacter(s: string): boolean {
for (var i = 0, n = s.length; i < n; i++) {
var c = s.charCodeAt(i);
if ((CharacterCodes.A <= c && c <= CharacterCodes.Z) ||
(c >= CharacterCodes.maxAsciiCharacter && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) {
return true;
}
}
return false;
}
function getMatchKind(searchTerms: { caseSensitive: boolean; term: string }[], name: string): MatchKind {
var matchKind = MatchKind.none;
if (name) {
for (var j = 0, n = searchTerms.length; j < n; j++) {
var searchTerm = searchTerms[j];
var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase();
// in case of case-insensitive search searchTerm.term will already be lower-cased
var index = nameToSearch.indexOf(searchTerm.term);
if (index < 0) {
// Didn't match.
return MatchKind.none;
}
var termKind = MatchKind.substring;
if (index === 0) {
// here we know that match occur at the beginning of the string.
// if search term and declName has the same length - we have an exact match, otherwise declName have longer length and this will be prefix match
termKind = name.length === searchTerm.term.length ? MatchKind.exact : MatchKind.prefix;
}
// Update our match kind if we don't have one, or if this match is better.
if (matchKind === MatchKind.none || termKind < matchKind) {
matchKind = termKind;
}
}
}
return matchKind;
}
}
}
+813
View File
@@ -0,0 +1,813 @@
module ts {
// Note(cyrusn): this enum is ordered from strongest match type to weakest match type.
export enum PatternMatchKind {
Exact,
Prefix,
Substring,
CamelCase
}
// Information about a match made by the pattern matcher between a candidate and the
// search pattern.
export interface PatternMatch {
// What kind of match this was. Exact matches are better than prefix matches which are
// better than substring matches which are better than CamelCase matches.
kind: PatternMatchKind;
// If this was a camel case match, how strong the match is. Higher number means
// it was a better match.
camelCaseWeight?: number;
// If this was a match where all constituent parts of the candidate and search pattern
// matched case sensitively or case insensitively. Case sensitive matches of the kind
// are better matches than insensitive matches.
isCaseSensitive: boolean;
// Whether or not this match occurred with the punctuation from the search pattern stripped
// out or not. Matches without the punctuation stripped are better than ones with punctuation
// stripped.
punctuationStripped: boolean;
}
// The pattern matcher maintains an internal cache of information as it is used. Therefore,
// you should not keep it around forever and should get and release the matcher appropriately
// once you no longer need it.
export interface PatternMatcher {
// Used to match a candidate against the last segment of a possibly dotted pattern. This
// is useful as a quick check to prevent having to compute a container before calling
// "getMatches".
//
// For example, if the search pattern is "ts.c.SK" and the candidate is "SyntaxKind", then
// this will return a successful match, having only tested "SK" against "SyntaxKind". At
// that point a call can be made to 'getMatches("SyntaxKind", "ts.compiler")', with the
// work to create 'ts.compiler' only being done once the first match succeeded.
getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[];
// Fully checks a candidate, with an dotted container, against the search pattern.
// The candidate must match the last part of the search pattern, and the dotted container
// must match the preceding segments of the pattern.
getMatches(candidate: string, dottedContainer: string): PatternMatch[];
// Whether or not the pattern contained dots or not. Clients can use this to determine
// If they should call getMatches, or if getMatchesForLastSegmentOfPattern is sufficient.
patternContainsDots: boolean;
}
// First we break up the pattern given by dots. Each portion of the pattern between the
// dots is a 'Segment'. The 'Segment' contains information about the entire section of
// text between the dots, as well as information about any individual 'Words' that we
// can break the segment into. A 'Word' is simply a contiguous sequence of characters
// that can appear in a typescript identifier. So "GetKeyword" would be one word, while
// "Get Keyword" would be two words. Once we have the individual 'words', we break those
// into constituent 'character spans' of interest. For example, while 'UIElement' is one
// word, it make character spans corresponding to "U", "I" and "Element". These spans
// are then used when doing camel cased matches against candidate patterns.
interface Segment {
// Information about the entire piece of text between the dots. For example, if the
// text between the dots is 'GetKeyword', then TotalTextChunk.Text will be 'GetKeyword' and
// TotalTextChunk.CharacterSpans will correspond to 'Get', 'Keyword'.
totalTextChunk: TextChunk;
// Information about the subwords compromising the total word. For example, if the
// text between the dots is 'GetFoo KeywordBar', then the subwords will be 'GetFoo'
// and 'KeywordBar'. Those individual words will have CharacterSpans of ('Get' and
// 'Foo') and('Keyword' and 'Bar') respectively.
subWordTextChunks: TextChunk[];
}
// Information about a chunk of text from the pattern. The chunk is a piece of text, with
// cached information about the character spans within in. Character spans are used for
// camel case matching.
interface TextChunk {
// The text of the chunk. This should be a contiguous sequence of character that could
// occur in a symbol name.
text: string;
// The text of a chunk in lower case. Cached because it is needed often to check for
// case insensitive matches.
textLowerCase: string;
// Whether or not this chunk is entirely lowercase. We have different rules when searching
// for something entirely lowercase or not.
isLowerCase: boolean;
// The spans in this text chunk that we think are of interest and should be matched
// independently. For example, if the chunk is for "UIElement" the the spans of interest
// correspond to "U", "I" and "Element". If "UIElement" isn't found as an exaxt, prefix.
// or substring match, then the character spans will be used to attempt a camel case match.
characterSpans: TextSpan[];
}
function createPatternMatch(kind: PatternMatchKind, punctuationStripped: boolean, isCaseSensitive: boolean, camelCaseWeight?: number): PatternMatch {
return {
kind,
punctuationStripped,
isCaseSensitive,
camelCaseWeight
};
}
export function createPatternMatcher(pattern: string): PatternMatcher {
// We'll often see the same candidate string many times when searching (For example, when
// we see the name of a module that is used everywhere, or the name of an overload). As
// such, we cache the information we compute about the candidate for the life of this
// pattern matcher so we don't have to compute it multiple times.
var stringToWordSpans: Map<TextSpan[]> = {};
pattern = pattern.trim();
var fullPatternSegment = createSegment(pattern);
var dotSeparatedSegments = pattern.split(".").map(p => createSegment(p.trim()));
var invalidPattern = dotSeparatedSegments.length === 0 || forEach(dotSeparatedSegments, segmentIsInvalid);
return {
getMatches,
getMatchesForLastSegmentOfPattern,
patternContainsDots: dotSeparatedSegments.length > 1
};
// Quick checks so we can bail out when asked to match a candidate.
function skipMatch(candidate: string) {
return invalidPattern || !candidate;
}
function getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[] {
if (skipMatch(candidate)) {
return undefined;
}
return matchSegment(candidate, lastOrUndefined(dotSeparatedSegments));
}
function getMatches(candidate: string, dottedContainer: string): PatternMatch[] {
if (skipMatch(candidate)) {
return undefined;
}
// First, check that the last part of the dot separated pattern matches the name of the
// candidate. If not, then there's no point in proceeding and doing the more
// expensive work.
var candidateMatch = matchSegment(candidate, lastOrUndefined(dotSeparatedSegments));
if (!candidateMatch) {
return undefined;
}
dottedContainer = dottedContainer || "";
var containerParts = dottedContainer.split(".");
// -1 because the last part was checked against the name, and only the rest
// of the parts are checked against the container.
if (dotSeparatedSegments.length - 1 > containerParts.length) {
// There weren't enough container parts to match against the pattern parts.
// So this definitely doesn't match.
return null;
}
// So far so good. Now break up the container for the candidate and check if all
// the dotted parts match up correctly.
var totalMatch = candidateMatch;
for (var i = dotSeparatedSegments.length - 2, j = containerParts.length - 1;
i >= 0;
i--, j--) {
var segment = dotSeparatedSegments[i];
var containerName = containerParts[j];
var containerMatch = matchSegment(containerName, segment);
if (!containerMatch) {
// This container didn't match the pattern piece. So there's no match at all.
return undefined;
}
addRange(totalMatch, containerMatch);
}
// Success, this symbol's full name matched against the dotted name the user was asking
// about.
return totalMatch;
}
function getWordSpans(word: string): TextSpan[] {
if (!hasProperty(stringToWordSpans, word)) {
stringToWordSpans[word] = breakIntoWordSpans(word);
}
return stringToWordSpans[word];
}
function matchTextChunk(candidate: string, chunk: TextChunk, punctuationStripped: boolean): PatternMatch {
var index = indexOfIgnoringCase(candidate, chunk.textLowerCase);
if (index === 0) {
if (chunk.text.length === candidate.length) {
// a) Check if the part matches the candidate entirely, in an case insensitive or
// sensitive manner. If it does, return that there was an exact match.
return createPatternMatch(PatternMatchKind.Exact, punctuationStripped, /*isCaseSensitive:*/ candidate === chunk.text);
}
else {
// b) Check if the part is a prefix of the candidate, in a case insensitive or sensitive
// manner. If it does, return that there was a prefix match.
return createPatternMatch(PatternMatchKind.Prefix, punctuationStripped, /*isCaseSensitive:*/ startsWith(candidate, chunk.text));
}
}
var isLowercase = chunk.isLowerCase;
if (isLowercase) {
if (index > 0) {
// c) If the part is entirely lowercase, then check if it is contained anywhere in the
// candidate in a case insensitive manner. If so, return that there was a substring
// match.
//
// Note: We only have a substring match if the lowercase part is prefix match of some
// word part. That way we don't match something like 'Class' when the user types 'a'.
// But we would match 'FooAttribute' (since 'Attribute' starts with 'a').
var wordSpans = getWordSpans(candidate);
for (var i = 0, n = wordSpans.length; i < n; i++) {
var span = wordSpans[i]
if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) {
return createPatternMatch(PatternMatchKind.Substring, punctuationStripped,
/*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false));
}
}
}
}
else {
// d) If the part was not entirely lowercase, then check if it is contained in the
// candidate in a case *sensitive* manner. If so, return that there was a substring
// match.
if (candidate.indexOf(chunk.text) > 0) {
return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, /*isCaseSensitive:*/ true);
}
}
if (!isLowercase) {
// e) If the part was not entirely lowercase, then attempt a camel cased match as well.
if (chunk.characterSpans.length > 0) {
var candidateParts = getWordSpans(candidate);
var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false);
if (camelCaseWeight !== undefined) {
return createPatternMatch(PatternMatchKind.CamelCase, punctuationStripped, /*isCaseSensitive:*/ true, /*camelCaseWeight:*/ camelCaseWeight);
}
camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true);
if (camelCaseWeight !== undefined) {
return createPatternMatch(PatternMatchKind.CamelCase, punctuationStripped, /*isCaseSensitive:*/ false, /*camelCaseWeight:*/ camelCaseWeight);
}
}
}
if (isLowercase) {
// f) Is the pattern a substring of the candidate starting on one of the candidate's word boundaries?
// We could check every character boundary start of the candidate for the pattern. However, that's
// an m * n operation in the wost case. Instead, find the first instance of the pattern
// substring, and see if it starts on a capital letter. It seems unlikely that the user will try to
// filter the list based on a substring that starts on a capital letter and also with a lowercase one.
// (Pattern: fogbar, Candidate: quuxfogbarFogBar).
if (chunk.text.length < candidate.length) {
if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) {
return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, /*isCaseSensitive:*/ false);
}
}
}
return undefined;
}
function containsSpaceOrAsterisk(text: string): boolean {
for (var i = 0; i < text.length; i++) {
var ch = text.charCodeAt(i);
if (ch === CharacterCodes.space || ch === CharacterCodes.asterisk) {
return true;
}
}
return false;
}
function matchSegment(candidate: string, segment: Segment): PatternMatch[] {
// First check if the segment matches as is. This is also useful if the segment contains
// characters we would normally strip when splitting into parts that we also may want to
// match in the candidate. For example if the segment is "@int" and the candidate is
// "@int", then that will show up as an exact match here.
//
// Note: if the segment contains a space or an asterisk then we must assume that it's a
// multi-word segment.
if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) {
var match = matchTextChunk(candidate, segment.totalTextChunk, /*punctuationStripped:*/ false);
if (match) {
return [match];
}
}
// The logic for pattern matching is now as follows:
//
// 1) Break the segment passed in into words. Breaking is rather simple and a
// good way to think about it that if gives you all the individual alphanumeric words
// of the pattern.
//
// 2) For each word try to match the word against the candidate value.
//
// 3) Matching is as follows:
//
// a) Check if the word matches the candidate entirely, in an case insensitive or
// sensitive manner. If it does, return that there was an exact match.
//
// b) Check if the word is a prefix of the candidate, in a case insensitive or
// sensitive manner. If it does, return that there was a prefix match.
//
// c) If the word is entirely lowercase, then check if it is contained anywhere in the
// candidate in a case insensitive manner. If so, return that there was a substring
// match.
//
// Note: We only have a substring match if the lowercase part is prefix match of
// some word part. That way we don't match something like 'Class' when the user
// types 'a'. But we would match 'FooAttribute' (since 'Attribute' starts with
// 'a').
//
// d) If the word was not entirely lowercase, then check if it is contained in the
// candidate in a case *sensitive* manner. If so, return that there was a substring
// match.
//
// e) If the word was not entirely lowercase, then attempt a camel cased match as
// well.
//
// f) The word is all lower case. Is it a case insensitive substring of the candidate starting
// on a part boundary of the candidate?
//
// Only if all words have some sort of match is the pattern considered matched.
var subWordTextChunks = segment.subWordTextChunks;
var matches: PatternMatch[] = undefined;
for (var i = 0, n = subWordTextChunks.length; i < n; i++) {
var subWordTextChunk = subWordTextChunks[i];
// Try to match the candidate with this word
var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true);
if (!result) {
return undefined;
}
matches = matches || [];
matches.push(result);
}
return matches;
}
function partStartsWith(candidate: string, candidateSpan: TextSpan, pattern: string, ignoreCase: boolean, patternSpan?: TextSpan): boolean {
var patternPartStart = patternSpan ? patternSpan.start : 0;
var patternPartLength = patternSpan ? patternSpan.length : pattern.length;
if (patternPartLength > candidateSpan.length) {
// Pattern part is longer than the candidate part. There can never be a match.
return false;
}
if (ignoreCase) {
for (var i = 0; i < patternPartLength; i++) {
var ch1 = pattern.charCodeAt(patternPartStart + i);
var ch2 = candidate.charCodeAt(candidateSpan.start + i);
if (toLowerCase(ch1) !== toLowerCase(ch2)) {
return false;
}
}
}
else {
for (var i = 0; i < patternPartLength; i++) {
var ch1 = pattern.charCodeAt(patternPartStart + i);
var ch2 = candidate.charCodeAt(candidateSpan.start + i);
if (ch1 !== ch2) {
return false;
}
}
}
return true;
}
function tryCamelCaseMatch(candidate: string, candidateParts: TextSpan[], chunk: TextChunk, ignoreCase: boolean): number {
var chunkCharacterSpans = chunk.characterSpans;
// Note: we may have more pattern parts than candidate parts. This is because multiple
// pattern parts may match a candidate part. For example "SiUI" against "SimpleUI".
// We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI. However, U
// and I will both match in UI.
var currentCandidate = 0;
var currentChunkSpan = 0;
var firstMatch: number = undefined;
var contiguous: boolean = undefined;
while (true) {
// Let's consider our termination cases
if (currentChunkSpan === chunkCharacterSpans.length) {
// We did match! We shall assign a weight to this
var weight = 0;
// Was this contiguous?
if (contiguous) {
weight += 1;
}
// Did we start at the beginning of the candidate?
if (firstMatch === 0) {
weight += 2;
}
return weight;
}
else if (currentCandidate === candidateParts.length) {
// No match, since we still have more of the pattern to hit
return undefined;
}
var candidatePart = candidateParts[currentCandidate];
var gotOneMatchThisCandidate = false;
// Consider the case of matching SiUI against SimpleUIElement. The candidate parts
// will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si'
// against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to
// still keep matching pattern parts against that candidate part.
for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) {
var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan];
if (gotOneMatchThisCandidate) {
// We've already gotten one pattern part match in this candidate. We will
// only continue trying to consumer pattern parts if the last part and this
// part are both upper case.
if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) ||
!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) {
break;
}
}
if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) {
break;
}
gotOneMatchThisCandidate = true;
firstMatch = firstMatch === undefined ? currentCandidate : firstMatch;
// If we were contiguous, then keep that value. If we weren't, then keep that
// value. If we don't know, then set the value to 'true' as an initial match is
// obviously contiguous.
contiguous = contiguous === undefined ? true : contiguous;
candidatePart = createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length);
}
// Check if we matched anything at all. If we didn't, then we need to unset the
// contiguous bit if we currently had it set.
// If we haven't set the bit yet, then that means we haven't matched anything so
// far, and we don't want to change that.
if (!gotOneMatchThisCandidate && contiguous !== undefined) {
contiguous = false;
}
// Move onto the next candidate.
currentCandidate++;
}
}
}
// Helper function to compare two matches to determine which is better. Matches are first
// ordered by kind (so all prefix matches always beat all substring matches). Then, if the
// match is a camel case match, the relative weights of hte match are used to determine
// which is better (with a greater weight being better). Then if the match is of the same
// type, then a case sensitive match is considered better than an insensitive one.
function patternMatchCompareTo(match1: PatternMatch, match2: PatternMatch): number {
return compareType(match1, match2) ||
compareCamelCase(match1, match2) ||
compareCase(match1, match2) ||
comparePunctuation(match1, match2);
}
function comparePunctuation(result1: PatternMatch, result2: PatternMatch) {
// Consider a match to be better if it was successful without stripping punctuation
// versus a match that had to strip punctuation to succeed.
if (result1.punctuationStripped !== result2.punctuationStripped) {
return result1.punctuationStripped ? 1 : -1;
}
return 0;
}
function compareCase(result1: PatternMatch, result2: PatternMatch) {
if (result1.isCaseSensitive !== result2.isCaseSensitive) {
return result1.isCaseSensitive ? -1 : 1;
}
return 0;
}
function compareType(result1: PatternMatch, result2: PatternMatch) {
return result1.kind - result2.kind;
}
function compareCamelCase(result1: PatternMatch, result2: PatternMatch) {
if (result1.kind === PatternMatchKind.CamelCase && result2.kind === PatternMatchKind.CamelCase) {
// Swap the values here. If result1 has a higher weight, then we want it to come
// first.
return result2.camelCaseWeight - result1.camelCaseWeight;
}
return 0;
}
function createSegment(text: string): Segment {
return {
totalTextChunk: createTextChunk(text),
subWordTextChunks: breakPatternIntoTextChunks(text)
}
}
// A segment is considered invalid if we couldn't find any words in it.
function segmentIsInvalid(segment: Segment) {
return segment.subWordTextChunks.length === 0;
}
function isUpperCaseLetter(ch: number) {
// Fast check for the ascii range.
if (ch >= CharacterCodes.A && ch <= CharacterCodes.Z) {
return true;
}
if (ch < CharacterCodes.maxAsciiCharacter || !isUnicodeIdentifierStart(ch, ScriptTarget.Latest)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
// non-allocating manner.
var str = String.fromCharCode(ch);
return str === str.toUpperCase();
}
function isLowerCaseLetter(ch: number) {
// Fast check for the ascii range.
if (ch >= CharacterCodes.a && ch <= CharacterCodes.z) {
return true;
}
if (ch < CharacterCodes.maxAsciiCharacter || !isUnicodeIdentifierStart(ch, ScriptTarget.Latest)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
// non-allocating manner.
var str = String.fromCharCode(ch);
return str === str.toLowerCase();
}
function containsUpperCaseLetter(string: string): boolean {
for (var i = 0, n = string.length; i < n; i++) {
if (isUpperCaseLetter(string.charCodeAt(i))) {
return true;
}
}
return false;
}
function startsWith(string: string, search: string) {
for (var i = 0, n = search.length; i < n; i++) {
if (string.charCodeAt(i) !== search.charCodeAt(i)) {
return false;
}
}
return true;
}
// Assumes 'value' is already lowercase.
function indexOfIgnoringCase(string: string, value: string): number {
for (var i = 0, n = string.length - value.length; i <= n; i++) {
if (startsWithIgnoringCase(string, value, i)) {
return i;
}
}
return -1;
}
// Assumes 'value' is already lowercase.
function startsWithIgnoringCase(string: string, value: string, start: number): boolean {
for (var i = 0, n = value.length; i < n; i++) {
var ch1 = toLowerCase(string.charCodeAt(i + start));
var ch2 = value.charCodeAt(i);
if (ch1 !== ch2) {
return false;
}
}
return true;
}
function toLowerCase(ch: number): number {
// Fast convert for the ascii range.
if (ch >= CharacterCodes.A && ch <= CharacterCodes.Z) {
return CharacterCodes.a + (ch - CharacterCodes.A);
}
if (ch < CharacterCodes.maxAsciiCharacter) {
return ch;
}
// TODO: find a way to compute this for any unicode characters in a
// non-allocating manner.
return String.fromCharCode(ch).toLowerCase().charCodeAt(0);
}
function isDigit(ch: number) {
// TODO(cyrusn): Find a way to support this for unicode digits.
return ch >= CharacterCodes._0 && ch <= CharacterCodes._9;
}
function isWordChar(ch: number) {
return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === CharacterCodes._ || ch === CharacterCodes.$;
}
function breakPatternIntoTextChunks(pattern: string): TextChunk[] {
var result: TextChunk[] = [];
var wordStart = 0;
var wordLength = 0;
for (var i = 0; i < pattern.length; i++) {
var ch = pattern.charCodeAt(i);
if (isWordChar(ch)) {
if (wordLength++ === 0) {
wordStart = i;
}
}
else {
if (wordLength > 0) {
result.push(createTextChunk(pattern.substr(wordStart, wordLength)));
wordLength = 0;
}
}
}
if (wordLength > 0) {
result.push(createTextChunk(pattern.substr(wordStart, wordLength)));
}
return result;
}
function createTextChunk(text: string): TextChunk {
var textLowerCase = text.toLowerCase();
return {
text,
textLowerCase,
isLowerCase: text === textLowerCase,
characterSpans: breakIntoCharacterSpans(text)
}
}
/* @internal */ export function breakIntoCharacterSpans(identifier: string): TextSpan[] {
return breakIntoSpans(identifier, /*word:*/ false);
}
/* @internal */ export function breakIntoWordSpans(identifier: string): TextSpan[] {
return breakIntoSpans(identifier, /*word:*/ true);
}
function breakIntoSpans(identifier: string, word: boolean): TextSpan[] {
var result: TextSpan[] = [];
var wordStart = 0;
for (var i = 1, n = identifier.length; i < n; i++) {
var lastIsDigit = isDigit(identifier.charCodeAt(i - 1));
var currentIsDigit = isDigit(identifier.charCodeAt(i));
var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i);
var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart);
if (charIsPunctuation(identifier.charCodeAt(i - 1)) ||
charIsPunctuation(identifier.charCodeAt(i)) ||
lastIsDigit != currentIsDigit ||
hasTransitionFromLowerToUpper ||
hasTransitionFromUpperToLower) {
if (!isAllPunctuation(identifier, wordStart, i)) {
result.push(createTextSpan(wordStart, i - wordStart));
}
wordStart = i;
}
}
if (!isAllPunctuation(identifier, wordStart, identifier.length)) {
result.push(createTextSpan(wordStart, identifier.length - wordStart));
}
return result;
}
function charIsPunctuation(ch: number) {
switch (ch) {
case CharacterCodes.exclamation:
case CharacterCodes.doubleQuote:
case CharacterCodes.hash:
case CharacterCodes.percent:
case CharacterCodes.ampersand:
case CharacterCodes.singleQuote:
case CharacterCodes.openParen:
case CharacterCodes.closeParen:
case CharacterCodes.asterisk:
case CharacterCodes.comma:
case CharacterCodes.minus:
case CharacterCodes.dot:
case CharacterCodes.slash:
case CharacterCodes.colon:
case CharacterCodes.semicolon:
case CharacterCodes.question:
case CharacterCodes.at:
case CharacterCodes.openBracket:
case CharacterCodes.backslash:
case CharacterCodes.closeBracket:
case CharacterCodes._:
case CharacterCodes.openBrace:
case CharacterCodes.closeBrace:
return true;
}
return false;
}
function isAllPunctuation(identifier: string, start: number, end: number): boolean {
for (var i = start; i < end; i++) {
var ch = identifier.charCodeAt(i);
// We don't consider _ or $ as punctuation as there may be things with that name.
if (!charIsPunctuation(ch) || ch === CharacterCodes._ || ch === CharacterCodes.$) {
return false;
}
}
return true;
}
function transitionFromUpperToLower(identifier: string, word: boolean, index: number, wordStart: number): boolean {
if (word) {
// Cases this supports:
// 1) IDisposable -> I, Disposable
// 2) UIElement -> UI, Element
// 3) HTMLDocument -> HTML, Document
//
// etc.
if (index != wordStart &&
index + 1 < identifier.length) {
var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index));
var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1));
if (currentIsUpper && nextIsLower) {
// We have a transition from an upper to a lower letter here. But we only
// want to break if all the letters that preceded are uppercase. i.e. if we
// have "Foo" we don't want to break that into "F, oo". But if we have
// "IFoo" or "UIFoo", then we want to break that into "I, Foo" and "UI,
// Foo". i.e. the last uppercase letter belongs to the lowercase letters
// that follows. Note: this will make the following not split properly:
// "HELLOthere". However, these sorts of names do not show up in .Net
// programs.
for (var i = wordStart; i < index; i++) {
if (!isUpperCaseLetter(identifier.charCodeAt(i))) {
return false;
}
}
return true;
}
}
}
return false;
}
function transitionFromLowerToUpper(identifier: string, word: boolean, index: number): boolean {
var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1));
var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index));
// See if the casing indicates we're starting a new word. Note: if we're breaking on
// words, then just seeing an upper case character isn't enough. Instead, it has to
// be uppercase and the previous character can't be uppercase.
//
// For example, breaking "AddMetadata" on words would make: Add Metadata
//
// on characters would be: A dd M etadata
//
// Break "AM" on words would be: AM
//
// on characters would be: A M
//
// We break the search string on characters. But we break the symbol name on words.
var transition = word
? (currentIsUpper && !lastIsUpper)
: currentIsUpper;
return transition;
}
}
+131 -268
View File
@@ -2,14 +2,15 @@
/// <reference path='breakpoints.ts' />
/// <reference path='outliningElementsCollector.ts' />
/// <reference path='navigateTo.ts' />
/// <reference path='navigationBar.ts' />
/// <reference path='patternMatcher.ts' />
/// <reference path='signatureHelp.ts' />
/// <reference path='utilities.ts' />
/// <reference path='formatting\formatting.ts' />
/// <reference path='formatting\smartIndenter.ts' />
module ts {
export var servicesVersion = "0.4"
export interface Node {
@@ -61,9 +62,9 @@ module ts {
scriptSnapshot: IScriptSnapshot;
nameTable: Map<string>;
getNamedDeclarations(): Declaration[];
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
getLineStarts(): number[];
getPositionFromLineAndCharacter(line: number, character: number): number;
getPositionOfLineAndCharacter(line: number, character: number): number;
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
}
@@ -612,7 +613,7 @@ module ts {
}
if (paramHelpStringMargin === undefined) {
paramHelpStringMargin = sourceFile.getLineAndCharacterFromPosition(firstLineParamHelpStringPos).character - 1;
paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character;
}
// Now consume white spaces max
@@ -750,16 +751,16 @@ module ts {
return updateSourceFile(this, newText, textChangeRange);
}
public getLineAndCharacterFromPosition(position: number): LineAndCharacter {
return getLineAndCharacterOfPosition(this, position);
public getLineAndCharacterOfPosition(position: number): LineAndCharacter {
return ts.getLineAndCharacterOfPosition(this, position);
}
public getLineStarts(): number[] {
return getLineStarts(this);
}
public getPositionFromLineAndCharacter(line: number, character: number): number {
return getPositionFromLineAndCharacter(this, line, character);
public getPositionOfLineAndCharacter(line: number, character: number): number {
return ts.getPositionOfLineAndCharacter(this, line, character);
}
public getNamedDeclarations() {
@@ -800,7 +801,7 @@ module ts {
case SyntaxKind.TypeAliasDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ImportEqualsDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.TypeLiteral:
@@ -900,7 +901,7 @@ module ts {
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getNavigateToItems(searchValue: string): NavigateToItem[];
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
getNavigationBarItems(fileName: string): NavigationBarItem[];
getOutliningSpans(fileName: string): OutliningSpan[];
@@ -1378,13 +1379,6 @@ module ts {
public static typeAlias = "type alias name";
}
enum MatchKind {
none = 0,
exact = 1,
substring = 2,
prefix = 3
}
/// Language Service
interface CompletionSession {
@@ -1558,78 +1552,49 @@ module ts {
var file = this.getEntry(fileName);
return file && file.scriptSnapshot;
}
public getChangeRange(fileName: string, lastKnownVersion: string, oldScriptSnapshot: IScriptSnapshot): TextChangeRange {
var currentVersion = this.getVersion(fileName);
if (lastKnownVersion === currentVersion) {
return unchangedTextChangeRange; // "No changes"
}
var scriptSnapshot = this.getScriptSnapshot(fileName);
return scriptSnapshot.getChangeRange(oldScriptSnapshot);
}
}
class SyntaxTreeCache {
private hostCache: HostCache;
// For our syntactic only features, we also keep a cache of the syntax tree for the
// currently edited file.
private currentFileName: string = "";
private currentFileVersion: string = null;
private currentSourceFile: SourceFile = null;
private currentFileName: string;
private currentFileVersion: string;
private currentFileScriptSnapshot: IScriptSnapshot;
private currentSourceFile: SourceFile;
constructor(private host: LanguageServiceHost) {
}
private log(message: string) {
if (this.host.log) {
this.host.log(message);
public getCurrentSourceFile(fileName: string): SourceFile {
var scriptSnapshot = this.host.getScriptSnapshot(fileName);
if (!scriptSnapshot) {
// The host does not know about this file.
throw new Error("Could not find file: '" + fileName + "'.");
}
}
private initialize(fileName: string) {
// ensure that both source file and syntax tree are either initialized or not initialized
var start = new Date().getTime();
this.hostCache = new HostCache(this.host);
this.log("SyntaxTreeCache.Initialize: new HostCache: " + (new Date().getTime() - start));
var version = this.hostCache.getVersion(fileName);
var version = this.host.getScriptVersion(fileName);
var sourceFile: SourceFile;
if (this.currentFileName !== fileName) {
var scriptSnapshot = this.hostCache.getScriptSnapshot(fileName);
var start = new Date().getTime();
// This is a new file, just parse it
sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, ScriptTarget.Latest, version, /*setNodeParents:*/ true);
this.log("SyntaxTreeCache.Initialize: createSourceFile: " + (new Date().getTime() - start));
}
else if (this.currentFileVersion !== version) {
var scriptSnapshot = this.hostCache.getScriptSnapshot(fileName);
var editRange = this.hostCache.getChangeRange(fileName, this.currentFileVersion, this.currentSourceFile.scriptSnapshot);
var start = new Date().getTime();
// This is the same file, just a newer version. Incrementally parse the file.
var editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot);
sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange);
this.log("SyntaxTreeCache.Initialize: updateSourceFile: " + (new Date().getTime() - start));
}
if (sourceFile) {
// All done, ensure state is up to date
this.currentFileVersion = version;
this.currentFileName = fileName;
this.currentFileScriptSnapshot = scriptSnapshot;
this.currentSourceFile = sourceFile;
}
}
public getCurrentSourceFile(fileName: string): SourceFile {
this.initialize(fileName);
return this.currentSourceFile;
}
public getCurrentScriptSnapshot(fileName: string): IScriptSnapshot {
return this.getCurrentSourceFile(fileName).scriptSnapshot;
}
}
function setSourceFileFields(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string) {
@@ -1930,7 +1895,7 @@ module ts {
function isNameOfExternalModuleImportOrDeclaration(node: Node): boolean {
if (node.kind === SyntaxKind.StringLiteral) {
return isNameOfModuleDeclaration(node) ||
(isExternalModuleImportDeclaration(node.parent.parent) && getExternalModuleImportDeclarationExpression(node.parent.parent) === node);
(isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node);
}
return false;
@@ -1992,6 +1957,62 @@ module ts {
});
}
/* @internal */ export function getContainerNode(node: Node): Node {
while (true) {
node = node.parent;
if (!node) {
return undefined;
}
switch (node.kind) {
case SyntaxKind.SourceFile:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ModuleDeclaration:
return node;
}
}
}
/* @internal */ export function getNodeKind(node: Node): string {
switch (node.kind) {
case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement;
case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement;
case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement;
case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement;
case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement;
case SyntaxKind.VariableDeclaration:
return isConst(node)
? ScriptElementKind.constElement
: isLet(node)
? ScriptElementKind.letElement
: ScriptElementKind.variableElement;
case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement;
case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement;
case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
return ScriptElementKind.memberFunctionElement;
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.PropertySignature:
return ScriptElementKind.memberVariableElement;
case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement;
case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement;
case SyntaxKind.CallSignature: return ScriptElementKind.callSignatureElement;
case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement;
case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement;
case SyntaxKind.EnumMember: return ScriptElementKind.variableElement;
case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement;
}
return ScriptElementKind.unknown;
}
export function createLanguageService(host: LanguageServiceHost, documentRegistry: DocumentRegistry = createDocumentRegistry()): LanguageService {
var syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host);
var ruleProvider: formatting.RulesProvider;
@@ -2019,6 +2040,7 @@ module ts {
}
function getValidSourceFile(fileName: string): SourceFile {
fileName = normalizeSlashes(fileName);
var sourceFile = program.getSourceFile(getCanonicalFileName(fileName));
if (!sourceFile) {
throw new Error("Could not find file: '" + fileName + "'.");
@@ -2107,7 +2129,7 @@ module ts {
}
// We have an older version of the sourceFile, incrementally parse the changes
var textChangeRange = hostCache.getChangeRange(fileName, oldSourceFile.version, oldSourceFile.scriptSnapshot);
var textChangeRange = hostFileInformation.scriptSnapshot.getChangeRange(oldSourceFile.scriptSnapshot);
return documentRegistry.updateDocument(oldSourceFile, fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version, textChangeRange);
}
}
@@ -2172,8 +2194,6 @@ module ts {
function getSyntacticDiagnostics(fileName: string) {
synchronizeHostData();
fileName = normalizeSlashes(fileName);
return program.getSyntacticDiagnostics(getValidSourceFile(fileName));
}
@@ -2184,7 +2204,6 @@ module ts {
function getSemanticDiagnostics(fileName: string) {
synchronizeHostData();
fileName = normalizeSlashes(fileName)
var targetSourceFile = getValidSourceFile(fileName);
// Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file.
@@ -2261,8 +2280,6 @@ module ts {
function getCompletionsAtPosition(fileName: string, position: number) {
synchronizeHostData();
fileName = normalizeSlashes(fileName);
var syntacticStart = new Date().getTime();
var sourceFile = getValidSourceFile(fileName);
@@ -2681,8 +2698,6 @@ module ts {
function getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails {
// Note: No need to call synchronizeHostData, as we have captured all the data we need
// in the getCompletionsAtPosition earlier
fileName = normalizeSlashes(fileName);
var sourceFile = getValidSourceFile(fileName);
var session = activeCompletionSession;
@@ -2722,29 +2737,6 @@ module ts {
}
}
function getContainerNode(node: Node): Node {
while (true) {
node = node.parent;
if (!node) {
return undefined;
}
switch (node.kind) {
case SyntaxKind.SourceFile:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ModuleDeclaration:
return node;
}
}
}
// TODO(drosen): use contextual SemanticMeaning.
function getSymbolKind(symbol: Symbol, typeResolver: TypeChecker, location: Node): string {
var flags = symbol.getFlags();
@@ -2831,39 +2823,6 @@ module ts {
return ScriptElementKind.unknown;
}
function getNodeKind(node: Node): string {
switch (node.kind) {
case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement;
case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement;
case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement;
case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement;
case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement;
case SyntaxKind.VariableDeclaration:
return isConst(node)
? ScriptElementKind.constElement
: isLet(node)
? ScriptElementKind.letElement
: ScriptElementKind.variableElement;
case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement;
case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement;
case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
return ScriptElementKind.memberFunctionElement;
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.PropertySignature:
return ScriptElementKind.memberVariableElement;
case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement;
case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement;
case SyntaxKind.CallSignature: return ScriptElementKind.callSignatureElement;
case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement;
case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement;
case SyntaxKind.EnumMember: return ScriptElementKind.variableElement;
case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement;
}
return ScriptElementKind.unknown;
}
function getSymbolModifiers(symbol: Symbol): string {
return symbol && symbol.declarations && symbol.declarations.length > 0
? getNodeModifiers(symbol.declarations[0])
@@ -3086,19 +3045,19 @@ module ts {
displayParts.push(spacePart());
addFullSymbolName(symbol);
ts.forEach(symbol.declarations, declaration => {
if (declaration.kind === SyntaxKind.ImportDeclaration) {
var importDeclaration = <ImportDeclaration>declaration;
if (isExternalModuleImportDeclaration(importDeclaration)) {
if (declaration.kind === SyntaxKind.ImportEqualsDeclaration) {
var importEqualsDeclaration = <ImportEqualsDeclaration>declaration;
if (isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) {
displayParts.push(spacePart());
displayParts.push(operatorPart(SyntaxKind.EqualsToken));
displayParts.push(spacePart());
displayParts.push(keywordPart(SyntaxKind.RequireKeyword));
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
displayParts.push(displayPart(getTextOfNode(getExternalModuleImportDeclarationExpression(importDeclaration)), SymbolDisplayPartKind.stringLiteral));
displayParts.push(displayPart(getTextOfNode(getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral));
displayParts.push(punctuationPart(SyntaxKind.CloseParenToken));
}
else {
var internalAliasSymbol = typeResolver.getSymbolAtLocation(importDeclaration.moduleReference);
var internalAliasSymbol = typeResolver.getSymbolAtLocation(importEqualsDeclaration.moduleReference);
if (internalAliasSymbol) {
displayParts.push(spacePart());
displayParts.push(operatorPart(SyntaxKind.EqualsToken));
@@ -3201,7 +3160,6 @@ module ts {
function getQuickInfoAtPosition(fileName: string, position: number): QuickInfo {
synchronizeHostData();
fileName = normalizeSlashes(fileName);
var sourceFile = getValidSourceFile(fileName);
var node = getTouchingPropertyName(sourceFile, position);
if (!node) {
@@ -3247,7 +3205,6 @@ module ts {
function getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] {
synchronizeHostData();
fileName = normalizeSlashes(fileName);
var sourceFile = getValidSourceFile(fileName);
var node = getTouchingPropertyName(sourceFile, position);
@@ -3383,7 +3340,6 @@ module ts {
function getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
synchronizeHostData();
fileName = normalizeSlashes(fileName);
var sourceFile = getValidSourceFile(fileName);
var node = getTouchingWord(sourceFile, position);
@@ -3932,7 +3888,6 @@ module ts {
function findReferences(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): ReferenceEntry[] {
synchronizeHostData();
fileName = normalizeSlashes(fileName);
var sourceFile = getValidSourceFile(fileName);
var node = getTouchingPropertyName(sourceFile, position);
@@ -4654,7 +4609,7 @@ module ts {
return true;
}
else if (parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>parent).left === node) {
var operator = (<BinaryExpression>parent).operator;
var operator = (<BinaryExpression>parent).operatorToken.kind;
return SyntaxKind.FirstAssignment <= operator && operator <= SyntaxKind.LastAssignment;
}
}
@@ -4663,89 +4618,10 @@ module ts {
}
/// NavigateTo
function getNavigateToItems(searchValue: string): NavigateToItem[] {
function getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[] {
synchronizeHostData();
// Split search value in terms array
var terms = searchValue.split(" ");
// default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version
var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t }));
var items: NavigateToItem[] = [];
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
forEach(program.getSourceFiles(), sourceFile => {
cancellationToken.throwIfCancellationRequested();
var fileName = sourceFile.fileName;
var declarations = sourceFile.getNamedDeclarations();
for (var i = 0, n = declarations.length; i < n; i++) {
var declaration = declarations[i];
// TODO(jfreeman): Skip this declaration if it has a computed name
var name = (<Identifier>declaration.name).text;
var matchKind = getMatchKind(searchTerms, name);
if (matchKind !== MatchKind.none) {
var container = <Declaration>getContainerNode(declaration);
items.push({
name: name,
kind: getNodeKind(declaration),
kindModifiers: getNodeModifiers(declaration),
matchKind: MatchKind[matchKind],
fileName: fileName,
textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()),
// TODO(jfreeman): What should be the containerName when the container has a computed name?
containerName: container && container.name ? (<Identifier>container.name).text : "",
containerKind: container && container.name ? getNodeKind(container) : ""
});
}
}
});
return items;
function hasAnyUpperCaseCharacter(s: string): boolean {
for (var i = 0, n = s.length; i < n; i++) {
var c = s.charCodeAt(i);
if ((CharacterCodes.A <= c && c <= CharacterCodes.Z) ||
(c >= CharacterCodes.maxAsciiCharacter && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) {
return true;
}
}
return false;
}
function getMatchKind(searchTerms: { caseSensitive: boolean; term: string }[], name: string): MatchKind {
var matchKind = MatchKind.none;
if (name) {
for (var j = 0, n = searchTerms.length; j < n; j++) {
var searchTerm = searchTerms[j];
var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase();
// in case of case-insensitive search searchTerm.term will already be lower-cased
var index = nameToSearch.indexOf(searchTerm.term);
if (index < 0) {
// Didn't match.
return MatchKind.none;
}
var termKind = MatchKind.substring;
if (index === 0) {
// here we know that match occur at the beginning of the string.
// if search term and declName has the same length - we have an exact match, otherwise declName have longer length and this will be prefix match
termKind = name.length === searchTerm.term.length ? MatchKind.exact : MatchKind.prefix;
}
// Update our match kind if we don't have one, or if this match is better.
if (matchKind === MatchKind.none || termKind < matchKind) {
matchKind = termKind;
}
}
}
return matchKind;
}
return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount);
}
function containErrors(diagnostics: Diagnostic[]): boolean {
@@ -4755,7 +4631,6 @@ module ts {
function getEmitOutput(fileName: string): EmitOutput {
synchronizeHostData();
fileName = normalizeSlashes(fileName);
var sourceFile = getValidSourceFile(fileName);
var outputFiles: OutputFile[] = [];
@@ -4818,7 +4693,7 @@ module ts {
return SemanticMeaning.Namespace;
}
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ImportEqualsDeclaration:
return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace;
// An external module can be a Value
@@ -4853,10 +4728,10 @@ module ts {
while (node.parent.kind === SyntaxKind.QualifiedName) {
node = node.parent;
}
return isInternalModuleImportDeclaration(node.parent) && (<ImportDeclaration>node.parent).moduleReference === node;
return isInternalModuleImportEqualsDeclaration(node.parent) && (<ImportEqualsDeclaration>node.parent).moduleReference === node;
}
function getMeaningFromRightHandSideOfImport(node: Node) {
function getMeaningFromRightHandSideOfImportEquals(node: Node) {
Debug.assert(node.kind === SyntaxKind.Identifier);
// import a = |b|; // Namespace
@@ -4865,7 +4740,7 @@ module ts {
if (node.parent.kind === SyntaxKind.QualifiedName &&
(<QualifiedName>node.parent).right === node &&
node.parent.parent.kind === SyntaxKind.ImportDeclaration) {
node.parent.parent.kind === SyntaxKind.ImportEqualsDeclaration) {
return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace;
}
return SemanticMeaning.Namespace;
@@ -4876,7 +4751,7 @@ module ts {
return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace;
}
else if (isInRightSideOfImport(node)) {
return getMeaningFromRightHandSideOfImport(node);
return getMeaningFromRightHandSideOfImportEquals(node);
}
else if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
return getMeaningFromDeclaration(node.parent);
@@ -4899,23 +4774,21 @@ module ts {
function getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems {
synchronizeHostData();
fileName = normalizeSlashes(fileName);
var sourceFile = getValidSourceFile(fileName);
return SignatureHelp.getSignatureHelpItems(sourceFile, position, typeInfoResolver, cancellationToken);
}
/// Syntactic features
function getCurrentSourceFile(fileName: string): SourceFile {
fileName = normalizeSlashes(fileName);
var currentSourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
return currentSourceFile;
function getSourceFile(fileName: string): SourceFile {
return syntaxTreeCache.getCurrentSourceFile(fileName);
}
function getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan {
fileName = ts.normalizeSlashes(fileName);
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
// Get node at the location
var node = getTouchingPropertyName(getCurrentSourceFile(fileName), startPos);
var node = getTouchingPropertyName(sourceFile, startPos);
if (!node) {
return;
@@ -4969,19 +4842,19 @@ module ts {
function getBreakpointStatementAtPosition(fileName: string, position: number) {
// doesn't use compiler - no need to synchronize with host
fileName = ts.normalizeSlashes(fileName);
return BreakpointResolver.spanInSourceFileAtLocation(getCurrentSourceFile(fileName), position);
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
return BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position);
}
function getNavigationBarItems(fileName: string): NavigationBarItem[] {
fileName = normalizeSlashes(fileName);
function getNavigationBarItems(fileName: string): NavigationBarItem[]{
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
return NavigationBar.getNavigationBarItems(getCurrentSourceFile(fileName));
return NavigationBar.getNavigationBarItems(sourceFile);
}
function getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] {
synchronizeHostData();
fileName = normalizeSlashes(fileName);
var sourceFile = getValidSourceFile(fileName);
@@ -5055,8 +4928,7 @@ module ts {
function getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] {
// doesn't use compiler - no need to synchronize with host
fileName = normalizeSlashes(fileName);
var sourceFile = getCurrentSourceFile(fileName);
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
// Make a scanner we can get trivia from.
var triviaScanner = createScanner(ScriptTarget.Latest, /*skipTrivia:*/ false, sourceFile.text);
@@ -5274,13 +5146,12 @@ module ts {
function getOutliningSpans(fileName: string): OutliningSpan[] {
// doesn't use compiler - no need to synchronize with host
fileName = normalizeSlashes(fileName);
var sourceFile = getCurrentSourceFile(fileName);
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
return OutliningElementsCollector.collectElements(sourceFile);
}
function getBraceMatchingAtPosition(fileName: string, position: number) {
var sourceFile = getCurrentSourceFile(fileName);
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
var result: TextSpan[] = [];
var token = getTouchingToken(sourceFile, position);
@@ -5333,10 +5204,8 @@ module ts {
}
function getIndentationAtPosition(fileName: string, position: number, editorOptions: EditorOptions) {
fileName = normalizeSlashes(fileName);
var start = new Date().getTime();
var sourceFile = getCurrentSourceFile(fileName);
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start));
var start = new Date().getTime();
@@ -5348,22 +5217,17 @@ module ts {
}
function getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[] {
fileName = normalizeSlashes(fileName);
var sourceFile = getCurrentSourceFile(fileName);
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
return formatting.formatSelection(start, end, sourceFile, getRuleProvider(options), options);
}
function getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[] {
fileName = normalizeSlashes(fileName);
var sourceFile = getCurrentSourceFile(fileName);
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
return formatting.formatDocument(sourceFile, getRuleProvider(options), options);
}
function getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[] {
fileName = normalizeSlashes(fileName);
var sourceFile = getCurrentSourceFile(fileName);
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
if (key === "}") {
return formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(options), options);
@@ -5387,8 +5251,6 @@ module ts {
// anything away.
synchronizeHostData();
fileName = normalizeSlashes(fileName);
var sourceFile = getValidSourceFile(fileName);
cancellationToken.throwIfCancellationRequested();
@@ -5531,7 +5393,6 @@ module ts {
function getRenameInfo(fileName: string, position: number): RenameInfo {
synchronizeHostData();
fileName = normalizeSlashes(fileName);
var sourceFile = getValidSourceFile(fileName);
var node = getTouchingWord(sourceFile, position);
@@ -5615,7 +5476,7 @@ module ts {
getFormattingEditsForDocument,
getFormattingEditsAfterKeystroke,
getEmitOutput,
getSourceFile: getCurrentSourceFile,
getSourceFile,
getProgram
};
}
@@ -5779,25 +5640,25 @@ module ts {
}
}
else if (lastNonTriviaToken === SyntaxKind.DotToken && isKeyword(token)) {
token = SyntaxKind.Identifier;
token = SyntaxKind.Identifier;
}
else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) {
// We have two keywords in a row. Only treat the second as a keyword if
// it's a sequence that could legally occur in the language. Otherwise
// treat it as an identifier. This way, if someone writes "private var"
// we recognize that 'var' is actually an identifier here.
token = SyntaxKind.Identifier;
// We have two keywords in a row. Only treat the second as a keyword if
// it's a sequence that could legally occur in the language. Otherwise
// treat it as an identifier. This way, if someone writes "private var"
// we recognize that 'var' is actually an identifier here.
token = SyntaxKind.Identifier;
}
else if (lastNonTriviaToken === SyntaxKind.Identifier &&
token === SyntaxKind.LessThanToken) {
// Could be the start of something generic. Keep track of that by bumping
// up the current count of generic contexts we may be in.
angleBracketStack++;
// Could be the start of something generic. Keep track of that by bumping
// up the current count of generic contexts we may be in.
angleBracketStack++;
}
else if (token === SyntaxKind.GreaterThanToken && angleBracketStack > 0) {
// If we think we're currently in something generic, then mark that that
// generic entity is complete.
angleBracketStack--;
// If we think we're currently in something generic, then mark that that
// generic entity is complete.
angleBracketStack--;
}
else if (token === SyntaxKind.AnyKeyword ||
token === SyntaxKind.StringKeyword ||
@@ -5958,7 +5819,8 @@ module ts {
case SyntaxKind.EqualsToken:
case SyntaxKind.CommaToken:
return true;
default: return false;
default:
return false;
}
}
@@ -6003,6 +5865,7 @@ module ts {
case SyntaxKind.SingleLineCommentTrivia:
return TokenClass.Comment;
case SyntaxKind.WhitespaceTrivia:
case SyntaxKind.NewLineTrivia:
return TokenClass.Whitespace;
case SyntaxKind.Identifier:
default:
+4 -4
View File
@@ -138,7 +138,7 @@ module ts {
* Returns a JSON-encoded value of the type:
* { name: string; kind: string; kindModifiers: string; containerName: string; containerKind: string; matchKind: string; fileName: string; textSpan: { start: number; length: number}; } [] = [];
*/
getNavigateToItems(searchValue: string): string;
getNavigateToItems(searchValue: string, maxResultCount?: number): string;
/**
* Returns a JSON-encoded value of the type:
@@ -628,11 +628,11 @@ module ts {
/// NAVIGATE TO
/** Return a list of symbols that are interesting to navigate to */
public getNavigateToItems(searchValue: string): string {
public getNavigateToItems(searchValue: string, maxResultCount?: number): string {
return this.forwardJSONCall(
"getNavigateToItems('" + searchValue + "')",
"getNavigateToItems('" + searchValue + "', " + maxResultCount+ ")",
() => {
var items = this.languageService.getNavigateToItems(searchValue);
var items = this.languageService.getNavigateToItems(searchValue, maxResultCount);
return items;
});
}
+6 -12
View File
@@ -6,12 +6,11 @@ module ts {
}
export function getEndLinePosition(line: number, sourceFile: SourceFile): number {
Debug.assert(line >= 1);
Debug.assert(line >= 0);
var lineStarts = sourceFile.getLineStarts();
// lines returned by SourceFile.getLineAndCharacterForPosition are 1-based
var lineIndex = line - 1;
if (lineIndex === lineStarts.length - 1) {
var lineIndex = line;
if (lineIndex + 1 === lineStarts.length) {
// last line - return EOF
return sourceFile.text.length - 1;
}
@@ -32,15 +31,10 @@ module ts {
}
}
export function getStartPositionOfLine(line: number, sourceFile: SourceFile): number {
Debug.assert(line >= 1);
return sourceFile.getLineStarts()[line - 1];
}
export function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number {
export function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number {
var lineStarts = sourceFile.getLineStarts();
var line = sourceFile.getLineAndCharacterFromPosition(position).line;
return lineStarts[line - 1];
var line = sourceFile.getLineAndCharacterOfPosition(position).line;
return lineStarts[line];
}
export function rangeContainsRange(r1: TextRange, r2: TextRange): boolean {
+1 -3
View File
@@ -30,9 +30,7 @@ var Board = (function () {
function Board() {
}
Board.prototype.allShipsSunk = function () {
return this.ships.every(function (val) {
return val.isSunk;
});
return this.ships.every(function (val) { return val.isSunk; });
};
return Board;
})();
+185 -144
View File
@@ -21,8 +21,8 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void
var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
allDiagnostics.forEach(diagnostic => {
var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`);
var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`);
});
var exitCode = emitResult.emitSkipped ? 1 : 0;
@@ -160,132 +160,142 @@ declare module "typescript" {
VoidKeyword = 98,
WhileKeyword = 99,
WithKeyword = 100,
ImplementsKeyword = 101,
InterfaceKeyword = 102,
LetKeyword = 103,
PackageKeyword = 104,
PrivateKeyword = 105,
ProtectedKeyword = 106,
PublicKeyword = 107,
StaticKeyword = 108,
YieldKeyword = 109,
AnyKeyword = 110,
BooleanKeyword = 111,
ConstructorKeyword = 112,
DeclareKeyword = 113,
GetKeyword = 114,
ModuleKeyword = 115,
RequireKeyword = 116,
NumberKeyword = 117,
SetKeyword = 118,
StringKeyword = 119,
SymbolKeyword = 120,
TypeKeyword = 121,
OfKeyword = 122,
QualifiedName = 123,
ComputedPropertyName = 124,
TypeParameter = 125,
Parameter = 126,
PropertySignature = 127,
PropertyDeclaration = 128,
MethodSignature = 129,
MethodDeclaration = 130,
Constructor = 131,
GetAccessor = 132,
SetAccessor = 133,
CallSignature = 134,
ConstructSignature = 135,
IndexSignature = 136,
TypeReference = 137,
FunctionType = 138,
ConstructorType = 139,
TypeQuery = 140,
TypeLiteral = 141,
ArrayType = 142,
TupleType = 143,
UnionType = 144,
ParenthesizedType = 145,
ObjectBindingPattern = 146,
ArrayBindingPattern = 147,
BindingElement = 148,
ArrayLiteralExpression = 149,
ObjectLiteralExpression = 150,
PropertyAccessExpression = 151,
ElementAccessExpression = 152,
CallExpression = 153,
NewExpression = 154,
TaggedTemplateExpression = 155,
TypeAssertionExpression = 156,
ParenthesizedExpression = 157,
FunctionExpression = 158,
ArrowFunction = 159,
DeleteExpression = 160,
TypeOfExpression = 161,
VoidExpression = 162,
PrefixUnaryExpression = 163,
PostfixUnaryExpression = 164,
BinaryExpression = 165,
ConditionalExpression = 166,
TemplateExpression = 167,
YieldExpression = 168,
SpreadElementExpression = 169,
OmittedExpression = 170,
TemplateSpan = 171,
Block = 172,
VariableStatement = 173,
EmptyStatement = 174,
ExpressionStatement = 175,
IfStatement = 176,
DoStatement = 177,
WhileStatement = 178,
ForStatement = 179,
ForInStatement = 180,
ForOfStatement = 181,
ContinueStatement = 182,
BreakStatement = 183,
ReturnStatement = 184,
WithStatement = 185,
SwitchStatement = 186,
LabeledStatement = 187,
ThrowStatement = 188,
TryStatement = 189,
DebuggerStatement = 190,
VariableDeclaration = 191,
VariableDeclarationList = 192,
FunctionDeclaration = 193,
ClassDeclaration = 194,
InterfaceDeclaration = 195,
TypeAliasDeclaration = 196,
EnumDeclaration = 197,
ModuleDeclaration = 198,
ModuleBlock = 199,
ImportDeclaration = 200,
ExportAssignment = 201,
ExternalModuleReference = 202,
CaseClause = 203,
DefaultClause = 204,
HeritageClause = 205,
CatchClause = 206,
PropertyAssignment = 207,
ShorthandPropertyAssignment = 208,
EnumMember = 209,
SourceFile = 210,
SyntaxList = 211,
Count = 212,
AsKeyword = 101,
FromKeyword = 102,
ImplementsKeyword = 103,
InterfaceKeyword = 104,
LetKeyword = 105,
PackageKeyword = 106,
PrivateKeyword = 107,
ProtectedKeyword = 108,
PublicKeyword = 109,
StaticKeyword = 110,
YieldKeyword = 111,
AnyKeyword = 112,
BooleanKeyword = 113,
ConstructorKeyword = 114,
DeclareKeyword = 115,
GetKeyword = 116,
ModuleKeyword = 117,
RequireKeyword = 118,
NumberKeyword = 119,
SetKeyword = 120,
StringKeyword = 121,
SymbolKeyword = 122,
TypeKeyword = 123,
OfKeyword = 124,
QualifiedName = 125,
ComputedPropertyName = 126,
TypeParameter = 127,
Parameter = 128,
PropertySignature = 129,
PropertyDeclaration = 130,
MethodSignature = 131,
MethodDeclaration = 132,
Constructor = 133,
GetAccessor = 134,
SetAccessor = 135,
CallSignature = 136,
ConstructSignature = 137,
IndexSignature = 138,
TypeReference = 139,
FunctionType = 140,
ConstructorType = 141,
TypeQuery = 142,
TypeLiteral = 143,
ArrayType = 144,
TupleType = 145,
UnionType = 146,
ParenthesizedType = 147,
ObjectBindingPattern = 148,
ArrayBindingPattern = 149,
BindingElement = 150,
ArrayLiteralExpression = 151,
ObjectLiteralExpression = 152,
PropertyAccessExpression = 153,
ElementAccessExpression = 154,
CallExpression = 155,
NewExpression = 156,
TaggedTemplateExpression = 157,
TypeAssertionExpression = 158,
ParenthesizedExpression = 159,
FunctionExpression = 160,
ArrowFunction = 161,
DeleteExpression = 162,
TypeOfExpression = 163,
VoidExpression = 164,
PrefixUnaryExpression = 165,
PostfixUnaryExpression = 166,
BinaryExpression = 167,
ConditionalExpression = 168,
TemplateExpression = 169,
YieldExpression = 170,
SpreadElementExpression = 171,
OmittedExpression = 172,
TemplateSpan = 173,
Block = 174,
VariableStatement = 175,
EmptyStatement = 176,
ExpressionStatement = 177,
IfStatement = 178,
DoStatement = 179,
WhileStatement = 180,
ForStatement = 181,
ForInStatement = 182,
ForOfStatement = 183,
ContinueStatement = 184,
BreakStatement = 185,
ReturnStatement = 186,
WithStatement = 187,
SwitchStatement = 188,
LabeledStatement = 189,
ThrowStatement = 190,
TryStatement = 191,
DebuggerStatement = 192,
VariableDeclaration = 193,
VariableDeclarationList = 194,
FunctionDeclaration = 195,
ClassDeclaration = 196,
InterfaceDeclaration = 197,
TypeAliasDeclaration = 198,
EnumDeclaration = 199,
ModuleDeclaration = 200,
ModuleBlock = 201,
ImportEqualsDeclaration = 202,
ImportDeclaration = 203,
ImportClause = 204,
NamespaceImport = 205,
NamedImports = 206,
ImportSpecifier = 207,
ExportAssignment = 208,
ExportDeclaration = 209,
NamedExports = 210,
ExportSpecifier = 211,
ExternalModuleReference = 212,
CaseClause = 213,
DefaultClause = 214,
HeritageClause = 215,
CatchClause = 216,
PropertyAssignment = 217,
ShorthandPropertyAssignment = 218,
EnumMember = 219,
SourceFile = 220,
SyntaxList = 221,
Count = 222,
FirstAssignment = 52,
LastAssignment = 63,
FirstReservedWord = 65,
LastReservedWord = 100,
FirstKeyword = 65,
LastKeyword = 122,
FirstFutureReservedWord = 101,
LastFutureReservedWord = 109,
FirstTypeNode = 137,
LastTypeNode = 145,
LastKeyword = 124,
FirstFutureReservedWord = 103,
LastFutureReservedWord = 111,
FirstTypeNode = 139,
LastTypeNode = 147,
FirstPunctuation = 14,
LastPunctuation = 63,
FirstToken = 0,
LastToken = 122,
LastToken = 124,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -294,7 +304,7 @@ declare module "typescript" {
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 63,
FirstNode = 123,
FirstNode = 125,
}
const enum NodeFlags {
Export = 1,
@@ -332,13 +342,13 @@ declare module "typescript" {
kind: SyntaxKind;
flags: NodeFlags;
parserContextFlags?: ParserContextFlags;
modifiers?: ModifiersArray;
id?: number;
parent?: Node;
symbol?: Symbol;
locals?: SymbolTable;
nextContainer?: Node;
localSymbol?: Symbol;
modifiers?: ModifiersArray;
}
interface NodeArray<T> extends Array<T>, TextRange {
hasTrailingComma?: boolean;
@@ -527,7 +537,7 @@ declare module "typescript" {
}
interface BinaryExpression extends Expression {
left: Expression;
operator: SyntaxKind;
operatorToken: Node;
right: Expression;
}
interface ConditionalExpression extends Expression {
@@ -702,20 +712,49 @@ declare module "typescript" {
name: Identifier;
members: NodeArray<EnumMember>;
}
interface ModuleDeclaration extends Declaration, ModuleElement {
interface ExportContainer {
exportStars?: ExportDeclaration[];
}
interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer {
name: Identifier | LiteralExpression;
body: ModuleBlock | ModuleDeclaration;
}
interface ModuleBlock extends Node, ModuleElement {
statements: NodeArray<ModuleElement>;
}
interface ImportDeclaration extends Declaration, ModuleElement {
interface ImportEqualsDeclaration extends Declaration, ModuleElement {
name: Identifier;
moduleReference: EntityName | ExternalModuleReference;
}
interface ExternalModuleReference extends Node {
expression?: Expression;
}
interface ImportDeclaration extends Statement, ModuleElement {
importClause?: ImportClause;
moduleSpecifier: Expression;
}
interface ImportClause extends Declaration {
name?: Identifier;
namedBindings?: NamespaceImport | NamedImports;
}
interface NamespaceImport extends Declaration {
name: Identifier;
}
interface ExportDeclaration extends Statement, ModuleElement {
exportClause?: NamedExports;
moduleSpecifier?: Expression;
}
interface NamedImportsOrExports extends Node {
elements: NodeArray<ImportOrExportSpecifier>;
}
type NamedImports = NamedImportsOrExports;
type NamedExports = NamedImportsOrExports;
interface ImportOrExportSpecifier extends Declaration {
propertyName?: Identifier;
name: Identifier;
}
type ImportSpecifier = ImportOrExportSpecifier;
type ExportSpecifier = ImportOrExportSpecifier;
interface ExportAssignment extends Statement, ModuleElement {
exportName: Identifier;
}
@@ -725,7 +764,7 @@ declare module "typescript" {
interface CommentRange extends TextRange {
hasTrailingNewLine?: boolean;
}
interface SourceFile extends Declaration {
interface SourceFile extends Declaration, ExportContainer {
statements: NodeArray<ModuleElement>;
endOfFileToken: Node;
fileName: string;
@@ -879,7 +918,7 @@ declare module "typescript" {
}
interface SymbolVisibilityResult {
accessibility: SymbolAccessibility;
aliasesToMakeVisible?: ImportDeclaration[];
aliasesToMakeVisible?: ImportEqualsDeclaration[];
errorSymbolName?: string;
errorNode?: Node;
}
@@ -887,11 +926,11 @@ declare module "typescript" {
errorModuleName?: string;
}
interface EmitResolver {
getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string;
getExpressionNamePrefix(node: Identifier): string;
getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string;
getExpressionNameSubstitution(node: Identifier): string;
getExportAssignmentName(node: SourceFile): string;
isReferencedImportDeclaration(node: ImportDeclaration): boolean;
isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean;
isReferencedImportDeclaration(node: Node): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
@@ -986,8 +1025,10 @@ declare module "typescript" {
declaredType?: Type;
mapper?: TypeMapper;
referenced?: boolean;
exportAssignSymbol?: Symbol;
exportAssignmentChecked?: boolean;
exportAssignmentSymbol?: Symbol;
unionType?: UnionType;
resolvedExports?: SymbolTable;
}
interface TransientSymbol extends Symbol, SymbolLinks {
}
@@ -1012,7 +1053,8 @@ declare module "typescript" {
enumMemberValue?: number;
isIllegalTypeReferenceInConstraint?: boolean;
isVisible?: boolean;
localModuleName?: string;
generatedName?: string;
generatedNames?: Map<string>;
assignmentChecks?: Map<boolean>;
hasReportedStatementInAmbientContext?: boolean;
importOnRightSide?: Symbol;
@@ -1326,6 +1368,7 @@ declare module "typescript" {
equals = 61,
exclamation = 33,
greaterThan = 62,
hash = 35,
lessThan = 60,
minus = 45,
openBrace = 123,
@@ -1392,8 +1435,8 @@ declare module "typescript" {
}
function tokenToString(t: SyntaxKind): string;
function computeLineStarts(text: string): number[];
function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number;
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
function getLineStarts(sourceFile: SourceFile): number[];
function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): {
line: number;
@@ -1477,9 +1520,9 @@ declare module "typescript" {
scriptSnapshot: IScriptSnapshot;
nameTable: Map<string>;
getNamedDeclarations(): Declaration[];
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
getLineStarts(): number[];
getPositionFromLineAndCharacter(line: number, character: number): number;
getPositionOfLineAndCharacter(line: number, character: number): number;
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
}
/**
@@ -1541,7 +1584,7 @@ declare module "typescript" {
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getNavigateToItems(searchValue: string): NavigateToItem[];
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
getNavigationBarItems(fileName: string): NavigationBarItem[];
getOutliningSpans(fileName: string): OutliningSpan[];
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
@@ -1955,8 +1998,8 @@ function compile(fileNames, options) {
var emitResult = program.emit();
var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
allDiagnostics.forEach(function (diagnostic) {
var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
console.log(diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL));
var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
console.log(diagnostic.file.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL));
});
var exitCode = emitResult.emitSkipped ? 1 : 0;
console.log("Process exiting with code '" + exitCode + "'.");
@@ -1964,8 +2007,6 @@ function compile(fileNames, options) {
}
exports.compile = compile;
compile(process.argv.slice(2), {
noEmitOnError: true,
noImplicitAny: true,
target: 1 /* ES5 */,
module: 1 /* CommonJS */
noEmitOnError: true, noImplicitAny: true,
target: 1 /* ES5 */, module: 1 /* CommonJS */
});
+310 -168
View File
@@ -56,27 +56,27 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void
>diagnostics : ts.Diagnostic[]
allDiagnostics.forEach(diagnostic => {
>allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }) : void
>allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }) : void
>allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void
>allDiagnostics : ts.Diagnostic[]
>forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void
>diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); } : (diagnostic: ts.Diagnostic) => void
>diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); } : (diagnostic: ts.Diagnostic) => void
>diagnostic : ts.Diagnostic
var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
>lineChar : ts.LineAndCharacter
>diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start) : ts.LineAndCharacter
>diagnostic.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
>diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter
>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
>diagnostic.file : ts.SourceFile
>diagnostic : ts.Diagnostic
>file : ts.SourceFile
>getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
>diagnostic.start : number
>diagnostic : ts.Diagnostic
>start : number
console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`);
>console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`) : any
console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`);
>console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`) : any
>console.log : any
>console : any
>log : any
@@ -85,9 +85,11 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void
>diagnostic : ts.Diagnostic
>file : ts.SourceFile
>fileName : string
>lineChar.line + 1 : number
>lineChar.line : number
>lineChar : ts.LineAndCharacter
>line : number
>lineChar.character + 1 : number
>lineChar.character : number
>lineChar : ts.LineAndCharacter
>character : number
@@ -496,340 +498,370 @@ declare module "typescript" {
WithKeyword = 100,
>WithKeyword : SyntaxKind
ImplementsKeyword = 101,
AsKeyword = 101,
>AsKeyword : SyntaxKind
FromKeyword = 102,
>FromKeyword : SyntaxKind
ImplementsKeyword = 103,
>ImplementsKeyword : SyntaxKind
InterfaceKeyword = 102,
InterfaceKeyword = 104,
>InterfaceKeyword : SyntaxKind
LetKeyword = 103,
LetKeyword = 105,
>LetKeyword : SyntaxKind
PackageKeyword = 104,
PackageKeyword = 106,
>PackageKeyword : SyntaxKind
PrivateKeyword = 105,
PrivateKeyword = 107,
>PrivateKeyword : SyntaxKind
ProtectedKeyword = 106,
ProtectedKeyword = 108,
>ProtectedKeyword : SyntaxKind
PublicKeyword = 107,
PublicKeyword = 109,
>PublicKeyword : SyntaxKind
StaticKeyword = 108,
StaticKeyword = 110,
>StaticKeyword : SyntaxKind
YieldKeyword = 109,
YieldKeyword = 111,
>YieldKeyword : SyntaxKind
AnyKeyword = 110,
AnyKeyword = 112,
>AnyKeyword : SyntaxKind
BooleanKeyword = 111,
BooleanKeyword = 113,
>BooleanKeyword : SyntaxKind
ConstructorKeyword = 112,
ConstructorKeyword = 114,
>ConstructorKeyword : SyntaxKind
DeclareKeyword = 113,
DeclareKeyword = 115,
>DeclareKeyword : SyntaxKind
GetKeyword = 114,
GetKeyword = 116,
>GetKeyword : SyntaxKind
ModuleKeyword = 115,
ModuleKeyword = 117,
>ModuleKeyword : SyntaxKind
RequireKeyword = 116,
RequireKeyword = 118,
>RequireKeyword : SyntaxKind
NumberKeyword = 117,
NumberKeyword = 119,
>NumberKeyword : SyntaxKind
SetKeyword = 118,
SetKeyword = 120,
>SetKeyword : SyntaxKind
StringKeyword = 119,
StringKeyword = 121,
>StringKeyword : SyntaxKind
SymbolKeyword = 120,
SymbolKeyword = 122,
>SymbolKeyword : SyntaxKind
TypeKeyword = 121,
TypeKeyword = 123,
>TypeKeyword : SyntaxKind
OfKeyword = 122,
OfKeyword = 124,
>OfKeyword : SyntaxKind
QualifiedName = 123,
QualifiedName = 125,
>QualifiedName : SyntaxKind
ComputedPropertyName = 124,
ComputedPropertyName = 126,
>ComputedPropertyName : SyntaxKind
TypeParameter = 125,
TypeParameter = 127,
>TypeParameter : SyntaxKind
Parameter = 126,
Parameter = 128,
>Parameter : SyntaxKind
PropertySignature = 127,
PropertySignature = 129,
>PropertySignature : SyntaxKind
PropertyDeclaration = 128,
PropertyDeclaration = 130,
>PropertyDeclaration : SyntaxKind
MethodSignature = 129,
MethodSignature = 131,
>MethodSignature : SyntaxKind
MethodDeclaration = 130,
MethodDeclaration = 132,
>MethodDeclaration : SyntaxKind
Constructor = 131,
Constructor = 133,
>Constructor : SyntaxKind
GetAccessor = 132,
GetAccessor = 134,
>GetAccessor : SyntaxKind
SetAccessor = 133,
SetAccessor = 135,
>SetAccessor : SyntaxKind
CallSignature = 134,
CallSignature = 136,
>CallSignature : SyntaxKind
ConstructSignature = 135,
ConstructSignature = 137,
>ConstructSignature : SyntaxKind
IndexSignature = 136,
IndexSignature = 138,
>IndexSignature : SyntaxKind
TypeReference = 137,
TypeReference = 139,
>TypeReference : SyntaxKind
FunctionType = 138,
FunctionType = 140,
>FunctionType : SyntaxKind
ConstructorType = 139,
ConstructorType = 141,
>ConstructorType : SyntaxKind
TypeQuery = 140,
TypeQuery = 142,
>TypeQuery : SyntaxKind
TypeLiteral = 141,
TypeLiteral = 143,
>TypeLiteral : SyntaxKind
ArrayType = 142,
ArrayType = 144,
>ArrayType : SyntaxKind
TupleType = 143,
TupleType = 145,
>TupleType : SyntaxKind
UnionType = 144,
UnionType = 146,
>UnionType : SyntaxKind
ParenthesizedType = 145,
ParenthesizedType = 147,
>ParenthesizedType : SyntaxKind
ObjectBindingPattern = 146,
ObjectBindingPattern = 148,
>ObjectBindingPattern : SyntaxKind
ArrayBindingPattern = 147,
ArrayBindingPattern = 149,
>ArrayBindingPattern : SyntaxKind
BindingElement = 148,
BindingElement = 150,
>BindingElement : SyntaxKind
ArrayLiteralExpression = 149,
ArrayLiteralExpression = 151,
>ArrayLiteralExpression : SyntaxKind
ObjectLiteralExpression = 150,
ObjectLiteralExpression = 152,
>ObjectLiteralExpression : SyntaxKind
PropertyAccessExpression = 151,
PropertyAccessExpression = 153,
>PropertyAccessExpression : SyntaxKind
ElementAccessExpression = 152,
ElementAccessExpression = 154,
>ElementAccessExpression : SyntaxKind
CallExpression = 153,
CallExpression = 155,
>CallExpression : SyntaxKind
NewExpression = 154,
NewExpression = 156,
>NewExpression : SyntaxKind
TaggedTemplateExpression = 155,
TaggedTemplateExpression = 157,
>TaggedTemplateExpression : SyntaxKind
TypeAssertionExpression = 156,
TypeAssertionExpression = 158,
>TypeAssertionExpression : SyntaxKind
ParenthesizedExpression = 157,
ParenthesizedExpression = 159,
>ParenthesizedExpression : SyntaxKind
FunctionExpression = 158,
FunctionExpression = 160,
>FunctionExpression : SyntaxKind
ArrowFunction = 159,
ArrowFunction = 161,
>ArrowFunction : SyntaxKind
DeleteExpression = 160,
DeleteExpression = 162,
>DeleteExpression : SyntaxKind
TypeOfExpression = 161,
TypeOfExpression = 163,
>TypeOfExpression : SyntaxKind
VoidExpression = 162,
VoidExpression = 164,
>VoidExpression : SyntaxKind
PrefixUnaryExpression = 163,
PrefixUnaryExpression = 165,
>PrefixUnaryExpression : SyntaxKind
PostfixUnaryExpression = 164,
PostfixUnaryExpression = 166,
>PostfixUnaryExpression : SyntaxKind
BinaryExpression = 165,
BinaryExpression = 167,
>BinaryExpression : SyntaxKind
ConditionalExpression = 166,
ConditionalExpression = 168,
>ConditionalExpression : SyntaxKind
TemplateExpression = 167,
TemplateExpression = 169,
>TemplateExpression : SyntaxKind
YieldExpression = 168,
YieldExpression = 170,
>YieldExpression : SyntaxKind
SpreadElementExpression = 169,
SpreadElementExpression = 171,
>SpreadElementExpression : SyntaxKind
OmittedExpression = 170,
OmittedExpression = 172,
>OmittedExpression : SyntaxKind
TemplateSpan = 171,
TemplateSpan = 173,
>TemplateSpan : SyntaxKind
Block = 172,
Block = 174,
>Block : SyntaxKind
VariableStatement = 173,
VariableStatement = 175,
>VariableStatement : SyntaxKind
EmptyStatement = 174,
EmptyStatement = 176,
>EmptyStatement : SyntaxKind
ExpressionStatement = 175,
ExpressionStatement = 177,
>ExpressionStatement : SyntaxKind
IfStatement = 176,
IfStatement = 178,
>IfStatement : SyntaxKind
DoStatement = 177,
DoStatement = 179,
>DoStatement : SyntaxKind
WhileStatement = 178,
WhileStatement = 180,
>WhileStatement : SyntaxKind
ForStatement = 179,
ForStatement = 181,
>ForStatement : SyntaxKind
ForInStatement = 180,
ForInStatement = 182,
>ForInStatement : SyntaxKind
ForOfStatement = 181,
ForOfStatement = 183,
>ForOfStatement : SyntaxKind
ContinueStatement = 182,
ContinueStatement = 184,
>ContinueStatement : SyntaxKind
BreakStatement = 183,
BreakStatement = 185,
>BreakStatement : SyntaxKind
ReturnStatement = 184,
ReturnStatement = 186,
>ReturnStatement : SyntaxKind
WithStatement = 185,
WithStatement = 187,
>WithStatement : SyntaxKind
SwitchStatement = 186,
SwitchStatement = 188,
>SwitchStatement : SyntaxKind
LabeledStatement = 187,
LabeledStatement = 189,
>LabeledStatement : SyntaxKind
ThrowStatement = 188,
ThrowStatement = 190,
>ThrowStatement : SyntaxKind
TryStatement = 189,
TryStatement = 191,
>TryStatement : SyntaxKind
DebuggerStatement = 190,
DebuggerStatement = 192,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 191,
VariableDeclaration = 193,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 192,
VariableDeclarationList = 194,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 193,
FunctionDeclaration = 195,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 194,
ClassDeclaration = 196,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 195,
InterfaceDeclaration = 197,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 196,
TypeAliasDeclaration = 198,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 197,
EnumDeclaration = 199,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 198,
ModuleDeclaration = 200,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 199,
ModuleBlock = 201,
>ModuleBlock : SyntaxKind
ImportDeclaration = 200,
ImportEqualsDeclaration = 202,
>ImportEqualsDeclaration : SyntaxKind
ImportDeclaration = 203,
>ImportDeclaration : SyntaxKind
ExportAssignment = 201,
ImportClause = 204,
>ImportClause : SyntaxKind
NamespaceImport = 205,
>NamespaceImport : SyntaxKind
NamedImports = 206,
>NamedImports : SyntaxKind
ImportSpecifier = 207,
>ImportSpecifier : SyntaxKind
ExportAssignment = 208,
>ExportAssignment : SyntaxKind
ExternalModuleReference = 202,
ExportDeclaration = 209,
>ExportDeclaration : SyntaxKind
NamedExports = 210,
>NamedExports : SyntaxKind
ExportSpecifier = 211,
>ExportSpecifier : SyntaxKind
ExternalModuleReference = 212,
>ExternalModuleReference : SyntaxKind
CaseClause = 203,
CaseClause = 213,
>CaseClause : SyntaxKind
DefaultClause = 204,
DefaultClause = 214,
>DefaultClause : SyntaxKind
HeritageClause = 205,
HeritageClause = 215,
>HeritageClause : SyntaxKind
CatchClause = 206,
CatchClause = 216,
>CatchClause : SyntaxKind
PropertyAssignment = 207,
PropertyAssignment = 217,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 208,
ShorthandPropertyAssignment = 218,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 209,
EnumMember = 219,
>EnumMember : SyntaxKind
SourceFile = 210,
SourceFile = 220,
>SourceFile : SyntaxKind
SyntaxList = 211,
SyntaxList = 221,
>SyntaxList : SyntaxKind
Count = 212,
Count = 222,
>Count : SyntaxKind
FirstAssignment = 52,
@@ -847,19 +879,19 @@ declare module "typescript" {
FirstKeyword = 65,
>FirstKeyword : SyntaxKind
LastKeyword = 122,
LastKeyword = 124,
>LastKeyword : SyntaxKind
FirstFutureReservedWord = 101,
FirstFutureReservedWord = 103,
>FirstFutureReservedWord : SyntaxKind
LastFutureReservedWord = 109,
LastFutureReservedWord = 111,
>LastFutureReservedWord : SyntaxKind
FirstTypeNode = 137,
FirstTypeNode = 139,
>FirstTypeNode : SyntaxKind
LastTypeNode = 145,
LastTypeNode = 147,
>LastTypeNode : SyntaxKind
FirstPunctuation = 14,
@@ -871,7 +903,7 @@ declare module "typescript" {
FirstToken = 0,
>FirstToken : SyntaxKind
LastToken = 122,
LastToken = 124,
>LastToken : SyntaxKind
FirstTriviaToken = 2,
@@ -898,7 +930,7 @@ declare module "typescript" {
LastBinaryOperator = 63,
>LastBinaryOperator : SyntaxKind
FirstNode = 123,
FirstNode = 125,
>FirstNode : SyntaxKind
}
const enum NodeFlags {
@@ -1004,6 +1036,10 @@ declare module "typescript" {
>parserContextFlags : ParserContextFlags
>ParserContextFlags : ParserContextFlags
modifiers?: ModifiersArray;
>modifiers : ModifiersArray
>ModifiersArray : ModifiersArray
id?: number;
>id : number
@@ -1026,10 +1062,6 @@ declare module "typescript" {
localSymbol?: Symbol;
>localSymbol : Symbol
>Symbol : Symbol
modifiers?: ModifiersArray;
>modifiers : ModifiersArray
>ModifiersArray : ModifiersArray
}
interface NodeArray<T> extends Array<T>, TextRange {
>NodeArray : NodeArray<T>
@@ -1585,9 +1617,9 @@ declare module "typescript" {
>left : Expression
>Expression : Expression
operator: SyntaxKind;
>operator : SyntaxKind
>SyntaxKind : SyntaxKind
operatorToken: Node;
>operatorToken : Node
>Node : Node
right: Expression;
>right : Expression
@@ -2128,10 +2160,18 @@ declare module "typescript" {
>NodeArray : NodeArray<T>
>EnumMember : EnumMember
}
interface ModuleDeclaration extends Declaration, ModuleElement {
interface ExportContainer {
>ExportContainer : ExportContainer
exportStars?: ExportDeclaration[];
>exportStars : ExportDeclaration[]
>ExportDeclaration : ExportDeclaration
}
interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer {
>ModuleDeclaration : ModuleDeclaration
>Declaration : Declaration
>ModuleElement : ModuleElement
>ExportContainer : ExportContainer
name: Identifier | LiteralExpression;
>name : Identifier | LiteralExpression
@@ -2153,8 +2193,8 @@ declare module "typescript" {
>NodeArray : NodeArray<T>
>ModuleElement : ModuleElement
}
interface ImportDeclaration extends Declaration, ModuleElement {
>ImportDeclaration : ImportDeclaration
interface ImportEqualsDeclaration extends Declaration, ModuleElement {
>ImportEqualsDeclaration : ImportEqualsDeclaration
>Declaration : Declaration
>ModuleElement : ModuleElement
@@ -2175,6 +2215,90 @@ declare module "typescript" {
>expression : Expression
>Expression : Expression
}
interface ImportDeclaration extends Statement, ModuleElement {
>ImportDeclaration : ImportDeclaration
>Statement : Statement
>ModuleElement : ModuleElement
importClause?: ImportClause;
>importClause : ImportClause
>ImportClause : ImportClause
moduleSpecifier: Expression;
>moduleSpecifier : Expression
>Expression : Expression
}
interface ImportClause extends Declaration {
>ImportClause : ImportClause
>Declaration : Declaration
name?: Identifier;
>name : Identifier
>Identifier : Identifier
namedBindings?: NamespaceImport | NamedImports;
>namedBindings : NamespaceImport | NamedImportsOrExports
>NamespaceImport : NamespaceImport
>NamedImports : NamedImportsOrExports
}
interface NamespaceImport extends Declaration {
>NamespaceImport : NamespaceImport
>Declaration : Declaration
name: Identifier;
>name : Identifier
>Identifier : Identifier
}
interface ExportDeclaration extends Statement, ModuleElement {
>ExportDeclaration : ExportDeclaration
>Statement : Statement
>ModuleElement : ModuleElement
exportClause?: NamedExports;
>exportClause : NamedImportsOrExports
>NamedExports : NamedImportsOrExports
moduleSpecifier?: Expression;
>moduleSpecifier : Expression
>Expression : Expression
}
interface NamedImportsOrExports extends Node {
>NamedImportsOrExports : NamedImportsOrExports
>Node : Node
elements: NodeArray<ImportOrExportSpecifier>;
>elements : NodeArray<ImportOrExportSpecifier>
>NodeArray : NodeArray<T>
>ImportOrExportSpecifier : ImportOrExportSpecifier
}
type NamedImports = NamedImportsOrExports;
>NamedImports : NamedImportsOrExports
>NamedImportsOrExports : NamedImportsOrExports
type NamedExports = NamedImportsOrExports;
>NamedExports : NamedImportsOrExports
>NamedImportsOrExports : NamedImportsOrExports
interface ImportOrExportSpecifier extends Declaration {
>ImportOrExportSpecifier : ImportOrExportSpecifier
>Declaration : Declaration
propertyName?: Identifier;
>propertyName : Identifier
>Identifier : Identifier
name: Identifier;
>name : Identifier
>Identifier : Identifier
}
type ImportSpecifier = ImportOrExportSpecifier;
>ImportSpecifier : ImportOrExportSpecifier
>ImportOrExportSpecifier : ImportOrExportSpecifier
type ExportSpecifier = ImportOrExportSpecifier;
>ExportSpecifier : ImportOrExportSpecifier
>ImportOrExportSpecifier : ImportOrExportSpecifier
interface ExportAssignment extends Statement, ModuleElement {
>ExportAssignment : ExportAssignment
>Statement : Statement
@@ -2198,9 +2322,10 @@ declare module "typescript" {
hasTrailingNewLine?: boolean;
>hasTrailingNewLine : boolean
}
interface SourceFile extends Declaration {
interface SourceFile extends Declaration, ExportContainer {
>SourceFile : SourceFile
>Declaration : Declaration
>ExportContainer : ExportContainer
statements: NodeArray<ModuleElement>;
>statements : NodeArray<ModuleElement>
@@ -2814,9 +2939,9 @@ declare module "typescript" {
>accessibility : SymbolAccessibility
>SymbolAccessibility : SymbolAccessibility
aliasesToMakeVisible?: ImportDeclaration[];
>aliasesToMakeVisible : ImportDeclaration[]
>ImportDeclaration : ImportDeclaration
aliasesToMakeVisible?: ImportEqualsDeclaration[];
>aliasesToMakeVisible : ImportEqualsDeclaration[]
>ImportEqualsDeclaration : ImportEqualsDeclaration
errorSymbolName?: string;
>errorSymbolName : string
@@ -2835,14 +2960,16 @@ declare module "typescript" {
interface EmitResolver {
>EmitResolver : EmitResolver
getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string;
>getLocalNameOfContainer : (container: EnumDeclaration | ModuleDeclaration) => string
>container : EnumDeclaration | ModuleDeclaration
getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string;
>getGeneratedNameForNode : (node: EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration) => string
>node : EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration
>ModuleDeclaration : ModuleDeclaration
>EnumDeclaration : EnumDeclaration
>ImportDeclaration : ImportDeclaration
>ExportDeclaration : ExportDeclaration
getExpressionNamePrefix(node: Identifier): string;
>getExpressionNamePrefix : (node: Identifier) => string
getExpressionNameSubstitution(node: Identifier): string;
>getExpressionNameSubstitution : (node: Identifier) => string
>node : Identifier
>Identifier : Identifier
@@ -2851,15 +2978,15 @@ declare module "typescript" {
>node : SourceFile
>SourceFile : SourceFile
isReferencedImportDeclaration(node: ImportDeclaration): boolean;
>isReferencedImportDeclaration : (node: ImportDeclaration) => boolean
>node : ImportDeclaration
>ImportDeclaration : ImportDeclaration
isReferencedImportDeclaration(node: Node): boolean;
>isReferencedImportDeclaration : (node: Node) => boolean
>node : Node
>Node : Node
isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean;
>isTopLevelValueImportWithEntityName : (node: ImportDeclaration) => boolean
>node : ImportDeclaration
>ImportDeclaration : ImportDeclaration
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean
>node : ImportEqualsDeclaration
>ImportEqualsDeclaration : ImportEqualsDeclaration
getNodeCheckFlags(node: Node): NodeCheckFlags;
>getNodeCheckFlags : (node: Node) => NodeCheckFlags
@@ -3188,13 +3315,20 @@ declare module "typescript" {
referenced?: boolean;
>referenced : boolean
exportAssignSymbol?: Symbol;
>exportAssignSymbol : Symbol
exportAssignmentChecked?: boolean;
>exportAssignmentChecked : boolean
exportAssignmentSymbol?: Symbol;
>exportAssignmentSymbol : Symbol
>Symbol : Symbol
unionType?: UnionType;
>unionType : UnionType
>UnionType : UnionType
resolvedExports?: SymbolTable;
>resolvedExports : SymbolTable
>SymbolTable : SymbolTable
}
interface TransientSymbol extends Symbol, SymbolLinks {
>TransientSymbol : TransientSymbol
@@ -3263,8 +3397,12 @@ declare module "typescript" {
isVisible?: boolean;
>isVisible : boolean
localModuleName?: string;
>localModuleName : string
generatedName?: string;
>generatedName : string
generatedNames?: Map<string>;
>generatedNames : Map<string>
>Map : Map<T>
assignmentChecks?: Map<boolean>;
>assignmentChecks : Map<boolean>
@@ -4188,6 +4326,9 @@ declare module "typescript" {
greaterThan = 62,
>greaterThan : CharacterCodes
hash = 35,
>hash : CharacterCodes
lessThan = 60,
>lessThan : CharacterCodes
@@ -4393,15 +4534,15 @@ declare module "typescript" {
>computeLineStarts : (text: string) => number[]
>text : string
function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
>getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number
>sourceFile : SourceFile
>SourceFile : SourceFile
>line : number
>character : number
function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number;
>computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number
>lineStarts : number[]
>line : number
>character : number
@@ -4760,16 +4901,16 @@ declare module "typescript" {
>getNamedDeclarations : () => Declaration[]
>Declaration : Declaration
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
>getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter
>pos : number
>LineAndCharacter : LineAndCharacter
getLineStarts(): number[];
>getLineStarts : () => number[]
getPositionFromLineAndCharacter(line: number, character: number): number;
>getPositionFromLineAndCharacter : (line: number, character: number) => number
getPositionOfLineAndCharacter(line: number, character: number): number;
>getPositionOfLineAndCharacter : (line: number, character: number) => number
>line : number
>character : number
@@ -4986,9 +5127,10 @@ declare module "typescript" {
>position : number
>ReferenceEntry : ReferenceEntry
getNavigateToItems(searchValue: string): NavigateToItem[];
>getNavigateToItems : (searchValue: string) => NavigateToItem[]
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[]
>searchValue : string
>maxResultCount : number
>NavigateToItem : NavigateToItem
getNavigationBarItems(fileName: string): NavigationBarItem[];
+195 -151
View File
@@ -39,7 +39,7 @@ export function delint(sourceFile: ts.SourceFile) {
break;
case ts.SyntaxKind.BinaryExpression:
var op = (<ts.BinaryExpression>node).operator;
var op = (<ts.BinaryExpression>node).operatorToken.kind;
if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) {
report(node, "Use '===' and '!=='.")
@@ -51,8 +51,8 @@ export function delint(sourceFile: ts.SourceFile) {
}
function report(node: ts.Node, message: string) {
var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart());
console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`)
var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart());
console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`)
}
}
@@ -191,132 +191,142 @@ declare module "typescript" {
VoidKeyword = 98,
WhileKeyword = 99,
WithKeyword = 100,
ImplementsKeyword = 101,
InterfaceKeyword = 102,
LetKeyword = 103,
PackageKeyword = 104,
PrivateKeyword = 105,
ProtectedKeyword = 106,
PublicKeyword = 107,
StaticKeyword = 108,
YieldKeyword = 109,
AnyKeyword = 110,
BooleanKeyword = 111,
ConstructorKeyword = 112,
DeclareKeyword = 113,
GetKeyword = 114,
ModuleKeyword = 115,
RequireKeyword = 116,
NumberKeyword = 117,
SetKeyword = 118,
StringKeyword = 119,
SymbolKeyword = 120,
TypeKeyword = 121,
OfKeyword = 122,
QualifiedName = 123,
ComputedPropertyName = 124,
TypeParameter = 125,
Parameter = 126,
PropertySignature = 127,
PropertyDeclaration = 128,
MethodSignature = 129,
MethodDeclaration = 130,
Constructor = 131,
GetAccessor = 132,
SetAccessor = 133,
CallSignature = 134,
ConstructSignature = 135,
IndexSignature = 136,
TypeReference = 137,
FunctionType = 138,
ConstructorType = 139,
TypeQuery = 140,
TypeLiteral = 141,
ArrayType = 142,
TupleType = 143,
UnionType = 144,
ParenthesizedType = 145,
ObjectBindingPattern = 146,
ArrayBindingPattern = 147,
BindingElement = 148,
ArrayLiteralExpression = 149,
ObjectLiteralExpression = 150,
PropertyAccessExpression = 151,
ElementAccessExpression = 152,
CallExpression = 153,
NewExpression = 154,
TaggedTemplateExpression = 155,
TypeAssertionExpression = 156,
ParenthesizedExpression = 157,
FunctionExpression = 158,
ArrowFunction = 159,
DeleteExpression = 160,
TypeOfExpression = 161,
VoidExpression = 162,
PrefixUnaryExpression = 163,
PostfixUnaryExpression = 164,
BinaryExpression = 165,
ConditionalExpression = 166,
TemplateExpression = 167,
YieldExpression = 168,
SpreadElementExpression = 169,
OmittedExpression = 170,
TemplateSpan = 171,
Block = 172,
VariableStatement = 173,
EmptyStatement = 174,
ExpressionStatement = 175,
IfStatement = 176,
DoStatement = 177,
WhileStatement = 178,
ForStatement = 179,
ForInStatement = 180,
ForOfStatement = 181,
ContinueStatement = 182,
BreakStatement = 183,
ReturnStatement = 184,
WithStatement = 185,
SwitchStatement = 186,
LabeledStatement = 187,
ThrowStatement = 188,
TryStatement = 189,
DebuggerStatement = 190,
VariableDeclaration = 191,
VariableDeclarationList = 192,
FunctionDeclaration = 193,
ClassDeclaration = 194,
InterfaceDeclaration = 195,
TypeAliasDeclaration = 196,
EnumDeclaration = 197,
ModuleDeclaration = 198,
ModuleBlock = 199,
ImportDeclaration = 200,
ExportAssignment = 201,
ExternalModuleReference = 202,
CaseClause = 203,
DefaultClause = 204,
HeritageClause = 205,
CatchClause = 206,
PropertyAssignment = 207,
ShorthandPropertyAssignment = 208,
EnumMember = 209,
SourceFile = 210,
SyntaxList = 211,
Count = 212,
AsKeyword = 101,
FromKeyword = 102,
ImplementsKeyword = 103,
InterfaceKeyword = 104,
LetKeyword = 105,
PackageKeyword = 106,
PrivateKeyword = 107,
ProtectedKeyword = 108,
PublicKeyword = 109,
StaticKeyword = 110,
YieldKeyword = 111,
AnyKeyword = 112,
BooleanKeyword = 113,
ConstructorKeyword = 114,
DeclareKeyword = 115,
GetKeyword = 116,
ModuleKeyword = 117,
RequireKeyword = 118,
NumberKeyword = 119,
SetKeyword = 120,
StringKeyword = 121,
SymbolKeyword = 122,
TypeKeyword = 123,
OfKeyword = 124,
QualifiedName = 125,
ComputedPropertyName = 126,
TypeParameter = 127,
Parameter = 128,
PropertySignature = 129,
PropertyDeclaration = 130,
MethodSignature = 131,
MethodDeclaration = 132,
Constructor = 133,
GetAccessor = 134,
SetAccessor = 135,
CallSignature = 136,
ConstructSignature = 137,
IndexSignature = 138,
TypeReference = 139,
FunctionType = 140,
ConstructorType = 141,
TypeQuery = 142,
TypeLiteral = 143,
ArrayType = 144,
TupleType = 145,
UnionType = 146,
ParenthesizedType = 147,
ObjectBindingPattern = 148,
ArrayBindingPattern = 149,
BindingElement = 150,
ArrayLiteralExpression = 151,
ObjectLiteralExpression = 152,
PropertyAccessExpression = 153,
ElementAccessExpression = 154,
CallExpression = 155,
NewExpression = 156,
TaggedTemplateExpression = 157,
TypeAssertionExpression = 158,
ParenthesizedExpression = 159,
FunctionExpression = 160,
ArrowFunction = 161,
DeleteExpression = 162,
TypeOfExpression = 163,
VoidExpression = 164,
PrefixUnaryExpression = 165,
PostfixUnaryExpression = 166,
BinaryExpression = 167,
ConditionalExpression = 168,
TemplateExpression = 169,
YieldExpression = 170,
SpreadElementExpression = 171,
OmittedExpression = 172,
TemplateSpan = 173,
Block = 174,
VariableStatement = 175,
EmptyStatement = 176,
ExpressionStatement = 177,
IfStatement = 178,
DoStatement = 179,
WhileStatement = 180,
ForStatement = 181,
ForInStatement = 182,
ForOfStatement = 183,
ContinueStatement = 184,
BreakStatement = 185,
ReturnStatement = 186,
WithStatement = 187,
SwitchStatement = 188,
LabeledStatement = 189,
ThrowStatement = 190,
TryStatement = 191,
DebuggerStatement = 192,
VariableDeclaration = 193,
VariableDeclarationList = 194,
FunctionDeclaration = 195,
ClassDeclaration = 196,
InterfaceDeclaration = 197,
TypeAliasDeclaration = 198,
EnumDeclaration = 199,
ModuleDeclaration = 200,
ModuleBlock = 201,
ImportEqualsDeclaration = 202,
ImportDeclaration = 203,
ImportClause = 204,
NamespaceImport = 205,
NamedImports = 206,
ImportSpecifier = 207,
ExportAssignment = 208,
ExportDeclaration = 209,
NamedExports = 210,
ExportSpecifier = 211,
ExternalModuleReference = 212,
CaseClause = 213,
DefaultClause = 214,
HeritageClause = 215,
CatchClause = 216,
PropertyAssignment = 217,
ShorthandPropertyAssignment = 218,
EnumMember = 219,
SourceFile = 220,
SyntaxList = 221,
Count = 222,
FirstAssignment = 52,
LastAssignment = 63,
FirstReservedWord = 65,
LastReservedWord = 100,
FirstKeyword = 65,
LastKeyword = 122,
FirstFutureReservedWord = 101,
LastFutureReservedWord = 109,
FirstTypeNode = 137,
LastTypeNode = 145,
LastKeyword = 124,
FirstFutureReservedWord = 103,
LastFutureReservedWord = 111,
FirstTypeNode = 139,
LastTypeNode = 147,
FirstPunctuation = 14,
LastPunctuation = 63,
FirstToken = 0,
LastToken = 122,
LastToken = 124,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -325,7 +335,7 @@ declare module "typescript" {
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 63,
FirstNode = 123,
FirstNode = 125,
}
const enum NodeFlags {
Export = 1,
@@ -363,13 +373,13 @@ declare module "typescript" {
kind: SyntaxKind;
flags: NodeFlags;
parserContextFlags?: ParserContextFlags;
modifiers?: ModifiersArray;
id?: number;
parent?: Node;
symbol?: Symbol;
locals?: SymbolTable;
nextContainer?: Node;
localSymbol?: Symbol;
modifiers?: ModifiersArray;
}
interface NodeArray<T> extends Array<T>, TextRange {
hasTrailingComma?: boolean;
@@ -558,7 +568,7 @@ declare module "typescript" {
}
interface BinaryExpression extends Expression {
left: Expression;
operator: SyntaxKind;
operatorToken: Node;
right: Expression;
}
interface ConditionalExpression extends Expression {
@@ -733,20 +743,49 @@ declare module "typescript" {
name: Identifier;
members: NodeArray<EnumMember>;
}
interface ModuleDeclaration extends Declaration, ModuleElement {
interface ExportContainer {
exportStars?: ExportDeclaration[];
}
interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer {
name: Identifier | LiteralExpression;
body: ModuleBlock | ModuleDeclaration;
}
interface ModuleBlock extends Node, ModuleElement {
statements: NodeArray<ModuleElement>;
}
interface ImportDeclaration extends Declaration, ModuleElement {
interface ImportEqualsDeclaration extends Declaration, ModuleElement {
name: Identifier;
moduleReference: EntityName | ExternalModuleReference;
}
interface ExternalModuleReference extends Node {
expression?: Expression;
}
interface ImportDeclaration extends Statement, ModuleElement {
importClause?: ImportClause;
moduleSpecifier: Expression;
}
interface ImportClause extends Declaration {
name?: Identifier;
namedBindings?: NamespaceImport | NamedImports;
}
interface NamespaceImport extends Declaration {
name: Identifier;
}
interface ExportDeclaration extends Statement, ModuleElement {
exportClause?: NamedExports;
moduleSpecifier?: Expression;
}
interface NamedImportsOrExports extends Node {
elements: NodeArray<ImportOrExportSpecifier>;
}
type NamedImports = NamedImportsOrExports;
type NamedExports = NamedImportsOrExports;
interface ImportOrExportSpecifier extends Declaration {
propertyName?: Identifier;
name: Identifier;
}
type ImportSpecifier = ImportOrExportSpecifier;
type ExportSpecifier = ImportOrExportSpecifier;
interface ExportAssignment extends Statement, ModuleElement {
exportName: Identifier;
}
@@ -756,7 +795,7 @@ declare module "typescript" {
interface CommentRange extends TextRange {
hasTrailingNewLine?: boolean;
}
interface SourceFile extends Declaration {
interface SourceFile extends Declaration, ExportContainer {
statements: NodeArray<ModuleElement>;
endOfFileToken: Node;
fileName: string;
@@ -910,7 +949,7 @@ declare module "typescript" {
}
interface SymbolVisibilityResult {
accessibility: SymbolAccessibility;
aliasesToMakeVisible?: ImportDeclaration[];
aliasesToMakeVisible?: ImportEqualsDeclaration[];
errorSymbolName?: string;
errorNode?: Node;
}
@@ -918,11 +957,11 @@ declare module "typescript" {
errorModuleName?: string;
}
interface EmitResolver {
getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string;
getExpressionNamePrefix(node: Identifier): string;
getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string;
getExpressionNameSubstitution(node: Identifier): string;
getExportAssignmentName(node: SourceFile): string;
isReferencedImportDeclaration(node: ImportDeclaration): boolean;
isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean;
isReferencedImportDeclaration(node: Node): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
@@ -1017,8 +1056,10 @@ declare module "typescript" {
declaredType?: Type;
mapper?: TypeMapper;
referenced?: boolean;
exportAssignSymbol?: Symbol;
exportAssignmentChecked?: boolean;
exportAssignmentSymbol?: Symbol;
unionType?: UnionType;
resolvedExports?: SymbolTable;
}
interface TransientSymbol extends Symbol, SymbolLinks {
}
@@ -1043,7 +1084,8 @@ declare module "typescript" {
enumMemberValue?: number;
isIllegalTypeReferenceInConstraint?: boolean;
isVisible?: boolean;
localModuleName?: string;
generatedName?: string;
generatedNames?: Map<string>;
assignmentChecks?: Map<boolean>;
hasReportedStatementInAmbientContext?: boolean;
importOnRightSide?: Symbol;
@@ -1357,6 +1399,7 @@ declare module "typescript" {
equals = 61,
exclamation = 33,
greaterThan = 62,
hash = 35,
lessThan = 60,
minus = 45,
openBrace = 123,
@@ -1423,8 +1466,8 @@ declare module "typescript" {
}
function tokenToString(t: SyntaxKind): string;
function computeLineStarts(text: string): number[];
function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number;
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
function getLineStarts(sourceFile: SourceFile): number[];
function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): {
line: number;
@@ -1508,9 +1551,9 @@ declare module "typescript" {
scriptSnapshot: IScriptSnapshot;
nameTable: Map<string>;
getNamedDeclarations(): Declaration[];
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
getLineStarts(): number[];
getPositionFromLineAndCharacter(line: number, character: number): number;
getPositionOfLineAndCharacter(line: number, character: number): number;
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
}
/**
@@ -1572,7 +1615,7 @@ declare module "typescript" {
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getNavigateToItems(searchValue: string): NavigateToItem[];
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
getNavigationBarItems(fileName: string): NavigationBarItem[];
getOutliningSpans(fileName: string): OutliningSpan[];
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
@@ -1985,25 +2028,26 @@ function delint(sourceFile) {
delintNode(sourceFile);
function delintNode(node) {
switch (node.kind) {
case 179 /* ForStatement */:
case 180 /* ForInStatement */:
case 178 /* WhileStatement */:
case 177 /* DoStatement */:
if (node.statement.kind !== 172 /* Block */) {
case 181 /* ForStatement */:
case 182 /* ForInStatement */:
case 180 /* WhileStatement */:
case 179 /* DoStatement */:
if (node.statement.kind !== 174 /* Block */) {
report(node, "A looping statement's contents should be wrapped in a block body.");
}
break;
case 176 /* IfStatement */:
case 178 /* IfStatement */:
var ifStatement = node;
if (ifStatement.thenStatement.kind !== 172 /* Block */) {
if (ifStatement.thenStatement.kind !== 174 /* Block */) {
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
}
if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 172 /* Block */ && ifStatement.elseStatement.kind !== 176 /* IfStatement */) {
if (ifStatement.elseStatement &&
ifStatement.elseStatement.kind !== 174 /* Block */ && ifStatement.elseStatement.kind !== 178 /* IfStatement */) {
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
}
break;
case 165 /* BinaryExpression */:
var op = node.operator;
case 167 /* BinaryExpression */:
var op = node.operatorToken.kind;
if (op === 28 /* EqualsEqualsToken */ || op === 29 /* ExclamationEqualsToken */) {
report(node, "Use '===' and '!=='.");
}
@@ -2012,8 +2056,8 @@ function delint(sourceFile) {
ts.forEachChild(node, delintNode);
}
function report(node, message) {
var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart());
console.log(sourceFile.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + message);
var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart());
console.log(sourceFile.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + message);
}
}
exports.delint = delint;
+313 -169
View File
@@ -173,15 +173,17 @@ export function delint(sourceFile: ts.SourceFile) {
>SyntaxKind : typeof ts.SyntaxKind
>BinaryExpression : ts.SyntaxKind
var op = (<ts.BinaryExpression>node).operator;
var op = (<ts.BinaryExpression>node).operatorToken.kind;
>op : ts.SyntaxKind
>(<ts.BinaryExpression>node).operator : ts.SyntaxKind
>(<ts.BinaryExpression>node).operatorToken.kind : ts.SyntaxKind
>(<ts.BinaryExpression>node).operatorToken : ts.Node
>(<ts.BinaryExpression>node) : ts.BinaryExpression
><ts.BinaryExpression>node : ts.BinaryExpression
>ts : unknown
>BinaryExpression : ts.BinaryExpression
>node : ts.Node
>operator : ts.SyntaxKind
>operatorToken : ts.Node
>kind : ts.SyntaxKind
if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) {
>op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken : boolean
@@ -224,28 +226,30 @@ export function delint(sourceFile: ts.SourceFile) {
>Node : ts.Node
>message : string
var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart());
var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart());
>lineChar : ts.LineAndCharacter
>sourceFile.getLineAndCharacterFromPosition(node.getStart()) : ts.LineAndCharacter
>sourceFile.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
>sourceFile.getLineAndCharacterOfPosition(node.getStart()) : ts.LineAndCharacter
>sourceFile.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
>sourceFile : ts.SourceFile
>getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
>node.getStart() : number
>node.getStart : (sourceFile?: ts.SourceFile) => number
>node : ts.Node
>getStart : (sourceFile?: ts.SourceFile) => number
console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`)
>console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) : any
console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`)
>console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) : any
>console.log : any
>console : any
>log : any
>sourceFile.fileName : string
>sourceFile : ts.SourceFile
>fileName : string
>lineChar.line + 1 : number
>lineChar.line : number
>lineChar : ts.LineAndCharacter
>line : number
>lineChar.character + 1 : number
>lineChar.character : number
>lineChar : ts.LineAndCharacter
>character : number
@@ -640,340 +644,370 @@ declare module "typescript" {
WithKeyword = 100,
>WithKeyword : SyntaxKind
ImplementsKeyword = 101,
AsKeyword = 101,
>AsKeyword : SyntaxKind
FromKeyword = 102,
>FromKeyword : SyntaxKind
ImplementsKeyword = 103,
>ImplementsKeyword : SyntaxKind
InterfaceKeyword = 102,
InterfaceKeyword = 104,
>InterfaceKeyword : SyntaxKind
LetKeyword = 103,
LetKeyword = 105,
>LetKeyword : SyntaxKind
PackageKeyword = 104,
PackageKeyword = 106,
>PackageKeyword : SyntaxKind
PrivateKeyword = 105,
PrivateKeyword = 107,
>PrivateKeyword : SyntaxKind
ProtectedKeyword = 106,
ProtectedKeyword = 108,
>ProtectedKeyword : SyntaxKind
PublicKeyword = 107,
PublicKeyword = 109,
>PublicKeyword : SyntaxKind
StaticKeyword = 108,
StaticKeyword = 110,
>StaticKeyword : SyntaxKind
YieldKeyword = 109,
YieldKeyword = 111,
>YieldKeyword : SyntaxKind
AnyKeyword = 110,
AnyKeyword = 112,
>AnyKeyword : SyntaxKind
BooleanKeyword = 111,
BooleanKeyword = 113,
>BooleanKeyword : SyntaxKind
ConstructorKeyword = 112,
ConstructorKeyword = 114,
>ConstructorKeyword : SyntaxKind
DeclareKeyword = 113,
DeclareKeyword = 115,
>DeclareKeyword : SyntaxKind
GetKeyword = 114,
GetKeyword = 116,
>GetKeyword : SyntaxKind
ModuleKeyword = 115,
ModuleKeyword = 117,
>ModuleKeyword : SyntaxKind
RequireKeyword = 116,
RequireKeyword = 118,
>RequireKeyword : SyntaxKind
NumberKeyword = 117,
NumberKeyword = 119,
>NumberKeyword : SyntaxKind
SetKeyword = 118,
SetKeyword = 120,
>SetKeyword : SyntaxKind
StringKeyword = 119,
StringKeyword = 121,
>StringKeyword : SyntaxKind
SymbolKeyword = 120,
SymbolKeyword = 122,
>SymbolKeyword : SyntaxKind
TypeKeyword = 121,
TypeKeyword = 123,
>TypeKeyword : SyntaxKind
OfKeyword = 122,
OfKeyword = 124,
>OfKeyword : SyntaxKind
QualifiedName = 123,
QualifiedName = 125,
>QualifiedName : SyntaxKind
ComputedPropertyName = 124,
ComputedPropertyName = 126,
>ComputedPropertyName : SyntaxKind
TypeParameter = 125,
TypeParameter = 127,
>TypeParameter : SyntaxKind
Parameter = 126,
Parameter = 128,
>Parameter : SyntaxKind
PropertySignature = 127,
PropertySignature = 129,
>PropertySignature : SyntaxKind
PropertyDeclaration = 128,
PropertyDeclaration = 130,
>PropertyDeclaration : SyntaxKind
MethodSignature = 129,
MethodSignature = 131,
>MethodSignature : SyntaxKind
MethodDeclaration = 130,
MethodDeclaration = 132,
>MethodDeclaration : SyntaxKind
Constructor = 131,
Constructor = 133,
>Constructor : SyntaxKind
GetAccessor = 132,
GetAccessor = 134,
>GetAccessor : SyntaxKind
SetAccessor = 133,
SetAccessor = 135,
>SetAccessor : SyntaxKind
CallSignature = 134,
CallSignature = 136,
>CallSignature : SyntaxKind
ConstructSignature = 135,
ConstructSignature = 137,
>ConstructSignature : SyntaxKind
IndexSignature = 136,
IndexSignature = 138,
>IndexSignature : SyntaxKind
TypeReference = 137,
TypeReference = 139,
>TypeReference : SyntaxKind
FunctionType = 138,
FunctionType = 140,
>FunctionType : SyntaxKind
ConstructorType = 139,
ConstructorType = 141,
>ConstructorType : SyntaxKind
TypeQuery = 140,
TypeQuery = 142,
>TypeQuery : SyntaxKind
TypeLiteral = 141,
TypeLiteral = 143,
>TypeLiteral : SyntaxKind
ArrayType = 142,
ArrayType = 144,
>ArrayType : SyntaxKind
TupleType = 143,
TupleType = 145,
>TupleType : SyntaxKind
UnionType = 144,
UnionType = 146,
>UnionType : SyntaxKind
ParenthesizedType = 145,
ParenthesizedType = 147,
>ParenthesizedType : SyntaxKind
ObjectBindingPattern = 146,
ObjectBindingPattern = 148,
>ObjectBindingPattern : SyntaxKind
ArrayBindingPattern = 147,
ArrayBindingPattern = 149,
>ArrayBindingPattern : SyntaxKind
BindingElement = 148,
BindingElement = 150,
>BindingElement : SyntaxKind
ArrayLiteralExpression = 149,
ArrayLiteralExpression = 151,
>ArrayLiteralExpression : SyntaxKind
ObjectLiteralExpression = 150,
ObjectLiteralExpression = 152,
>ObjectLiteralExpression : SyntaxKind
PropertyAccessExpression = 151,
PropertyAccessExpression = 153,
>PropertyAccessExpression : SyntaxKind
ElementAccessExpression = 152,
ElementAccessExpression = 154,
>ElementAccessExpression : SyntaxKind
CallExpression = 153,
CallExpression = 155,
>CallExpression : SyntaxKind
NewExpression = 154,
NewExpression = 156,
>NewExpression : SyntaxKind
TaggedTemplateExpression = 155,
TaggedTemplateExpression = 157,
>TaggedTemplateExpression : SyntaxKind
TypeAssertionExpression = 156,
TypeAssertionExpression = 158,
>TypeAssertionExpression : SyntaxKind
ParenthesizedExpression = 157,
ParenthesizedExpression = 159,
>ParenthesizedExpression : SyntaxKind
FunctionExpression = 158,
FunctionExpression = 160,
>FunctionExpression : SyntaxKind
ArrowFunction = 159,
ArrowFunction = 161,
>ArrowFunction : SyntaxKind
DeleteExpression = 160,
DeleteExpression = 162,
>DeleteExpression : SyntaxKind
TypeOfExpression = 161,
TypeOfExpression = 163,
>TypeOfExpression : SyntaxKind
VoidExpression = 162,
VoidExpression = 164,
>VoidExpression : SyntaxKind
PrefixUnaryExpression = 163,
PrefixUnaryExpression = 165,
>PrefixUnaryExpression : SyntaxKind
PostfixUnaryExpression = 164,
PostfixUnaryExpression = 166,
>PostfixUnaryExpression : SyntaxKind
BinaryExpression = 165,
BinaryExpression = 167,
>BinaryExpression : SyntaxKind
ConditionalExpression = 166,
ConditionalExpression = 168,
>ConditionalExpression : SyntaxKind
TemplateExpression = 167,
TemplateExpression = 169,
>TemplateExpression : SyntaxKind
YieldExpression = 168,
YieldExpression = 170,
>YieldExpression : SyntaxKind
SpreadElementExpression = 169,
SpreadElementExpression = 171,
>SpreadElementExpression : SyntaxKind
OmittedExpression = 170,
OmittedExpression = 172,
>OmittedExpression : SyntaxKind
TemplateSpan = 171,
TemplateSpan = 173,
>TemplateSpan : SyntaxKind
Block = 172,
Block = 174,
>Block : SyntaxKind
VariableStatement = 173,
VariableStatement = 175,
>VariableStatement : SyntaxKind
EmptyStatement = 174,
EmptyStatement = 176,
>EmptyStatement : SyntaxKind
ExpressionStatement = 175,
ExpressionStatement = 177,
>ExpressionStatement : SyntaxKind
IfStatement = 176,
IfStatement = 178,
>IfStatement : SyntaxKind
DoStatement = 177,
DoStatement = 179,
>DoStatement : SyntaxKind
WhileStatement = 178,
WhileStatement = 180,
>WhileStatement : SyntaxKind
ForStatement = 179,
ForStatement = 181,
>ForStatement : SyntaxKind
ForInStatement = 180,
ForInStatement = 182,
>ForInStatement : SyntaxKind
ForOfStatement = 181,
ForOfStatement = 183,
>ForOfStatement : SyntaxKind
ContinueStatement = 182,
ContinueStatement = 184,
>ContinueStatement : SyntaxKind
BreakStatement = 183,
BreakStatement = 185,
>BreakStatement : SyntaxKind
ReturnStatement = 184,
ReturnStatement = 186,
>ReturnStatement : SyntaxKind
WithStatement = 185,
WithStatement = 187,
>WithStatement : SyntaxKind
SwitchStatement = 186,
SwitchStatement = 188,
>SwitchStatement : SyntaxKind
LabeledStatement = 187,
LabeledStatement = 189,
>LabeledStatement : SyntaxKind
ThrowStatement = 188,
ThrowStatement = 190,
>ThrowStatement : SyntaxKind
TryStatement = 189,
TryStatement = 191,
>TryStatement : SyntaxKind
DebuggerStatement = 190,
DebuggerStatement = 192,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 191,
VariableDeclaration = 193,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 192,
VariableDeclarationList = 194,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 193,
FunctionDeclaration = 195,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 194,
ClassDeclaration = 196,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 195,
InterfaceDeclaration = 197,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 196,
TypeAliasDeclaration = 198,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 197,
EnumDeclaration = 199,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 198,
ModuleDeclaration = 200,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 199,
ModuleBlock = 201,
>ModuleBlock : SyntaxKind
ImportDeclaration = 200,
ImportEqualsDeclaration = 202,
>ImportEqualsDeclaration : SyntaxKind
ImportDeclaration = 203,
>ImportDeclaration : SyntaxKind
ExportAssignment = 201,
ImportClause = 204,
>ImportClause : SyntaxKind
NamespaceImport = 205,
>NamespaceImport : SyntaxKind
NamedImports = 206,
>NamedImports : SyntaxKind
ImportSpecifier = 207,
>ImportSpecifier : SyntaxKind
ExportAssignment = 208,
>ExportAssignment : SyntaxKind
ExternalModuleReference = 202,
ExportDeclaration = 209,
>ExportDeclaration : SyntaxKind
NamedExports = 210,
>NamedExports : SyntaxKind
ExportSpecifier = 211,
>ExportSpecifier : SyntaxKind
ExternalModuleReference = 212,
>ExternalModuleReference : SyntaxKind
CaseClause = 203,
CaseClause = 213,
>CaseClause : SyntaxKind
DefaultClause = 204,
DefaultClause = 214,
>DefaultClause : SyntaxKind
HeritageClause = 205,
HeritageClause = 215,
>HeritageClause : SyntaxKind
CatchClause = 206,
CatchClause = 216,
>CatchClause : SyntaxKind
PropertyAssignment = 207,
PropertyAssignment = 217,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 208,
ShorthandPropertyAssignment = 218,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 209,
EnumMember = 219,
>EnumMember : SyntaxKind
SourceFile = 210,
SourceFile = 220,
>SourceFile : SyntaxKind
SyntaxList = 211,
SyntaxList = 221,
>SyntaxList : SyntaxKind
Count = 212,
Count = 222,
>Count : SyntaxKind
FirstAssignment = 52,
@@ -991,19 +1025,19 @@ declare module "typescript" {
FirstKeyword = 65,
>FirstKeyword : SyntaxKind
LastKeyword = 122,
LastKeyword = 124,
>LastKeyword : SyntaxKind
FirstFutureReservedWord = 101,
FirstFutureReservedWord = 103,
>FirstFutureReservedWord : SyntaxKind
LastFutureReservedWord = 109,
LastFutureReservedWord = 111,
>LastFutureReservedWord : SyntaxKind
FirstTypeNode = 137,
FirstTypeNode = 139,
>FirstTypeNode : SyntaxKind
LastTypeNode = 145,
LastTypeNode = 147,
>LastTypeNode : SyntaxKind
FirstPunctuation = 14,
@@ -1015,7 +1049,7 @@ declare module "typescript" {
FirstToken = 0,
>FirstToken : SyntaxKind
LastToken = 122,
LastToken = 124,
>LastToken : SyntaxKind
FirstTriviaToken = 2,
@@ -1042,7 +1076,7 @@ declare module "typescript" {
LastBinaryOperator = 63,
>LastBinaryOperator : SyntaxKind
FirstNode = 123,
FirstNode = 125,
>FirstNode : SyntaxKind
}
const enum NodeFlags {
@@ -1148,6 +1182,10 @@ declare module "typescript" {
>parserContextFlags : ParserContextFlags
>ParserContextFlags : ParserContextFlags
modifiers?: ModifiersArray;
>modifiers : ModifiersArray
>ModifiersArray : ModifiersArray
id?: number;
>id : number
@@ -1170,10 +1208,6 @@ declare module "typescript" {
localSymbol?: Symbol;
>localSymbol : Symbol
>Symbol : Symbol
modifiers?: ModifiersArray;
>modifiers : ModifiersArray
>ModifiersArray : ModifiersArray
}
interface NodeArray<T> extends Array<T>, TextRange {
>NodeArray : NodeArray<T>
@@ -1729,9 +1763,9 @@ declare module "typescript" {
>left : Expression
>Expression : Expression
operator: SyntaxKind;
>operator : SyntaxKind
>SyntaxKind : SyntaxKind
operatorToken: Node;
>operatorToken : Node
>Node : Node
right: Expression;
>right : Expression
@@ -2272,10 +2306,18 @@ declare module "typescript" {
>NodeArray : NodeArray<T>
>EnumMember : EnumMember
}
interface ModuleDeclaration extends Declaration, ModuleElement {
interface ExportContainer {
>ExportContainer : ExportContainer
exportStars?: ExportDeclaration[];
>exportStars : ExportDeclaration[]
>ExportDeclaration : ExportDeclaration
}
interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer {
>ModuleDeclaration : ModuleDeclaration
>Declaration : Declaration
>ModuleElement : ModuleElement
>ExportContainer : ExportContainer
name: Identifier | LiteralExpression;
>name : Identifier | LiteralExpression
@@ -2297,8 +2339,8 @@ declare module "typescript" {
>NodeArray : NodeArray<T>
>ModuleElement : ModuleElement
}
interface ImportDeclaration extends Declaration, ModuleElement {
>ImportDeclaration : ImportDeclaration
interface ImportEqualsDeclaration extends Declaration, ModuleElement {
>ImportEqualsDeclaration : ImportEqualsDeclaration
>Declaration : Declaration
>ModuleElement : ModuleElement
@@ -2319,6 +2361,90 @@ declare module "typescript" {
>expression : Expression
>Expression : Expression
}
interface ImportDeclaration extends Statement, ModuleElement {
>ImportDeclaration : ImportDeclaration
>Statement : Statement
>ModuleElement : ModuleElement
importClause?: ImportClause;
>importClause : ImportClause
>ImportClause : ImportClause
moduleSpecifier: Expression;
>moduleSpecifier : Expression
>Expression : Expression
}
interface ImportClause extends Declaration {
>ImportClause : ImportClause
>Declaration : Declaration
name?: Identifier;
>name : Identifier
>Identifier : Identifier
namedBindings?: NamespaceImport | NamedImports;
>namedBindings : NamespaceImport | NamedImportsOrExports
>NamespaceImport : NamespaceImport
>NamedImports : NamedImportsOrExports
}
interface NamespaceImport extends Declaration {
>NamespaceImport : NamespaceImport
>Declaration : Declaration
name: Identifier;
>name : Identifier
>Identifier : Identifier
}
interface ExportDeclaration extends Statement, ModuleElement {
>ExportDeclaration : ExportDeclaration
>Statement : Statement
>ModuleElement : ModuleElement
exportClause?: NamedExports;
>exportClause : NamedImportsOrExports
>NamedExports : NamedImportsOrExports
moduleSpecifier?: Expression;
>moduleSpecifier : Expression
>Expression : Expression
}
interface NamedImportsOrExports extends Node {
>NamedImportsOrExports : NamedImportsOrExports
>Node : Node
elements: NodeArray<ImportOrExportSpecifier>;
>elements : NodeArray<ImportOrExportSpecifier>
>NodeArray : NodeArray<T>
>ImportOrExportSpecifier : ImportOrExportSpecifier
}
type NamedImports = NamedImportsOrExports;
>NamedImports : NamedImportsOrExports
>NamedImportsOrExports : NamedImportsOrExports
type NamedExports = NamedImportsOrExports;
>NamedExports : NamedImportsOrExports
>NamedImportsOrExports : NamedImportsOrExports
interface ImportOrExportSpecifier extends Declaration {
>ImportOrExportSpecifier : ImportOrExportSpecifier
>Declaration : Declaration
propertyName?: Identifier;
>propertyName : Identifier
>Identifier : Identifier
name: Identifier;
>name : Identifier
>Identifier : Identifier
}
type ImportSpecifier = ImportOrExportSpecifier;
>ImportSpecifier : ImportOrExportSpecifier
>ImportOrExportSpecifier : ImportOrExportSpecifier
type ExportSpecifier = ImportOrExportSpecifier;
>ExportSpecifier : ImportOrExportSpecifier
>ImportOrExportSpecifier : ImportOrExportSpecifier
interface ExportAssignment extends Statement, ModuleElement {
>ExportAssignment : ExportAssignment
>Statement : Statement
@@ -2342,9 +2468,10 @@ declare module "typescript" {
hasTrailingNewLine?: boolean;
>hasTrailingNewLine : boolean
}
interface SourceFile extends Declaration {
interface SourceFile extends Declaration, ExportContainer {
>SourceFile : SourceFile
>Declaration : Declaration
>ExportContainer : ExportContainer
statements: NodeArray<ModuleElement>;
>statements : NodeArray<ModuleElement>
@@ -2958,9 +3085,9 @@ declare module "typescript" {
>accessibility : SymbolAccessibility
>SymbolAccessibility : SymbolAccessibility
aliasesToMakeVisible?: ImportDeclaration[];
>aliasesToMakeVisible : ImportDeclaration[]
>ImportDeclaration : ImportDeclaration
aliasesToMakeVisible?: ImportEqualsDeclaration[];
>aliasesToMakeVisible : ImportEqualsDeclaration[]
>ImportEqualsDeclaration : ImportEqualsDeclaration
errorSymbolName?: string;
>errorSymbolName : string
@@ -2979,14 +3106,16 @@ declare module "typescript" {
interface EmitResolver {
>EmitResolver : EmitResolver
getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string;
>getLocalNameOfContainer : (container: EnumDeclaration | ModuleDeclaration) => string
>container : EnumDeclaration | ModuleDeclaration
getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string;
>getGeneratedNameForNode : (node: EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration) => string
>node : EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration
>ModuleDeclaration : ModuleDeclaration
>EnumDeclaration : EnumDeclaration
>ImportDeclaration : ImportDeclaration
>ExportDeclaration : ExportDeclaration
getExpressionNamePrefix(node: Identifier): string;
>getExpressionNamePrefix : (node: Identifier) => string
getExpressionNameSubstitution(node: Identifier): string;
>getExpressionNameSubstitution : (node: Identifier) => string
>node : Identifier
>Identifier : Identifier
@@ -2995,15 +3124,15 @@ declare module "typescript" {
>node : SourceFile
>SourceFile : SourceFile
isReferencedImportDeclaration(node: ImportDeclaration): boolean;
>isReferencedImportDeclaration : (node: ImportDeclaration) => boolean
>node : ImportDeclaration
>ImportDeclaration : ImportDeclaration
isReferencedImportDeclaration(node: Node): boolean;
>isReferencedImportDeclaration : (node: Node) => boolean
>node : Node
>Node : Node
isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean;
>isTopLevelValueImportWithEntityName : (node: ImportDeclaration) => boolean
>node : ImportDeclaration
>ImportDeclaration : ImportDeclaration
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean
>node : ImportEqualsDeclaration
>ImportEqualsDeclaration : ImportEqualsDeclaration
getNodeCheckFlags(node: Node): NodeCheckFlags;
>getNodeCheckFlags : (node: Node) => NodeCheckFlags
@@ -3332,13 +3461,20 @@ declare module "typescript" {
referenced?: boolean;
>referenced : boolean
exportAssignSymbol?: Symbol;
>exportAssignSymbol : Symbol
exportAssignmentChecked?: boolean;
>exportAssignmentChecked : boolean
exportAssignmentSymbol?: Symbol;
>exportAssignmentSymbol : Symbol
>Symbol : Symbol
unionType?: UnionType;
>unionType : UnionType
>UnionType : UnionType
resolvedExports?: SymbolTable;
>resolvedExports : SymbolTable
>SymbolTable : SymbolTable
}
interface TransientSymbol extends Symbol, SymbolLinks {
>TransientSymbol : TransientSymbol
@@ -3407,8 +3543,12 @@ declare module "typescript" {
isVisible?: boolean;
>isVisible : boolean
localModuleName?: string;
>localModuleName : string
generatedName?: string;
>generatedName : string
generatedNames?: Map<string>;
>generatedNames : Map<string>
>Map : Map<T>
assignmentChecks?: Map<boolean>;
>assignmentChecks : Map<boolean>
@@ -4332,6 +4472,9 @@ declare module "typescript" {
greaterThan = 62,
>greaterThan : CharacterCodes
hash = 35,
>hash : CharacterCodes
lessThan = 60,
>lessThan : CharacterCodes
@@ -4537,15 +4680,15 @@ declare module "typescript" {
>computeLineStarts : (text: string) => number[]
>text : string
function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
>getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number
>sourceFile : SourceFile
>SourceFile : SourceFile
>line : number
>character : number
function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number;
>computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number
>lineStarts : number[]
>line : number
>character : number
@@ -4904,16 +5047,16 @@ declare module "typescript" {
>getNamedDeclarations : () => Declaration[]
>Declaration : Declaration
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
>getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter
>pos : number
>LineAndCharacter : LineAndCharacter
getLineStarts(): number[];
>getLineStarts : () => number[]
getPositionFromLineAndCharacter(line: number, character: number): number;
>getPositionFromLineAndCharacter : (line: number, character: number) => number
getPositionOfLineAndCharacter(line: number, character: number): number;
>getPositionOfLineAndCharacter : (line: number, character: number) => number
>line : number
>character : number
@@ -5130,9 +5273,10 @@ declare module "typescript" {
>position : number
>ReferenceEntry : ReferenceEntry
getNavigateToItems(searchValue: string): NavigateToItem[];
>getNavigateToItems : (searchValue: string) => NavigateToItem[]
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[]
>searchValue : string
>maxResultCount : number
>NavigateToItem : NavigateToItem
getNavigationBarItems(fileName: string): NavigationBarItem[];
+181 -138
View File
@@ -54,7 +54,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) {
return {
outputs: outputs,
errors: errors.map(function (e) {
return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): "
return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): "
+ ts.flattenDiagnosticMessageText(e.messageText, os.EOL);
})
};
@@ -192,132 +192,142 @@ declare module "typescript" {
VoidKeyword = 98,
WhileKeyword = 99,
WithKeyword = 100,
ImplementsKeyword = 101,
InterfaceKeyword = 102,
LetKeyword = 103,
PackageKeyword = 104,
PrivateKeyword = 105,
ProtectedKeyword = 106,
PublicKeyword = 107,
StaticKeyword = 108,
YieldKeyword = 109,
AnyKeyword = 110,
BooleanKeyword = 111,
ConstructorKeyword = 112,
DeclareKeyword = 113,
GetKeyword = 114,
ModuleKeyword = 115,
RequireKeyword = 116,
NumberKeyword = 117,
SetKeyword = 118,
StringKeyword = 119,
SymbolKeyword = 120,
TypeKeyword = 121,
OfKeyword = 122,
QualifiedName = 123,
ComputedPropertyName = 124,
TypeParameter = 125,
Parameter = 126,
PropertySignature = 127,
PropertyDeclaration = 128,
MethodSignature = 129,
MethodDeclaration = 130,
Constructor = 131,
GetAccessor = 132,
SetAccessor = 133,
CallSignature = 134,
ConstructSignature = 135,
IndexSignature = 136,
TypeReference = 137,
FunctionType = 138,
ConstructorType = 139,
TypeQuery = 140,
TypeLiteral = 141,
ArrayType = 142,
TupleType = 143,
UnionType = 144,
ParenthesizedType = 145,
ObjectBindingPattern = 146,
ArrayBindingPattern = 147,
BindingElement = 148,
ArrayLiteralExpression = 149,
ObjectLiteralExpression = 150,
PropertyAccessExpression = 151,
ElementAccessExpression = 152,
CallExpression = 153,
NewExpression = 154,
TaggedTemplateExpression = 155,
TypeAssertionExpression = 156,
ParenthesizedExpression = 157,
FunctionExpression = 158,
ArrowFunction = 159,
DeleteExpression = 160,
TypeOfExpression = 161,
VoidExpression = 162,
PrefixUnaryExpression = 163,
PostfixUnaryExpression = 164,
BinaryExpression = 165,
ConditionalExpression = 166,
TemplateExpression = 167,
YieldExpression = 168,
SpreadElementExpression = 169,
OmittedExpression = 170,
TemplateSpan = 171,
Block = 172,
VariableStatement = 173,
EmptyStatement = 174,
ExpressionStatement = 175,
IfStatement = 176,
DoStatement = 177,
WhileStatement = 178,
ForStatement = 179,
ForInStatement = 180,
ForOfStatement = 181,
ContinueStatement = 182,
BreakStatement = 183,
ReturnStatement = 184,
WithStatement = 185,
SwitchStatement = 186,
LabeledStatement = 187,
ThrowStatement = 188,
TryStatement = 189,
DebuggerStatement = 190,
VariableDeclaration = 191,
VariableDeclarationList = 192,
FunctionDeclaration = 193,
ClassDeclaration = 194,
InterfaceDeclaration = 195,
TypeAliasDeclaration = 196,
EnumDeclaration = 197,
ModuleDeclaration = 198,
ModuleBlock = 199,
ImportDeclaration = 200,
ExportAssignment = 201,
ExternalModuleReference = 202,
CaseClause = 203,
DefaultClause = 204,
HeritageClause = 205,
CatchClause = 206,
PropertyAssignment = 207,
ShorthandPropertyAssignment = 208,
EnumMember = 209,
SourceFile = 210,
SyntaxList = 211,
Count = 212,
AsKeyword = 101,
FromKeyword = 102,
ImplementsKeyword = 103,
InterfaceKeyword = 104,
LetKeyword = 105,
PackageKeyword = 106,
PrivateKeyword = 107,
ProtectedKeyword = 108,
PublicKeyword = 109,
StaticKeyword = 110,
YieldKeyword = 111,
AnyKeyword = 112,
BooleanKeyword = 113,
ConstructorKeyword = 114,
DeclareKeyword = 115,
GetKeyword = 116,
ModuleKeyword = 117,
RequireKeyword = 118,
NumberKeyword = 119,
SetKeyword = 120,
StringKeyword = 121,
SymbolKeyword = 122,
TypeKeyword = 123,
OfKeyword = 124,
QualifiedName = 125,
ComputedPropertyName = 126,
TypeParameter = 127,
Parameter = 128,
PropertySignature = 129,
PropertyDeclaration = 130,
MethodSignature = 131,
MethodDeclaration = 132,
Constructor = 133,
GetAccessor = 134,
SetAccessor = 135,
CallSignature = 136,
ConstructSignature = 137,
IndexSignature = 138,
TypeReference = 139,
FunctionType = 140,
ConstructorType = 141,
TypeQuery = 142,
TypeLiteral = 143,
ArrayType = 144,
TupleType = 145,
UnionType = 146,
ParenthesizedType = 147,
ObjectBindingPattern = 148,
ArrayBindingPattern = 149,
BindingElement = 150,
ArrayLiteralExpression = 151,
ObjectLiteralExpression = 152,
PropertyAccessExpression = 153,
ElementAccessExpression = 154,
CallExpression = 155,
NewExpression = 156,
TaggedTemplateExpression = 157,
TypeAssertionExpression = 158,
ParenthesizedExpression = 159,
FunctionExpression = 160,
ArrowFunction = 161,
DeleteExpression = 162,
TypeOfExpression = 163,
VoidExpression = 164,
PrefixUnaryExpression = 165,
PostfixUnaryExpression = 166,
BinaryExpression = 167,
ConditionalExpression = 168,
TemplateExpression = 169,
YieldExpression = 170,
SpreadElementExpression = 171,
OmittedExpression = 172,
TemplateSpan = 173,
Block = 174,
VariableStatement = 175,
EmptyStatement = 176,
ExpressionStatement = 177,
IfStatement = 178,
DoStatement = 179,
WhileStatement = 180,
ForStatement = 181,
ForInStatement = 182,
ForOfStatement = 183,
ContinueStatement = 184,
BreakStatement = 185,
ReturnStatement = 186,
WithStatement = 187,
SwitchStatement = 188,
LabeledStatement = 189,
ThrowStatement = 190,
TryStatement = 191,
DebuggerStatement = 192,
VariableDeclaration = 193,
VariableDeclarationList = 194,
FunctionDeclaration = 195,
ClassDeclaration = 196,
InterfaceDeclaration = 197,
TypeAliasDeclaration = 198,
EnumDeclaration = 199,
ModuleDeclaration = 200,
ModuleBlock = 201,
ImportEqualsDeclaration = 202,
ImportDeclaration = 203,
ImportClause = 204,
NamespaceImport = 205,
NamedImports = 206,
ImportSpecifier = 207,
ExportAssignment = 208,
ExportDeclaration = 209,
NamedExports = 210,
ExportSpecifier = 211,
ExternalModuleReference = 212,
CaseClause = 213,
DefaultClause = 214,
HeritageClause = 215,
CatchClause = 216,
PropertyAssignment = 217,
ShorthandPropertyAssignment = 218,
EnumMember = 219,
SourceFile = 220,
SyntaxList = 221,
Count = 222,
FirstAssignment = 52,
LastAssignment = 63,
FirstReservedWord = 65,
LastReservedWord = 100,
FirstKeyword = 65,
LastKeyword = 122,
FirstFutureReservedWord = 101,
LastFutureReservedWord = 109,
FirstTypeNode = 137,
LastTypeNode = 145,
LastKeyword = 124,
FirstFutureReservedWord = 103,
LastFutureReservedWord = 111,
FirstTypeNode = 139,
LastTypeNode = 147,
FirstPunctuation = 14,
LastPunctuation = 63,
FirstToken = 0,
LastToken = 122,
LastToken = 124,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -326,7 +336,7 @@ declare module "typescript" {
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 63,
FirstNode = 123,
FirstNode = 125,
}
const enum NodeFlags {
Export = 1,
@@ -364,13 +374,13 @@ declare module "typescript" {
kind: SyntaxKind;
flags: NodeFlags;
parserContextFlags?: ParserContextFlags;
modifiers?: ModifiersArray;
id?: number;
parent?: Node;
symbol?: Symbol;
locals?: SymbolTable;
nextContainer?: Node;
localSymbol?: Symbol;
modifiers?: ModifiersArray;
}
interface NodeArray<T> extends Array<T>, TextRange {
hasTrailingComma?: boolean;
@@ -559,7 +569,7 @@ declare module "typescript" {
}
interface BinaryExpression extends Expression {
left: Expression;
operator: SyntaxKind;
operatorToken: Node;
right: Expression;
}
interface ConditionalExpression extends Expression {
@@ -734,20 +744,49 @@ declare module "typescript" {
name: Identifier;
members: NodeArray<EnumMember>;
}
interface ModuleDeclaration extends Declaration, ModuleElement {
interface ExportContainer {
exportStars?: ExportDeclaration[];
}
interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer {
name: Identifier | LiteralExpression;
body: ModuleBlock | ModuleDeclaration;
}
interface ModuleBlock extends Node, ModuleElement {
statements: NodeArray<ModuleElement>;
}
interface ImportDeclaration extends Declaration, ModuleElement {
interface ImportEqualsDeclaration extends Declaration, ModuleElement {
name: Identifier;
moduleReference: EntityName | ExternalModuleReference;
}
interface ExternalModuleReference extends Node {
expression?: Expression;
}
interface ImportDeclaration extends Statement, ModuleElement {
importClause?: ImportClause;
moduleSpecifier: Expression;
}
interface ImportClause extends Declaration {
name?: Identifier;
namedBindings?: NamespaceImport | NamedImports;
}
interface NamespaceImport extends Declaration {
name: Identifier;
}
interface ExportDeclaration extends Statement, ModuleElement {
exportClause?: NamedExports;
moduleSpecifier?: Expression;
}
interface NamedImportsOrExports extends Node {
elements: NodeArray<ImportOrExportSpecifier>;
}
type NamedImports = NamedImportsOrExports;
type NamedExports = NamedImportsOrExports;
interface ImportOrExportSpecifier extends Declaration {
propertyName?: Identifier;
name: Identifier;
}
type ImportSpecifier = ImportOrExportSpecifier;
type ExportSpecifier = ImportOrExportSpecifier;
interface ExportAssignment extends Statement, ModuleElement {
exportName: Identifier;
}
@@ -757,7 +796,7 @@ declare module "typescript" {
interface CommentRange extends TextRange {
hasTrailingNewLine?: boolean;
}
interface SourceFile extends Declaration {
interface SourceFile extends Declaration, ExportContainer {
statements: NodeArray<ModuleElement>;
endOfFileToken: Node;
fileName: string;
@@ -911,7 +950,7 @@ declare module "typescript" {
}
interface SymbolVisibilityResult {
accessibility: SymbolAccessibility;
aliasesToMakeVisible?: ImportDeclaration[];
aliasesToMakeVisible?: ImportEqualsDeclaration[];
errorSymbolName?: string;
errorNode?: Node;
}
@@ -919,11 +958,11 @@ declare module "typescript" {
errorModuleName?: string;
}
interface EmitResolver {
getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string;
getExpressionNamePrefix(node: Identifier): string;
getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string;
getExpressionNameSubstitution(node: Identifier): string;
getExportAssignmentName(node: SourceFile): string;
isReferencedImportDeclaration(node: ImportDeclaration): boolean;
isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean;
isReferencedImportDeclaration(node: Node): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
@@ -1018,8 +1057,10 @@ declare module "typescript" {
declaredType?: Type;
mapper?: TypeMapper;
referenced?: boolean;
exportAssignSymbol?: Symbol;
exportAssignmentChecked?: boolean;
exportAssignmentSymbol?: Symbol;
unionType?: UnionType;
resolvedExports?: SymbolTable;
}
interface TransientSymbol extends Symbol, SymbolLinks {
}
@@ -1044,7 +1085,8 @@ declare module "typescript" {
enumMemberValue?: number;
isIllegalTypeReferenceInConstraint?: boolean;
isVisible?: boolean;
localModuleName?: string;
generatedName?: string;
generatedNames?: Map<string>;
assignmentChecks?: Map<boolean>;
hasReportedStatementInAmbientContext?: boolean;
importOnRightSide?: Symbol;
@@ -1358,6 +1400,7 @@ declare module "typescript" {
equals = 61,
exclamation = 33,
greaterThan = 62,
hash = 35,
lessThan = 60,
minus = 45,
openBrace = 123,
@@ -1424,8 +1467,8 @@ declare module "typescript" {
}
function tokenToString(t: SyntaxKind): string;
function computeLineStarts(text: string): number[];
function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number;
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
function getLineStarts(sourceFile: SourceFile): number[];
function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): {
line: number;
@@ -1509,9 +1552,9 @@ declare module "typescript" {
scriptSnapshot: IScriptSnapshot;
nameTable: Map<string>;
getNamedDeclarations(): Declaration[];
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
getLineStarts(): number[];
getPositionFromLineAndCharacter(line: number, character: number): number;
getPositionOfLineAndCharacter(line: number, character: number): number;
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
}
/**
@@ -1573,7 +1616,7 @@ declare module "typescript" {
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getNavigateToItems(searchValue: string): NavigateToItem[];
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
getNavigationBarItems(fileName: string): NavigationBarItem[];
getOutliningSpans(fileName: string): OutliningSpan[];
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
@@ -2014,7 +2057,7 @@ function transform(contents, compilerOptions) {
return {
outputs: outputs,
errors: errors.map(function (e) {
return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL);
return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL);
})
};
}
@@ -177,7 +177,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) {
>diagnostics : ts.Diagnostic[]
return {
>{ outputs: outputs, errors: errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) } : { outputs: any[]; errors: string[]; }
>{ outputs: outputs, errors: errors.map(function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) } : { outputs: any[]; errors: string[]; }
outputs: outputs,
>outputs : any[]
@@ -185,30 +185,32 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) {
errors: errors.map(function (e) {
>errors : string[]
>errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) : string[]
>errors.map(function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) : string[]
>errors.map : <U>(callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[]
>errors : ts.Diagnostic[]
>map : <U>(callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[]
>function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); } : (e: ts.Diagnostic) => string
>function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); } : (e: ts.Diagnostic) => string
>e : ts.Diagnostic
return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): "
>e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL) : string
>e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " : string
>e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line : string
return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): "
>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL) : string
>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " : string
>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) : string
>e.file.fileName + "(" : string
>e.file.fileName : string
>e.file : ts.SourceFile
>e : ts.Diagnostic
>file : ts.SourceFile
>fileName : string
>e.file.getLineAndCharacterFromPosition(e.start).line : number
>e.file.getLineAndCharacterFromPosition(e.start) : ts.LineAndCharacter
>e.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
>(e.file.getLineAndCharacterOfPosition(e.start).line + 1) : number
>e.file.getLineAndCharacterOfPosition(e.start).line + 1 : number
>e.file.getLineAndCharacterOfPosition(e.start).line : number
>e.file.getLineAndCharacterOfPosition(e.start) : ts.LineAndCharacter
>e.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
>e.file : ts.SourceFile
>e : ts.Diagnostic
>file : ts.SourceFile
>getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
>e.start : number
>e : ts.Diagnostic
>start : number
@@ -592,340 +594,370 @@ declare module "typescript" {
WithKeyword = 100,
>WithKeyword : SyntaxKind
ImplementsKeyword = 101,
AsKeyword = 101,
>AsKeyword : SyntaxKind
FromKeyword = 102,
>FromKeyword : SyntaxKind
ImplementsKeyword = 103,
>ImplementsKeyword : SyntaxKind
InterfaceKeyword = 102,
InterfaceKeyword = 104,
>InterfaceKeyword : SyntaxKind
LetKeyword = 103,
LetKeyword = 105,
>LetKeyword : SyntaxKind
PackageKeyword = 104,
PackageKeyword = 106,
>PackageKeyword : SyntaxKind
PrivateKeyword = 105,
PrivateKeyword = 107,
>PrivateKeyword : SyntaxKind
ProtectedKeyword = 106,
ProtectedKeyword = 108,
>ProtectedKeyword : SyntaxKind
PublicKeyword = 107,
PublicKeyword = 109,
>PublicKeyword : SyntaxKind
StaticKeyword = 108,
StaticKeyword = 110,
>StaticKeyword : SyntaxKind
YieldKeyword = 109,
YieldKeyword = 111,
>YieldKeyword : SyntaxKind
AnyKeyword = 110,
AnyKeyword = 112,
>AnyKeyword : SyntaxKind
BooleanKeyword = 111,
BooleanKeyword = 113,
>BooleanKeyword : SyntaxKind
ConstructorKeyword = 112,
ConstructorKeyword = 114,
>ConstructorKeyword : SyntaxKind
DeclareKeyword = 113,
DeclareKeyword = 115,
>DeclareKeyword : SyntaxKind
GetKeyword = 114,
GetKeyword = 116,
>GetKeyword : SyntaxKind
ModuleKeyword = 115,
ModuleKeyword = 117,
>ModuleKeyword : SyntaxKind
RequireKeyword = 116,
RequireKeyword = 118,
>RequireKeyword : SyntaxKind
NumberKeyword = 117,
NumberKeyword = 119,
>NumberKeyword : SyntaxKind
SetKeyword = 118,
SetKeyword = 120,
>SetKeyword : SyntaxKind
StringKeyword = 119,
StringKeyword = 121,
>StringKeyword : SyntaxKind
SymbolKeyword = 120,
SymbolKeyword = 122,
>SymbolKeyword : SyntaxKind
TypeKeyword = 121,
TypeKeyword = 123,
>TypeKeyword : SyntaxKind
OfKeyword = 122,
OfKeyword = 124,
>OfKeyword : SyntaxKind
QualifiedName = 123,
QualifiedName = 125,
>QualifiedName : SyntaxKind
ComputedPropertyName = 124,
ComputedPropertyName = 126,
>ComputedPropertyName : SyntaxKind
TypeParameter = 125,
TypeParameter = 127,
>TypeParameter : SyntaxKind
Parameter = 126,
Parameter = 128,
>Parameter : SyntaxKind
PropertySignature = 127,
PropertySignature = 129,
>PropertySignature : SyntaxKind
PropertyDeclaration = 128,
PropertyDeclaration = 130,
>PropertyDeclaration : SyntaxKind
MethodSignature = 129,
MethodSignature = 131,
>MethodSignature : SyntaxKind
MethodDeclaration = 130,
MethodDeclaration = 132,
>MethodDeclaration : SyntaxKind
Constructor = 131,
Constructor = 133,
>Constructor : SyntaxKind
GetAccessor = 132,
GetAccessor = 134,
>GetAccessor : SyntaxKind
SetAccessor = 133,
SetAccessor = 135,
>SetAccessor : SyntaxKind
CallSignature = 134,
CallSignature = 136,
>CallSignature : SyntaxKind
ConstructSignature = 135,
ConstructSignature = 137,
>ConstructSignature : SyntaxKind
IndexSignature = 136,
IndexSignature = 138,
>IndexSignature : SyntaxKind
TypeReference = 137,
TypeReference = 139,
>TypeReference : SyntaxKind
FunctionType = 138,
FunctionType = 140,
>FunctionType : SyntaxKind
ConstructorType = 139,
ConstructorType = 141,
>ConstructorType : SyntaxKind
TypeQuery = 140,
TypeQuery = 142,
>TypeQuery : SyntaxKind
TypeLiteral = 141,
TypeLiteral = 143,
>TypeLiteral : SyntaxKind
ArrayType = 142,
ArrayType = 144,
>ArrayType : SyntaxKind
TupleType = 143,
TupleType = 145,
>TupleType : SyntaxKind
UnionType = 144,
UnionType = 146,
>UnionType : SyntaxKind
ParenthesizedType = 145,
ParenthesizedType = 147,
>ParenthesizedType : SyntaxKind
ObjectBindingPattern = 146,
ObjectBindingPattern = 148,
>ObjectBindingPattern : SyntaxKind
ArrayBindingPattern = 147,
ArrayBindingPattern = 149,
>ArrayBindingPattern : SyntaxKind
BindingElement = 148,
BindingElement = 150,
>BindingElement : SyntaxKind
ArrayLiteralExpression = 149,
ArrayLiteralExpression = 151,
>ArrayLiteralExpression : SyntaxKind
ObjectLiteralExpression = 150,
ObjectLiteralExpression = 152,
>ObjectLiteralExpression : SyntaxKind
PropertyAccessExpression = 151,
PropertyAccessExpression = 153,
>PropertyAccessExpression : SyntaxKind
ElementAccessExpression = 152,
ElementAccessExpression = 154,
>ElementAccessExpression : SyntaxKind
CallExpression = 153,
CallExpression = 155,
>CallExpression : SyntaxKind
NewExpression = 154,
NewExpression = 156,
>NewExpression : SyntaxKind
TaggedTemplateExpression = 155,
TaggedTemplateExpression = 157,
>TaggedTemplateExpression : SyntaxKind
TypeAssertionExpression = 156,
TypeAssertionExpression = 158,
>TypeAssertionExpression : SyntaxKind
ParenthesizedExpression = 157,
ParenthesizedExpression = 159,
>ParenthesizedExpression : SyntaxKind
FunctionExpression = 158,
FunctionExpression = 160,
>FunctionExpression : SyntaxKind
ArrowFunction = 159,
ArrowFunction = 161,
>ArrowFunction : SyntaxKind
DeleteExpression = 160,
DeleteExpression = 162,
>DeleteExpression : SyntaxKind
TypeOfExpression = 161,
TypeOfExpression = 163,
>TypeOfExpression : SyntaxKind
VoidExpression = 162,
VoidExpression = 164,
>VoidExpression : SyntaxKind
PrefixUnaryExpression = 163,
PrefixUnaryExpression = 165,
>PrefixUnaryExpression : SyntaxKind
PostfixUnaryExpression = 164,
PostfixUnaryExpression = 166,
>PostfixUnaryExpression : SyntaxKind
BinaryExpression = 165,
BinaryExpression = 167,
>BinaryExpression : SyntaxKind
ConditionalExpression = 166,
ConditionalExpression = 168,
>ConditionalExpression : SyntaxKind
TemplateExpression = 167,
TemplateExpression = 169,
>TemplateExpression : SyntaxKind
YieldExpression = 168,
YieldExpression = 170,
>YieldExpression : SyntaxKind
SpreadElementExpression = 169,
SpreadElementExpression = 171,
>SpreadElementExpression : SyntaxKind
OmittedExpression = 170,
OmittedExpression = 172,
>OmittedExpression : SyntaxKind
TemplateSpan = 171,
TemplateSpan = 173,
>TemplateSpan : SyntaxKind
Block = 172,
Block = 174,
>Block : SyntaxKind
VariableStatement = 173,
VariableStatement = 175,
>VariableStatement : SyntaxKind
EmptyStatement = 174,
EmptyStatement = 176,
>EmptyStatement : SyntaxKind
ExpressionStatement = 175,
ExpressionStatement = 177,
>ExpressionStatement : SyntaxKind
IfStatement = 176,
IfStatement = 178,
>IfStatement : SyntaxKind
DoStatement = 177,
DoStatement = 179,
>DoStatement : SyntaxKind
WhileStatement = 178,
WhileStatement = 180,
>WhileStatement : SyntaxKind
ForStatement = 179,
ForStatement = 181,
>ForStatement : SyntaxKind
ForInStatement = 180,
ForInStatement = 182,
>ForInStatement : SyntaxKind
ForOfStatement = 181,
ForOfStatement = 183,
>ForOfStatement : SyntaxKind
ContinueStatement = 182,
ContinueStatement = 184,
>ContinueStatement : SyntaxKind
BreakStatement = 183,
BreakStatement = 185,
>BreakStatement : SyntaxKind
ReturnStatement = 184,
ReturnStatement = 186,
>ReturnStatement : SyntaxKind
WithStatement = 185,
WithStatement = 187,
>WithStatement : SyntaxKind
SwitchStatement = 186,
SwitchStatement = 188,
>SwitchStatement : SyntaxKind
LabeledStatement = 187,
LabeledStatement = 189,
>LabeledStatement : SyntaxKind
ThrowStatement = 188,
ThrowStatement = 190,
>ThrowStatement : SyntaxKind
TryStatement = 189,
TryStatement = 191,
>TryStatement : SyntaxKind
DebuggerStatement = 190,
DebuggerStatement = 192,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 191,
VariableDeclaration = 193,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 192,
VariableDeclarationList = 194,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 193,
FunctionDeclaration = 195,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 194,
ClassDeclaration = 196,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 195,
InterfaceDeclaration = 197,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 196,
TypeAliasDeclaration = 198,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 197,
EnumDeclaration = 199,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 198,
ModuleDeclaration = 200,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 199,
ModuleBlock = 201,
>ModuleBlock : SyntaxKind
ImportDeclaration = 200,
ImportEqualsDeclaration = 202,
>ImportEqualsDeclaration : SyntaxKind
ImportDeclaration = 203,
>ImportDeclaration : SyntaxKind
ExportAssignment = 201,
ImportClause = 204,
>ImportClause : SyntaxKind
NamespaceImport = 205,
>NamespaceImport : SyntaxKind
NamedImports = 206,
>NamedImports : SyntaxKind
ImportSpecifier = 207,
>ImportSpecifier : SyntaxKind
ExportAssignment = 208,
>ExportAssignment : SyntaxKind
ExternalModuleReference = 202,
ExportDeclaration = 209,
>ExportDeclaration : SyntaxKind
NamedExports = 210,
>NamedExports : SyntaxKind
ExportSpecifier = 211,
>ExportSpecifier : SyntaxKind
ExternalModuleReference = 212,
>ExternalModuleReference : SyntaxKind
CaseClause = 203,
CaseClause = 213,
>CaseClause : SyntaxKind
DefaultClause = 204,
DefaultClause = 214,
>DefaultClause : SyntaxKind
HeritageClause = 205,
HeritageClause = 215,
>HeritageClause : SyntaxKind
CatchClause = 206,
CatchClause = 216,
>CatchClause : SyntaxKind
PropertyAssignment = 207,
PropertyAssignment = 217,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 208,
ShorthandPropertyAssignment = 218,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 209,
EnumMember = 219,
>EnumMember : SyntaxKind
SourceFile = 210,
SourceFile = 220,
>SourceFile : SyntaxKind
SyntaxList = 211,
SyntaxList = 221,
>SyntaxList : SyntaxKind
Count = 212,
Count = 222,
>Count : SyntaxKind
FirstAssignment = 52,
@@ -943,19 +975,19 @@ declare module "typescript" {
FirstKeyword = 65,
>FirstKeyword : SyntaxKind
LastKeyword = 122,
LastKeyword = 124,
>LastKeyword : SyntaxKind
FirstFutureReservedWord = 101,
FirstFutureReservedWord = 103,
>FirstFutureReservedWord : SyntaxKind
LastFutureReservedWord = 109,
LastFutureReservedWord = 111,
>LastFutureReservedWord : SyntaxKind
FirstTypeNode = 137,
FirstTypeNode = 139,
>FirstTypeNode : SyntaxKind
LastTypeNode = 145,
LastTypeNode = 147,
>LastTypeNode : SyntaxKind
FirstPunctuation = 14,
@@ -967,7 +999,7 @@ declare module "typescript" {
FirstToken = 0,
>FirstToken : SyntaxKind
LastToken = 122,
LastToken = 124,
>LastToken : SyntaxKind
FirstTriviaToken = 2,
@@ -994,7 +1026,7 @@ declare module "typescript" {
LastBinaryOperator = 63,
>LastBinaryOperator : SyntaxKind
FirstNode = 123,
FirstNode = 125,
>FirstNode : SyntaxKind
}
const enum NodeFlags {
@@ -1100,6 +1132,10 @@ declare module "typescript" {
>parserContextFlags : ParserContextFlags
>ParserContextFlags : ParserContextFlags
modifiers?: ModifiersArray;
>modifiers : ModifiersArray
>ModifiersArray : ModifiersArray
id?: number;
>id : number
@@ -1122,10 +1158,6 @@ declare module "typescript" {
localSymbol?: Symbol;
>localSymbol : Symbol
>Symbol : Symbol
modifiers?: ModifiersArray;
>modifiers : ModifiersArray
>ModifiersArray : ModifiersArray
}
interface NodeArray<T> extends Array<T>, TextRange {
>NodeArray : NodeArray<T>
@@ -1681,9 +1713,9 @@ declare module "typescript" {
>left : Expression
>Expression : Expression
operator: SyntaxKind;
>operator : SyntaxKind
>SyntaxKind : SyntaxKind
operatorToken: Node;
>operatorToken : Node
>Node : Node
right: Expression;
>right : Expression
@@ -2224,10 +2256,18 @@ declare module "typescript" {
>NodeArray : NodeArray<T>
>EnumMember : EnumMember
}
interface ModuleDeclaration extends Declaration, ModuleElement {
interface ExportContainer {
>ExportContainer : ExportContainer
exportStars?: ExportDeclaration[];
>exportStars : ExportDeclaration[]
>ExportDeclaration : ExportDeclaration
}
interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer {
>ModuleDeclaration : ModuleDeclaration
>Declaration : Declaration
>ModuleElement : ModuleElement
>ExportContainer : ExportContainer
name: Identifier | LiteralExpression;
>name : Identifier | LiteralExpression
@@ -2249,8 +2289,8 @@ declare module "typescript" {
>NodeArray : NodeArray<T>
>ModuleElement : ModuleElement
}
interface ImportDeclaration extends Declaration, ModuleElement {
>ImportDeclaration : ImportDeclaration
interface ImportEqualsDeclaration extends Declaration, ModuleElement {
>ImportEqualsDeclaration : ImportEqualsDeclaration
>Declaration : Declaration
>ModuleElement : ModuleElement
@@ -2271,6 +2311,90 @@ declare module "typescript" {
>expression : Expression
>Expression : Expression
}
interface ImportDeclaration extends Statement, ModuleElement {
>ImportDeclaration : ImportDeclaration
>Statement : Statement
>ModuleElement : ModuleElement
importClause?: ImportClause;
>importClause : ImportClause
>ImportClause : ImportClause
moduleSpecifier: Expression;
>moduleSpecifier : Expression
>Expression : Expression
}
interface ImportClause extends Declaration {
>ImportClause : ImportClause
>Declaration : Declaration
name?: Identifier;
>name : Identifier
>Identifier : Identifier
namedBindings?: NamespaceImport | NamedImports;
>namedBindings : NamespaceImport | NamedImportsOrExports
>NamespaceImport : NamespaceImport
>NamedImports : NamedImportsOrExports
}
interface NamespaceImport extends Declaration {
>NamespaceImport : NamespaceImport
>Declaration : Declaration
name: Identifier;
>name : Identifier
>Identifier : Identifier
}
interface ExportDeclaration extends Statement, ModuleElement {
>ExportDeclaration : ExportDeclaration
>Statement : Statement
>ModuleElement : ModuleElement
exportClause?: NamedExports;
>exportClause : NamedImportsOrExports
>NamedExports : NamedImportsOrExports
moduleSpecifier?: Expression;
>moduleSpecifier : Expression
>Expression : Expression
}
interface NamedImportsOrExports extends Node {
>NamedImportsOrExports : NamedImportsOrExports
>Node : Node
elements: NodeArray<ImportOrExportSpecifier>;
>elements : NodeArray<ImportOrExportSpecifier>
>NodeArray : NodeArray<T>
>ImportOrExportSpecifier : ImportOrExportSpecifier
}
type NamedImports = NamedImportsOrExports;
>NamedImports : NamedImportsOrExports
>NamedImportsOrExports : NamedImportsOrExports
type NamedExports = NamedImportsOrExports;
>NamedExports : NamedImportsOrExports
>NamedImportsOrExports : NamedImportsOrExports
interface ImportOrExportSpecifier extends Declaration {
>ImportOrExportSpecifier : ImportOrExportSpecifier
>Declaration : Declaration
propertyName?: Identifier;
>propertyName : Identifier
>Identifier : Identifier
name: Identifier;
>name : Identifier
>Identifier : Identifier
}
type ImportSpecifier = ImportOrExportSpecifier;
>ImportSpecifier : ImportOrExportSpecifier
>ImportOrExportSpecifier : ImportOrExportSpecifier
type ExportSpecifier = ImportOrExportSpecifier;
>ExportSpecifier : ImportOrExportSpecifier
>ImportOrExportSpecifier : ImportOrExportSpecifier
interface ExportAssignment extends Statement, ModuleElement {
>ExportAssignment : ExportAssignment
>Statement : Statement
@@ -2294,9 +2418,10 @@ declare module "typescript" {
hasTrailingNewLine?: boolean;
>hasTrailingNewLine : boolean
}
interface SourceFile extends Declaration {
interface SourceFile extends Declaration, ExportContainer {
>SourceFile : SourceFile
>Declaration : Declaration
>ExportContainer : ExportContainer
statements: NodeArray<ModuleElement>;
>statements : NodeArray<ModuleElement>
@@ -2910,9 +3035,9 @@ declare module "typescript" {
>accessibility : SymbolAccessibility
>SymbolAccessibility : SymbolAccessibility
aliasesToMakeVisible?: ImportDeclaration[];
>aliasesToMakeVisible : ImportDeclaration[]
>ImportDeclaration : ImportDeclaration
aliasesToMakeVisible?: ImportEqualsDeclaration[];
>aliasesToMakeVisible : ImportEqualsDeclaration[]
>ImportEqualsDeclaration : ImportEqualsDeclaration
errorSymbolName?: string;
>errorSymbolName : string
@@ -2931,14 +3056,16 @@ declare module "typescript" {
interface EmitResolver {
>EmitResolver : EmitResolver
getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string;
>getLocalNameOfContainer : (container: EnumDeclaration | ModuleDeclaration) => string
>container : EnumDeclaration | ModuleDeclaration
getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string;
>getGeneratedNameForNode : (node: EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration) => string
>node : EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration
>ModuleDeclaration : ModuleDeclaration
>EnumDeclaration : EnumDeclaration
>ImportDeclaration : ImportDeclaration
>ExportDeclaration : ExportDeclaration
getExpressionNamePrefix(node: Identifier): string;
>getExpressionNamePrefix : (node: Identifier) => string
getExpressionNameSubstitution(node: Identifier): string;
>getExpressionNameSubstitution : (node: Identifier) => string
>node : Identifier
>Identifier : Identifier
@@ -2947,15 +3074,15 @@ declare module "typescript" {
>node : SourceFile
>SourceFile : SourceFile
isReferencedImportDeclaration(node: ImportDeclaration): boolean;
>isReferencedImportDeclaration : (node: ImportDeclaration) => boolean
>node : ImportDeclaration
>ImportDeclaration : ImportDeclaration
isReferencedImportDeclaration(node: Node): boolean;
>isReferencedImportDeclaration : (node: Node) => boolean
>node : Node
>Node : Node
isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean;
>isTopLevelValueImportWithEntityName : (node: ImportDeclaration) => boolean
>node : ImportDeclaration
>ImportDeclaration : ImportDeclaration
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean
>node : ImportEqualsDeclaration
>ImportEqualsDeclaration : ImportEqualsDeclaration
getNodeCheckFlags(node: Node): NodeCheckFlags;
>getNodeCheckFlags : (node: Node) => NodeCheckFlags
@@ -3284,13 +3411,20 @@ declare module "typescript" {
referenced?: boolean;
>referenced : boolean
exportAssignSymbol?: Symbol;
>exportAssignSymbol : Symbol
exportAssignmentChecked?: boolean;
>exportAssignmentChecked : boolean
exportAssignmentSymbol?: Symbol;
>exportAssignmentSymbol : Symbol
>Symbol : Symbol
unionType?: UnionType;
>unionType : UnionType
>UnionType : UnionType
resolvedExports?: SymbolTable;
>resolvedExports : SymbolTable
>SymbolTable : SymbolTable
}
interface TransientSymbol extends Symbol, SymbolLinks {
>TransientSymbol : TransientSymbol
@@ -3359,8 +3493,12 @@ declare module "typescript" {
isVisible?: boolean;
>isVisible : boolean
localModuleName?: string;
>localModuleName : string
generatedName?: string;
>generatedName : string
generatedNames?: Map<string>;
>generatedNames : Map<string>
>Map : Map<T>
assignmentChecks?: Map<boolean>;
>assignmentChecks : Map<boolean>
@@ -4284,6 +4422,9 @@ declare module "typescript" {
greaterThan = 62,
>greaterThan : CharacterCodes
hash = 35,
>hash : CharacterCodes
lessThan = 60,
>lessThan : CharacterCodes
@@ -4489,15 +4630,15 @@ declare module "typescript" {
>computeLineStarts : (text: string) => number[]
>text : string
function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
>getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number
>sourceFile : SourceFile
>SourceFile : SourceFile
>line : number
>character : number
function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number;
>computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number
>lineStarts : number[]
>line : number
>character : number
@@ -4856,16 +4997,16 @@ declare module "typescript" {
>getNamedDeclarations : () => Declaration[]
>Declaration : Declaration
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
>getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter
>pos : number
>LineAndCharacter : LineAndCharacter
getLineStarts(): number[];
>getLineStarts : () => number[]
getPositionFromLineAndCharacter(line: number, character: number): number;
>getPositionFromLineAndCharacter : (line: number, character: number) => number
getPositionOfLineAndCharacter(line: number, character: number): number;
>getPositionOfLineAndCharacter : (line: number, character: number) => number
>line : number
>character : number
@@ -5082,9 +5223,10 @@ declare module "typescript" {
>position : number
>ReferenceEntry : ReferenceEntry
getNavigateToItems(searchValue: string): NavigateToItem[];
>getNavigateToItems : (searchValue: string) => NavigateToItem[]
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[]
>searchValue : string
>maxResultCount : number
>NavigateToItem : NavigateToItem
getNavigationBarItems(fileName: string): NavigationBarItem[];
+183 -140
View File
@@ -87,8 +87,8 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) {
allDiagnostics.forEach(diagnostic => {
if (diagnostic.file) {
var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`);
var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`);
}
else {
console.log(` Error: ${diagnostic.messageText}`);
@@ -229,132 +229,142 @@ declare module "typescript" {
VoidKeyword = 98,
WhileKeyword = 99,
WithKeyword = 100,
ImplementsKeyword = 101,
InterfaceKeyword = 102,
LetKeyword = 103,
PackageKeyword = 104,
PrivateKeyword = 105,
ProtectedKeyword = 106,
PublicKeyword = 107,
StaticKeyword = 108,
YieldKeyword = 109,
AnyKeyword = 110,
BooleanKeyword = 111,
ConstructorKeyword = 112,
DeclareKeyword = 113,
GetKeyword = 114,
ModuleKeyword = 115,
RequireKeyword = 116,
NumberKeyword = 117,
SetKeyword = 118,
StringKeyword = 119,
SymbolKeyword = 120,
TypeKeyword = 121,
OfKeyword = 122,
QualifiedName = 123,
ComputedPropertyName = 124,
TypeParameter = 125,
Parameter = 126,
PropertySignature = 127,
PropertyDeclaration = 128,
MethodSignature = 129,
MethodDeclaration = 130,
Constructor = 131,
GetAccessor = 132,
SetAccessor = 133,
CallSignature = 134,
ConstructSignature = 135,
IndexSignature = 136,
TypeReference = 137,
FunctionType = 138,
ConstructorType = 139,
TypeQuery = 140,
TypeLiteral = 141,
ArrayType = 142,
TupleType = 143,
UnionType = 144,
ParenthesizedType = 145,
ObjectBindingPattern = 146,
ArrayBindingPattern = 147,
BindingElement = 148,
ArrayLiteralExpression = 149,
ObjectLiteralExpression = 150,
PropertyAccessExpression = 151,
ElementAccessExpression = 152,
CallExpression = 153,
NewExpression = 154,
TaggedTemplateExpression = 155,
TypeAssertionExpression = 156,
ParenthesizedExpression = 157,
FunctionExpression = 158,
ArrowFunction = 159,
DeleteExpression = 160,
TypeOfExpression = 161,
VoidExpression = 162,
PrefixUnaryExpression = 163,
PostfixUnaryExpression = 164,
BinaryExpression = 165,
ConditionalExpression = 166,
TemplateExpression = 167,
YieldExpression = 168,
SpreadElementExpression = 169,
OmittedExpression = 170,
TemplateSpan = 171,
Block = 172,
VariableStatement = 173,
EmptyStatement = 174,
ExpressionStatement = 175,
IfStatement = 176,
DoStatement = 177,
WhileStatement = 178,
ForStatement = 179,
ForInStatement = 180,
ForOfStatement = 181,
ContinueStatement = 182,
BreakStatement = 183,
ReturnStatement = 184,
WithStatement = 185,
SwitchStatement = 186,
LabeledStatement = 187,
ThrowStatement = 188,
TryStatement = 189,
DebuggerStatement = 190,
VariableDeclaration = 191,
VariableDeclarationList = 192,
FunctionDeclaration = 193,
ClassDeclaration = 194,
InterfaceDeclaration = 195,
TypeAliasDeclaration = 196,
EnumDeclaration = 197,
ModuleDeclaration = 198,
ModuleBlock = 199,
ImportDeclaration = 200,
ExportAssignment = 201,
ExternalModuleReference = 202,
CaseClause = 203,
DefaultClause = 204,
HeritageClause = 205,
CatchClause = 206,
PropertyAssignment = 207,
ShorthandPropertyAssignment = 208,
EnumMember = 209,
SourceFile = 210,
SyntaxList = 211,
Count = 212,
AsKeyword = 101,
FromKeyword = 102,
ImplementsKeyword = 103,
InterfaceKeyword = 104,
LetKeyword = 105,
PackageKeyword = 106,
PrivateKeyword = 107,
ProtectedKeyword = 108,
PublicKeyword = 109,
StaticKeyword = 110,
YieldKeyword = 111,
AnyKeyword = 112,
BooleanKeyword = 113,
ConstructorKeyword = 114,
DeclareKeyword = 115,
GetKeyword = 116,
ModuleKeyword = 117,
RequireKeyword = 118,
NumberKeyword = 119,
SetKeyword = 120,
StringKeyword = 121,
SymbolKeyword = 122,
TypeKeyword = 123,
OfKeyword = 124,
QualifiedName = 125,
ComputedPropertyName = 126,
TypeParameter = 127,
Parameter = 128,
PropertySignature = 129,
PropertyDeclaration = 130,
MethodSignature = 131,
MethodDeclaration = 132,
Constructor = 133,
GetAccessor = 134,
SetAccessor = 135,
CallSignature = 136,
ConstructSignature = 137,
IndexSignature = 138,
TypeReference = 139,
FunctionType = 140,
ConstructorType = 141,
TypeQuery = 142,
TypeLiteral = 143,
ArrayType = 144,
TupleType = 145,
UnionType = 146,
ParenthesizedType = 147,
ObjectBindingPattern = 148,
ArrayBindingPattern = 149,
BindingElement = 150,
ArrayLiteralExpression = 151,
ObjectLiteralExpression = 152,
PropertyAccessExpression = 153,
ElementAccessExpression = 154,
CallExpression = 155,
NewExpression = 156,
TaggedTemplateExpression = 157,
TypeAssertionExpression = 158,
ParenthesizedExpression = 159,
FunctionExpression = 160,
ArrowFunction = 161,
DeleteExpression = 162,
TypeOfExpression = 163,
VoidExpression = 164,
PrefixUnaryExpression = 165,
PostfixUnaryExpression = 166,
BinaryExpression = 167,
ConditionalExpression = 168,
TemplateExpression = 169,
YieldExpression = 170,
SpreadElementExpression = 171,
OmittedExpression = 172,
TemplateSpan = 173,
Block = 174,
VariableStatement = 175,
EmptyStatement = 176,
ExpressionStatement = 177,
IfStatement = 178,
DoStatement = 179,
WhileStatement = 180,
ForStatement = 181,
ForInStatement = 182,
ForOfStatement = 183,
ContinueStatement = 184,
BreakStatement = 185,
ReturnStatement = 186,
WithStatement = 187,
SwitchStatement = 188,
LabeledStatement = 189,
ThrowStatement = 190,
TryStatement = 191,
DebuggerStatement = 192,
VariableDeclaration = 193,
VariableDeclarationList = 194,
FunctionDeclaration = 195,
ClassDeclaration = 196,
InterfaceDeclaration = 197,
TypeAliasDeclaration = 198,
EnumDeclaration = 199,
ModuleDeclaration = 200,
ModuleBlock = 201,
ImportEqualsDeclaration = 202,
ImportDeclaration = 203,
ImportClause = 204,
NamespaceImport = 205,
NamedImports = 206,
ImportSpecifier = 207,
ExportAssignment = 208,
ExportDeclaration = 209,
NamedExports = 210,
ExportSpecifier = 211,
ExternalModuleReference = 212,
CaseClause = 213,
DefaultClause = 214,
HeritageClause = 215,
CatchClause = 216,
PropertyAssignment = 217,
ShorthandPropertyAssignment = 218,
EnumMember = 219,
SourceFile = 220,
SyntaxList = 221,
Count = 222,
FirstAssignment = 52,
LastAssignment = 63,
FirstReservedWord = 65,
LastReservedWord = 100,
FirstKeyword = 65,
LastKeyword = 122,
FirstFutureReservedWord = 101,
LastFutureReservedWord = 109,
FirstTypeNode = 137,
LastTypeNode = 145,
LastKeyword = 124,
FirstFutureReservedWord = 103,
LastFutureReservedWord = 111,
FirstTypeNode = 139,
LastTypeNode = 147,
FirstPunctuation = 14,
LastPunctuation = 63,
FirstToken = 0,
LastToken = 122,
LastToken = 124,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -363,7 +373,7 @@ declare module "typescript" {
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 63,
FirstNode = 123,
FirstNode = 125,
}
const enum NodeFlags {
Export = 1,
@@ -401,13 +411,13 @@ declare module "typescript" {
kind: SyntaxKind;
flags: NodeFlags;
parserContextFlags?: ParserContextFlags;
modifiers?: ModifiersArray;
id?: number;
parent?: Node;
symbol?: Symbol;
locals?: SymbolTable;
nextContainer?: Node;
localSymbol?: Symbol;
modifiers?: ModifiersArray;
}
interface NodeArray<T> extends Array<T>, TextRange {
hasTrailingComma?: boolean;
@@ -596,7 +606,7 @@ declare module "typescript" {
}
interface BinaryExpression extends Expression {
left: Expression;
operator: SyntaxKind;
operatorToken: Node;
right: Expression;
}
interface ConditionalExpression extends Expression {
@@ -771,20 +781,49 @@ declare module "typescript" {
name: Identifier;
members: NodeArray<EnumMember>;
}
interface ModuleDeclaration extends Declaration, ModuleElement {
interface ExportContainer {
exportStars?: ExportDeclaration[];
}
interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer {
name: Identifier | LiteralExpression;
body: ModuleBlock | ModuleDeclaration;
}
interface ModuleBlock extends Node, ModuleElement {
statements: NodeArray<ModuleElement>;
}
interface ImportDeclaration extends Declaration, ModuleElement {
interface ImportEqualsDeclaration extends Declaration, ModuleElement {
name: Identifier;
moduleReference: EntityName | ExternalModuleReference;
}
interface ExternalModuleReference extends Node {
expression?: Expression;
}
interface ImportDeclaration extends Statement, ModuleElement {
importClause?: ImportClause;
moduleSpecifier: Expression;
}
interface ImportClause extends Declaration {
name?: Identifier;
namedBindings?: NamespaceImport | NamedImports;
}
interface NamespaceImport extends Declaration {
name: Identifier;
}
interface ExportDeclaration extends Statement, ModuleElement {
exportClause?: NamedExports;
moduleSpecifier?: Expression;
}
interface NamedImportsOrExports extends Node {
elements: NodeArray<ImportOrExportSpecifier>;
}
type NamedImports = NamedImportsOrExports;
type NamedExports = NamedImportsOrExports;
interface ImportOrExportSpecifier extends Declaration {
propertyName?: Identifier;
name: Identifier;
}
type ImportSpecifier = ImportOrExportSpecifier;
type ExportSpecifier = ImportOrExportSpecifier;
interface ExportAssignment extends Statement, ModuleElement {
exportName: Identifier;
}
@@ -794,7 +833,7 @@ declare module "typescript" {
interface CommentRange extends TextRange {
hasTrailingNewLine?: boolean;
}
interface SourceFile extends Declaration {
interface SourceFile extends Declaration, ExportContainer {
statements: NodeArray<ModuleElement>;
endOfFileToken: Node;
fileName: string;
@@ -948,7 +987,7 @@ declare module "typescript" {
}
interface SymbolVisibilityResult {
accessibility: SymbolAccessibility;
aliasesToMakeVisible?: ImportDeclaration[];
aliasesToMakeVisible?: ImportEqualsDeclaration[];
errorSymbolName?: string;
errorNode?: Node;
}
@@ -956,11 +995,11 @@ declare module "typescript" {
errorModuleName?: string;
}
interface EmitResolver {
getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string;
getExpressionNamePrefix(node: Identifier): string;
getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string;
getExpressionNameSubstitution(node: Identifier): string;
getExportAssignmentName(node: SourceFile): string;
isReferencedImportDeclaration(node: ImportDeclaration): boolean;
isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean;
isReferencedImportDeclaration(node: Node): boolean;
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
getNodeCheckFlags(node: Node): NodeCheckFlags;
isDeclarationVisible(node: Declaration): boolean;
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
@@ -1055,8 +1094,10 @@ declare module "typescript" {
declaredType?: Type;
mapper?: TypeMapper;
referenced?: boolean;
exportAssignSymbol?: Symbol;
exportAssignmentChecked?: boolean;
exportAssignmentSymbol?: Symbol;
unionType?: UnionType;
resolvedExports?: SymbolTable;
}
interface TransientSymbol extends Symbol, SymbolLinks {
}
@@ -1081,7 +1122,8 @@ declare module "typescript" {
enumMemberValue?: number;
isIllegalTypeReferenceInConstraint?: boolean;
isVisible?: boolean;
localModuleName?: string;
generatedName?: string;
generatedNames?: Map<string>;
assignmentChecks?: Map<boolean>;
hasReportedStatementInAmbientContext?: boolean;
importOnRightSide?: Symbol;
@@ -1395,6 +1437,7 @@ declare module "typescript" {
equals = 61,
exclamation = 33,
greaterThan = 62,
hash = 35,
lessThan = 60,
minus = 45,
openBrace = 123,
@@ -1461,8 +1504,8 @@ declare module "typescript" {
}
function tokenToString(t: SyntaxKind): string;
function computeLineStarts(text: string): number[];
function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number;
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
function getLineStarts(sourceFile: SourceFile): number[];
function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): {
line: number;
@@ -1546,9 +1589,9 @@ declare module "typescript" {
scriptSnapshot: IScriptSnapshot;
nameTable: Map<string>;
getNamedDeclarations(): Declaration[];
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
getLineStarts(): number[];
getPositionFromLineAndCharacter(line: number, character: number): number;
getPositionOfLineAndCharacter(line: number, character: number): number;
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
}
/**
@@ -1610,7 +1653,7 @@ declare module "typescript" {
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
getNavigateToItems(searchValue: string): NavigateToItem[];
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
getNavigationBarItems(fileName: string): NavigationBarItem[];
getOutliningSpans(fileName: string): OutliningSpan[];
getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[];
@@ -2074,8 +2117,8 @@ function watch(rootFileNames, options) {
var allDiagnostics = services.getCompilerOptionsDiagnostics().concat(services.getSyntacticDiagnostics(fileName)).concat(services.getSemanticDiagnostics(fileName));
allDiagnostics.forEach(function (diagnostic) {
if (diagnostic.file) {
var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
console.log(" Error " + diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
console.log(" Error " + diagnostic.file.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
}
else {
console.log(" Error: " + diagnostic.messageText);
+310 -168
View File
@@ -317,11 +317,11 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) {
>fileName : string
allDiagnostics.forEach(diagnostic => {
>allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void
>allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void
>allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void
>allDiagnostics : ts.Diagnostic[]
>forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void
>diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void
>diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void
>diagnostic : ts.Diagnostic
if (diagnostic.file) {
@@ -329,20 +329,20 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) {
>diagnostic : ts.Diagnostic
>file : ts.SourceFile
var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
>lineChar : ts.LineAndCharacter
>diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start) : ts.LineAndCharacter
>diagnostic.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
>diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter
>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
>diagnostic.file : ts.SourceFile
>diagnostic : ts.Diagnostic
>file : ts.SourceFile
>getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
>diagnostic.start : number
>diagnostic : ts.Diagnostic
>start : number
console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`);
>console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`) : any
console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`);
>console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`) : any
>console.log : any
>console : any
>log : any
@@ -351,9 +351,11 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) {
>diagnostic : ts.Diagnostic
>file : ts.SourceFile
>fileName : string
>lineChar.line + 1 : number
>lineChar.line : number
>lineChar : ts.LineAndCharacter
>line : number
>lineChar.character + 1 : number
>lineChar.character : number
>lineChar : ts.LineAndCharacter
>character : number
@@ -765,340 +767,370 @@ declare module "typescript" {
WithKeyword = 100,
>WithKeyword : SyntaxKind
ImplementsKeyword = 101,
AsKeyword = 101,
>AsKeyword : SyntaxKind
FromKeyword = 102,
>FromKeyword : SyntaxKind
ImplementsKeyword = 103,
>ImplementsKeyword : SyntaxKind
InterfaceKeyword = 102,
InterfaceKeyword = 104,
>InterfaceKeyword : SyntaxKind
LetKeyword = 103,
LetKeyword = 105,
>LetKeyword : SyntaxKind
PackageKeyword = 104,
PackageKeyword = 106,
>PackageKeyword : SyntaxKind
PrivateKeyword = 105,
PrivateKeyword = 107,
>PrivateKeyword : SyntaxKind
ProtectedKeyword = 106,
ProtectedKeyword = 108,
>ProtectedKeyword : SyntaxKind
PublicKeyword = 107,
PublicKeyword = 109,
>PublicKeyword : SyntaxKind
StaticKeyword = 108,
StaticKeyword = 110,
>StaticKeyword : SyntaxKind
YieldKeyword = 109,
YieldKeyword = 111,
>YieldKeyword : SyntaxKind
AnyKeyword = 110,
AnyKeyword = 112,
>AnyKeyword : SyntaxKind
BooleanKeyword = 111,
BooleanKeyword = 113,
>BooleanKeyword : SyntaxKind
ConstructorKeyword = 112,
ConstructorKeyword = 114,
>ConstructorKeyword : SyntaxKind
DeclareKeyword = 113,
DeclareKeyword = 115,
>DeclareKeyword : SyntaxKind
GetKeyword = 114,
GetKeyword = 116,
>GetKeyword : SyntaxKind
ModuleKeyword = 115,
ModuleKeyword = 117,
>ModuleKeyword : SyntaxKind
RequireKeyword = 116,
RequireKeyword = 118,
>RequireKeyword : SyntaxKind
NumberKeyword = 117,
NumberKeyword = 119,
>NumberKeyword : SyntaxKind
SetKeyword = 118,
SetKeyword = 120,
>SetKeyword : SyntaxKind
StringKeyword = 119,
StringKeyword = 121,
>StringKeyword : SyntaxKind
SymbolKeyword = 120,
SymbolKeyword = 122,
>SymbolKeyword : SyntaxKind
TypeKeyword = 121,
TypeKeyword = 123,
>TypeKeyword : SyntaxKind
OfKeyword = 122,
OfKeyword = 124,
>OfKeyword : SyntaxKind
QualifiedName = 123,
QualifiedName = 125,
>QualifiedName : SyntaxKind
ComputedPropertyName = 124,
ComputedPropertyName = 126,
>ComputedPropertyName : SyntaxKind
TypeParameter = 125,
TypeParameter = 127,
>TypeParameter : SyntaxKind
Parameter = 126,
Parameter = 128,
>Parameter : SyntaxKind
PropertySignature = 127,
PropertySignature = 129,
>PropertySignature : SyntaxKind
PropertyDeclaration = 128,
PropertyDeclaration = 130,
>PropertyDeclaration : SyntaxKind
MethodSignature = 129,
MethodSignature = 131,
>MethodSignature : SyntaxKind
MethodDeclaration = 130,
MethodDeclaration = 132,
>MethodDeclaration : SyntaxKind
Constructor = 131,
Constructor = 133,
>Constructor : SyntaxKind
GetAccessor = 132,
GetAccessor = 134,
>GetAccessor : SyntaxKind
SetAccessor = 133,
SetAccessor = 135,
>SetAccessor : SyntaxKind
CallSignature = 134,
CallSignature = 136,
>CallSignature : SyntaxKind
ConstructSignature = 135,
ConstructSignature = 137,
>ConstructSignature : SyntaxKind
IndexSignature = 136,
IndexSignature = 138,
>IndexSignature : SyntaxKind
TypeReference = 137,
TypeReference = 139,
>TypeReference : SyntaxKind
FunctionType = 138,
FunctionType = 140,
>FunctionType : SyntaxKind
ConstructorType = 139,
ConstructorType = 141,
>ConstructorType : SyntaxKind
TypeQuery = 140,
TypeQuery = 142,
>TypeQuery : SyntaxKind
TypeLiteral = 141,
TypeLiteral = 143,
>TypeLiteral : SyntaxKind
ArrayType = 142,
ArrayType = 144,
>ArrayType : SyntaxKind
TupleType = 143,
TupleType = 145,
>TupleType : SyntaxKind
UnionType = 144,
UnionType = 146,
>UnionType : SyntaxKind
ParenthesizedType = 145,
ParenthesizedType = 147,
>ParenthesizedType : SyntaxKind
ObjectBindingPattern = 146,
ObjectBindingPattern = 148,
>ObjectBindingPattern : SyntaxKind
ArrayBindingPattern = 147,
ArrayBindingPattern = 149,
>ArrayBindingPattern : SyntaxKind
BindingElement = 148,
BindingElement = 150,
>BindingElement : SyntaxKind
ArrayLiteralExpression = 149,
ArrayLiteralExpression = 151,
>ArrayLiteralExpression : SyntaxKind
ObjectLiteralExpression = 150,
ObjectLiteralExpression = 152,
>ObjectLiteralExpression : SyntaxKind
PropertyAccessExpression = 151,
PropertyAccessExpression = 153,
>PropertyAccessExpression : SyntaxKind
ElementAccessExpression = 152,
ElementAccessExpression = 154,
>ElementAccessExpression : SyntaxKind
CallExpression = 153,
CallExpression = 155,
>CallExpression : SyntaxKind
NewExpression = 154,
NewExpression = 156,
>NewExpression : SyntaxKind
TaggedTemplateExpression = 155,
TaggedTemplateExpression = 157,
>TaggedTemplateExpression : SyntaxKind
TypeAssertionExpression = 156,
TypeAssertionExpression = 158,
>TypeAssertionExpression : SyntaxKind
ParenthesizedExpression = 157,
ParenthesizedExpression = 159,
>ParenthesizedExpression : SyntaxKind
FunctionExpression = 158,
FunctionExpression = 160,
>FunctionExpression : SyntaxKind
ArrowFunction = 159,
ArrowFunction = 161,
>ArrowFunction : SyntaxKind
DeleteExpression = 160,
DeleteExpression = 162,
>DeleteExpression : SyntaxKind
TypeOfExpression = 161,
TypeOfExpression = 163,
>TypeOfExpression : SyntaxKind
VoidExpression = 162,
VoidExpression = 164,
>VoidExpression : SyntaxKind
PrefixUnaryExpression = 163,
PrefixUnaryExpression = 165,
>PrefixUnaryExpression : SyntaxKind
PostfixUnaryExpression = 164,
PostfixUnaryExpression = 166,
>PostfixUnaryExpression : SyntaxKind
BinaryExpression = 165,
BinaryExpression = 167,
>BinaryExpression : SyntaxKind
ConditionalExpression = 166,
ConditionalExpression = 168,
>ConditionalExpression : SyntaxKind
TemplateExpression = 167,
TemplateExpression = 169,
>TemplateExpression : SyntaxKind
YieldExpression = 168,
YieldExpression = 170,
>YieldExpression : SyntaxKind
SpreadElementExpression = 169,
SpreadElementExpression = 171,
>SpreadElementExpression : SyntaxKind
OmittedExpression = 170,
OmittedExpression = 172,
>OmittedExpression : SyntaxKind
TemplateSpan = 171,
TemplateSpan = 173,
>TemplateSpan : SyntaxKind
Block = 172,
Block = 174,
>Block : SyntaxKind
VariableStatement = 173,
VariableStatement = 175,
>VariableStatement : SyntaxKind
EmptyStatement = 174,
EmptyStatement = 176,
>EmptyStatement : SyntaxKind
ExpressionStatement = 175,
ExpressionStatement = 177,
>ExpressionStatement : SyntaxKind
IfStatement = 176,
IfStatement = 178,
>IfStatement : SyntaxKind
DoStatement = 177,
DoStatement = 179,
>DoStatement : SyntaxKind
WhileStatement = 178,
WhileStatement = 180,
>WhileStatement : SyntaxKind
ForStatement = 179,
ForStatement = 181,
>ForStatement : SyntaxKind
ForInStatement = 180,
ForInStatement = 182,
>ForInStatement : SyntaxKind
ForOfStatement = 181,
ForOfStatement = 183,
>ForOfStatement : SyntaxKind
ContinueStatement = 182,
ContinueStatement = 184,
>ContinueStatement : SyntaxKind
BreakStatement = 183,
BreakStatement = 185,
>BreakStatement : SyntaxKind
ReturnStatement = 184,
ReturnStatement = 186,
>ReturnStatement : SyntaxKind
WithStatement = 185,
WithStatement = 187,
>WithStatement : SyntaxKind
SwitchStatement = 186,
SwitchStatement = 188,
>SwitchStatement : SyntaxKind
LabeledStatement = 187,
LabeledStatement = 189,
>LabeledStatement : SyntaxKind
ThrowStatement = 188,
ThrowStatement = 190,
>ThrowStatement : SyntaxKind
TryStatement = 189,
TryStatement = 191,
>TryStatement : SyntaxKind
DebuggerStatement = 190,
DebuggerStatement = 192,
>DebuggerStatement : SyntaxKind
VariableDeclaration = 191,
VariableDeclaration = 193,
>VariableDeclaration : SyntaxKind
VariableDeclarationList = 192,
VariableDeclarationList = 194,
>VariableDeclarationList : SyntaxKind
FunctionDeclaration = 193,
FunctionDeclaration = 195,
>FunctionDeclaration : SyntaxKind
ClassDeclaration = 194,
ClassDeclaration = 196,
>ClassDeclaration : SyntaxKind
InterfaceDeclaration = 195,
InterfaceDeclaration = 197,
>InterfaceDeclaration : SyntaxKind
TypeAliasDeclaration = 196,
TypeAliasDeclaration = 198,
>TypeAliasDeclaration : SyntaxKind
EnumDeclaration = 197,
EnumDeclaration = 199,
>EnumDeclaration : SyntaxKind
ModuleDeclaration = 198,
ModuleDeclaration = 200,
>ModuleDeclaration : SyntaxKind
ModuleBlock = 199,
ModuleBlock = 201,
>ModuleBlock : SyntaxKind
ImportDeclaration = 200,
ImportEqualsDeclaration = 202,
>ImportEqualsDeclaration : SyntaxKind
ImportDeclaration = 203,
>ImportDeclaration : SyntaxKind
ExportAssignment = 201,
ImportClause = 204,
>ImportClause : SyntaxKind
NamespaceImport = 205,
>NamespaceImport : SyntaxKind
NamedImports = 206,
>NamedImports : SyntaxKind
ImportSpecifier = 207,
>ImportSpecifier : SyntaxKind
ExportAssignment = 208,
>ExportAssignment : SyntaxKind
ExternalModuleReference = 202,
ExportDeclaration = 209,
>ExportDeclaration : SyntaxKind
NamedExports = 210,
>NamedExports : SyntaxKind
ExportSpecifier = 211,
>ExportSpecifier : SyntaxKind
ExternalModuleReference = 212,
>ExternalModuleReference : SyntaxKind
CaseClause = 203,
CaseClause = 213,
>CaseClause : SyntaxKind
DefaultClause = 204,
DefaultClause = 214,
>DefaultClause : SyntaxKind
HeritageClause = 205,
HeritageClause = 215,
>HeritageClause : SyntaxKind
CatchClause = 206,
CatchClause = 216,
>CatchClause : SyntaxKind
PropertyAssignment = 207,
PropertyAssignment = 217,
>PropertyAssignment : SyntaxKind
ShorthandPropertyAssignment = 208,
ShorthandPropertyAssignment = 218,
>ShorthandPropertyAssignment : SyntaxKind
EnumMember = 209,
EnumMember = 219,
>EnumMember : SyntaxKind
SourceFile = 210,
SourceFile = 220,
>SourceFile : SyntaxKind
SyntaxList = 211,
SyntaxList = 221,
>SyntaxList : SyntaxKind
Count = 212,
Count = 222,
>Count : SyntaxKind
FirstAssignment = 52,
@@ -1116,19 +1148,19 @@ declare module "typescript" {
FirstKeyword = 65,
>FirstKeyword : SyntaxKind
LastKeyword = 122,
LastKeyword = 124,
>LastKeyword : SyntaxKind
FirstFutureReservedWord = 101,
FirstFutureReservedWord = 103,
>FirstFutureReservedWord : SyntaxKind
LastFutureReservedWord = 109,
LastFutureReservedWord = 111,
>LastFutureReservedWord : SyntaxKind
FirstTypeNode = 137,
FirstTypeNode = 139,
>FirstTypeNode : SyntaxKind
LastTypeNode = 145,
LastTypeNode = 147,
>LastTypeNode : SyntaxKind
FirstPunctuation = 14,
@@ -1140,7 +1172,7 @@ declare module "typescript" {
FirstToken = 0,
>FirstToken : SyntaxKind
LastToken = 122,
LastToken = 124,
>LastToken : SyntaxKind
FirstTriviaToken = 2,
@@ -1167,7 +1199,7 @@ declare module "typescript" {
LastBinaryOperator = 63,
>LastBinaryOperator : SyntaxKind
FirstNode = 123,
FirstNode = 125,
>FirstNode : SyntaxKind
}
const enum NodeFlags {
@@ -1273,6 +1305,10 @@ declare module "typescript" {
>parserContextFlags : ParserContextFlags
>ParserContextFlags : ParserContextFlags
modifiers?: ModifiersArray;
>modifiers : ModifiersArray
>ModifiersArray : ModifiersArray
id?: number;
>id : number
@@ -1295,10 +1331,6 @@ declare module "typescript" {
localSymbol?: Symbol;
>localSymbol : Symbol
>Symbol : Symbol
modifiers?: ModifiersArray;
>modifiers : ModifiersArray
>ModifiersArray : ModifiersArray
}
interface NodeArray<T> extends Array<T>, TextRange {
>NodeArray : NodeArray<T>
@@ -1854,9 +1886,9 @@ declare module "typescript" {
>left : Expression
>Expression : Expression
operator: SyntaxKind;
>operator : SyntaxKind
>SyntaxKind : SyntaxKind
operatorToken: Node;
>operatorToken : Node
>Node : Node
right: Expression;
>right : Expression
@@ -2397,10 +2429,18 @@ declare module "typescript" {
>NodeArray : NodeArray<T>
>EnumMember : EnumMember
}
interface ModuleDeclaration extends Declaration, ModuleElement {
interface ExportContainer {
>ExportContainer : ExportContainer
exportStars?: ExportDeclaration[];
>exportStars : ExportDeclaration[]
>ExportDeclaration : ExportDeclaration
}
interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer {
>ModuleDeclaration : ModuleDeclaration
>Declaration : Declaration
>ModuleElement : ModuleElement
>ExportContainer : ExportContainer
name: Identifier | LiteralExpression;
>name : Identifier | LiteralExpression
@@ -2422,8 +2462,8 @@ declare module "typescript" {
>NodeArray : NodeArray<T>
>ModuleElement : ModuleElement
}
interface ImportDeclaration extends Declaration, ModuleElement {
>ImportDeclaration : ImportDeclaration
interface ImportEqualsDeclaration extends Declaration, ModuleElement {
>ImportEqualsDeclaration : ImportEqualsDeclaration
>Declaration : Declaration
>ModuleElement : ModuleElement
@@ -2444,6 +2484,90 @@ declare module "typescript" {
>expression : Expression
>Expression : Expression
}
interface ImportDeclaration extends Statement, ModuleElement {
>ImportDeclaration : ImportDeclaration
>Statement : Statement
>ModuleElement : ModuleElement
importClause?: ImportClause;
>importClause : ImportClause
>ImportClause : ImportClause
moduleSpecifier: Expression;
>moduleSpecifier : Expression
>Expression : Expression
}
interface ImportClause extends Declaration {
>ImportClause : ImportClause
>Declaration : Declaration
name?: Identifier;
>name : Identifier
>Identifier : Identifier
namedBindings?: NamespaceImport | NamedImports;
>namedBindings : NamespaceImport | NamedImportsOrExports
>NamespaceImport : NamespaceImport
>NamedImports : NamedImportsOrExports
}
interface NamespaceImport extends Declaration {
>NamespaceImport : NamespaceImport
>Declaration : Declaration
name: Identifier;
>name : Identifier
>Identifier : Identifier
}
interface ExportDeclaration extends Statement, ModuleElement {
>ExportDeclaration : ExportDeclaration
>Statement : Statement
>ModuleElement : ModuleElement
exportClause?: NamedExports;
>exportClause : NamedImportsOrExports
>NamedExports : NamedImportsOrExports
moduleSpecifier?: Expression;
>moduleSpecifier : Expression
>Expression : Expression
}
interface NamedImportsOrExports extends Node {
>NamedImportsOrExports : NamedImportsOrExports
>Node : Node
elements: NodeArray<ImportOrExportSpecifier>;
>elements : NodeArray<ImportOrExportSpecifier>
>NodeArray : NodeArray<T>
>ImportOrExportSpecifier : ImportOrExportSpecifier
}
type NamedImports = NamedImportsOrExports;
>NamedImports : NamedImportsOrExports
>NamedImportsOrExports : NamedImportsOrExports
type NamedExports = NamedImportsOrExports;
>NamedExports : NamedImportsOrExports
>NamedImportsOrExports : NamedImportsOrExports
interface ImportOrExportSpecifier extends Declaration {
>ImportOrExportSpecifier : ImportOrExportSpecifier
>Declaration : Declaration
propertyName?: Identifier;
>propertyName : Identifier
>Identifier : Identifier
name: Identifier;
>name : Identifier
>Identifier : Identifier
}
type ImportSpecifier = ImportOrExportSpecifier;
>ImportSpecifier : ImportOrExportSpecifier
>ImportOrExportSpecifier : ImportOrExportSpecifier
type ExportSpecifier = ImportOrExportSpecifier;
>ExportSpecifier : ImportOrExportSpecifier
>ImportOrExportSpecifier : ImportOrExportSpecifier
interface ExportAssignment extends Statement, ModuleElement {
>ExportAssignment : ExportAssignment
>Statement : Statement
@@ -2467,9 +2591,10 @@ declare module "typescript" {
hasTrailingNewLine?: boolean;
>hasTrailingNewLine : boolean
}
interface SourceFile extends Declaration {
interface SourceFile extends Declaration, ExportContainer {
>SourceFile : SourceFile
>Declaration : Declaration
>ExportContainer : ExportContainer
statements: NodeArray<ModuleElement>;
>statements : NodeArray<ModuleElement>
@@ -3083,9 +3208,9 @@ declare module "typescript" {
>accessibility : SymbolAccessibility
>SymbolAccessibility : SymbolAccessibility
aliasesToMakeVisible?: ImportDeclaration[];
>aliasesToMakeVisible : ImportDeclaration[]
>ImportDeclaration : ImportDeclaration
aliasesToMakeVisible?: ImportEqualsDeclaration[];
>aliasesToMakeVisible : ImportEqualsDeclaration[]
>ImportEqualsDeclaration : ImportEqualsDeclaration
errorSymbolName?: string;
>errorSymbolName : string
@@ -3104,14 +3229,16 @@ declare module "typescript" {
interface EmitResolver {
>EmitResolver : EmitResolver
getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string;
>getLocalNameOfContainer : (container: EnumDeclaration | ModuleDeclaration) => string
>container : EnumDeclaration | ModuleDeclaration
getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string;
>getGeneratedNameForNode : (node: EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration) => string
>node : EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration
>ModuleDeclaration : ModuleDeclaration
>EnumDeclaration : EnumDeclaration
>ImportDeclaration : ImportDeclaration
>ExportDeclaration : ExportDeclaration
getExpressionNamePrefix(node: Identifier): string;
>getExpressionNamePrefix : (node: Identifier) => string
getExpressionNameSubstitution(node: Identifier): string;
>getExpressionNameSubstitution : (node: Identifier) => string
>node : Identifier
>Identifier : Identifier
@@ -3120,15 +3247,15 @@ declare module "typescript" {
>node : SourceFile
>SourceFile : SourceFile
isReferencedImportDeclaration(node: ImportDeclaration): boolean;
>isReferencedImportDeclaration : (node: ImportDeclaration) => boolean
>node : ImportDeclaration
>ImportDeclaration : ImportDeclaration
isReferencedImportDeclaration(node: Node): boolean;
>isReferencedImportDeclaration : (node: Node) => boolean
>node : Node
>Node : Node
isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean;
>isTopLevelValueImportWithEntityName : (node: ImportDeclaration) => boolean
>node : ImportDeclaration
>ImportDeclaration : ImportDeclaration
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean
>node : ImportEqualsDeclaration
>ImportEqualsDeclaration : ImportEqualsDeclaration
getNodeCheckFlags(node: Node): NodeCheckFlags;
>getNodeCheckFlags : (node: Node) => NodeCheckFlags
@@ -3457,13 +3584,20 @@ declare module "typescript" {
referenced?: boolean;
>referenced : boolean
exportAssignSymbol?: Symbol;
>exportAssignSymbol : Symbol
exportAssignmentChecked?: boolean;
>exportAssignmentChecked : boolean
exportAssignmentSymbol?: Symbol;
>exportAssignmentSymbol : Symbol
>Symbol : Symbol
unionType?: UnionType;
>unionType : UnionType
>UnionType : UnionType
resolvedExports?: SymbolTable;
>resolvedExports : SymbolTable
>SymbolTable : SymbolTable
}
interface TransientSymbol extends Symbol, SymbolLinks {
>TransientSymbol : TransientSymbol
@@ -3532,8 +3666,12 @@ declare module "typescript" {
isVisible?: boolean;
>isVisible : boolean
localModuleName?: string;
>localModuleName : string
generatedName?: string;
>generatedName : string
generatedNames?: Map<string>;
>generatedNames : Map<string>
>Map : Map<T>
assignmentChecks?: Map<boolean>;
>assignmentChecks : Map<boolean>
@@ -4457,6 +4595,9 @@ declare module "typescript" {
greaterThan = 62,
>greaterThan : CharacterCodes
hash = 35,
>hash : CharacterCodes
lessThan = 60,
>lessThan : CharacterCodes
@@ -4662,15 +4803,15 @@ declare module "typescript" {
>computeLineStarts : (text: string) => number[]
>text : string
function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
>getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number
>sourceFile : SourceFile
>SourceFile : SourceFile
>line : number
>character : number
function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number;
>computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number
>lineStarts : number[]
>line : number
>character : number
@@ -5029,16 +5170,16 @@ declare module "typescript" {
>getNamedDeclarations : () => Declaration[]
>Declaration : Declaration
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
>getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter
>pos : number
>LineAndCharacter : LineAndCharacter
getLineStarts(): number[];
>getLineStarts : () => number[]
getPositionFromLineAndCharacter(line: number, character: number): number;
>getPositionFromLineAndCharacter : (line: number, character: number) => number
getPositionOfLineAndCharacter(line: number, character: number): number;
>getPositionOfLineAndCharacter : (line: number, character: number) => number
>line : number
>character : number
@@ -5255,9 +5396,10 @@ declare module "typescript" {
>position : number
>ReferenceEntry : ReferenceEntry
getNavigateToItems(searchValue: string): NavigateToItem[];
>getNavigateToItems : (searchValue: string) => NavigateToItem[]
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[]
>searchValue : string
>maxResultCount : number
>NavigateToItem : NavigateToItem
getNavigationBarItems(fileName: string): NavigationBarItem[];
@@ -19,9 +19,7 @@ module clodule {
var clodule = (function () {
function clodule() {
}
clodule.sfn = function (id) {
return 42;
};
clodule.sfn = function (id) { return 42; };
return clodule;
})();
var clodule;
@@ -28,16 +28,12 @@ var Point = (function () {
this.x = x;
this.y = y;
}
Point.Origin = function () {
return { x: 0, y: 0 };
}; // unexpected error here bug 840246
Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246
return Point;
})();
var Point;
(function (Point) {
function Origin() {
return null;
}
function Origin() { return null; }
Point.Origin = Origin; //expected duplicate identifier error
})(Point || (Point = {}));
var A;
@@ -47,17 +43,13 @@ var A;
this.x = x;
this.y = y;
}
Point.Origin = function () {
return { x: 0, y: 0 };
}; // unexpected error here bug 840246
Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246
return Point;
})();
A.Point = Point;
var Point;
(function (Point) {
function Origin() {
return "";
}
function Origin() { return ""; }
Point.Origin = Origin; //expected duplicate identifier error
})(Point = A.Point || (A.Point = {}));
})(A || (A = {}));
@@ -28,16 +28,12 @@ var Point = (function () {
this.x = x;
this.y = y;
}
Point.Origin = function () {
return { x: 0, y: 0 };
};
Point.Origin = function () { return { x: 0, y: 0 }; };
return Point;
})();
var Point;
(function (Point) {
function Origin() {
return "";
} // not an error, since not exported
function Origin() { return ""; } // not an error, since not exported
})(Point || (Point = {}));
var A;
(function (A) {
@@ -46,16 +42,12 @@ var A;
this.x = x;
this.y = y;
}
Point.Origin = function () {
return { x: 0, y: 0 };
};
Point.Origin = function () { return { x: 0, y: 0 }; };
return Point;
})();
A.Point = Point;
var Point;
(function (Point) {
function Origin() {
return "";
} // not an error since not exported
function Origin() { return ""; } // not an error since not exported
})(Point = A.Point || (A.Point = {}));
})(A || (A = {}));
@@ -1,8 +1,7 @@
tests/cases/conformance/Symbols/ES5SymbolProperty1.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/Symbols/ES5SymbolProperty1.ts(7,6): error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'.
==== tests/cases/conformance/Symbols/ES5SymbolProperty1.ts (2 errors) ====
==== tests/cases/conformance/Symbols/ES5SymbolProperty1.ts (1 errors) ====
interface SymbolConstructor {
foo: string;
}
@@ -10,8 +9,6 @@ tests/cases/conformance/Symbols/ES5SymbolProperty1.ts(7,6): error TS2471: A comp
var obj = {
[Symbol.foo]: 0
~~~~~~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~~~~~~~~
!!! error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'.
}
@@ -12,7 +12,8 @@ obj[Symbol.foo];
//// [ES5SymbolProperty1.js]
var Symbol;
var obj = {
[Symbol.foo]: 0
};
var obj = (_a = {}, _a[Symbol.foo] =
0,
_a);
obj[Symbol.foo];
var _a;
@@ -1,16 +1,13 @@
tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(10,11): error TS2304: Cannot find name 'Symbol'.
==== tests/cases/conformance/Symbols/ES5SymbolProperty2.ts (3 errors) ====
==== tests/cases/conformance/Symbols/ES5SymbolProperty2.ts (2 errors) ====
module M {
var Symbol;
export class C {
[Symbol.iterator]() { }
~~~~~~~~~~~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~~~~~~~~~~~~~
!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
}
@@ -1,14 +1,11 @@
tests/cases/conformance/Symbols/ES5SymbolProperty3.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/Symbols/ES5SymbolProperty3.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
==== tests/cases/conformance/Symbols/ES5SymbolProperty3.ts (2 errors) ====
==== tests/cases/conformance/Symbols/ES5SymbolProperty3.ts (1 errors) ====
var Symbol;
class C {
[Symbol.iterator]() { }
~~~~~~~~~~~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~~~~~~~~~~~~~
!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
}
@@ -1,14 +1,11 @@
tests/cases/conformance/Symbols/ES5SymbolProperty4.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/Symbols/ES5SymbolProperty4.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
==== tests/cases/conformance/Symbols/ES5SymbolProperty4.ts (2 errors) ====
==== tests/cases/conformance/Symbols/ES5SymbolProperty4.ts (1 errors) ====
var Symbol: { iterator: string };
class C {
[Symbol.iterator]() { }
~~~~~~~~~~~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~~~~~~~~~~~~~
!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
}
@@ -1,14 +1,11 @@
tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target.
==== tests/cases/conformance/Symbols/ES5SymbolProperty5.ts (2 errors) ====
==== tests/cases/conformance/Symbols/ES5SymbolProperty5.ts (1 errors) ====
var Symbol: { iterator: symbol };
class C {
[Symbol.iterator]() { }
~~~~~~~~~~~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
}
(new C)[Symbol.iterator](0) // Should error
@@ -1,13 +1,10 @@
tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(2,6): error TS2304: Cannot find name 'Symbol'.
tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(5,9): error TS2304: Cannot find name 'Symbol'.
==== tests/cases/conformance/Symbols/ES5SymbolProperty6.ts (3 errors) ====
==== tests/cases/conformance/Symbols/ES5SymbolProperty6.ts (2 errors) ====
class C {
[Symbol.iterator]() { }
~~~~~~~~~~~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~~~~
!!! error TS2304: Cannot find name 'Symbol'.
}
@@ -1,14 +1,11 @@
tests/cases/conformance/Symbols/ES5SymbolProperty7.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/Symbols/ES5SymbolProperty7.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
==== tests/cases/conformance/Symbols/ES5SymbolProperty7.ts (2 errors) ====
==== tests/cases/conformance/Symbols/ES5SymbolProperty7.ts (1 errors) ====
var Symbol: { iterator: any };
class C {
[Symbol.iterator]() { }
~~~~~~~~~~~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~~~~~~~~~~~~~
!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'.
}
@@ -1,12 +1,9 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,12): error TS2304: Cannot find name 'yield'.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,20): error TS2304: Cannot find name 'foo'.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (3 errors) ====
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (2 errors) ====
var v = { [yield]: foo }
~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~~~
!!! error TS2304: Cannot find name 'yield'.
~~~
@@ -2,4 +2,7 @@
var v = { [yield]: foo }
//// [FunctionDeclaration8_es6.js]
var v = { [yield]: foo };
var v = (_a = {}, _a[yield] =
foo,
_a);
var _a;
@@ -1,15 +1,12 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,14): error TS9000: 'yield' expressions are not currently supported.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (3 errors) ====
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (2 errors) ====
function * foo() {
~
!!! error TS9001: Generators are not currently supported.
var v = { [yield]: foo }
~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -5,5 +5,8 @@ function * foo() {
//// [FunctionDeclaration9_es6.js]
function foo() {
var v = { []: foo };
var v = (_a = {}, _a[] =
foo,
_a);
var _a;
}
@@ -2,5 +2,4 @@
var v = { * }
//// [FunctionPropertyAssignments4_es6.js]
var v = { : function () {
} };
var v = { : function () { } };
@@ -1,13 +1,10 @@
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'.
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (3 errors) ====
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (2 errors) ====
var v = { *[foo()]() { } }
~
!!! error TS9001: Generators are not currently supported.
~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
~~~
!!! error TS2304: Cannot find name 'foo'.
@@ -2,4 +2,6 @@
var v = { *[foo()]() { } }
//// [FunctionPropertyAssignments5_es6.js]
var v = { [foo()]: function () { } };
var v = (_a = {}, _a[foo()] = function () { },
_a);
var _a;
@@ -7,5 +7,6 @@ var v = { * foo() {
//// [YieldExpression10_es6.js]
var v = { foo: function () {
;
} };
;
}
};
@@ -2,6 +2,4 @@
function* foo() { yield }
//// [YieldExpression13_es6.js]
function foo() {
;
}
function foo() { ; }
@@ -2,6 +2,4 @@
var v = { get foo() { yield foo; } }
//// [YieldExpression17_es6.js]
var v = { get foo() {
;
} };
var v = { get foo() { ; } };
@@ -52,9 +52,7 @@ var C = (function () {
}
C.privateMethod = function () { };
Object.defineProperty(C, "privateGetter", {
get: function () {
return 0;
},
get: function () { return 0; },
enumerable: true,
configurable: true
});
@@ -65,9 +63,7 @@ var C = (function () {
});
C.protectedMethod = function () { };
Object.defineProperty(C, "protectedGetter", {
get: function () {
return 0;
},
get: function () { return 0; },
enumerable: true,
configurable: true
});
@@ -78,9 +74,7 @@ var C = (function () {
});
C.publicMethod = function () { };
Object.defineProperty(C, "publicGetter", {
get: function () {
return 0;
},
get: function () { return 0; },
enumerable: true,
configurable: true
});
@@ -97,9 +91,7 @@ var D = (function () {
}
D.privateMethod = function () { };
Object.defineProperty(D, "privateGetter", {
get: function () {
return 0;
},
get: function () { return 0; },
enumerable: true,
configurable: true
});
@@ -110,9 +102,7 @@ var D = (function () {
});
D.protectedMethod = function () { };
Object.defineProperty(D, "protectedGetter", {
get: function () {
return 0;
},
get: function () { return 0; },
enumerable: true,
configurable: true
});
@@ -123,9 +113,7 @@ var D = (function () {
});
D.publicMethod = function () { };
Object.defineProperty(D, "publicGetter", {
get: function () {
return 0;
},
get: function () { return 0; },
enumerable: true,
configurable: true
});
@@ -142,9 +130,7 @@ var E = (function () {
}
E.prototype.method = function () { };
Object.defineProperty(E.prototype, "getter", {
get: function () {
return 0;
},
get: function () { return 0; },
enumerable: true,
configurable: true
});
+1 -3
View File
@@ -47,9 +47,7 @@ var D = (function () {
return D;
})();
var x = {
get a() {
return 1;
}
get a() { return 1; }
};
var y = {
set b(v) { }
+1 -3
View File
@@ -44,9 +44,7 @@ var D = (function () {
return D;
})();
var x = {
get a() {
return 1;
}
get a() { return 1; }
};
var y = {
set b(v) { }
@@ -2,5 +2,4 @@
var v = { get foo() }
//// [accessorWithoutBody1.js]
var v = { get foo() {
} };
var v = { get foo() { } };
@@ -2,5 +2,4 @@
var v = { set foo(a) }
//// [accessorWithoutBody2.js]
var v = { set foo(a) {
} };
var v = { set foo(a) { } };
@@ -11,14 +11,10 @@ var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "x", {
get: function () {
return 1;
},
get: function () { return 1; },
enumerable: true,
configurable: true
});
return C;
})();
var y = { get foo() {
return 3;
} };
var y = { get foo() { return 3; } };
@@ -18,38 +18,26 @@ var LanguageSpec_section_4_5_error_cases = (function () {
function LanguageSpec_section_4_5_error_cases() {
}
Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterFirst", {
get: function () {
return "";
},
get: function () { return ""; },
set: function (a) { },
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterLast", {
get: function () {
return "";
},
get: function () { return ""; },
set: function (a) { },
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterFirst", {
get: function () {
return "";
},
set: function (aStr) {
aStr = 0;
},
get: function () { return ""; },
set: function (aStr) { aStr = 0; },
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterLast", {
get: function () {
return "";
},
set: function (aStr) {
aStr = 0;
},
get: function () { return ""; },
set: function (aStr) { aStr = 0; },
enumerable: true,
configurable: true
});
@@ -47,49 +47,37 @@ var LanguageSpec_section_4_5_inference = (function () {
function LanguageSpec_section_4_5_inference() {
}
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation", {
get: function () {
return new B();
},
get: function () { return new B(); },
set: function (a) { },
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation_GetterFirst", {
get: function () {
return new B();
},
get: function () { return new B(); },
set: function (a) { },
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter", {
get: function () {
return new B();
},
get: function () { return new B(); },
set: function (a) { },
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter_SetterFirst", {
get: function () {
return new B();
},
get: function () { return new B(); },
set: function (a) { },
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation", {
get: function () {
return new B();
},
get: function () { return new B(); },
set: function (a) { },
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation_GetterFirst", {
get: function () {
return new B();
},
get: function () { return new B(); },
set: function (a) { },
enumerable: true,
configurable: true
@@ -84,6 +84,4 @@ var r16 = a + M;
var r17 = a + '';
var r18 = a + 123;
var r19 = a + { a: '' };
var r20 = a + (function (a) {
return a;
});
var r20 = a + (function (a) { return a; });
@@ -25,9 +25,7 @@ var r11 = null + (() => { });
//// [additionOperatorWithNullValueAndInvalidOperator.js]
// If one operand is the null or undefined value, it is treated as having the type of the other operand.
function foo() {
return undefined;
}
function foo() { return undefined; }
var a;
var b;
var c;
@@ -25,9 +25,7 @@ var r11 = undefined + (() => { });
//// [additionOperatorWithUndefinedValueAndInvalidOperands.js]
// If one operand is the null or undefined value, it is treated as having the type of the other operand.
function foo() {
return undefined;
}
function foo() { return undefined; }
var a;
var b;
var c;
@@ -21,9 +21,7 @@ export var a = function () {
//// [aliasUsedAsNameValue_0.js]
exports.id;
//// [aliasUsedAsNameValue_1.js]
function b(a) {
return null;
}
function b(a) { return null; }
exports.b = b;
//// [aliasUsedAsNameValue_2.js]
///<reference path='aliasUsedAsNameValue_0.ts' />
@@ -5,6 +5,4 @@ function foo() { return null; }
//// [ambientClassOverloadForFunction.js]
;
function foo() {
return null;
}
function foo() { return null; }
@@ -1,4 +1,4 @@
tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,5): error TS2439: Import declaration in an ambient external module declaration cannot reference external module through relative external module name.
tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,5): error TS2439: Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name.
tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,25): error TS2307: Cannot find external module './SubModule'.
@@ -6,7 +6,7 @@ tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.
declare module "OuterModule" {
import m2 = require("./SubModule");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2439: Import declaration in an ambient external module declaration cannot reference external module through relative external module name.
!!! error TS2439: Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name.
~~~~~~~~~~~~~
!!! error TS2307: Cannot find external module './SubModule'.
class SubModule {
@@ -6,9 +6,7 @@ var r3 = <<T>(x: T) => T>f; // ambiguous, appears to the parser as a << operatio
//// [ambiguousGenericAssertion1.js]
function f(x) {
return null;
}
function f(x) { return null; }
var r = function (x) { return x; };
var r2 = f; // valid
var r3 = << T > (x), T;
@@ -12,15 +12,11 @@ var x2: string = foof2("s", null);
var y2: number = foof2("s", null);
//// [ambiguousOverload.js]
function foof(bar) {
return bar;
}
function foof(bar) { return bar; }
;
var x = foof("s", null);
var y = foof("s", null);
function foof2(bar) {
return bar;
}
function foof2(bar) { return bar; }
;
var x2 = foof2("s", null);
var y2 = foof2("s", null);
+1 -3
View File
@@ -28,6 +28,4 @@ var M;
M.C = C;
})(M || (M = {}));
var c = new M.C();
c.m(function (n) {
return "hello: " + n;
}, 18);
c.m(function (n) { return "hello: " + n; }, 18);
@@ -27,6 +27,4 @@ paired.reduce(function (b1, b2) {
}, []);
paired.reduce(function (b3, b4) { return b3.concat({}); }, []);
paired.map(function (c1) { return c1.count; });
paired.map(function (c2) {
return c2.count;
});
paired.map(function (c2) { return c2.count; });
@@ -95,12 +95,8 @@ var __extends = this.__extends || function (d, b) {
var C1 = (function () {
function C1() {
}
C1.prototype.IM1 = function () {
return null;
};
C1.prototype.C1M1 = function () {
return null;
};
C1.prototype.IM1 = function () { return null; };
C1.prototype.C1M1 = function () { return null; };
return C1;
})();
var C2 = (function (_super) {
@@ -108,17 +104,13 @@ var C2 = (function (_super) {
function C2() {
_super.apply(this, arguments);
}
C2.prototype.C2M1 = function () {
return null;
};
C2.prototype.C2M1 = function () { return null; };
return C2;
})(C1);
var C3 = (function () {
function C3() {
}
C3.prototype.CM3M1 = function () {
return 3;
};
C3.prototype.CM3M1 = function () { return 3; };
return C3;
})();
/*
@@ -138,9 +130,7 @@ var i1 = c1;
var c2 = new C2();
var c3 = new C3();
var o1 = { one: 1 };
var f1 = function () {
return new C1();
};
var f1 = function () { return new C1(); };
var arr_any = [];
var arr_i1 = [];
var arr_c1 = [];
@@ -69,12 +69,8 @@ var __extends = this.__extends || function (d, b) {
var C1 = (function () {
function C1() {
}
C1.prototype.IM1 = function () {
return null;
};
C1.prototype.C1M1 = function () {
return null;
};
C1.prototype.IM1 = function () { return null; };
C1.prototype.C1M1 = function () { return null; };
return C1;
})();
var C2 = (function (_super) {
@@ -82,17 +78,13 @@ var C2 = (function (_super) {
function C2() {
_super.apply(this, arguments);
}
C2.prototype.C2M1 = function () {
return null;
};
C2.prototype.C2M1 = function () { return null; };
return C2;
})(C1);
var C3 = (function () {
function C3() {
}
C3.prototype.CM3M1 = function () {
return 3;
};
C3.prototype.CM3M1 = function () { return 3; };
return C3;
})();
/*
@@ -112,9 +104,7 @@ var i1 = c1;
var c2 = new C2();
var c3 = new C3();
var o1 = { one: 1 };
var f1 = function () {
return new C1();
};
var f1 = function () { return new C1(); };
var arr_any = [];
var arr_i1 = [];
var arr_c1 = [];
@@ -128,9 +118,7 @@ arr_c3 = arr_c2_2; // should be an error - is
arr_c3 = arr_c1_2; // should be an error - is
arr_c3 = arr_i1_2; // should be an error - is
arr_any = f1; // should be an error - is
arr_any = function () {
return null;
}; // should be an error - is
arr_any = function () { return null; }; // should be an error - is
arr_any = o1; // should be an error - is
arr_any = a1; // should be ok - is
arr_any = c1; // should be an error - is
@@ -30,9 +30,7 @@ arr_any = c3; // should be an error - is
var C3 = (function () {
function C3() {
}
C3.prototype.CM3M1 = function () {
return 3;
};
C3.prototype.CM3M1 = function () { return 3; };
return C3;
})();
/*
@@ -49,7 +47,5 @@ Type 1 of any[]:
var c3 = new C3();
var o1 = { one: 1 };
var arr_any = [];
arr_any = function () {
return null;
}; // should be an error - is
arr_any = function () { return null; }; // should be an error - is
arr_any = c3; // should be an error - is
@@ -184,14 +184,10 @@ var M2;
// <Identifier>(ParamList) => { ... } is a generic arrow function
var generic1 = function (n) { return [n]; };
var generic1; // Incorrect error, Bug 829597
var generic2 = function (n) {
return [n];
};
var generic2 = function (n) { return [n]; };
var generic2;
// <Identifier> ((ParamList) => { ... } ) is a type assertion to an arrow function
var asserted1 = (function (n) { return [n]; });
var asserted1;
var asserted2 = (function (n) {
return n;
});
var asserted2 = (function (n) { return n; });
var asserted2;
@@ -91,16 +91,10 @@ function tryCatchFn() {
//// [arrowFunctionExpressions.js]
// ArrowFormalParameters => AssignmentExpression is equivalent to ArrowFormalParameters => { return AssignmentExpression; }
var a = function (p) { return p.length; };
var a = function (p) {
return p.length;
};
var a = function (p) { return p.length; };
// Identifier => Block is equivalent to(Identifier) => Block
var b = function (j) {
return 0;
};
var b = function (j) {
return 0;
};
var b = function (j) { return 0; };
var b = function (j) { return 0; };
// Identifier => AssignmentExpression is equivalent to(Identifier) => AssignmentExpression
var c;
var d = function (n) { return c = n; };
@@ -11,6 +11,4 @@ var C = (function () {
}
return C;
})();
var c = new C(function () {
return asdf;
}); // should error
var c = new C(function () { return asdf; }); // should error
@@ -79,24 +79,12 @@ var missingCurliesWithArrow;
(function (missingCurliesWithArrow) {
var withStatement;
(function (withStatement) {
var a = function () {
var k = 10;
};
var b = function () {
var k = 10;
};
var c = function (x) {
var k = 10;
};
var d = function (x, y) {
var k = 10;
};
var e = function (x, y) {
var k = 10;
};
var f = function () {
var k = 10;
};
var a = function () { var k = 10; };
var b = function () { var k = 10; };
var c = function (x) { var k = 10; };
var d = function (x, y) { var k = 10; };
var e = function (x, y) { var k = 10; };
var f = function () { var k = 10; };
})(withStatement || (withStatement = {}));
var withoutStatement;
(function (withoutStatement) {
+4 -2
View File
@@ -37,7 +37,9 @@ y
//// [asiArith.js]
var x = 1;
var y = 1;
var z = x + + +y;
var z = x +
+ +y;
var a = 1;
var b = 1;
var c = x - - -y;
var c = x -
- -y;
@@ -91,12 +91,8 @@ var h;
x = h;
var i;
x = i;
x = { f: function () {
return 1;
} };
x = { f: function (x) {
return x;
} };
x = { f: function () { return 1; } };
x = { f: function (x) { return x; } };
function j(a) {
x = a;
}
@@ -12,6 +12,4 @@ fn(function (a, b) { return true; })
//// [assignLambdaToNominalSubtypeOfFunction.js]
function fn(cb) { }
fn(function (a, b) { return true; });
fn(function (a, b) {
return true;
});
fn(function (a, b) { return true; });
+1 -3
View File
@@ -13,8 +13,6 @@ module M {
//// [assignToFn.js]
var M;
(function (M) {
var x = { f: function (n) {
return true;
} };
var x = { f: function (n) { return true; } };
x.f = "hello";
})(M || (M = {}));

Some files were not shown because too many files have changed in this diff Show More