Merge branch 'master' into getReferences

Conflicts:
	src/compiler/checker.ts
This commit is contained in:
Mohamed Hegazy
2014-08-20 22:55:41 -07:00
3934 changed files with 175244 additions and 25131 deletions
+13 -14
View File
@@ -956,11 +956,24 @@ declare var JSON: JSON;
/////////////////////////////
interface Array<T> {
/**
* Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.
*/
length: number;
/**
* Returns a string representation of an array.
*/
toString(): string;
toLocaleString(): string;
/**
* Appends new elements to an array, and returns the new length of the array.
* @param items New elements of the Array.
*/
push(...items: T[]): number;
/**
* Removes the last element from an array and returns it.
*/
pop(): T;
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
@@ -976,15 +989,6 @@ interface Array<T> {
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
*/
join(separator?: string): string;
/**
* Removes the last element from an array and returns it.
*/
pop(): T;
/**
* Appends new elements to an array, and returns the new length of the array.
* @param items New elements of the Array.
*/
push(...items: T[]): number;
/**
* Reverses the elements in an Array.
*/
@@ -1101,11 +1105,6 @@ interface Array<T> {
*/
reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
/**
* Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.
*/
length: number;
[n: number]: T;
}
declare var Array: {
+13 -14
View File
@@ -956,11 +956,24 @@ declare var JSON: JSON;
/////////////////////////////
interface Array<T> {
/**
* Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.
*/
length: number;
/**
* Returns a string representation of an array.
*/
toString(): string;
toLocaleString(): string;
/**
* Appends new elements to an array, and returns the new length of the array.
* @param items New elements of the Array.
*/
push(...items: T[]): number;
/**
* Removes the last element from an array and returns it.
*/
pop(): T;
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
@@ -976,15 +989,6 @@ interface Array<T> {
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
*/
join(separator?: string): string;
/**
* Removes the last element from an array and returns it.
*/
pop(): T;
/**
* Appends new elements to an array, and returns the new length of the array.
* @param items New elements of the Array.
*/
push(...items: T[]): number;
/**
* Reverses the elements in an Array.
*/
@@ -1101,11 +1105,6 @@ interface Array<T> {
*/
reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
/**
* Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.
*/
length: number;
[n: number]: T;
}
declare var Array: {
+1 -1
View File
@@ -1,2 +1,2 @@
#!/usr/bin/env node
require('./tc.js')
require('./tsc.js')
+1426 -656
View File
File diff suppressed because it is too large Load Diff
+1694 -835
View File
File diff suppressed because it is too large Load Diff
+325 -22
View File
@@ -36,19 +36,17 @@ module ts {
getTypeCount: () => typeCount,
checkProgram: checkProgram,
emitFiles: invokeEmitter,
getSymbolOfNode: getSymbolOfNode,
getParentOfSymbol: getParentOfSymbol,
getTypeOfSymbol: getTypeOfSymbol,
getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol,
getPropertiesOfType: getPropertiesOfType,
getPropertyOfType: getPropertyOfType,
getSignaturesOfType: getSignaturesOfType,
getIndexTypeOfType: getIndexTypeOfType,
getReturnTypeOfSignature: getReturnTypeOfSignature,
resolveEntityName: resolveEntityName,
getSymbolsInScope: getSymbolsInScope,
getSymbolInfo: getSymbolInfo,
getTypeOfExpression: getTypeOfExpression,
getTypeOfNode: getTypeOfNode,
getApparentType: getApparentType,
typeToString: typeToString,
symbolToString: symbolToString,
getAugmentedPropertiesOfApparentType: getAugmentedPropertiesOfApparentType,
@@ -360,8 +358,7 @@ module ts {
var node = <ImportDeclaration>getDeclarationOfKind(symbol, SyntaxKind.ImportDeclaration);
var target = node.externalModuleName ?
resolveExternalModuleName(node, node.externalModuleName) :
resolveEntityName(node, node.entityName, node.entityName.kind === SyntaxKind.QualifiedName ?
SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace : SymbolFlags.Namespace);
getSymbolOfPartOfRightHandSideOfImport(node.entityName, node);
if (links.target === resolvingSymbol) {
links.target = target || unknownSymbol;
}
@@ -375,6 +372,33 @@ module ts {
return links.target;
}
// This function is only for imports with entity names
function getSymbolOfPartOfRightHandSideOfImport(entityName: EntityName, importDeclaration?: ImportDeclaration): Symbol {
if (!importDeclaration) {
importDeclaration = getAncestor(entityName, SyntaxKind.ImportDeclaration);
Debug.assert(importDeclaration);
}
// There are three things we might try to look for. In the following examples,
// the search term is enclosed in |...|:
//
// import a = |b|; // Namespace
// import a = |b.c|; // Value, type, namespace
// import a = |b.c|.d; // Namespace
if (entityName.kind === SyntaxKind.Identifier && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
entityName = entityName.parent;
}
// Check for case 1 and 3 in the above example
if (entityName.kind === SyntaxKind.Identifier || entityName.parent.kind === SyntaxKind.QualifiedName) {
return resolveEntityName(importDeclaration, entityName, SymbolFlags.Namespace);
}
else {
// Case 2 in above example
// entityName.kind could be a QualifiedName or a Missing identifier
Debug.assert(entityName.parent.kind === SyntaxKind.ImportDeclaration);
return resolveEntityName(importDeclaration, entityName, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace);
}
}
function getFullyQualifiedName(symbol: Symbol) {
return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol);
}
@@ -782,7 +806,7 @@ module ts {
// But it cant, hence the accessible is going to be undefined, but that doesnt mean m.c is accessible
// It is accessible if the parent m is accessible because then m.c can be accessed through qualification
meaningToLook = getQualifiedLeftMeaning(meaning);
symbol = symbol.parent;
symbol = getParentOfSymbol(symbol);
}
// This could be a symbol that is not exported in the external module
@@ -905,7 +929,7 @@ module ts {
if (accessibleSymbolChain && !needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {
break;
}
symbol = accessibleSymbolChain ? accessibleSymbolChain[0].parent : symbol.parent;
symbol = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
meaning = getQualifiedLeftMeaning(meaning);
}
@@ -2300,6 +2324,12 @@ module ts {
return getTypeFromArrayTypeNode(<ArrayTypeNode>node);
case SyntaxKind.TypeLiteral:
return getTypeFromTypeLiteralNode(<TypeLiteralNode>node);
// This function assumes that an identifier or qualified name is a type expression
// Callers should first ensure this by calling isTypeNode
case SyntaxKind.Identifier:
case SyntaxKind.QualifiedName:
var symbol = getSymbolInfo(node);
return getDeclaredTypeOfSymbol(symbol);
default:
return unknownType;
}
@@ -6550,14 +6580,242 @@ module ts {
return mapToArray(symbols);
}
function getSymbolOfIdentifier(identifier: Identifier) {
if (isDeclarationIdentifier(identifier)) {
return getSymbolOfNode(identifier.parent);
// True if the given identifier is the name of a type declaration node (class, interface, enum, type parameter, etc)
function isTypeDeclarationName(name: Node): boolean {
return name.kind == SyntaxKind.Identifier &&
isTypeDeclaration(name.parent) &&
(<Declaration>name.parent).name === name;
}
// True if the given identifier, string literal, or number literal is the name of a declaration node
function isDeclarationOrFunctionExpressionOrCatchVariableName(name: Node): boolean {
if (name.kind !== SyntaxKind.Identifier && name.kind !== SyntaxKind.StringLiteral && name.kind !== SyntaxKind.NumericLiteral) {
return false;
}
var entityName: Node = identifier;
while (isRightSideOfQualifiedNameOrPropertyAccess(entityName))
var parent = name.parent;
if (isDeclaration(parent) || parent.kind === SyntaxKind.FunctionExpression) {
return (<Declaration>parent).name === name;
}
if (parent.kind === SyntaxKind.CatchBlock) {
return (<CatchBlock>parent).variable === name;
}
return false;
}
function isTypeDeclaration(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.TypeParameter:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.EnumDeclaration:
return true;
}
}
function isDeclaration(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.TypeParameter:
case SyntaxKind.Parameter:
case SyntaxKind.VariableDeclaration:
case SyntaxKind.Property:
case SyntaxKind.PropertyAssignment:
case SyntaxKind.EnumMember:
case SyntaxKind.Method:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.ImportDeclaration:
return true;
}
return false;
}
// True if the given identifier is part of a type reference
function isTypeReferenceIdentifier(entityName: EntityName): boolean {
var node: Node = entityName;
while (node.parent && node.parent.kind === SyntaxKind.QualifiedName) node = node.parent;
return node.parent && node.parent.kind === SyntaxKind.TypeReference;
}
function isExpression(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.ThisKeyword:
case SyntaxKind.SuperKeyword:
case SyntaxKind.NullKeyword:
case SyntaxKind.TrueKeyword:
case SyntaxKind.FalseKeyword:
case SyntaxKind.RegularExpressionLiteral:
case SyntaxKind.ArrayLiteral:
case SyntaxKind.ObjectLiteral:
case SyntaxKind.PropertyAccess:
case SyntaxKind.IndexedAccess:
case SyntaxKind.CallExpression:
case SyntaxKind.NewExpression:
case SyntaxKind.TypeAssertion:
case SyntaxKind.ParenExpression:
case SyntaxKind.FunctionExpression:
case SyntaxKind.ArrowFunction:
case SyntaxKind.PrefixOperator:
case SyntaxKind.PostfixOperator:
case SyntaxKind.BinaryExpression:
case SyntaxKind.ConditionalExpression:
case SyntaxKind.OmittedExpression:
return true;
case SyntaxKind.QualifiedName:
while (node.parent.kind === SyntaxKind.QualifiedName) node = node.parent;
return node.parent.kind === SyntaxKind.TypeQuery;
case SyntaxKind.Identifier:
if (node.parent.kind === SyntaxKind.TypeQuery) {
return true;
}
// Fall through
case SyntaxKind.NumericLiteral:
case SyntaxKind.StringLiteral:
var parent = node.parent;
switch (parent.kind) {
case SyntaxKind.VariableDeclaration:
case SyntaxKind.Parameter:
case SyntaxKind.Property:
case SyntaxKind.EnumMember:
return (<VariableDeclaration>parent).initializer === node;
case SyntaxKind.ExpressionStatement:
case SyntaxKind.IfStatement:
case SyntaxKind.DoStatement:
case SyntaxKind.WhileStatement:
case SyntaxKind.ReturnStatement:
case SyntaxKind.WithStatement:
case SyntaxKind.SwitchStatement:
case SyntaxKind.CaseClause:
case SyntaxKind.ThrowStatement:
case SyntaxKind.SwitchStatement:
return (<ExpressionStatement>parent).expression === node;
case SyntaxKind.ForStatement:
return (<ForStatement>parent).initializer === node ||
(<ForStatement>parent).condition === node ||
(<ForStatement>parent).iterator === node;
case SyntaxKind.ForInStatement:
return (<ForInStatement>parent).variable === node ||
(<ForInStatement>parent).expression === node;
case SyntaxKind.TypeAssertion:
return node === (<TypeAssertion>parent).operand;
default:
if (isExpression(parent)) {
return true;
}
}
}
return false;
}
function isTypeNode(node: Node): boolean {
if (node.kind >= SyntaxKind.FirstTypeNode && node.kind <= SyntaxKind.LastTypeNode) {
return true;
}
switch (node.kind) {
case SyntaxKind.AnyKeyword:
case SyntaxKind.NumberKeyword:
case SyntaxKind.StringKeyword:
case SyntaxKind.BooleanKeyword:
return true;
case SyntaxKind.VoidKeyword:
return node.parent.kind !== SyntaxKind.PrefixOperator;
case SyntaxKind.StringLiteral:
// Specialized signatures can have string literals as their parameters' type names
return node.parent.kind === SyntaxKind.Parameter;
// Identifiers and qualified names may be type nodes, depending on their context. Climb
// above them to find the lowest container
case SyntaxKind.Identifier:
// If the identifier is the RHS of a qualified name, then it's a type iff its parent is.
if (node.parent.kind === SyntaxKind.QualifiedName) {
node = node.parent;
}
// Fall through
case SyntaxKind.QualifiedName:
// At this point, node is either a qualified name or an identifier
var parent = node.parent;
if (parent.kind === SyntaxKind.TypeQuery) {
return false;
}
// Do not recursively call isTypeNode on the parent. In the example:
//
// var a: A.B.C;
//
// Calling isTypeNode would consider the qualified name A.B a type node. Only C or
// A.B.C is a type node.
if (parent.kind >= SyntaxKind.FirstTypeNode && parent.kind <= SyntaxKind.LastTypeNode) {
return true;
}
switch (parent.kind) {
case SyntaxKind.TypeParameter:
return node === (<TypeParameterDeclaration>parent).constraint;
case SyntaxKind.Property:
case SyntaxKind.Parameter:
case SyntaxKind.VariableDeclaration:
return node === (<VariableDeclaration>parent).type;
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
case SyntaxKind.ArrowFunction:
case SyntaxKind.Constructor:
case SyntaxKind.Method:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
return node === (<FunctionDeclaration>parent).type;
case SyntaxKind.CallSignature:
case SyntaxKind.ConstructSignature:
case SyntaxKind.IndexSignature:
return node === (<SignatureDeclaration>parent).type;
case SyntaxKind.TypeAssertion:
return node === (<TypeAssertion>parent).type;
case SyntaxKind.CallExpression:
case SyntaxKind.NewExpression:
return (<CallExpression>parent).typeArguments.indexOf(node) >= 0;
}
}
return false;
}
function isInRightSideOfImportOrExportAssignment(node: EntityName) {
while (node.parent.kind === SyntaxKind.QualifiedName) {
node = node.parent;
}
if (node.parent.kind === SyntaxKind.ImportDeclaration) {
return (<ImportDeclaration>node.parent).entityName === node;
}
if (node.parent.kind === SyntaxKind.ExportAssignment) {
return (<ExportAssignment>node.parent).exportName === node;
}
return false;
}
function isRightSideOfQualifiedNameOrPropertyAccess(node: Node) {
return (node.parent.kind === SyntaxKind.QualifiedName || node.parent.kind === SyntaxKind.PropertyAccess) &&
(<QualifiedName>node.parent).right === node;
}
function getSymbolOfEntityName(entityName: EntityName): Symbol {
if (isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) {
return getSymbolOfNode(entityName.parent);
}
if (entityName.parent.kind === SyntaxKind.ExportAssignment) {
return resolveEntityName(/*location*/ entityName.parent.parent, entityName,
/*all meanings*/ SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Import);
}
if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
entityName = entityName.parent;
}
if (isExpression(entityName)) {
if (entityName.kind === SyntaxKind.Identifier) {
@@ -6585,12 +6843,17 @@ module ts {
meaning |= SymbolFlags.Import;
return resolveEntityName(entityName, entityName, meaning);
}
// Do we want to return undefined here?
return undefined;
}
function getSymbolInfo(node: Node) {
switch (node.kind) {
case SyntaxKind.Identifier:
return getSymbolOfIdentifier(<Identifier>node);
case SyntaxKind.PropertyAccess:
case SyntaxKind.QualifiedName:
return getSymbolOfEntityName(<Identifier>node);
case SyntaxKind.ThisKeyword:
case SyntaxKind.SuperKeyword:
@@ -6645,16 +6908,56 @@ module ts {
return undefined;
}
function getTypeOfExpression(node: Node) {
function getTypeOfNode(node: Node): Type {
if (isExpression(node)) {
while (isRightSideOfQualifiedNameOrPropertyAccess(node)) {
node = node.parent;
}
return <Type>getApparentType(checkExpression(node));
return getTypeOfExpression(<Expression>node);
}
if (isTypeNode(node)) {
return getTypeFromTypeNode(<TypeNode>node);
}
if (isTypeDeclaration(node)) {
// In this case, we call getSymbolOfNode instead of getSymbolInfo because it is a declaration
var symbol = getSymbolOfNode(node);
return getDeclaredTypeOfSymbol(symbol);
}
if (isTypeDeclarationName(node)) {
var symbol = getSymbolInfo(node);
return getDeclaredTypeOfSymbol(symbol);
}
if (isDeclaration(node)) {
// In this case, we call getSymbolOfNode instead of getSymbolInfo because it is a declaration
var symbol = getSymbolOfNode(node);
return getTypeOfSymbol(symbol);
}
if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
var symbol = getSymbolInfo(node);
return getTypeOfSymbol(symbol);
}
if (isInRightSideOfImportOrExportAssignment(node)) {
var symbol: Symbol;
symbol = node.parent.kind === SyntaxKind.ExportAssignment
? getSymbolInfo(node)
: getSymbolOfPartOfRightHandSideOfImport(node);
var declaredType = getDeclaredTypeOfSymbol(symbol);
return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol);
}
return unknownType;
}
function getTypeOfExpression(expr: Expression): Type {
if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) {
expr = expr.parent;
}
return checkExpression(expr);
}
function getAugmentedPropertiesOfApparentType(type: Type): Symbol[]{
var apparentType = getApparentType(type);
@@ -6663,13 +6966,13 @@ module ts {
var propertiesByName: Map<Symbol> = {};
var results: Symbol[] = [];
forEach(getPropertiesOfType(apparentType), (s) => {
forEach(getPropertiesOfType(apparentType), s => {
propertiesByName[s.name] = s;
results.push(s);
});
var resolved = resolveObjectTypeMembers(<ObjectType>type);
forEachValue(resolved.members, (s) => {
forEachValue(resolved.members, s => {
if (symbolIsValue(s) && !propertiesByName[s.name]) {
propertiesByName[s.name] = s;
results.push(s);
@@ -6677,7 +6980,7 @@ module ts {
});
if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) {
forEach(getPropertiesOfType(globalFunctionType), (s) => {
forEach(getPropertiesOfType(globalFunctionType), s => {
if (!propertiesByName[s.name]) {
propertiesByName[s.name] = s;
results.push(s);
+2 -2
View File
@@ -68,8 +68,8 @@ module ts {
}
export function concatenate<T>(array1: T[], array2: T[]): T[] {
if (!array2.length) return array1;
if (!array1.length) return array2;
if (!array2 || !array2.length) return array1;
if (!array1 || !array1.length) return array2;
return array1.concat(array2);
}
+270 -306
View File
@@ -2,20 +2,11 @@
/// <reference path="types.ts" />
module ts {
export var Diagnostics = {
Unknown_compiler_option_0: { code: 6001, category: DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." },
File_0_not_found: { code: 6002, category: DiagnosticCategory.Error, key: "File '{0}' not found." },
File_0_must_have_extension_ts_or_d_ts: { code: 6003, category: DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." },
Unrecognized_escape_sequence: { code: 1000, category: DiagnosticCategory.Error, key: "Unrecognized escape sequence." },
Unexpected_character_0: { code: 1001, category: DiagnosticCategory.Error, key: "Unexpected character {0}." },
Missing_close_quote_character: { code: 1002, category: DiagnosticCategory.Error, key: "Missing close quote character." },
Identifier_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Identifier expected." },
_0_keyword_expected: { code: 1004, category: DiagnosticCategory.Error, key: "'{0}' keyword expected." },
_0_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "'{0}' expected." },
Identifier_expected_0_is_a_keyword: { code: 1006, category: DiagnosticCategory.Error, key: "Identifier expected; '{0}' is a keyword." },
Automatic_semicolon_insertion_not_allowed: { code: 1007, category: DiagnosticCategory.Error, key: "Automatic semicolon insertion not allowed." },
Unterminated_string_literal: { code: 1002, category: DiagnosticCategory.Error, key: "Unterminated string literal." },
Identifier_expected: { code: 1003, category: DiagnosticCategory.Error, key: "Identifier expected." },
_0_expected: { code: 1005, category: DiagnosticCategory.Error, key: "'{0}' expected." },
Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed." },
Asterisk_Slash_expected: { code: 1010, category: DiagnosticCategory.Error, key: "'*/' expected." },
public_or_private_modifier_must_precede_static: { code: 1011, category: DiagnosticCategory.Error, key: "'public' or 'private' modifier must precede 'static'." },
Unexpected_token: { code: 1012, category: DiagnosticCategory.Error, key: "Unexpected token." },
Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: DiagnosticCategory.Error, key: "Catch clause parameter cannot have a type annotation." },
A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: DiagnosticCategory.Error, key: "A rest parameter must be last in a parameter list." },
@@ -28,16 +19,16 @@ module ts {
An_index_signature_must_have_a_type_annotation: { code: 1021, category: DiagnosticCategory.Error, key: "An index signature must have a type annotation." },
An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation." },
An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string' or 'number'." },
extends_clause_already_seen: { code: 1024, category: DiagnosticCategory.Error, key: "'extends' clause already seen." },
extends_clause_must_precede_implements_clause: { code: 1025, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause." },
Classes_can_only_extend_a_single_class: { code: 1026, category: DiagnosticCategory.Error, key: "Classes can only extend a single class." },
implements_clause_already_seen: { code: 1027, category: DiagnosticCategory.Error, key: "'implements' clause already seen." },
A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: DiagnosticCategory.Error, key: "A class or interface declaration can only have one 'extends' clause." },
An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: DiagnosticCategory.Error, key: "An 'extends' clause must precede an 'implements' clause." },
A_class_can_only_extend_a_single_class: { code: 1026, category: DiagnosticCategory.Error, key: "A class can only extend a single class." },
A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: DiagnosticCategory.Error, key: "A class declaration can only have one 'implements' clause." },
Accessibility_modifier_already_seen: { code: 1028, category: DiagnosticCategory.Error, key: "Accessibility modifier already seen." },
_0_modifier_must_precede_1_modifier: { code: 1029, category: DiagnosticCategory.Error, key: "'{0}' modifier must precede '{1}' modifier." },
_0_modifier_already_seen: { code: 1030, category: DiagnosticCategory.Error, key: "'{0}' modifier already seen." },
_0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a class element." },
Interface_declaration_cannot_have_implements_clause: { code: 1032, category: DiagnosticCategory.Error, key: "Interface declaration cannot have 'implements' clause." },
super_invocation_cannot_have_type_arguments: { code: 1034, category: DiagnosticCategory.Error, key: "'super' invocation cannot have type arguments." },
An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: DiagnosticCategory.Error, key: "An interface declaration cannot have an 'implements' clause." },
super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: DiagnosticCategory.Error, key: "'super' must be followed by an argument list or member access." },
Only_ambient_modules_can_use_quoted_names: { code: 1035, category: DiagnosticCategory.Error, key: "Only ambient modules can use quoted names." },
Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: DiagnosticCategory.Error, key: "Statements are not allowed in ambient contexts." },
A_function_implementation_cannot_be_declared_in_an_ambient_context: { code: 1037, category: DiagnosticCategory.Error, key: "A function implementation cannot be declared in an ambient context." },
@@ -53,23 +44,11 @@ module ts {
A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: DiagnosticCategory.Error, key: "A 'set' accessor parameter cannot have an initializer." },
A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have rest parameter." },
A_get_accessor_cannot_have_parameters: { code: 1054, category: DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters." },
Modifiers_cannot_appear_here: { code: 1055, category: DiagnosticCategory.Error, key: "Modifiers cannot appear here." },
Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher." },
Enum_member_must_have_initializer: { code: -9999999, category: DiagnosticCategory.Error, key: "Enum member must have initializer." },
Enum_member_must_have_initializer: { code: 1061, category: DiagnosticCategory.Error, key: "Enum member must have initializer." },
An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in an internal module." },
Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." },
module_class_interface_enum_import_or_statement: { code: 1067, category: DiagnosticCategory.NoPrefix, key: "module, class, interface, enum, import or statement" },
Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." },
statement: { code: 1069, category: DiagnosticCategory.NoPrefix, key: "statement" },
case_or_default_clause: { code: 1070, category: DiagnosticCategory.NoPrefix, key: "case or default clause" },
identifier: { code: 1071, category: DiagnosticCategory.NoPrefix, key: "identifier" },
call_construct_index_property_or_function_signature: { code: 1072, category: DiagnosticCategory.NoPrefix, key: "call, construct, index, property or function signature" },
expression: { code: 1073, category: DiagnosticCategory.NoPrefix, key: "expression" },
type_name: { code: 1074, category: DiagnosticCategory.NoPrefix, key: "type name" },
property_or_accessor: { code: 1075, category: DiagnosticCategory.NoPrefix, key: "property or accessor" },
parameter: { code: 1076, category: DiagnosticCategory.NoPrefix, key: "parameter" },
type: { code: 1077, category: DiagnosticCategory.NoPrefix, key: "type" },
type_parameter: { code: 1078, category: DiagnosticCategory.NoPrefix, key: "type parameter" },
A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration." },
Invalid_reference_directive_syntax: { code: 1084, category: DiagnosticCategory.Error, key: "Invalid 'reference' directive syntax." },
Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: DiagnosticCategory.Error, key: "Octal literals are not available when targeting ECMAScript 5 and higher." },
@@ -88,13 +67,12 @@ module ts {
Invalid_use_of_0_in_strict_mode: { code: 1100, category: DiagnosticCategory.Error, key: "Invalid use of '{0}' in strict mode." },
with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in strict mode." },
delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: DiagnosticCategory.Error, key: "'delete' cannot be called on an identifier in strict mode." },
Invalid_left_hand_side_in_for_in_statement: { code: 1103, category: DiagnosticCategory.Error, key: "Invalid left-hand side in 'for...in' statement." },
A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: DiagnosticCategory.Error, key: "A 'continue' statement can only be used within an enclosing iteration statement." },
A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: DiagnosticCategory.Error, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." },
Jump_target_cannot_cross_function_boundary: { code: 1107, category: DiagnosticCategory.Error, key: "Jump target cannot cross function boundary." },
A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: DiagnosticCategory.Error, key: "A 'return' statement can only be used within a function body." },
Expression_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Expression expected." },
Type_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Type expected." },
Expression_expected: { code: 1109, category: DiagnosticCategory.Error, key: "Expression expected." },
Type_expected: { code: 1110, category: DiagnosticCategory.Error, key: "Type expected." },
A_constructor_implementation_cannot_be_declared_in_an_ambient_context: { code: 1111, category: DiagnosticCategory.Error, key: "A constructor implementation cannot be declared in an ambient context." },
A_class_member_cannot_be_declared_optional: { code: 1112, category: DiagnosticCategory.Error, key: "A class member cannot be declared optional." },
A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: DiagnosticCategory.Error, key: "A 'default' clause cannot appear more than once in a 'switch' statement." },
@@ -106,193 +84,259 @@ module ts {
An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: DiagnosticCategory.Error, key: "An object literal cannot have property and accessor with the same name." },
An_export_assignment_cannot_have_modifiers: { code: 1120, category: DiagnosticCategory.Error, key: "An export assignment cannot have modifiers." },
Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: DiagnosticCategory.Error, key: "Octal literals are not allowed in strict mode." },
Duplicate_identifier_0: { code: 2000, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 2018, category: DiagnosticCategory.Error, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." },
Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 2019, category: DiagnosticCategory.Error, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." },
Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 2020, category: DiagnosticCategory.Error, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." },
Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 2021, category: DiagnosticCategory.Error, key: "Extends clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." },
Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 2022, category: DiagnosticCategory.Error, key: "Implements clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." },
Extends_clause_of_exported_interface_0_has_or_is_using_name_1_from_private_module_2: { code: 2023, category: DiagnosticCategory.Error, key: "Extends clause of exported interface '{0}' has or is using name '{1}' from private module '{2}'." },
Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 2024, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using private name '{1}'." },
Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 2025, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using private name '{1}'." },
Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 2026, category: DiagnosticCategory.Error, key: "Property '{0}' of exported interface has or is using private name '{1}'." },
Exported_variable_0_has_or_is_using_private_name_1: { code: 2027, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using private name '{1}'." },
Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2028, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2029, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2030, category: DiagnosticCategory.Error, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." },
Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 2031, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 2032, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." },
Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 2033, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." },
Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 2034, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." },
Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2035, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." },
Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2036, category: DiagnosticCategory.Error, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." },
Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 2037, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." },
Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 2038, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." },
Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 2039, category: DiagnosticCategory.Error, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." },
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 2040, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." },
Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2041, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2042, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2043, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2044, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2045, category: DiagnosticCategory.Error, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2046, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2047, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2048, category: DiagnosticCategory.Error, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 2049, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." },
Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 2050, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using private name '{0}'." },
Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 2051, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using private name '{0}'." },
Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 2052, category: DiagnosticCategory.Error, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." },
Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 2053, category: DiagnosticCategory.Error, key: "Return type of call signature from exported interface has or is using private name '{0}'." },
Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 2054, category: DiagnosticCategory.Error, key: "Return type of index signature from exported interface has or is using private name '{0}'." },
Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 2055, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using private name '{0}'." },
Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 2056, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using private name '{0}'." },
Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 2057, category: DiagnosticCategory.Error, key: "Return type of method from exported interface has or is using private name '{0}'." },
Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 2058, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using private name '{0}'." },
Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 2059, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." },
Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 2060, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." },
Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 2061, category: DiagnosticCategory.Error, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." },
Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 2062, category: DiagnosticCategory.Error, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." },
Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 2063, category: DiagnosticCategory.Error, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." },
Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 2064, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." },
Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 2065, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." },
Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 2066, category: DiagnosticCategory.Error, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." },
Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 2067, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." },
Import_declaration_0_is_using_private_name_1: { code: 2181, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2208, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." },
Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2209, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." },
Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 2210, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." },
Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 2211, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." },
Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 2212, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." },
Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 2213, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." },
Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2214, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." },
Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2215, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." },
Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2216, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." },
Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2217, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." },
Type_parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2218, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." },
Type_parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 2219, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 2220, 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: 2221, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2222, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2223, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using name '{1}' from private module '{2}'." },
Variable_declaration_list_cannot_be_empty: { code: 1123, category: DiagnosticCategory.Error, key: "Variable declaration list cannot be empty." },
Digit_expected: { code: 1124, category: DiagnosticCategory.Error, key: "Digit expected." },
Hexadecimal_digit_expected: { code: 1125, category: DiagnosticCategory.Error, key: "Hexadecimal digit expected." },
Unexpected_end_of_text: { code: 1126, category: DiagnosticCategory.Error, key: "Unexpected end of text." },
Invalid_character: { code: 1127, category: DiagnosticCategory.Error, key: "Invalid character." },
Declaration_or_statement_expected: { code: 1128, category: DiagnosticCategory.Error, key: "Declaration or statement expected." },
Statement_expected: { code: 1129, category: DiagnosticCategory.Error, key: "Statement expected." },
case_or_default_expected: { code: 1130, category: DiagnosticCategory.Error, key: "'case' or 'default' expected." },
Property_or_signature_expected: { code: 1131, category: DiagnosticCategory.Error, key: "Property or signature expected." },
Enum_member_expected: { code: 1132, category: DiagnosticCategory.Error, key: "Enum member expected." },
Type_reference_expected: { code: 1133, category: DiagnosticCategory.Error, key: "Type reference expected." },
Variable_declaration_expected: { code: 1134, category: DiagnosticCategory.Error, key: "Variable declaration expected." },
Argument_expression_expected: { code: 1135, category: DiagnosticCategory.Error, key: "Argument expression expected." },
Property_assignment_expected: { code: 1136, category: DiagnosticCategory.Error, key: "Property assignment expected." },
Expression_or_comma_expected: { code: 1137, category: DiagnosticCategory.Error, key: "Expression or comma expected." },
Parameter_declaration_expected: { code: 1138, category: DiagnosticCategory.Error, key: "Parameter declaration expected." },
Type_parameter_declaration_expected: { code: 1139, category: DiagnosticCategory.Error, key: "Type parameter declaration expected." },
Type_argument_expected: { code: 1140, category: DiagnosticCategory.Error, key: "Type argument expected." },
String_literal_expected: { code: 1141, category: DiagnosticCategory.Error, key: "String literal expected." },
Line_break_not_permitted_here: { code: 1142, category: DiagnosticCategory.Error, key: "Line break not permitted here." },
catch_or_finally_expected: { code: 1143, category: DiagnosticCategory.Error, key: "'catch' or 'finally' expected." },
Block_or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "Block or ';' expected." },
Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members." },
Declaration_expected: { code: 1146, category: DiagnosticCategory.Error, key: "Declaration expected." },
Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: DiagnosticCategory.Error, key: "Import declarations in an internal module cannot reference an external module." },
Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." },
Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: 1149, category: DiagnosticCategory.Error, key: "Filename '{0}' differs from already included filename '{1}' only in casing" },
new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 2068, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead." },
Multiple_constructor_implementations_are_not_allowed: { code: 2070, category: DiagnosticCategory.Error, key: "Multiple constructor implementations are not allowed." },
A_class_may_only_implement_another_class_or_interface: { code: 2074, category: DiagnosticCategory.Error, key: "A class may only implement another class or interface." },
get_and_set_accessor_must_have_the_same_type: { code: 2096, category: DiagnosticCategory.Error, key: "'get' and 'set' accessor must have the same type." },
Static_members_cannot_reference_class_type_parameters: { code: 2099, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2102, category: DiagnosticCategory.Error, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" },
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2112, category: DiagnosticCategory.Error, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." },
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2113, category: DiagnosticCategory.Error, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." },
An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2114, category: DiagnosticCategory.Error, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." },
The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2115, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." },
The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2116, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." },
The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2117, category: DiagnosticCategory.Error, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." },
The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2118, category: DiagnosticCategory.Error, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." },
The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2119, category: DiagnosticCategory.Error, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" },
A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2126, category: DiagnosticCategory.Error, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." },
Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2127, category: DiagnosticCategory.Error, key: "Getter and setter accessors do not agree in visibility." },
A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2131, category: DiagnosticCategory.Error, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." },
Untyped_function_calls_may_not_accept_type_arguments: { code: 2158, category: DiagnosticCategory.Error, key: "Untyped function calls may not accept type arguments." },
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2120, category: DiagnosticCategory.Error, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." },
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2121, category: DiagnosticCategory.Error, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." },
Setters_cannot_return_a_value: { code: 2122, category: DiagnosticCategory.Error, key: "Setters cannot return a value." },
Invalid_left_hand_side_of_assignment_expression: { code: 2130, category: DiagnosticCategory.Error, key: "Invalid left-hand side of assignment expression." },
Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2134, category: DiagnosticCategory.Error, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." },
All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2135, category: DiagnosticCategory.Error, key: "All symbols within a 'with' block will be resolved to 'any'." },
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2139, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator must be a variable, property or indexer." },
Overload_signatures_must_all_be_public_or_private: { code: 2150, category: DiagnosticCategory.Error, key: "Overload signatures must all be public or private." },
Overload_signatures_must_all_be_exported_or_not_exported: { code: 2151, category: DiagnosticCategory.Error, key: "Overload signatures must all be exported or not exported." },
Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2152, category: DiagnosticCategory.Error, key: "Overload signatures must all be ambient or non-ambient." },
Overload_signatures_must_all_be_optional_or_required: { code: 2153, category: DiagnosticCategory.Error, key: "Overload signatures must all be optional or required." },
this_cannot_be_referenced_in_constructor_arguments: { code: 2155, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in constructor arguments." },
Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2161, category: DiagnosticCategory.Error, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" },
A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2163, category: DiagnosticCategory.Error, key: "A signature with an implementation cannot use a string literal type." },
Interface_0_cannot_simultaneously_extend_types_1_and_2_Colon: { code: 2189, category: DiagnosticCategory.Error, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}':" },
Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2190, category: DiagnosticCategory.Error, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." },
Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2192, category: DiagnosticCategory.Error, key: "Individual declarations in merged declaration {0} must be all exported or all local." },
super_cannot_be_referenced_in_constructor_arguments: { code: 2193, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in constructor arguments." },
Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2194, category: DiagnosticCategory.Error, key: "Return type of constructor signature must be assignable to the instance type of the class" },
Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2196, category: DiagnosticCategory.Error, key: "Ambient external module declaration cannot specify relative module name." },
Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2197, category: DiagnosticCategory.Error, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." },
Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2200, category: DiagnosticCategory.Error, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." },
Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2205, category: DiagnosticCategory.Error, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." },
Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2206, category: DiagnosticCategory.Error, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." },
Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2207, category: DiagnosticCategory.Error, key: "Expression resolves to '_super' that compiler uses to capture base class reference." },
Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter: { code: 2224, category: DiagnosticCategory.Error, key: "Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter." },
Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2225, category: DiagnosticCategory.Error, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." },
Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2229, category: DiagnosticCategory.Error, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2230, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2231, category: DiagnosticCategory.Error, key: "Parameter '{0}' cannot be referenced in its initializer." },
Duplicate_string_index_signature: { code: 2232, category: DiagnosticCategory.Error, key: "Duplicate string index signature." },
Duplicate_number_index_signature: { code: 2233, category: DiagnosticCategory.Error, key: "Duplicate number index signature." },
All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2234, category: DiagnosticCategory.Error, key: "All declarations of an interface must have identical type parameters." },
Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter: { code: 2235, category: DiagnosticCategory.Error, key: "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter." },
Function_implementation_name_must_be_0: { code: 2239, category: DiagnosticCategory.Error, key: "Function implementation name must be '{0}'." },
Constructor_implementation_is_missing: { code: 2240, category: DiagnosticCategory.Error, key: "Constructor implementation is missing." },
An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2245, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in a module with other exported elements." },
A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2246, category: DiagnosticCategory.Error, key: "A parameter property is only allowed in a constructor implementation." },
Function_overload_must_be_static: { code: 2247, category: DiagnosticCategory.Error, key: "Function overload must be static." },
Function_overload_must_not_be_static: { code: 2248, category: DiagnosticCategory.Error, key: "Function overload must not be static." },
Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2249, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." },
Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2250, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." },
Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2251, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." },
Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2252, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." },
Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2253, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." },
Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2254, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." },
Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2255, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." },
Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2256, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." },
Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2257, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." },
Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2258, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." },
Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2259, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." },
Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2260, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." },
Circular_definition_of_import_alias_0: { code: 3000, category: DiagnosticCategory.Error, key: "Circular definition of import alias '{0}'." },
Cannot_find_name_0: { code: 3001, category: DiagnosticCategory.Error, key: "Cannot find name '{0}'." },
Module_0_has_no_exported_member_1: { code: 3002, category: DiagnosticCategory.Error, key: "Module '{0}' has no exported member '{1}'." },
Cannot_find_external_module_0: { code: 3003, category: DiagnosticCategory.Error, key: "Cannot find external module '{0}'." },
A_module_cannot_have_more_than_one_export_assignment: { code: 3004, category: DiagnosticCategory.Error, key: "A module cannot have more than one export assignment." },
Type_0_recursively_references_itself_as_a_base_type: { code: 3005, category: DiagnosticCategory.Error, key: "Type '{0}' recursively references itself as a base type." },
A_class_may_only_extend_another_class: { code: 3006, category: DiagnosticCategory.Error, key: "A class may only extend another class." },
An_interface_may_only_extend_a_class_or_another_interface: { code: 3007, category: DiagnosticCategory.Error, key: "An interface may only extend a class or another interface." },
Generic_type_0_requires_1_type_argument_s: { code: 3008, category: DiagnosticCategory.Error, key: "Generic type '{0}' requires {1} type argument(s)." },
Type_0_is_not_generic: { code: 3009, category: DiagnosticCategory.Error, key: "Type '{0}' is not generic." },
Cannot_find_global_type_0: { code: 3010, category: DiagnosticCategory.Error, key: "Cannot find global type '{0}'." },
Global_type_0_must_be_a_class_or_interface_type: { code: 3011, category: DiagnosticCategory.Error, key: "Global type '{0}' must be a class or interface type." },
Global_type_0_must_have_1_type_parameter_s: { code: 3012, category: DiagnosticCategory.Error, key: "Global type '{0}' must have {1} type parameter(s)." },
this_cannot_be_referenced_in_a_module_body: { code: 3013, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a module body." },
this_cannot_be_referenced_in_a_static_property_initializer: { code: 3014, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a static property initializer." },
this_cannot_be_referenced_in_current_location: { code: -9999999, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in current location." },
super_can_only_be_referenced_in_a_derived_class: { code: 3015, category: DiagnosticCategory.Error, key: "'super' can only be referenced in a derived class." },
Property_0_does_not_exist_on_type_1: { code: 3017, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." },
An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 3018, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', or 'any'." },
Type_0_does_not_satisfy_the_constraint_1_Colon: { code: 3019, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}':" },
Type_0_does_not_satisfy_the_constraint_1: { code: 3019, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." },
Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 3020, category: DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." },
Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 3021, category: DiagnosticCategory.Error, key: "Cannot invoke an expression whose type lacks a call signature." },
Only_a_void_function_can_be_called_with_the_new_keyword: { code: 3022, category: DiagnosticCategory.Error, key: "Only a void function can be called with the 'new' keyword." },
Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 3023, category: DiagnosticCategory.Error, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." },
Neither_type_0_nor_type_1_is_assignable_to_the_other_Colon: { code: 3024, category: DiagnosticCategory.Error, key: "Neither type '{0}' nor type '{1}' is assignable to the other:" },
Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 3024, category: DiagnosticCategory.Error, key: "Neither type '{0}' nor type '{1}' is assignable to the other." },
No_best_common_type_exists_among_return_expressions: { code: 3027, category: DiagnosticCategory.Error, key: "No best common type exists among return expressions." },
Operator_0_cannot_be_applied_to_types_1_and_2: { code: 3028, category: DiagnosticCategory.Error, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." },
No_best_common_type_exists_between_0_and_1: { code: 3029, category: DiagnosticCategory.Error, key: "No best common type exists between '{0}' and '{1}'." },
No_best_common_type_exists_between_0_1_and_2: { code: 3030, category: DiagnosticCategory.Error, key: "No best common type exists between '{0}', '{1}', and '{2}'." },
A_rest_parameter_must_be_of_an_array_type: { code: 3031, category: DiagnosticCategory.Error, key: "A rest parameter must be of an array type." },
A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 3032, category: DiagnosticCategory.Error, key: "A parameter initializer is only allowed in a function or constructor implementation." },
Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 3033, category: DiagnosticCategory.Error, key: "Specialized overload signature is not assignable to any non-specialized signature." },
Duplicate_function_implementation: { code: 3034, category: DiagnosticCategory.Error, key: "Duplicate function implementation." },
Overload_signature_is_not_compatible_with_function_implementation: { code: 3035, category: DiagnosticCategory.Error, key: "Overload signature is not compatible with function implementation." },
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 3036, category: DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." },
Index_signature_is_missing_in_type_0: { code: 4003, category: DiagnosticCategory.Error, key: "Index signature is missing in type '{0}'." },
Index_signatures_are_incompatible_Colon: { code: 4004, category: DiagnosticCategory.Error, key: "Index signatures are incompatible:" },
Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 4016, category: DiagnosticCategory.NoPrefix, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." },
Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 4017, category: DiagnosticCategory.NoPrefix, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." },
Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 4018, category: DiagnosticCategory.NoPrefix, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." },
Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 4019, category: DiagnosticCategory.NoPrefix, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." },
In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 4024, category: DiagnosticCategory.Error, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." },
Named_properties_0_of_types_1_and_2_are_not_identical: { code: 4032, category: DiagnosticCategory.NoPrefix, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." },
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." },
Circular_definition_of_import_alias_0: { code: 2303, category: DiagnosticCategory.Error, key: "Circular definition of import alias '{0}'." },
Cannot_find_name_0: { code: 2304, category: DiagnosticCategory.Error, key: "Cannot find name '{0}'." },
Module_0_has_no_exported_member_1: { code: 2305, category: DiagnosticCategory.Error, key: "Module '{0}' has no exported member '{1}'." },
File_0_is_not_an_external_module: { code: 2306, category: DiagnosticCategory.Error, key: "File '{0}' is not an external module." },
Cannot_find_external_module_0: { code: 2307, category: DiagnosticCategory.Error, key: "Cannot find external module '{0}'." },
A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: DiagnosticCategory.Error, key: "A module cannot have more than one export assignment." },
An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in a module with other exported elements." },
Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: DiagnosticCategory.Error, key: "Type '{0}' recursively references itself as a base type." },
A_class_may_only_extend_another_class: { code: 2311, category: DiagnosticCategory.Error, key: "A class may only extend another class." },
An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: DiagnosticCategory.Error, key: "An interface may only extend a class or another interface." },
Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: DiagnosticCategory.Error, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." },
Generic_type_0_requires_1_type_argument_s: { code: 2314, category: DiagnosticCategory.Error, key: "Generic type '{0}' requires {1} type argument(s)." },
Type_0_is_not_generic: { code: 2315, category: DiagnosticCategory.Error, key: "Type '{0}' is not generic." },
Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: DiagnosticCategory.Error, key: "Global type '{0}' must be a class or interface type." },
Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: DiagnosticCategory.Error, key: "Global type '{0}' must have {1} type parameter(s)." },
Cannot_find_global_type_0: { code: 2318, category: DiagnosticCategory.Error, key: "Cannot find global type '{0}'." },
Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." },
Interface_0_cannot_simultaneously_extend_types_1_and_2_Colon: { code: 2320, category: DiagnosticCategory.Error, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}':" },
Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: DiagnosticCategory.Error, key: "Excessive stack depth comparing types '{0}' and '{1}'." },
Type_0_is_not_assignable_to_type_1_Colon: { code: 2322, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}':" },
Type_0_is_not_assignable_to_type_1: { code: 2323, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}'." },
Property_0_is_missing_in_type_1: { code: 2324, category: DiagnosticCategory.Error, key: "Property '{0}' is missing in type '{1}'." },
Private_property_0_cannot_be_reimplemented: { code: 2325, category: DiagnosticCategory.Error, key: "Private property '{0}' cannot be reimplemented." },
Types_of_property_0_are_incompatible_Colon: { code: 2326, category: DiagnosticCategory.Error, key: "Types of property '{0}' are incompatible:" },
Required_property_0_cannot_be_reimplemented_with_optional_property_in_1: { code: 2327, category: DiagnosticCategory.Error, key: "Required property '{0}' cannot be reimplemented with optional property in '{1}'." },
Types_of_parameters_0_and_1_are_incompatible_Colon: { code: 2328, category: DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible:" },
Index_signature_is_missing_in_type_0: { code: 2329, category: DiagnosticCategory.Error, key: "Index signature is missing in type '{0}'." },
Index_signatures_are_incompatible_Colon: { code: 2330, category: DiagnosticCategory.Error, key: "Index signatures are incompatible:" },
this_cannot_be_referenced_in_a_module_body: { code: 2331, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a module body." },
this_cannot_be_referenced_in_current_location: { code: 2332, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in current location." },
this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in constructor arguments." },
this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a static property initializer." },
super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: DiagnosticCategory.Error, key: "'super' can only be referenced in a derived class." },
super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in constructor arguments." },
Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: DiagnosticCategory.Error, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" },
super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: DiagnosticCategory.Error, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" },
Property_0_does_not_exist_on_type_1: { code: 2339, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." },
Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: DiagnosticCategory.Error, key: "Only public methods of the base class are accessible via the 'super' keyword" },
Property_0_is_inaccessible: { code: 2341, category: DiagnosticCategory.Error, key: "Property '{0}' is inaccessible." },
An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', or 'any'." },
Type_0_does_not_satisfy_the_constraint_1_Colon: { code: 2343, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}':" },
Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." },
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." },
Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." },
Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: DiagnosticCategory.Error, key: "Untyped function calls may not accept type arguments." },
Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: DiagnosticCategory.Error, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" },
Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: DiagnosticCategory.Error, key: "Cannot invoke an expression whose type lacks a call signature." },
Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: DiagnosticCategory.Error, key: "Only a void function can be called with the 'new' keyword." },
Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: DiagnosticCategory.Error, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." },
Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: DiagnosticCategory.Error, key: "Neither type '{0}' nor type '{1}' is assignable to the other." },
Neither_type_0_nor_type_1_is_assignable_to_the_other_Colon: { code: 2353, category: DiagnosticCategory.Error, key: "Neither type '{0}' nor type '{1}' is assignable to the other:" },
No_best_common_type_exists_among_return_expressions: { code: 2354, category: DiagnosticCategory.Error, key: "No best common type exists among return expressions." },
A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: DiagnosticCategory.Error, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." },
An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: DiagnosticCategory.Error, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." },
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator must be a variable, property or indexer." },
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: DiagnosticCategory.Error, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." },
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: DiagnosticCategory.Error, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." },
The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: DiagnosticCategory.Error, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." },
The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: DiagnosticCategory.Error, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" },
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: DiagnosticCategory.Error, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." },
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: DiagnosticCategory.Error, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." },
Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: DiagnosticCategory.Error, key: "Invalid left-hand side of assignment expression." },
Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: DiagnosticCategory.Error, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." },
No_best_common_type_exists_between_0_1_and_2: { code: 2366, category: DiagnosticCategory.Error, key: "No best common type exists between '{0}', '{1}', and '{2}'." },
No_best_common_type_exists_between_0_and_1: { code: 2367, category: DiagnosticCategory.Error, key: "No best common type exists between '{0}' and '{1}'." },
Type_parameter_name_cannot_be_0: { code: 2368, category: DiagnosticCategory.Error, key: "Type parameter name cannot be '{0}'" },
A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: DiagnosticCategory.Error, key: "A parameter property is only allowed in a constructor implementation." },
A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: DiagnosticCategory.Error, key: "A rest parameter must be of an array type." },
A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: DiagnosticCategory.Error, key: "A parameter initializer is only allowed in a function or constructor implementation." },
Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: DiagnosticCategory.Error, key: "Parameter '{0}' cannot be referenced in its initializer." },
Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: DiagnosticCategory.Error, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." },
Duplicate_string_index_signature: { code: 2374, category: DiagnosticCategory.Error, key: "Duplicate string index signature." },
Duplicate_number_index_signature: { code: 2375, category: DiagnosticCategory.Error, key: "Duplicate number index signature." },
A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: DiagnosticCategory.Error, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." },
Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: DiagnosticCategory.Error, key: "Constructors for derived classes must contain a 'super' call." },
A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: DiagnosticCategory.Error, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." },
Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: DiagnosticCategory.Error, key: "Getter and setter accessors do not agree in visibility." },
get_and_set_accessor_must_have_the_same_type: { code: 2380, category: DiagnosticCategory.Error, key: "'get' and 'set' accessor must have the same type." },
A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: DiagnosticCategory.Error, key: "A signature with an implementation cannot use a string literal type." },
Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: DiagnosticCategory.Error, key: "Specialized overload signature is not assignable to any non-specialized signature." },
Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: DiagnosticCategory.Error, key: "Overload signatures must all be exported or not exported." },
Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: DiagnosticCategory.Error, key: "Overload signatures must all be ambient or non-ambient." },
Overload_signatures_must_all_be_public_or_private: { code: 2385, category: DiagnosticCategory.Error, key: "Overload signatures must all be public or private." },
Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: DiagnosticCategory.Error, key: "Overload signatures must all be optional or required." },
Function_overload_must_be_static: { code: 2387, category: DiagnosticCategory.Error, key: "Function overload must be static." },
Function_overload_must_not_be_static: { code: 2388, category: DiagnosticCategory.Error, key: "Function overload must not be static." },
Function_implementation_name_must_be_0: { code: 2389, category: DiagnosticCategory.Error, key: "Function implementation name must be '{0}'." },
Constructor_implementation_is_missing: { code: 2390, category: DiagnosticCategory.Error, key: "Constructor implementation is missing." },
Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: DiagnosticCategory.Error, key: "Function implementation is missing or not immediately following the declaration." },
Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: DiagnosticCategory.Error, key: "Multiple constructor implementations are not allowed." },
Duplicate_function_implementation: { code: 2393, category: DiagnosticCategory.Error, key: "Duplicate function implementation." },
Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: DiagnosticCategory.Error, key: "Overload signature is not compatible with function implementation." },
Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: DiagnosticCategory.Error, key: "Individual declarations in merged declaration {0} must be all exported or all local." },
Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: DiagnosticCategory.Error, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." },
Duplicate_identifier_i_Compiler_uses_i_to_initialize_rest_parameter: { code: 2397, category: DiagnosticCategory.Error, key: "Duplicate identifier '_i'. Compiler uses '_i' to initialize rest parameter." },
Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter: { code: 2398, category: DiagnosticCategory.Error, key: "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter." },
Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: DiagnosticCategory.Error, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." },
Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: DiagnosticCategory.Error, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." },
Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: DiagnosticCategory.Error, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." },
Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: DiagnosticCategory.Error, key: "Expression resolves to '_super' that compiler uses to capture base class reference." },
Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: DiagnosticCategory.Error, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." },
The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." },
The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." },
Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: DiagnosticCategory.Error, key: "Invalid left-hand side in 'for...in' statement." },
The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: DiagnosticCategory.Error, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." },
Setters_cannot_return_a_value: { code: 2408, category: DiagnosticCategory.Error, key: "Setters cannot return a value." },
Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: DiagnosticCategory.Error, key: "Return type of constructor signature must be assignable to the instance type of the class" },
All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: DiagnosticCategory.Error, key: "All symbols within a 'with' block will be resolved to 'any'." },
Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: DiagnosticCategory.Error, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." },
Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: DiagnosticCategory.Error, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." },
Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: DiagnosticCategory.Error, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." },
Class_name_cannot_be_0: { code: 2414, category: DiagnosticCategory.Error, key: "Class name cannot be '{0}'" },
Class_0_incorrectly_extends_base_class_1: { code: 2415, category: DiagnosticCategory.Error, key: "Class '{0}' incorrectly extends base class '{1}'." },
Class_0_incorrectly_extends_base_class_1_Colon: { code: 2416, category: DiagnosticCategory.Error, key: "Class '{0}' incorrectly extends base class '{1}':" },
Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: DiagnosticCategory.Error, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." },
Class_static_side_0_incorrectly_extends_base_class_static_side_1_Colon: { code: 2418, category: DiagnosticCategory.Error, key: "Class static side '{0}' incorrectly extends base class static side '{1}':" },
Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: DiagnosticCategory.Error, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." },
Class_0_incorrectly_implements_interface_1: { code: 2420, category: DiagnosticCategory.Error, key: "Class '{0}' incorrectly implements interface '{1}'." },
Class_0_incorrectly_implements_interface_1_Colon: { code: 2421, category: DiagnosticCategory.Error, key: "Class '{0}' incorrectly implements interface '{1}':" },
A_class_may_only_implement_another_class_or_interface: { code: 2422, category: DiagnosticCategory.Error, key: "A class may only implement another class or interface." },
Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: DiagnosticCategory.Error, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." },
Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: DiagnosticCategory.Error, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." },
Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: DiagnosticCategory.Error, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." },
Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: DiagnosticCategory.Error, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." },
Interface_name_cannot_be_0: { code: 2427, category: DiagnosticCategory.Error, key: "Interface name cannot be '{0}'" },
All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: DiagnosticCategory.Error, key: "All declarations of an interface must have identical type parameters." },
Interface_0_incorrectly_extends_interface_1_Colon: { code: 2429, category: DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}':" },
Interface_0_incorrectly_extends_interface_1: { code: 2430, category: DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}'." },
Enum_name_cannot_be_0: { code: 2431, category: DiagnosticCategory.Error, key: "Enum name cannot be '{0}'" },
In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: DiagnosticCategory.Error, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." },
A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: DiagnosticCategory.Error, key: "A module declaration cannot be in a different file from a class or function with which it is merged" },
A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: DiagnosticCategory.Error, key: "A module declaration cannot be located prior to a class or function with which it is merged" },
Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: DiagnosticCategory.Error, key: "Ambient external modules cannot be nested in other modules." },
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_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: DiagnosticCategory.Error, key: "Import declaration conflicts with local 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_name_1_from_private_module_2: { code: 4001, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
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_name_1_from_private_module_2: { code: 4003, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using name '{1}' from private module '{2}'." },
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}'." },
Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4005, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." },
Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." },
Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4007, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." },
Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." },
Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4009, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." },
Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." },
Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4011, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." },
Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." },
Type_parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4013, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." },
Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." },
Type_parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4015, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." },
Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." },
Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 4017, category: DiagnosticCategory.Error, key: "Implements clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." },
Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 4018, category: DiagnosticCategory.Error, key: "Extends clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." },
Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: DiagnosticCategory.Error, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." },
Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: DiagnosticCategory.Error, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." },
Extends_clause_of_exported_interface_0_has_or_is_using_name_1_from_private_module_2: { code: 4021, category: DiagnosticCategory.Error, key: "Extends clause of exported interface '{0}' has or is using name '{1}' from private module '{2}'." },
Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: DiagnosticCategory.Error, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." },
Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." },
Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." },
Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using private name '{1}'." },
Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." },
Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using private name '{1}'." },
Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." },
Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using private name '{1}'." },
Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: DiagnosticCategory.Error, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." },
Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: DiagnosticCategory.Error, key: "Property '{0}' of exported interface has or is using private name '{1}'." },
Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." },
Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." },
Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." },
Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." },
Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using private name '{0}'." },
Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." },
Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." },
Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using private name '{0}'." },
Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: DiagnosticCategory.Error, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." },
Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: DiagnosticCategory.Error, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." },
Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: DiagnosticCategory.Error, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." },
Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: DiagnosticCategory.Error, key: "Return type of call signature from exported interface has or is using private name '{0}'." },
Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: DiagnosticCategory.Error, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." },
Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: DiagnosticCategory.Error, key: "Return type of index signature from exported interface has or is using private name '{0}'." },
Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." },
Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." },
Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using private name '{0}'." },
Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." },
Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." },
Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using private name '{0}'." },
Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: DiagnosticCategory.Error, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." },
Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: DiagnosticCategory.Error, key: "Return type of method from exported interface has or is using private name '{0}'." },
Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." },
Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." },
Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using private name '{0}'." },
Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." },
Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." },
Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." },
Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: DiagnosticCategory.Error, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: DiagnosticCategory.Error, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." },
Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." },
Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." },
Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." },
Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." },
Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: DiagnosticCategory.Error, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: DiagnosticCategory.Error, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." },
Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." },
Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." },
The_current_host_does_not_support_the_0_option: { code: 5001, category: DiagnosticCategory.Error, key: "The current host does not support the '{0}' option." },
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." },
Cannot_read_file_0_Colon_1: { code: 5012, category: DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" },
Unsupported_file_encoding: { code: 5013, category: DiagnosticCategory.NoPrefix, key: "Unsupported file encoding." },
Unsupported_file_encoding: { code: 5013, category: DiagnosticCategory.Error, key: "Unsupported file encoding." },
Unknown_compiler_option_0: { code: 5023, category: DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." },
Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option mapRoot cannot be specified without specifying sourcemap option." },
Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option sourceRoot cannot be specified without specifying sourcemap option." },
@@ -303,13 +347,10 @@ module ts {
Watch_input_files: { code: 6005, category: DiagnosticCategory.Message, key: "Watch input files." },
Redirect_output_structure_to_the_directory: { code: 6006, category: DiagnosticCategory.Message, key: "Redirect output structure to the directory." },
Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." },
Skip_resolution_and_preprocessing: { code: 6010, category: DiagnosticCategory.Message, key: "Skip resolution and preprocessing." },
Specify_ECMAScript_target_version_Colon_ES3_default_or_ES5: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), or 'ES5'" },
Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs' or 'amd'" },
Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." },
Print_the_compiler_s_version: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version." },
Allow_use_of_deprecated_0_keyword_when_referencing_an_external_module: { code: 6021, category: DiagnosticCategory.Message, key: "Allow use of deprecated '{0}' keyword when referencing an external module." },
Specify_locale_for_errors_and_messages_For_example_0_or_1: { code: 6022, category: DiagnosticCategory.Message, key: "Specify locale for errors and messages. For example '{0}' or '{1}'" },
Syntax_Colon_0: { code: 6023, category: DiagnosticCategory.Message, key: "Syntax: {0}" },
options: { code: 6024, category: DiagnosticCategory.Message, key: "options" },
file: { code: 6025, category: DiagnosticCategory.Message, key: "file" },
@@ -317,29 +358,25 @@ module ts {
Options_Colon: { code: 6027, category: DiagnosticCategory.Message, key: "Options:" },
Version_0: { code: 6029, category: DiagnosticCategory.Message, key: "Version {0}" },
Insert_command_line_options_and_files_from_a_file: { code: 6030, category: DiagnosticCategory.Message, key: "Insert command line options and files from a file." },
Use_the_0_flag_to_see_options: { code: 6031, category: DiagnosticCategory.Message, key: "Use the '{0}' flag to see options." },
File_change_detected_Compiling: { code: 6032, category: DiagnosticCategory.Message, key: "File change detected. Compiling..." },
STRING: { code: 6033, category: DiagnosticCategory.Message, key: "STRING" },
KIND: { code: 6034, category: DiagnosticCategory.Message, key: "KIND" },
FILE: { code: 6035, category: DiagnosticCategory.Message, key: "FILE" },
VERSION: { code: 6036, category: DiagnosticCategory.Message, key: "VERSION" },
LOCATION: { code: 6037, category: DiagnosticCategory.Message, key: "LOCATION" },
DIRECTORY: { code: 6038, category: DiagnosticCategory.Message, key: "DIRECTORY" },
NUMBER: { code: 6039, category: DiagnosticCategory.Message, key: "NUMBER" },
Specify_the_codepage_to_use_when_opening_source_files: { code: 6040, category: DiagnosticCategory.Message, key: "Specify the codepage to use when opening source files." },
Additional_locations_Colon: { code: 6041, category: DiagnosticCategory.Message, key: "Additional locations:" },
Compilation_complete_Watching_for_file_changes: { code: 6042, category: DiagnosticCategory.Message, key: "Compilation complete. Watching for file changes." },
Generates_corresponding_map_file: { code: 6043, category: DiagnosticCategory.Message, key: "Generates corresponding '.map' file." },
Compiler_option_0_expects_an_argument: { code: 6044, category: DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." },
Unterminated_quoted_string_in_response_file_0: { code: 6045, category: DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." },
Argument_for_module_option_must_be_commonjs_or_amd: { code: 6045, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs' or 'amd'." },
Argument_for_target_option_must_be_es3_or_es5: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'es3' or 'es5'." },
Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6047, category: DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." },
Unsupported_locale_0: { code: 6048, category: DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },
Unable_to_open_file_0: { code: 6049, category: DiagnosticCategory.Error, key: "Unable to open file '{0}'." },
Corrupted_locale_file_0: { code: 6050, category: DiagnosticCategory.Error, key: "Corrupted locale file {0}." },
No_input_files_specified: { code: 6051, category: DiagnosticCategory.Error, key: "No input files specified." },
Warn_on_expressions_and_declarations_with_an_implied_any_type: { code: 7004, category: DiagnosticCategory.Message, key: "Warn on expressions and declarations with an implied 'any' type." },
Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs' or 'amd'." },
Argument_for_target_option_must_be_es3_or_es5: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'es3' or 'es5'." },
Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." },
Unsupported_locale_0: { code: 6049, category: DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },
Unable_to_open_file_0: { code: 6050, category: DiagnosticCategory.Error, key: "Unable to open file '{0}'." },
Corrupted_locale_file_0: { code: 6051, category: DiagnosticCategory.Error, key: "Corrupted locale file {0}." },
Warn_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: DiagnosticCategory.Message, key: "Warn on expressions and declarations with an implied 'any' type." },
File_0_not_found: { code: 6053, category: DiagnosticCategory.Error, key: "File '{0}' not found." },
File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
@@ -347,83 +384,10 @@ module ts {
_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: DiagnosticCategory.Error, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." },
Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: DiagnosticCategory.Error, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." },
Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: DiagnosticCategory.Error, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." },
Lambda_function_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7014, category: DiagnosticCategory.Error, key: "Lambda function, which lacks return-type annotation, implicitly has an '{0}' return type." },
Array_literal_implicitly_has_an_0_type: { code: 7015, category: DiagnosticCategory.Error, key: "Array literal implicitly has an '{0}' type." },
Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: DiagnosticCategory.Error, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." },
Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: DiagnosticCategory.Error, key: "Index signature of object type implicitly has an 'any' type." },
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
Variable_declaration_list_cannot_be_empty: { code: -9999999, category: DiagnosticCategory.Error, key: "Variable declaration list cannot be empty." },
Digit_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Digit expected." },
Hexadecimal_digit_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Hexadecimal digit expected." },
Unexpected_end_of_text: { code: -9999999, category: DiagnosticCategory.Error, key: "Unexpected end of text." },
Unterminated_string_constant: { code: -9999999, category: DiagnosticCategory.Error, key: "Unterminated string constant." },
Invalid_character: { code: -9999999, category: DiagnosticCategory.Error, key: "Invalid character." },
Declaration_or_statement_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Declaration or statement expected." },
Statement_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Statement expected." },
case_or_default_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "'case' or 'default' expected." },
Property_or_signature_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Property or signature expected." },
Enum_member_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Enum member expected." },
Type_reference_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Type reference expected." },
Variable_declaration_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Variable declaration expected." },
Argument_expression_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Argument expression expected." },
Property_assignment_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Property assignment expected." },
Expression_or_comma_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Expression or comma expected." },
Parameter_declaration_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Parameter declaration expected." },
Type_parameter_declaration_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Type parameter declaration expected." },
Type_argument_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Type argument expected." },
String_literal_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "String literal expected." },
not_preceded_by_parameter_list: { code: -9999999, category: DiagnosticCategory.Error, key: "'=>' not preceded by parameter list." },
Invalid_assignment_target: { code: -9999999, category: DiagnosticCategory.Error, key: "Invalid assignment target." },
super_must_be_followed_by_argument_list_or_member_access: { code: -9999999, category: DiagnosticCategory.Error, key: "'super' must be followed by argument list or member access." },
Line_break_not_permitted_here: { code: -9999999, category: DiagnosticCategory.Error, key: "Line break not permitted here." },
catch_or_finally_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "'catch' or 'finally' expected." },
Block_or_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Block or ';' expected." },
Modifiers_not_permitted_on_index_signature_members: { code: -9999999, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members." },
Class_member_declaration_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Class member declaration expected." },
Declaration_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Declaration expected." },
Invalid_reference_comment: { code: -9999999, category: DiagnosticCategory.Error, key: "Invalid reference comment." },
File_0_is_not_an_external_module: { code: -9999999, category: DiagnosticCategory.Error, key: "File '{0}' is not an external module." },
Excessive_stack_depth_comparing_types_0_and_1: { code: -9999999, category: DiagnosticCategory.Error, key: "Excessive stack depth comparing types '{0}' and '{1}'." },
Type_0_is_not_assignable_to_type_1_Colon: { code: -9999999, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}':" },
Type_0_is_not_assignable_to_type_1: { code: -9999999, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}'." },
Property_0_is_missing_in_type_1: { code: -9999999, category: DiagnosticCategory.Error, key: "Property '{0}' is missing in type '{1}'." },
Private_property_0_cannot_be_reimplemented: { code: -9999999, category: DiagnosticCategory.Error, key: "Private property '{0}' cannot be reimplemented." },
Required_property_0_cannot_be_reimplemented_with_optional_property_in_1: { code: 2012, category: DiagnosticCategory.Error, key: "Required property '{0}' cannot be reimplemented with optional property in '{1}'." },
Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: -9999999, category: DiagnosticCategory.Error, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" },
Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: -9999999, category: DiagnosticCategory.Error, key: "Only public methods of the base class are accessible via the 'super' keyword" },
A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: -9999999, category: DiagnosticCategory.Error, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." },
Constructors_for_derived_classes_must_contain_a_super_call: { code: -9999999, category: DiagnosticCategory.Error, key: "Constructors for derived classes must contain a 'super' call." },
Import_name_cannot_be_0: { code: -9999999, category: DiagnosticCategory.Error, key: "Import name cannot be '{0}'" },
Type_parameter_name_cannot_be_0: { code: -9999999, category: DiagnosticCategory.Error, key: "Type parameter name cannot be '{0}'" },
Class_name_cannot_be_0: { code: -9999999, category: DiagnosticCategory.Error, key: "Class name cannot be '{0}'" },
Interface_name_cannot_be_0: { code: -9999999, category: DiagnosticCategory.Error, key: "Interface name cannot be '{0}'" },
Enum_name_cannot_be_0: { code: -9999999, category: DiagnosticCategory.Error, key: "Enum name cannot be '{0}'" },
Types_of_property_0_are_incompatible_Colon: { code: -9999999, category: DiagnosticCategory.Error, key: "Types of property '{0}' are incompatible:" },
Types_of_parameters_0_and_1_are_incompatible_Colon: { code: -9999999, category: DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible:" },
Unknown_identifier_0: { code: -9999999, category: DiagnosticCategory.Error, key: "Unknown identifier '{0}'." },
Property_0_is_inaccessible: { code: -9999999, category: DiagnosticCategory.Error, key: "Property '{0}' is inaccessible." },
Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: -9999999, category: DiagnosticCategory.Error, key: "Function implementation is missing or not immediately following the declaration." },
Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: -9999999, category: DiagnosticCategory.Error, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." },
Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: -9999999, category: DiagnosticCategory.Error, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." },
Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: -9999999, category: DiagnosticCategory.Error, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." },
Class_0_incorrectly_extends_base_class_1_Colon: { code: -9999999, category: DiagnosticCategory.Error, key: "Class '{0}' incorrectly extends base class '{1}':" },
Class_0_incorrectly_extends_base_class_1: { code: -9999999, category: DiagnosticCategory.Error, key: "Class '{0}' incorrectly extends base class '{1}'." },
Class_static_side_0_incorrectly_extends_base_class_static_side_1_Colon: { code: -9999999, category: DiagnosticCategory.Error, key: "Class static side '{0}' incorrectly extends base class static side '{1}':" },
Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: -9999999, category: DiagnosticCategory.Error, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." },
Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: -9999999, category: DiagnosticCategory.Error, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." },
Class_0_incorrectly_implements_interface_1_Colon: { code: -9999999, category: DiagnosticCategory.Error, key: "Class '{0}' incorrectly implements interface '{1}':" },
Class_0_incorrectly_implements_interface_1: { code: -9999999, category: DiagnosticCategory.Error, key: "Class '{0}' incorrectly implements interface '{1}'." },
Interface_0_incorrectly_extends_interface_1_Colon: { code: -9999999, category: DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}':" },
Interface_0_incorrectly_extends_interface_1: { code: -9999999, category: DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}'." },
Ambient_external_modules_cannot_be_nested_in_other_modules: { code: -9999999, category: DiagnosticCategory.Error, key: "Ambient external modules cannot be nested in other modules." },
Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: -9999999, category: DiagnosticCategory.Error, key: "Import declarations in an internal module cannot reference an external module." },
A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: -9999999, category: DiagnosticCategory.Error, key: "A module declaration cannot be in a different file from a class or function with which it is merged" },
A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: -9999999, category: DiagnosticCategory.Error, key: "A module declaration cannot be located prior to a class or function with which it is merged" },
Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: -9999999, category: DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." },
Import_declaration_conflicts_with_local_declaration_of_0: { code: -9999999, category: DiagnosticCategory.Error, key: "Import declaration conflicts with local declaration of '{0}'" },
Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: -9999999, category: DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" },
Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: -9999999, category: DiagnosticCategory.Error, key: "Filename '{0}' differs from already included filename '{1}' only in casing" },
};
}
File diff suppressed because it is too large Load Diff
+420 -74
View File
@@ -5,6 +5,7 @@
module ts {
interface EmitTextWriter extends TextWriter {
rawWrite(s: string): void;
writeLiteral(s: string): void;
getTextPos(): number;
getLine(): number;
@@ -12,9 +13,16 @@ module ts {
getIndent(): number;
}
var indentStrings: string[] = [];
var indentStrings: string[] = ["", " "];
function getIndentString(level: number) {
return indentStrings[level] || (indentStrings[level] = level === 0 ? "" : getIndentString(level - 1) + " ");
if (indentStrings[level] === undefined) {
indentStrings[level] = getIndentString(level - 1) + indentStrings[1];
}
return indentStrings[level];
}
function getIndentSize() {
return indentStrings[1].length;
}
export function emitFiles(resolver: EmitResolver): EmitResult {
@@ -107,6 +115,15 @@ module ts {
}
}
function rawWrite(s: string) {
if (s !== undefined) {
if (lineStart) {
lineStart = false;
}
output += s;
}
}
function writeLiteral(s: string) {
if (s && s.length) {
write(s);
@@ -138,6 +155,7 @@ module ts {
return {
write: write,
writeSymbol: writeSymbol,
rawWrite: rawWrite,
writeLiteral: writeLiteral,
writeLine: writeLine,
increaseIndent: () => indent++,
@@ -145,8 +163,8 @@ module ts {
getIndent: () => indent,
getTextPos: () => output.length,
getLine: () => lineCount + 1,
getColumn: () => lineStart ? indent * 4 + 1 : output.length - linePos + 1,
getText: () => output
getColumn: () => lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1,
getText: () => output,
};
}
@@ -159,12 +177,141 @@ module ts {
return text.substring(skipTrivia(text, node.pos), node.end);
}
function getLineOfLocalPosition(pos: number) {
return currentSourceFile.getLineAndCharacterFromPosition(pos).line;
}
function writeFile(filename: string, data: string, writeByteOrderMark: boolean) {
compilerHost.writeFile(filename, data, writeByteOrderMark, hostErrorMessage => {
diagnostics.push(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, filename, hostErrorMessage));
});
}
function emitComments(comments: Comment[], trailingSeparator: boolean, writer: EmitTextWriter, writeComment: (comment: Comment, writer: EmitTextWriter) => void) {
var emitLeadingSpace = !trailingSeparator;
forEach(comments, comment => {
if (emitLeadingSpace) {
writer.write(" ");
emitLeadingSpace = false;
}
writeComment(comment, writer);
if (comment.hasTrailingNewLine) {
writer.writeLine();
}
else if (trailingSeparator) {
writer.write(" ");
}
else {
// Emit leading space to separate comment during next comment emit
emitLeadingSpace = true;
}
});
}
function emitNewLineBeforeLeadingComments(node: TextRange, leadingComments: Comment[], writer: EmitTextWriter) {
// If the leading comments start on different line than the start of node, write new line
if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos &&
getLineOfLocalPosition(node.pos) !== getLineOfLocalPosition(leadingComments[0].pos)) {
writer.writeLine();
}
}
function writeCommentRange(comment: Comment, writer: EmitTextWriter) {
if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) {
var firstCommentLineAndCharacter = currentSourceFile.getLineAndCharacterFromPosition(comment.pos);
var firstCommentLineIndent: number;
for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) {
var nextLineStart = currentSourceFile.getPositionFromLineAndCharacter(currentLine + 1, /*character*/1);
if (pos !== comment.pos) {
// If we are not emitting first line, we need to write the spaces to adjust the alignment
if (firstCommentLineIndent === undefined) {
firstCommentLineIndent = calculateIndent(currentSourceFile.getPositionFromLineAndCharacter(firstCommentLineAndCharacter.line, /*character*/1),
comment.pos);
}
// These are number of spaces writer is going to write at current indent
var currentWriterIndentSpacing = writer.getIndent() * getIndentSize();
// Number of spaces we want to be writing
// eg: Assume writer indent
// module m {
// /* starts at character 9 this is line 1
// * starts at character pos 4 line --1 = 8 - 8 + 3
// More left indented comment */ --2 = 8 - 8 + 2
// class c { }
// }
// module m {
// /* this is line 1 -- Assume current writer indent 8
// * line --3 = 8 - 4 + 5
// More right indented comment */ --4 = 8 - 4 + 11
// class c { }
// }
var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart);
if (spacesToEmit > 0) {
var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize();
var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize());
// Write indent size string ( in eg 1: = "", 2: "" , 3: string with 8 spaces 4: string with 12 spaces
writer.rawWrite(indentSizeSpaceString);
// Emit the single spaces (in eg: 1: 3 spaces, 2: 2 spaces, 3: 1 space, 4: 3 spaces)
while (numberOfSingleSpacesToEmit) {
writer.rawWrite(" ");
numberOfSingleSpacesToEmit--;
}
}
else {
// No spaces to emit write empty string
writer.rawWrite("");
}
}
// Write the comment line text
writeTrimmedCurrentLine(pos, nextLineStart);
pos = nextLineStart;
}
}
else {
// Single line comment of styly //....
writer.write(currentSourceFile.text.substring(comment.pos, comment.end));
}
function writeTrimmedCurrentLine(pos: number, nextLineStart: number) {
var end = Math.min(comment.end, nextLineStart - 1);
var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, '');
if (currentLineText) {
// trimmed forward and ending spaces text
writer.write(currentLineText);
if (end !== comment.end) {
writer.writeLine();
}
}
else {
// Empty string - make sure we write empty line
writer.writeLiteral(sys.newLine);
}
}
function calculateIndent(pos: number, end: number) {
var currentLineIndent = 0;
while (pos < end && isWhiteSpace(currentSourceFile.text.charCodeAt(pos))) {
pos++;
if (currentSourceFile.text.charCodeAt(pos) === CharacterCodes.tab) {
// Tabs = size of the indent
currentLineIndent += getIndentSize();
}
else {
// Single space
currentLineIndent++;
}
}
return currentLineIndent;
}
}
function emitJavaScript(jsFilePath: string, root?: SourceFile) {
var writer = createTextWriter(writeSymbol);
var write = writer.write;
@@ -177,14 +324,26 @@ module ts {
/** write emitted output to disk*/
var writeEmittedFiles = writeJavaScriptFile;
/** Emit leading comments of the node */
var emitLeadingComments = compilerOptions.removeComments ? (node: Node) => { } : emitLeadingDeclarationComments;
/** Emit Trailing comments of the node */
var emitTrailingComments = compilerOptions.removeComments ? (node: Node) => { } : emitTrailingDeclarationComments;
var detachedCommentsInfo: { nodePos: number; detachedCommentEndPos: number }[];
/** Emit detached comments of the node */
var emitDetachedComments = compilerOptions.removeComments ? (node: TextRange) => { } : emitDetachedCommentsAtPosition;
var writeComment = writeCommentRange;
/** Emit a node */
var emit = emitNode;
/** Called just before starting emit of a node */
var emitStart = function (node: Node) { }
var emitStart = function (node: Node) { };
/** Called once the emit of the node is done */
var emitEnd = function (node: Node) { }
var emitEnd = function (node: Node) { };
/** Emit the text for the given token that comes after startPos
* This by default writes the text provided with the given tokenKind
@@ -194,9 +353,6 @@ module ts {
* @param emitFn if given will be invoked to emit the text instead of actual token emit */
var emitToken = emitTokenText;
/** Called to notify start of new source file emit */
var emitNewSourceFileStart = function (node: SourceFile) { }
/** Called to before starting the lexical scopes as in function/class in the emitted code because of node
* @param scopeDeclaration node that starts the lexical scope
* @param scopeName Optional name of this scope instead of deducing one from the declaration node */
@@ -322,8 +478,9 @@ module ts {
if (!lastRecordedSourceMapSpan ||
lastRecordedSourceMapSpan.emittedLine != emittedLine ||
lastRecordedSourceMapSpan.emittedColumn != emittedColumn ||
lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line ||
(lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)) {
(lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex &&
(lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line ||
(lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) {
// Encode the last recordedSpan before assigning new
encodeLastRecordedSourceMapSpan();
@@ -341,12 +498,13 @@ module ts {
// Take the new pos instead since there is no change in emittedLine and column since last location
lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line;
lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character;
lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex;
}
}
function recordEmitNodeStartSpan(node: Node) {
// Get the token pos after skipping to the token (ignoring the leading trivia)
recordSourceMapSpan(ts.getTokenPosOfNode(node));
recordSourceMapSpan(skipTrivia(currentSourceFile.text, node.pos));
}
function recordEmitNodeEndSpan(node: Node) {
@@ -428,6 +586,12 @@ module ts {
sourceMapNameIndices.pop();
};
function writeCommentRangeWithMap(comment: Comment, writer: EmitTextWriter) {
recordSourceMapSpan(comment.pos);
writeCommentRange(comment, writer);
recordSourceMapSpan(comment.end);
}
function writeJavaScriptAndSourceMapFile(emitOutput: string, writeByteOrderMark: boolean) {
// Write source map file
encodeLastRecordedSourceMapSpan();
@@ -510,9 +674,9 @@ module ts {
emitStart = recordEmitNodeStartSpan;
emitEnd = recordEmitNodeEndSpan;
emitToken = writeTextWithSpanRecord;
emitNewSourceFileStart = recordNewSourceFileStart;
scopeEmitStart = recordScopeNameOfNode;
scopeEmitEnd = recordScopeNameEnd;
writeComment = writeCommentRangeWithMap;
}
function writeJavaScriptFile(emitOutput: string, writeByteOrderMark: boolean) {
@@ -697,9 +861,11 @@ module ts {
}
function emitPropertyAssignment(node: PropertyDeclaration) {
emitLeadingComments(node);
emit(node.name);
write(": ");
emit(node.initializer);
emitTrailingComments(node);
}
function emitPropertyAccess(node: PropertyAccess) {
@@ -866,13 +1032,16 @@ module ts {
function emitExpressionStatement(node: ExpressionStatement) {
var isArrowExpression = node.expression.kind === SyntaxKind.ArrowFunction;
emitLeadingComments(node);
if (isArrowExpression) write("(");
emit(node.expression);
if (isArrowExpression) write(")");
write(";");
emitTrailingComments(node);
}
function emitIfStatement(node: IfStatement) {
emitLeadingComments(node);
var endPos = emitToken(SyntaxKind.IfKeyword, node.pos);
write(" ");
endPos = emitToken(SyntaxKind.OpenParenToken, endPos);
@@ -890,6 +1059,7 @@ module ts {
emitEmbeddedStatement(node.elseStatement);
}
}
emitTrailingComments(node);
}
function emitDoStatement(node: DoStatement) {
@@ -958,9 +1128,11 @@ module ts {
}
function emitReturnStatement(node: ReturnStatement) {
emitLeadingComments(node);
emitToken(SyntaxKind.ReturnKeyword, node.pos);
emitOptional(" ", node.expression);
write(";");
emitTrailingComments(node);
}
function emitWithStatement(node: WhileStatement) {
@@ -1057,18 +1229,24 @@ module ts {
}
function emitVariableDeclaration(node: VariableDeclaration) {
emitLeadingComments(node);
emitModuleMemberName(node);
emitOptional(" = ", node.initializer);
emitTrailingComments(node);
}
function emitVariableStatement(node: VariableStatement) {
emitLeadingComments(node);
if (!(node.flags & NodeFlags.Export)) write("var ");
emitCommaList(node.declarations);
write(";");
emitTrailingComments(node);
}
function emitParameter(node: ParameterDeclaration) {
emitLeadingComments(node);
emit(node.name);
emitTrailingComments(node);
}
function emitDefaultValueAssignments(node: FunctionDeclaration) {
@@ -1096,11 +1274,13 @@ module ts {
var restIndex = node.parameters.length - 1;
var restParam = node.parameters[restIndex];
writeLine();
emitLeadingComments(restParam);
emitStart(restParam);
write("var ");
emitNode(restParam.name);
write(" = [];");
emitEnd(restParam);
emitTrailingComments(restParam);
writeLine();
write("for (");
emitStart(restParam);
@@ -1128,18 +1308,27 @@ module ts {
}
function emitAccessor(node: AccessorDeclaration) {
emitLeadingComments(node);
write(node.kind === SyntaxKind.GetAccessor ? "get " : "set ");
emit(node.name);
emitSignatureAndBody(node);
emitTrailingComments(node);
}
function emitFunctionDeclaration(node: FunctionDeclaration) {
if (!node.body) return;
if (node.kind !== SyntaxKind.Method) {
// Methods will emit the comments as part of emitting method declaration
emitLeadingComments(node);
}
write("function ");
if (node.kind === SyntaxKind.FunctionDeclaration || (node.kind === SyntaxKind.FunctionExpression && node.name)) {
emit(node.name);
}
emitSignatureAndBody(node);
if (node.kind !== SyntaxKind.Method) {
emitTrailingComments(node);
}
}
function emitCaptureThisForNodeIfNecessary(node: Node): void {
@@ -1152,11 +1341,13 @@ module ts {
}
function emitSignatureParameters(node: FunctionDeclaration) {
increaseIndent();
write("(");
if (node) {
emitCommaList(node.parameters, node.parameters.length - (hasRestParameters(node) ? 1 : 0));
}
write(")");
decreaseIndent();
}
function emitSignatureAndBody(node: FunctionDeclaration) {
@@ -1165,6 +1356,8 @@ module ts {
scopeEmitStart(node);
increaseIndent();
emitDetachedComments(node.body.kind === SyntaxKind.FunctionBlock ? (<Block>node.body).statements : node.body);
var startIndex = 0;
if (node.body.kind === SyntaxKind.FunctionBlock) {
startIndex = emitDirectivePrologues((<Block>node.body).statements, /*startWithNewLine*/ true);
@@ -1191,9 +1384,11 @@ module ts {
}
else {
writeLine();
emitLeadingComments(node.body);
write("return ");
emit(node.body);
write(";");
emitTrailingComments(node.body);
}
decreaseIndent();
writeLine();
@@ -1266,6 +1461,7 @@ module ts {
forEach(node.members, member => {
if (member.kind === SyntaxKind.Property && (member.flags & NodeFlags.Static) === staticFlag && (<PropertyDeclaration>member).initializer) {
writeLine();
emitLeadingComments(member);
emitStart(member);
emitStart((<PropertyDeclaration>member).name);
if (staticFlag) {
@@ -1280,6 +1476,7 @@ module ts {
emit((<PropertyDeclaration>member).initializer);
write(";");
emitEnd(member);
emitTrailingComments(member);
}
});
}
@@ -1289,6 +1486,7 @@ module ts {
if (member.kind === SyntaxKind.Method) {
if (!(<MethodDeclaration>member).body) return;
writeLine();
emitLeadingComments(member);
emitStart(member);
emitStart((<MethodDeclaration>member).name);
emitNode(node.name);
@@ -1303,6 +1501,7 @@ module ts {
emitEnd(member);
emitEnd(member);
write(";");
emitTrailingComments(member);
}
else if (member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) {
var accessors = getAllAccessorDeclarations(node, <AccessorDeclaration>member);
@@ -1322,20 +1521,24 @@ module ts {
increaseIndent();
if (accessors.getAccessor) {
writeLine();
emitLeadingComments(accessors.getAccessor);
write("get: ");
emitStart(accessors.getAccessor);
write("function ");
emitSignatureAndBody(accessors.getAccessor);
emitEnd(accessors.getAccessor);
emitTrailingComments(accessors.getAccessor);
write(",");
}
if (accessors.setAccessor) {
writeLine();
emitLeadingComments(accessors.setAccessor);
write("set: ");
emitStart(accessors.setAccessor);
write("function ");
emitSignatureAndBody(accessors.setAccessor);
emitEnd(accessors.setAccessor);
emitTrailingComments(accessors.setAccessor);
write(",");
}
writeLine();
@@ -1352,11 +1555,13 @@ module ts {
}
function emitClassDeclaration(node: ClassDeclaration) {
var ctor = getFirstConstructorWithBody(node);
emitLeadingComments(node);
write("var ");
emit(node.name);
write(" = (function (");
if (node.baseType) write("_super");
if (node.baseType) {
write("_super");
}
write(") {");
increaseIndent();
scopeEmitStart(node);
@@ -1369,45 +1574,7 @@ module ts {
emitEnd(node.baseType);
}
writeLine();
emitStart(<Node>ctor || node);
write("function ");
emit(node.name);
emitSignatureParameters(ctor);
write(" {");
scopeEmitStart(node, "constructor");
increaseIndent();
emitCaptureThisForNodeIfNecessary(node);
if (ctor) {
emitDefaultValueAssignments(ctor);
emitRestParameter(ctor);
if (node.baseType) {
var superCall = findInitialSuperCall(ctor);
if (superCall) {
writeLine();
emit(superCall);
}
}
emitParameterPropertyAssignments(ctor);
}
else {
if (node.baseType) {
writeLine();
emitStart(node.baseType);
write("_super.apply(this, arguments);");
emitEnd(node.baseType);
}
}
emitMemberAssignments(node, /*nonstatic*/0);
if (ctor) {
var statements: Node[] = (<Block>ctor.body).statements;
if (superCall) statements = statements.slice(1);
emitLines(statements);
}
decreaseIndent();
writeLine();
emitToken(SyntaxKind.CloseBraceToken, ctor ? (<Block>ctor.body).statements.end : node.members.end);
scopeEmitEnd();
emitEnd(<Node>ctor || node);
emitConstructorOfClass();
emitMemberFunctions(node);
emitMemberAssignments(node, NodeFlags.Static);
writeLine();
@@ -1437,9 +1604,63 @@ module ts {
emitEnd(node);
write(";");
}
emitTrailingComments(node);
function emitConstructorOfClass() {
var ctor = getFirstConstructorWithBody(node);
if (ctor) {
emitLeadingComments(ctor);
}
emitStart(<Node>ctor || node);
write("function ");
emit(node.name);
emitSignatureParameters(ctor);
write(" {");
scopeEmitStart(node, "constructor");
increaseIndent();
if (ctor) {
emitDetachedComments((<Block>ctor.body).statements);
}
emitCaptureThisForNodeIfNecessary(node);
if (ctor) {
emitDefaultValueAssignments(ctor);
emitRestParameter(ctor);
if (node.baseType) {
var superCall = findInitialSuperCall(ctor);
if (superCall) {
writeLine();
emit(superCall);
}
}
emitParameterPropertyAssignments(ctor);
}
else {
if (node.baseType) {
writeLine();
emitStart(node.baseType);
write("_super.apply(this, arguments);");
emitEnd(node.baseType);
}
}
emitMemberAssignments(node, /*nonstatic*/0);
if (ctor) {
var statements: Node[] = (<Block>ctor.body).statements;
if (superCall) statements = statements.slice(1);
emitLines(statements);
}
decreaseIndent();
writeLine();
emitToken(SyntaxKind.CloseBraceToken, ctor ? (<Block>ctor.body).statements.end : node.members.end);
scopeEmitEnd();
emitEnd(<Node>ctor || node);
if (ctor) {
emitTrailingComments(ctor);
}
}
}
function emitEnumDeclaration(node: EnumDeclaration) {
emitLeadingComments(node);
if (!(node.flags & NodeFlags.Export)) {
emitStart(node);
write("var ");
@@ -1456,26 +1677,7 @@ module ts {
write(") {");
increaseIndent();
scopeEmitStart(node);
forEach(node.members, member => {
writeLine();
emitStart(member);
write(resolver.getLocalNameOfContainer(node));
write("[");
write(resolver.getLocalNameOfContainer(node));
write("[");
emitQuotedIdentifier(member.name);
write("] = ");
if (member.initializer) {
emit(member.initializer);
}
else {
write(resolver.getEnumMemberValue(member).toString());
}
write("] = ");
emitQuotedIdentifier(member.name);
emitEnd(member);
write(";");
});
emitEnumMemberDeclarations();
decreaseIndent();
writeLine();
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
@@ -1496,6 +1698,32 @@ module ts {
emitEnd(node);
write(";");
}
emitTrailingComments(node);
function emitEnumMemberDeclarations() {
forEach(node.members, member => {
writeLine();
emitLeadingComments(member);
emitStart(member);
write(resolver.getLocalNameOfContainer(node));
write("[");
write(resolver.getLocalNameOfContainer(node));
write("[");
emitQuotedIdentifier(member.name);
write("] = ");
if (member.initializer) {
emit(member.initializer);
}
else {
write(resolver.getEnumMemberValue(member).toString());
}
write("] = ");
emitQuotedIdentifier(member.name);
emitEnd(member);
write(";");
emitTrailingComments(member);
});
}
}
function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration: ModuleDeclaration): ModuleDeclaration {
@@ -1507,6 +1735,7 @@ module ts {
function emitModuleDeclaration(node: ModuleDeclaration) {
if (!isInstantiated(node)) return;
emitLeadingComments(node);
if (!(node.flags & NodeFlags.Export)) {
emitStart(node);
write("var ");
@@ -1553,6 +1782,7 @@ module ts {
emitEnd(node);
write(";");
}
emitTrailingComments(node);
}
function emitImportDeclaration(node: ImportDeclaration) {
@@ -1569,16 +1799,19 @@ module ts {
if (node.externalModuleName && node.parent.kind === SyntaxKind.SourceFile && compilerOptions.module === ModuleKind.AMD) {
if (node.flags & NodeFlags.Export) {
writeLine();
emitLeadingComments(node);
emitStart(node);
emitModuleMemberName(node);
write(" = ");
emit(node.name);
write(";");
emitEnd(node);
emitTrailingComments(node);
}
}
else {
writeLine();
emitLeadingComments(node);
emitStart(node);
if (!(node.flags & NodeFlags.Export)) write("var ");
emitModuleMemberName(node);
@@ -1595,6 +1828,7 @@ module ts {
}
write(";");
emitEnd(node);
emitTrailingComments(node);
}
}
}
@@ -1691,6 +1925,7 @@ module ts {
function emitSourceFile(node: SourceFile) {
currentSourceFile = node;
emitDetachedComments(node);
// emit prologue directives prior to __extends
var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false);
if (!extendsEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitExtends) {
@@ -1840,6 +2075,84 @@ module ts {
}
}
function emitLeadingDeclarationComments(node: Node) {
// Emit the leading comments only if the parent's pos doesnt match because parent should take care of emitting these comments
if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) {
var leadingComments: Comment[];
if (detachedCommentsInfo === undefined || detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos !== node.pos) {
// get the leading comments from the node
leadingComments = getLeadingCommentsOfNode(node, currentSourceFile);
}
else {
// get the leading comments from detachedPos
leadingComments = getLeadingComments(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos);
if (detachedCommentsInfo.length - 1) {
detachedCommentsInfo.pop();
}
else {
detachedCommentsInfo = undefined;
}
}
emitNewLineBeforeLeadingComments(node, leadingComments, writer);
// Leading comments are emitted at /*leading comment1 */space/*leading comment*/space
emitComments(leadingComments, /*trailingSeparator*/ true, writer, writeComment);
}
}
function emitTrailingDeclarationComments(node: Node) {
// Emit the trailing comments only if the parent's end doesnt match
if (node.parent.kind === SyntaxKind.SourceFile || node.end !== node.parent.end) {
var trailingComments = getTrailingComments(currentSourceFile.text, node.end);
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/
emitComments(trailingComments, /*trailingSeparator*/ false, writer, writeComment);
}
}
function emitDetachedCommentsAtPosition(node: TextRange) {
var leadingComments = getLeadingComments(currentSourceFile.text, node.pos);
if (leadingComments) {
var detachedComments: Comment[] = [];
var lastComment: Comment;
forEach(leadingComments, comment => {
if (lastComment) {
var lastCommentLine = getLineOfLocalPosition(lastComment.end);
var commentLine = getLineOfLocalPosition(comment.pos);
if (commentLine >= lastCommentLine + 2) {
// There was a blank line between the last comment and this comment. This
// comment is not part of the copyright comments. Return what we have so
// far.
return detachedComments;
}
}
detachedComments.push(comment);
lastComment = comment;
});
if (detachedComments && detachedComments.length) {
// All comments look like they could have been part of the copyright header. Make
// sure there is at least one blank line between it and the node. If not, it's not
// a copyright header.
var lastCommentLine = getLineOfLocalPosition(detachedComments[detachedComments.length - 1].end);
var astLine = getLineOfLocalPosition(skipTrivia(currentSourceFile.text, node.pos));
if (astLine >= lastCommentLine + 2) {
// Valid detachedComments
emitNewLineBeforeLeadingComments(node, leadingComments, writer);
emitComments(detachedComments, /*trailingSeparator*/ true, writer, writeComment);
var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end };
if (detachedCommentsInfo) {
detachedCommentsInfo.push(currentDetachedCommentInfo);
}
else {
detachedCommentsInfo = [currentDetachedCommentInfo];
}
}
}
}
}
if (compilerOptions.sourceMap) {
initializeEmitterWithSourceMaps();
}
@@ -1869,6 +2182,8 @@ module ts {
var enclosingDeclaration: Node;
var reportedDeclarationError = false;
var emitJsDocComments = compilerOptions.removeComments ? function (declaration: Declaration) { } : writeJsDocComments;
var aliasDeclarationEmitInfo: {
declaration: ImportDeclaration;
outputPos: number;
@@ -1946,6 +2261,15 @@ module ts {
}
}
function writeJsDocComments(declaration: Declaration) {
if (declaration) {
var jsDocComments = getJsDocComments(declaration, currentSourceFile);
emitNewLineBeforeLeadingComments(declaration, jsDocComments, writer);
// jsDoc comments are emitted at /*leading comment1 */space/*leading comment*/space
emitComments(jsDocComments, /*trailingSeparator*/ true, writer, writeCommentRange);
}
}
function emitSourceTextOfNode(node: Node) {
write(getSourceTextOfLocalNode(node));
}
@@ -2004,6 +2328,7 @@ module ts {
function writeImportDeclaration(node: ImportDeclaration) {
// note usage of writer. methods instead of aliases created, just to make sure we are using
// correct writer especially to handle asynchronous alias writing
emitJsDocComments(node);
if (node.flags & NodeFlags.Export) {
writer.write("export ");
}
@@ -2043,6 +2368,7 @@ module ts {
function emitModuleDeclaration(node: ModuleDeclaration) {
if (resolver.isDeclarationVisible(node)) {
emitJsDocComments(node);
emitDeclarationFlags(node);
write("module ");
emitSourceTextOfNode(node.name);
@@ -2066,6 +2392,7 @@ module ts {
function emitEnumDeclaration(node: EnumDeclaration) {
if (resolver.isDeclarationVisible(node)) {
emitJsDocComments(node);
emitDeclarationFlags(node);
write("enum ");
emitSourceTextOfNode(node.name);
@@ -2080,6 +2407,7 @@ module ts {
}
function emitEnumMemberDeclaration(node: EnumMember) {
emitJsDocComments(node);
emitSourceTextOfNode(node.name);
var enumMemberValue = resolver.getEnumMemberValue(node);
if (enumMemberValue !== undefined) {
@@ -2155,6 +2483,9 @@ module ts {
};
}
increaseIndent();
emitJsDocComments(node);
decreaseIndent();
emitSourceTextOfNode(node.name);
// If there is constraint present and this is not a type parameter of the private method emit the constraint
if (node.constraint && (node.parent.kind !== SyntaxKind.Method || !(node.parent.flags & NodeFlags.Private))) {
@@ -2231,6 +2562,7 @@ module ts {
}
if (resolver.isDeclarationVisible(node)) {
emitJsDocComments(node);
emitDeclarationFlags(node);
write("class ");
emitSourceTextOfNode(node.name);
@@ -2255,6 +2587,7 @@ module ts {
function emitInterfaceDeclaration(node: InterfaceDeclaration) {
if (resolver.isDeclarationVisible(node)) {
emitJsDocComments(node);
emitDeclarationFlags(node);
write("interface ");
emitSourceTextOfNode(node.name);
@@ -2274,6 +2607,7 @@ module ts {
}
function emitPropertyDeclaration(node: PropertyDeclaration) {
emitJsDocComments(node);
emitDeclarationFlags(node);
emitVariableDeclaration(node);
write(";");
@@ -2340,6 +2674,7 @@ module ts {
function emitVariableStatement(node: VariableStatement) {
var hasDeclarationWithEmit = forEach(node.declarations, varDeclaration => resolver.isDeclarationVisible(varDeclaration));
if (hasDeclarationWithEmit) {
emitJsDocComments(node);
emitDeclarationFlags(node);
write("var ");
emitCommaList(node.declarations, emitVariableDeclaration);
@@ -2351,6 +2686,8 @@ module ts {
function emitAccessorDeclaration(node: AccessorDeclaration) {
var accessors = getAllAccessorDeclarations(<ClassDeclaration>node.parent, node);
if (node === accessors.firstAccessor) {
emitJsDocComments(accessors.getAccessor);
emitJsDocComments(accessors.setAccessor);
emitDeclarationFlags(node);
emitSourceTextOfNode(node.name);
if (!(node.flags & NodeFlags.Private)) {
@@ -2411,6 +2748,7 @@ module ts {
// so no need to verify if the declaration is visible
if ((node.kind !== SyntaxKind.FunctionDeclaration || resolver.isDeclarationVisible(node)) &&
!resolver.isImplementationOfOverload(node)) {
emitJsDocComments(node);
emitDeclarationFlags(node);
if (node.kind === SyntaxKind.FunctionDeclaration) {
write("function ");
@@ -2430,11 +2768,16 @@ module ts {
}
function emitConstructSignatureDeclaration(node: SignatureDeclaration) {
emitJsDocComments(node);
write("new ");
emitSignatureDeclaration(node);
}
function emitSignatureDeclaration(node: SignatureDeclaration) {
if (node.kind === SyntaxKind.CallSignature || node.kind === SyntaxKind.IndexSignature) {
// Only index and call signatures are emitted directly, so emit their js doc comments, rest will do that in their own functions
emitJsDocComments(node);
}
emitTypeParameters(node.typeParameters);
if (node.kind === SyntaxKind.IndexSignature) {
write("[");
@@ -2529,6 +2872,8 @@ module ts {
}
function emitParameterDeclaration(node: ParameterDeclaration) {
increaseIndent();
emitJsDocComments(node);
if (node.flags & NodeFlags.Rest) {
write("...");
}
@@ -2536,6 +2881,7 @@ module ts {
if (node.initializer || (node.flags & NodeFlags.QuestionMark)) {
write("?");
}
decreaseIndent();
if (!(node.parent.flags & NodeFlags.Private)) {
write(": ");
+38 -5
View File
@@ -139,6 +139,32 @@ module ts {
return (<Identifier>(<ExpressionStatement>node).expression).text === "use strict";
}
export function getLeadingCommentsOfNode(node: Node, sourceFileOfNode: SourceFile) {
// If parameter/type parameter, the prev token trailing comments are part of this node too
if (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) {
// eg (/** blah */ a, /** blah */ b);
return concatenate(getTrailingComments(sourceFileOfNode.text, node.pos),
// eg: (
// /** blah */ a,
// /** blah */ b);
getLeadingComments(sourceFileOfNode.text, node.pos));
}
else {
return getLeadingComments(sourceFileOfNode.text, node.pos);
}
}
export function getJsDocComments(node: Declaration, sourceFileOfNode: SourceFile) {
return filter(getLeadingCommentsOfNode(node, sourceFileOfNode), comment => isJsDocComment(comment));
function isJsDocComment(comment: Comment) {
// js doc is if comment is starting with /** but not if it is /**/
return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk &&
sourceFileOfNode.text.charCodeAt(comment.pos + 2) === CharacterCodes.asterisk &&
sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== CharacterCodes.slash;
}
}
// Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes
// stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise,
// embedded arrays are flattened and the 'cbNode' callback is invoked for each element. If a callback returns
@@ -646,6 +672,13 @@ module ts {
return getLineAndCharacterOfPosition(lineStarts, position);
}
function getPositionFromSourceLineAndCharacter(line: number, character: number): number {
if (!lineStarts) {
lineStarts = getLineStarts(sourceText);
}
return getPositionFromLineAndCharacter(lineStarts, line, character);
}
function error(message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void {
var start = scanner.getTokenPos();
var length = scanner.getTextPos() - start;
@@ -2024,7 +2057,7 @@ module ts {
primaryExpression.kind === SyntaxKind.SuperKeyword && token !== SyntaxKind.OpenParenToken && token !== SyntaxKind.DotToken;
if (illegalUsageOfSuperKeyword) {
error(Diagnostics.super_must_be_followed_by_argument_list_or_member_access);
error(Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
}
var expr = parseCallAndAccess(primaryExpression, /* inNewExpression */ false);
@@ -2077,13 +2110,12 @@ module ts {
var indexedAccess = <IndexedAccess>createNode(SyntaxKind.IndexedAccess, expr.pos);
indexedAccess.object = expr;
// It's not uncommon for a user to write: "new Type[]". Check for that common pattern
// and report a better error message.
// It's not uncommon for a user to write: "new Type[]".
// Check for that common pattern and report a better error message.
if (inNewExpression && parseOptional(SyntaxKind.CloseBracketToken)) {
indexedAccess.index = createMissingNode();
grammarErrorAtPos(bracketStart, scanner.getStartPos() - bracketStart, Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead);
}
// Otherwise parse the indexed access normally.
else {
indexedAccess.index = parseExpression();
parseExpected(SyntaxKind.CloseBracketToken);
@@ -3581,7 +3613,7 @@ module ts {
if (!matchResult) {
var start = range.pos;
var length = range.end - start;
errorAtPos(start, length, Diagnostics.Invalid_reference_comment);
errorAtPos(start, length, Diagnostics.Invalid_reference_directive_syntax);
}
else {
referencedFiles.push({
@@ -3626,6 +3658,7 @@ module ts {
file.filename = normalizePath(filename);
file.text = sourceText;
file.getLineAndCharacterFromPosition = getLineAndCharacterlFromSourcePosition;
file.getPositionFromLineAndCharacter = getPositionFromSourceLineAndCharacter;
file.syntacticErrors = [];
file.semanticErrors = [];
var referenceComments = processReferenceComments();
+23 -12
View File
@@ -264,6 +264,11 @@ module ts {
return result;
}
export function getPositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number {
Debug.assert(line > 0);
return lineStarts[line - 1] + character - 1;
}
export function getLineAndCharacterOfPosition(lineStarts: number[], position: number) {
var lineNumber = binarySearch(lineStarts, position);
if (lineNumber < 0) {
@@ -286,13 +291,13 @@ module ts {
var hasOwnProperty = Object.prototype.hasOwnProperty;
function isWhiteSpace(ch: number): boolean {
export function isWhiteSpace(ch: number): boolean {
return ch === CharacterCodes.space || ch === CharacterCodes.tab || ch === CharacterCodes.verticalTab || ch === CharacterCodes.formFeed ||
ch === CharacterCodes.nonBreakingSpace || ch === CharacterCodes.ogham || ch >= CharacterCodes.enQuad && ch <= CharacterCodes.zeroWidthSpace ||
ch === CharacterCodes.narrowNoBreakSpace || ch === CharacterCodes.mathematicalSpace || ch === CharacterCodes.ideographicSpace || ch === CharacterCodes.byteOrderMark;
}
function isLineBreak(ch: number): boolean {
export function isLineBreak(ch: number): boolean {
return ch === CharacterCodes.lineFeed || ch === CharacterCodes.carriageReturn || ch === CharacterCodes.lineSeparator || ch === CharacterCodes.paragraphSeparator;
}
@@ -359,9 +364,9 @@ module ts {
// between the given position and the next line break are returned. The return value is an array containing a TextRange for each
// comment. Single-line comment ranges include the the beginning '//' characters but not the ending line break. Multi-line comment
// ranges include the beginning '/* and ending '*/' characters. The return value is undefined if no comments were found.
function getCommentRanges(text: string, pos: number, trailing: boolean): TextRange[] {
var result: TextRange[];
var collecting = trailing;
function getCommentRanges(text: string, pos: number, trailing: boolean): Comment[] {
var result: Comment[];
var collecting = trailing || pos === 0;
while (true) {
var ch = text.charCodeAt(pos);
switch (ch) {
@@ -373,6 +378,9 @@ module ts {
return result;
}
collecting = true;
if (result && result.length) {
result[result.length - 1].hasTrailingNewLine = true;
}
continue;
case CharacterCodes.tab:
case CharacterCodes.verticalTab:
@@ -382,12 +390,14 @@ module ts {
continue;
case CharacterCodes.slash:
var nextChar = text.charCodeAt(pos + 1);
var hasTrailingNewLine = false;
if (nextChar === CharacterCodes.slash || nextChar === CharacterCodes.asterisk) {
var startPos = pos;
pos += 2;
if (nextChar === CharacterCodes.slash) {
while (pos < text.length) {
if (isLineBreak(text.charCodeAt(pos))) {
hasTrailingNewLine = true;
break;
}
pos++;
@@ -404,13 +414,16 @@ module ts {
}
if (collecting) {
if (!result) result = [];
result.push({ pos: startPos, end: pos });
result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine });
}
continue;
}
break;
default:
if (ch > CharacterCodes.maxAsciiCharacter && (isWhiteSpace(ch) || isLineBreak(ch))) {
if (result && result.length && isLineBreak(ch)) {
result[result.length - 1].hasTrailingNewLine = true;
}
pos++;
continue;
}
@@ -420,11 +433,11 @@ module ts {
}
}
export function getLeadingComments(text: string, pos: number): TextRange[] {
export function getLeadingComments(text: string, pos: number): Comment[] {
return getCommentRanges(text, pos, /*trailing*/ false);
}
export function getTrailingComments(text: string, pos: number): TextRange[] {
export function getTrailingComments(text: string, pos: number): Comment[] {
return getCommentRanges(text, pos, /*trailing*/ true);
}
@@ -601,7 +614,7 @@ module ts {
}
if (isLineBreak(ch)) {
result += text.substring(start, pos);
error(Diagnostics.Unterminated_string_constant);
error(Diagnostics.Unterminated_string_literal);
break;
}
pos++;
@@ -762,9 +775,8 @@ module ts {
if (text.charCodeAt(pos + 1) === CharacterCodes.asterisk) {
pos += 2;
var safeLength = len - 1; // For lookahead.
var commentClosed = false;
while (pos < safeLength) {
while (pos < len) {
var ch = text.charCodeAt(pos);
if (ch === CharacterCodes.asterisk && text.charCodeAt(pos + 1) === CharacterCodes.slash) {
@@ -780,7 +792,6 @@ module ts {
}
if (!commentClosed) {
pos++;
error(Diagnostics.Asterisk_Slash_expected);
}
+12 -6
View File
@@ -217,7 +217,11 @@ module ts {
FirstKeyword = BreakKeyword,
LastKeyword = StringKeyword,
FirstFutureReservedWord = ImplementsKeyword,
LastFutureReservedWord = YieldKeyword
LastFutureReservedWord = YieldKeyword,
FirstTypeNode = TypeReference,
LastTypeNode = ArrayType,
FirstPunctuation= OpenBraceToken,
LastPunctuation = CaretEqualsToken
}
export enum NodeFlags {
@@ -512,10 +516,15 @@ module ts {
filename: string;
}
export interface Comment extends TextRange {
hasTrailingNewLine?: boolean;
}
export interface SourceFile extends Block {
filename: string;
text: string;
getLineAndCharacterFromPosition(position: number): { line: number; character: number };
getPositionFromLineAndCharacter(line: number, character: number): number;
amdDependencies: string[];
referencedFiles: FileReference[];
syntacticErrors: Diagnostic[];
@@ -593,19 +602,17 @@ module ts {
getTypeCount(): number;
checkProgram(): void;
emitFiles(): EmitResult;
getSymbolOfNode(node: Node): Symbol;
getParentOfSymbol(symbol: Symbol): Symbol;
getTypeOfSymbol(symbol: Symbol): Type;
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
getPropertiesOfType(type: Type): Symbol[];
getPropertyOfType(type: Type, propetyName: string): Symbol;
getSignaturesOfType(type: Type, kind: SignatureKind): Signature[];
getIndexTypeOfType(type: Type, kind: IndexKind): Type;
getReturnTypeOfSignature(signature: Signature): Type;
resolveEntityName(location: Node, name: EntityName, meaning: SymbolFlags): Symbol;
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
getSymbolInfo(node: Node): Symbol;
getTypeOfExpression(node: Expression, contextualType?: Type, contextualMapper?: TypeMapper): Type;
getTypeOfNode(node: Node): Type;
getApparentType(type: Type): ApparentType;
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
getAugmentedPropertiesOfApparentType(type: Type): Symbol[];
@@ -937,7 +944,6 @@ module ts {
Warning,
Error,
Message,
NoPrefix
}
export interface CompilerOptions {
+33 -41
View File
@@ -39,8 +39,9 @@ class CompilerBaselineRunner extends RunnerBase {
public checkTestCodeOutput(fileName: string) {
describe('compiler tests for ' + fileName, () => {
// strips the fileName from the path.
var justName = fileName.replace(/^.*[\\\/]/, '');
// Mocha holds onto the closure environment of the describe callback even after the test is done.
// Everything declared here should be cleared out in the "after" callback.
var justName = fileName.replace(/^.*[\\\/]/, ''); // strips the fileName from the path.
var content = Harness.IO.readFile(fileName);
var testCaseContent = Harness.TestCaseParser.makeUnitsFromTest(content, fileName);
@@ -52,6 +53,7 @@ class CompilerBaselineRunner extends RunnerBase {
var rootDir = lastUnit.originalFilePath.indexOf('conformance') === -1 ? 'tests/cases/compiler/' : lastUnit.originalFilePath.substring(0, lastUnit.originalFilePath.lastIndexOf('/')) + '/';
var result: Harness.Compiler.CompilerResult;
var checker: ts.TypeChecker;
var options: ts.CompilerOptions;
// equivalent to the files that will be passed on the command line
var toBeCompiled: { unitName: string; content: string }[];
@@ -85,8 +87,10 @@ class CompilerBaselineRunner extends RunnerBase {
});
}
options = harnessCompiler.compileFiles(toBeCompiled, otherFiles, function (compileResult) {
options = harnessCompiler.compileFiles(toBeCompiled, otherFiles, function (compileResult, _checker) {
result = compileResult;
// The checker will be used by typeWriter
checker = _checker;
}, function (settings) {
harnessCompiler.setCompilerSettings(tcSettings);
});
@@ -97,6 +101,7 @@ class CompilerBaselineRunner extends RunnerBase {
a fresh compiler instance for themselves and then create a fresh one for the next test. Would be nice to get dev fixes
eventually to remove this limitation. */
for (var i = 0; i < tcSettings.length; ++i) {
// noImplicitAny is passed to getCompiler, but target is just passed in the settings blob to setCompilerSettings
if (!createNewInstance && (tcSettings[i].flag == "noimplicitany" || tcSettings[i].flag === 'target')) {
harnessCompiler = Harness.Compiler.getCompiler({
useExistingInstance: false,
@@ -118,6 +123,27 @@ class CompilerBaselineRunner extends RunnerBase {
}
});
after(() => {
// Mocha holds onto the closure environment of the describe callback even after the test is done.
// Therefore we have to clean out large objects after the test is done.
justName = undefined;
content = undefined;
testCaseContent = undefined;
units = undefined;
tcSettings = undefined;
lastUnit = undefined;
rootDir = undefined;
result = undefined;
checker = undefined;
options = undefined;
toBeCompiled = undefined;
otherFiles = undefined;
harnessCompiler = undefined;
declToBeCompiled = undefined;
declOtherFiles = undefined;
declResult = undefined;
});
function getByteOrderMarkText(file: Harness.Compiler.GeneratedFile): string {
return file.writeByteOrderMark ? "\u00EF\u00BB\u00BF" : "";
}
@@ -251,32 +277,15 @@ class CompilerBaselineRunner extends RunnerBase {
it('Correct type baselines for ' + fileName, () => {
// NEWTODO: Type baselines
if (/* ! */ false && /* ! */ result.errors.length === 0) {
if (result.errors.length === 0) {
Harness.Baseline.runBaseline('Correct expression types for ' + fileName, justName.replace(/\.ts/, '.types'), () => {
// TODO: Rewrite this part
//var compiler = new TypeScript.TypeScriptCompiler(
// new TypeScript.NullLogger(), TypeScript.ImmutableCompilationSettings.defaultSettings());
//compiler.addFile('lib.d.ts', TypeScript.ScriptSnapshot.fromString(Harness.Compiler.libTextMinimal),
// TypeScript.ByteOrderMark.None, /*version:*/ "0", /*isOpen:*/ true);
//var allFiles = toBeCompiled.concat(otherFiles);
//allFiles.forEach(file => {
// compiler.addFile(file.unitName, TypeScript.ScriptSnapshot.fromString(file.content),
// TypeScript.ByteOrderMark.None, /*version:*/ "0", /*isOpen:*/ true);
//});
var allFiles: any[] = [];
var compiler: any = undefined;
var typeBaselineText = '';
var allFiles = toBeCompiled.concat(otherFiles).filter(file => !!checker.getProgram().getSourceFile(file.unitName));
var typeLines: string[] = [];
var typeMap: { [fileName: string]: { [lineNum: number]: string[]; } } = {};
var walker = new TypeWriterWalker(checker);
allFiles.forEach(file => {
var codeLines = file.content.split('\n');
var walker = new TypeWriterWalker(file.unitName, compiler);
walker.run();
walker.results.forEach(result => {
walker.getTypes(file.unitName).forEach(result => {
var formattedLine = result.identifierName + " : " + result.type;
if (!typeMap[file.unitName]) {
typeMap[file.unitName] = {};
@@ -290,23 +299,6 @@ class CompilerBaselineRunner extends RunnerBase {
typeMap[file.unitName][result.line] = typeInfo;
});
var typeBaselineText = '';
var typeLines: string[] = [];
var typeMap: { [fileName: string]: { [lineNum: number]: string[]; } } = {};
allFiles.forEach(file => {
var codeLines = file.content.split('\n');
var walker = new TypeWriterWalker(file.unitName, compiler);
walker.run();
walker.results.forEach(result => {
var formattedLine = result.identifierName + " : " + result.type;
if (!typeMap[file.unitName]) {
typeMap[file.unitName] = {};
} else {
typeLines.push('No type information for this code.');
}
});
});
typeLines.push('=== ' + file.unitName + ' ===\r\n');
for (var i = 0; i < codeLines.length; i++) {
var currentCodeLine = codeLines[i];
+14 -8
View File
@@ -571,10 +571,6 @@ module Harness {
this.lastErrors = [];
}
public emitAllDeclarations() {
// NEWTODO: Do something here?
}
public reportCompilationErrors() {
return this.lastErrors;
}
@@ -604,12 +600,18 @@ module Harness {
result.files.forEach(file => {
ioHost.writeFile(file.fileName, file.code, false);
});
result.declFilesCode.forEach(file => {
ioHost.writeFile(file.fileName, file.code, false);
});
result.sourceMaps.forEach(file => {
ioHost.writeFile(file.fileName, file.code, false);
});
}, () => { }, this.compileOptions);
}
public compileFiles(inputFiles: { unitName: string; content: string }[],
otherFiles: { unitName: string; content?: string }[],
onComplete: (result: CompilerResult) => void,
onComplete: (result: CompilerResult, checker: ts.TypeChecker) => void,
settingsCallback?: (settings: ts.CompilerOptions) => void,
options?: ts.CompilerOptions) {
@@ -695,6 +697,10 @@ module Harness {
sys.newLine = setting.value;
break;
case 'comments':
options.removeComments = setting.value === 'false';
break;
case 'mapsourcefiles':
case 'maproot':
case 'generatedeclarationfiles':
@@ -702,7 +708,6 @@ module Harness {
case 'gatherDiagnostics':
case 'codepage':
case 'createFileLog':
case 'comments':
case 'filename':
case 'propagateenumconstants':
case 'removecomments':
@@ -755,7 +760,7 @@ module Harness {
var result = new CompilerResult(fileOutputs, errors, []);
// Covert the source Map data into the baseline
result.updateSourceMapRecord(program, emitResult ? emitResult.sourceMaps : undefined);
onComplete(result);
onComplete(result, checker);
// reset what newline means in case the last test changed it
sys.newLine = '\r\n';
@@ -764,7 +769,8 @@ module Harness {
}
export function getMinimalDiagnostic(err: ts.Diagnostic): MinimalDiagnostic {
return { filename: err.file && err.file.filename, start: err.start, end: err.start + err.length, line: 0, character: 0, message: err.messageText };
var errorLineInfo = err.file ? err.file.getLineAndCharacterFromPosition(err.start) : { line: 0, character: 0 };
return { filename: err.file && err.file.filename, start: err.start, end: err.start + err.length, line: errorLineInfo.line, character: errorLineInfo.character, message: err.messageText };
}
export function getErrorBaseline(inputFiles: { unitName: string; content: string }[],
+6 -6
View File
@@ -167,7 +167,6 @@ module Harness.LanguageService {
}
export class TypeScriptLS implements ts.LanguageServiceShimHost {
private ls: ts.LanguageServiceShim = null;
public newLS: ts.LanguageService;
private fileNameToScript: ts.Map<ScriptInfo> = {};
@@ -268,12 +267,13 @@ module Harness.LanguageService {
* To access the non-shim (i.e. actual) language service, use the "ls.languageService" property.
*/
public getLanguageService(): ts.LanguageServiceShim {
var ls = new TypeScript.Services.TypeScriptServicesFactory().createLanguageServiceShim(this);
this.ls = ls;
var hostAdapter = new LanguageServiceShimHostAdapter(this);
this.ls = new TypeScript.Services.TypeScriptServicesFactory().createLanguageServiceShim(this);
return this.ls;
}
this.newLS = ts.createLanguageService(hostAdapter, NonCachingDocumentRegistry.Instance);
return ls;
/** Return a new instance of the classifier service shim */
public getClassifier(): ts.ClassifierShim {
return new TypeScript.Services.TypeScriptServicesFactory().createClassifierShim(this);
}
/** Parse file given its source text */
+5 -8
View File
@@ -68,17 +68,11 @@ if (testConfigFile !== '') {
runners.push(new GeneratedFourslashRunner());
break;
case 'unittests':
runners.push(new UnitTestRunner(UnittestTestType.Compiler));
runners.push(new UnitTestRunner());
break;
case 'rwc':
runners.push(new RWCRunner());
break;
case 'ls':
runners.push(new UnitTestRunner(UnittestTestType.LanguageService));
break;
case 'services':
runners.push(new UnitTestRunner(UnittestTestType.Services));
break;
case 'reverse':
reverse = true;
break;
@@ -96,9 +90,12 @@ if (runners.length === 0) {
runners.push(new ProjectRunner());
}
//// language services
// language services
runners.push(new FourslashRunner());
//runners.push(new GeneratedFourslashRunner());
// unittests
runners.push(new UnitTestRunner());
}
sys.newLine = '\r\n';
+21 -10
View File
@@ -102,7 +102,12 @@ module RWC {
getSourceFile: (fileName, languageVersion) => {
var fileContents: string;
try {
fileContents = sys.readFile(fileName);
if (libPath === fileName) {
fileContents = Harness.IO.readFile(Harness.libFolder + "lib.d.ts");
}
else {
fileContents = sys.readFile(fileName);
}
}
catch (e) {
// Leave fileContents undefined;
@@ -134,9 +139,14 @@ module RWC {
// Load the files
inputList.forEach((item: string) => {
var resolvedPath = Harness.Path.switchToForwardSlashes(sys.resolvePath(item));
var resolvedPath = libPath === item ? item : Harness.Path.switchToForwardSlashes(sys.resolvePath(item));
try {
var content = sys.readFile(resolvedPath);
if (libPath === item) {
var content = Harness.IO.readFile(Harness.libFolder + "lib.d.ts");
}
else {
var content = sys.readFile(resolvedPath);
}
}
catch (e) {
// Leave content undefined.
@@ -148,13 +158,16 @@ module RWC {
// Emit the results
harnessCompiler.emitAll(emitterIOHost);
harnessCompiler.emitAllDeclarations();
var compilationErrors = harnessCompiler.reportCompilationErrors();
// Create an error baseline
compilationErrors.forEach(err => {
errors += err.filename + ' line ' + err.line + ': ' + err.message + '\r\n';
if (err.filename) {
errors += err.filename + ' (' + err.line + "," + err.character + "): " + err.message + '\r\n';
}
else {
errors += err.message + '\r\n';
}
});
});
});
@@ -165,25 +178,23 @@ module RWC {
it('has the expected emitted code', () => {
Harness.Baseline.runBaseline('has the expected emitted code', baseName + '.output.js', () => {
return collateOutputs(emitterIOHost, fn => fn.substr(fn.length - '.js'.length) === '.js', s => SyntacticCleaner.clean(s));
return collateOutputs(emitterIOHost, fn => Harness.Compiler.isJS(fn), s => SyntacticCleaner.clean(s));
}, false, baselineOpts);
});
it('has the expected declaration file content', () => {
Harness.Baseline.runBaseline('has the expected declaration file content', baseName + '.d.ts', () => {
var result = collateOutputs(emitterIOHost, fn => fn.substr(fn.length - '.d.ts'.length) === '.d.ts');
var result = collateOutputs(emitterIOHost, fn => Harness.Compiler.isDTS(fn));
return result.length > 0 ? result : null;
}, false, baselineOpts);
});
/*
it('has the expected source maps', () => {
Harness.Baseline.runBaseline('has the expected source maps', baseName + '.map', () => {
var result = collateOutputs(emitterIOHost, fn => fn.substr(fn.length - '.map'.length) === '.map');
return result.length > 0 ? result : null;
}, false, baselineOpts);
});
*/
it('has the expected errors', () => {
Harness.Baseline.runBaseline('has the expected errors', baseName + '.errors.txt', () => {
+83 -164
View File
@@ -1,180 +1,99 @@
/** TODO: Rewrite entirely **/
class TypeWriterWalker {
constructor(public filename: string, public compiler: any) {
}
public run() { }
public results: any[];
interface TypeWriterResult {
line: number;
column: number;
syntaxKind: string;
identifierName: string;
type: string;
}
/*
class TypeWriterWalker extends TypeScript.SyntaxWalker {
private document: TypeScript.Document;
private syntaxTree: TypeScript.SyntaxTree;
private text: TypeScript.ISimpleText;
private currentPosition = 0;
class TypeWriterWalker {
results: TypeWriterResult[];
currentSourceFile: ts.SourceFile;
public results: {
line: number;
column: number;
syntaxKind: string;
identifierName: string;
type: string;
}[] = [];
constructor(public filename: string, public compiler: TypeScript.TypeScriptCompiler) {
super();
this.document = compiler.getDocument(filename);
this.syntaxTree = this.document.syntaxTree();
this.text = this.syntaxTree.text;
constructor(public checker: ts.TypeChecker) {
}
public run() {
TypeScript.visitNodeOrToken(this, this.syntaxTree.sourceUnit());
public getTypes(fileName: string): TypeWriterResult[] {
var sourceFile = this.checker.getProgram().getSourceFile(fileName);
this.currentSourceFile = sourceFile;
this.results = [];
this.visitNode(sourceFile);
return this.results;
}
private isName(token: TypeScript.ISyntaxToken) {
var parent = token.parent;
private visitNode(node: ts.Node): void {
switch (node.kind) {
// Should always log expressions that are not tokens
// Also, always log the "this" keyword
// TODO: Ideally we should log all expressions, but to compare to the
// old typeWriter baselines, suppress tokens
case ts.SyntaxKind.ThisKeyword:
case ts.SyntaxKind.RegularExpressionLiteral:
case ts.SyntaxKind.ArrayLiteral:
case ts.SyntaxKind.ObjectLiteral:
case ts.SyntaxKind.PropertyAccess:
case ts.SyntaxKind.IndexedAccess:
case ts.SyntaxKind.CallExpression:
case ts.SyntaxKind.NewExpression:
case ts.SyntaxKind.TypeAssertion:
case ts.SyntaxKind.ParenExpression:
case ts.SyntaxKind.FunctionExpression:
case ts.SyntaxKind.ArrowFunction:
case ts.SyntaxKind.PrefixOperator:
case ts.SyntaxKind.PostfixOperator:
case ts.SyntaxKind.BinaryExpression:
case ts.SyntaxKind.ConditionalExpression:
this.log(node, this.getTypeOfNode(node));
break;
switch (parent.kind()) {
case TypeScript.SyntaxKind.ContinueStatement:
return (<TypeScript.ContinueStatementSyntax>parent).identifier === token;
case TypeScript.SyntaxKind.BreakStatement:
return (<TypeScript.BreakStatementSyntax>parent).identifier === token;
case TypeScript.SyntaxKind.LabeledStatement:
return (<TypeScript.LabeledStatementSyntax>parent).identifier === token;
// Should not change expression status (maybe expressions)
// TODO: Again, ideally should log number and string literals too,
// but to be consistent with the old typeWriter, just log identifiers
case ts.SyntaxKind.Identifier:
var identifier = <ts.Identifier>node;
if (!this.isLabel(identifier)) {
var type = this.getTypeOfNode(identifier);
this.log(node, type);
}
break;
}
ts.forEachChild(node, child => this.visitNode(child));
}
private isLabel(identifier: ts.Identifier): boolean {
var parent = identifier.parent;
switch (parent.kind) {
case ts.SyntaxKind.ContinueStatement:
case ts.SyntaxKind.BreakStatement:
return (<ts.BreakOrContinueStatement>parent).label === identifier;
case ts.SyntaxKind.LabelledStatement:
return (<ts.LabelledStatement>parent).label === identifier;
}
return false;
}
public visitToken(token: TypeScript.ISyntaxToken) {
if (token.kind() === TypeScript.SyntaxKind.IdentifierName) {
if (!this.isName(token)) {
this.log(token);
}
} else if (token.kind() === TypeScript.SyntaxKind.ThisKeyword) {
this.log(token);
}
return super.visitToken(token);
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 sourceText = ts.getSourceTextOfNodeFromSourceText(this.currentSourceFile.text, node);
var isUnknownType = (<ts.IntrinsicType>type).intrinsicName === "unknown";
// 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,
syntaxKind: ts.SyntaxKind[node.kind],
identifierName: sourceText,
type: isUnknownType ? sourceText : this.checker.typeToString(type)
});
}
public visitNode(node: TypeScript.ISyntaxNode) {
return super.visitNode(node);
}
private getAstForElement(element: TypeScript.ISyntaxElement) {
if (!TypeScript.isShared(element)) {
return element;
}
}
private getEnclosingScopeSymbol(ast: TypeScript.ISyntaxElement): TypeScript.PullSymbol {
var enclosingScopeAST = TypeScript.DeclarationEmitter.getEnclosingContainer(ast);
if (enclosingScopeAST) {
var typeInfo = this.compiler.pullGetSymbolInformationFromAST(enclosingScopeAST, this.document);
return typeInfo ? typeInfo.symbol : null;
}
return null;
}
private getTypeOfElement(element: TypeScript.ISyntaxElement) {
var ast = this.getAstForElement(element);
if (ast) {
var typeInfo = this.compiler.pullGetSymbolInformationFromAST(ast, this.document);
if (typeInfo.symbol && typeInfo.symbol.type) {
var enclosingScope = this.getEnclosingScopeSymbol(ast);
return typeInfo.symbol.type.toString(enclosingScope);
}
}
return "<unknown>";
}
public visitPrefixUnaryExpression(node: TypeScript.PrefixUnaryExpressionSyntax) {
this.log(node);
return super.visitPrefixUnaryExpression(node);
}
public visitArrayLiteralExpression(node: TypeScript.ArrayLiteralExpressionSyntax) {
this.log(node);
return super.visitArrayLiteralExpression(node);
}
public visitOmittedExpression(node: TypeScript.OmittedExpressionSyntax) {
this.log(node);
return super.visitOmittedExpression(node);
}
public visitParenthesizedExpression(node: TypeScript.ParenthesizedExpressionSyntax) {
this.log(node);
return super.visitParenthesizedExpression(node);
}
public visitSimpleArrowFunctionExpression(node: TypeScript.SimpleArrowFunctionExpressionSyntax) {
this.log(node);
return super.visitSimpleArrowFunctionExpression(node);
}
public visitParenthesizedArrowFunctionExpression(node: TypeScript.ParenthesizedArrowFunctionExpressionSyntax) {
this.log(node);
return super.visitParenthesizedArrowFunctionExpression(node);
}
public visitObjectCreationExpression(node: TypeScript.ObjectCreationExpressionSyntax) {
this.log(node);
return super.visitObjectCreationExpression(node);
}
public visitCastExpression(node: TypeScript.CastExpressionSyntax) {
this.log(node);
return super.visitCastExpression(node);
}
public visitObjectLiteralExpression(node: TypeScript.ObjectLiteralExpressionSyntax) {
this.log(node);
return super.visitObjectLiteralExpression(node);
}
public visitFunctionExpression(node: TypeScript.FunctionExpressionSyntax) {
this.log(node);
return super.visitFunctionExpression(node);
}
public visitTypeOfExpression(node: TypeScript.TypeOfExpressionSyntax) {
this.log(node);
return super.visitTypeOfExpression(node);
}
public visitDeleteExpression(node: TypeScript.DeleteExpressionSyntax) {
this.log(node);
return super.visitDeleteExpression(node);
}
public visitVoidExpression(node: TypeScript.VoidExpressionSyntax) {
this.log(node);
return super.visitVoidExpression(node);
}
public visitMemberAccessExpression(node: TypeScript.MemberAccessExpressionSyntax) {
this.log(node);
return super.visitMemberAccessExpression(node);
}
public visitPostfixUnaryExpression(node: TypeScript.PostfixUnaryExpressionSyntax) {
this.log(node);
return super.visitPostfixUnaryExpression(node);
}
public visitElementAccessExpression(node: TypeScript.ElementAccessExpressionSyntax) {
this.log(node);
return super.visitElementAccessExpression(node);
}
public visitInvocationExpression(node: TypeScript.InvocationExpressionSyntax) {
this.log(node);
return super.visitInvocationExpression(node);
}
public visitBinaryExpression(node: TypeScript.BinaryExpressionSyntax) {
this.log(node);
return super.visitBinaryExpression(node);
}
public visitConditionalExpression(node: TypeScript.ConditionalExpressionSyntax) {
this.log(node);
return super.visitConditionalExpression(node);
}
public log(node: TypeScript.ISyntaxNodeOrToken) {
var _fullStart = TypeScript.fullStart(node);
if (_fullStart >= 0) {
var pos = this.document.lineMap().getLineAndCharacterFromPosition(_fullStart);
this.results.push({ line: pos.line(), column: pos.character(), syntaxKind: TypeScript.SyntaxKind[node.kind()], identifierName: TypeScript.fullText(node, this.text).trim(), type: this.getTypeOfElement(node) });
}
private getTypeOfNode(node: ts.Node): ts.Type {
var type = this.checker.getTypeOfNode(node);
ts.Debug.assert(type, "type doesn't exist");
return type;
}
}
*/
+6 -22
View File
@@ -1,31 +1,13 @@
///<reference path="harness.ts" />
///<reference path="runnerbase.ts" />
enum UnittestTestType {
Compiler,
LanguageService,
Services,
}
class UnitTestRunner extends RunnerBase {
constructor(public testType?: UnittestTestType) {
constructor() {
super();
}
public initializeTests() {
switch (this.testType) {
case UnittestTestType.Compiler:
this.tests = this.enumerateFiles('tests/cases/unittests/compiler');
break;
case UnittestTestType.LanguageService:
this.tests = this.enumerateFiles('tests/cases/unittests/ls');
break;
default:
if (this.tests.length === 0) {
throw new Error('Unsupported test cases: ' + this.testType);
}
break;
}
this.tests = this.enumerateFiles('tests/cases/unittests/services');
var outfile = new Harness.Compiler.WriterAggregator()
var outerr = new Harness.Compiler.WriterAggregator();
@@ -38,7 +20,7 @@ class UnitTestRunner extends RunnerBase {
});
harnessCompiler.addInputFiles(toBeAdded);
harnessCompiler.setCompilerOptions({ noResolve: true });
var stdout = new Harness.Compiler.EmitterIOHost();
var emitDiagnostics = harnessCompiler.emitAll(stdout);
var results = stdout.toArray();
@@ -59,7 +41,9 @@ class UnitTestRunner extends RunnerBase {
before: before,
after: after,
Harness: Harness,
IO: Harness.IO
IO: Harness.IO,
ts: ts,
TypeScript: TypeScript
// FourSlash: FourSlash
};
}
+2 -2
View File
@@ -732,14 +732,14 @@ module TypeScript.ASTHelpers {
return false;
}
export function getNameOfIdenfierOrQualifiedName(name: ISyntaxElement): string {
export function getNameOfIdentifierOrQualifiedName(name: ISyntaxElement): string {
if (name.kind() === SyntaxKind.IdentifierName) {
return (<ISyntaxToken>name).text();
}
else {
Debug.assert(name.kind() == SyntaxKind.QualifiedName);
var dotExpr = <QualifiedNameSyntax>name;
return getNameOfIdenfierOrQualifiedName(dotExpr.left) + "." + getNameOfIdenfierOrQualifiedName(dotExpr.right);
return getNameOfIdentifierOrQualifiedName(dotExpr.left) + "." + getNameOfIdentifierOrQualifiedName(dotExpr.right);
}
}
+2 -2
View File
@@ -969,7 +969,7 @@ module TypeScript {
this.declFile.WriteLine("require(" + (<ExternalModuleReferenceSyntax>importDeclAST.moduleReference).stringLiteral.text() + ");");
}
else {
this.declFile.WriteLine(ASTHelpers.getNameOfIdenfierOrQualifiedName((<ModuleNameModuleReferenceSyntax>importDeclAST.moduleReference).moduleName) + ";");
this.declFile.WriteLine(ASTHelpers.getNameOfIdentifierOrQualifiedName((<ModuleNameModuleReferenceSyntax>importDeclAST.moduleReference).moduleName) + ";");
}
}
}
@@ -1023,7 +1023,7 @@ module TypeScript {
this.declFile.Write(moduleDecl.stringLiteral.text());
}
else {
this.declFile.Write(ASTHelpers.getNameOfIdenfierOrQualifiedName(moduleDecl.name));
this.declFile.Write(ASTHelpers.getNameOfIdentifierOrQualifiedName(moduleDecl.name));
}
this.declFile.WriteLine(" {");
+180 -108
View File
@@ -310,6 +310,7 @@ module ts {
public filename: string;
public text: string;
public getLineAndCharacterFromPosition(position: number): { line: number; character: number } { return null; }
public getPositionFromLineAndCharacter(line: number, character: number): number { return -1; }
public amdDependencies: string[];
public referencedFiles: FileReference[];
public syntacticErrors: Diagnostic[];
@@ -657,6 +658,7 @@ module ts {
InMultiLineCommentTrivia,
InSingleQuoteStringLiteral,
InDoubleQuoteStringLiteral,
EndingWithDotToken,
}
export enum TokenClass {
@@ -691,8 +693,7 @@ module ts {
compilationSettings: CompilerOptions,
scriptSnapshot: TypeScript.IScriptSnapshot,
version: number,
isOpen: boolean,
referencedFiles: string[]): SourceFile;
isOpen: boolean): SourceFile;
updateDocument(
sourceFile: SourceFile,
@@ -1488,7 +1489,7 @@ module ts {
sourceFile = documentRegistry.updateDocument(sourceFile, filename, compilationSettings, scriptSnapshot, version, isOpen, textChangeRange);
}
else {
sourceFile = documentRegistry.acquireDocument(filename, compilationSettings, scriptSnapshot, version, isOpen, []);
sourceFile = documentRegistry.acquireDocument(filename, compilationSettings, scriptSnapshot, version, isOpen);
}
// Remeber the new sourceFile
@@ -1779,7 +1780,7 @@ module ts {
// Right of dot member completion list
if (isRightOfDot) {
var type: Type = typeInfoResolver.getTypeOfExpression(mappedNode);
var type: ApparentType = typeInfoResolver.getApparentType(typeInfoResolver.getTypeOfNode(mappedNode));
if (!type) {
return undefined;
}
@@ -2758,50 +2759,41 @@ module ts {
}
/// Classifier
export function createClassifier(host: Logger): Classifier {
var scanner: TypeScript.Scanner.IScanner;
var lastDiagnosticKey: string = null;
var noRegexTable: boolean[];
var reportDiagnostic = (position: number, fullWidth: number, key: string, args: any[]) => {
lastDiagnosticKey = key;
};
if (!noRegexTable) {
noRegexTable = [];
noRegexTable[TypeScript.SyntaxKind.IdentifierName] = true;
noRegexTable[TypeScript.SyntaxKind.StringLiteral] = true;
noRegexTable[TypeScript.SyntaxKind.NumericLiteral] = true;
noRegexTable[TypeScript.SyntaxKind.RegularExpressionLiteral] = true;
noRegexTable[TypeScript.SyntaxKind.ThisKeyword] = true;
noRegexTable[TypeScript.SyntaxKind.PlusPlusToken] = true;
noRegexTable[TypeScript.SyntaxKind.MinusMinusToken] = true;
noRegexTable[TypeScript.SyntaxKind.CloseParenToken] = true;
noRegexTable[TypeScript.SyntaxKind.CloseBracketToken] = true;
noRegexTable[TypeScript.SyntaxKind.CloseBraceToken] = true;
noRegexTable[TypeScript.SyntaxKind.TrueKeyword] = true;
noRegexTable[TypeScript.SyntaxKind.FalseKeyword] = true;
}
var scanner: Scanner;
var noRegexTable: boolean[];
/// We do not have a full parser support to know when we should parse a regex or not
/// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where
/// we have a series of divide operator. this list allows us to be more accurate by ruling out
/// locations where a regexp cannot exist.
if (!noRegexTable) { noRegexTable = []; noRegexTable[SyntaxKind.Identifier] = true; noRegexTable[SyntaxKind.StringLiteral] = true; noRegexTable[SyntaxKind.NumericLiteral] = true; noRegexTable[SyntaxKind.RegularExpressionLiteral] = true; noRegexTable[SyntaxKind.ThisKeyword] = true; noRegexTable[SyntaxKind.PlusPlusToken] = true; noRegexTable[SyntaxKind.MinusMinusToken] = true; noRegexTable[SyntaxKind.CloseParenToken] = true; noRegexTable[SyntaxKind.CloseBracketToken] = true; noRegexTable[SyntaxKind.CloseBraceToken] = true; noRegexTable[SyntaxKind.TrueKeyword] = true; noRegexTable[SyntaxKind.FalseKeyword] = true; }
function getClassificationsForLine(text: string, lexState: EndOfLineState): ClassificationResult {
var offset = 0;
if (lexState !== EndOfLineState.Start) {
// If we're in a string literal, then prepend: "\
// (and a newline). That way when we lex we'll think we're still in a string literal.
//
// If we're in a multiline comment, then prepend: /*
// (and a newline). That way when we lex we'll think we're still in a multiline comment.
if (lexState === EndOfLineState.InDoubleQuoteStringLiteral) {
text = '"\\\n' + text;
}
else if (lexState === EndOfLineState.InSingleQuoteStringLiteral) {
text = "'\\\n" + text;
}
else if (lexState === EndOfLineState.InMultiLineCommentTrivia) {
text = "/*\n" + text;
}
var lastTokenOrCommentEnd = 0;
var lastToken = SyntaxKind.Unknown;
var inUnterminatedMultiLineComment = false;
offset = 3;
// If we're in a string literal, then prepend: "\
// (and a newline). That way when we lex we'll think we're still in a string literal.
//
// If we're in a multiline comment, then prepend: /*
// (and a newline). That way when we lex we'll think we're still in a multiline comment.
switch (lexState) {
case EndOfLineState.InDoubleQuoteStringLiteral:
text = '"\\\n' + text;
offset = 3;
break;
case EndOfLineState.InSingleQuoteStringLiteral:
text = "'\\\n" + text;
offset = 3;
break;
case EndOfLineState.InMultiLineCommentTrivia:
text = "/*\n" + text;
offset = 3;
break;
case EndOfLineState.EndingWithDotToken:
lastToken = SyntaxKind.DotToken;
break;
}
var result: ClassificationResult = {
@@ -2809,94 +2801,174 @@ module ts {
entries: []
};
var simpleText = TypeScript.SimpleText.fromString(text);
scanner = TypeScript.Scanner.createScanner(ScriptTarget.ES5, simpleText, reportDiagnostic);
scanner = createScanner(ScriptTarget.ES5, text, onError, processComment);
var lastTokenKind = TypeScript.SyntaxKind.None;
var token: TypeScript.ISyntaxToken = null;
var token = SyntaxKind.Unknown;
do {
lastDiagnosticKey = null;
token = scanner.scan();
token = scanner.scan(!noRegexTable[lastTokenKind]);
lastTokenKind = token.kind();
processToken(text, simpleText, offset, token, result);
}
while (token.kind() !== TypeScript.SyntaxKind.EndOfFileToken);
lastDiagnosticKey = null;
return result;
}
function processToken(text: string, simpleText: TypeScript.ISimpleText, offset: number, token: TypeScript.ISyntaxToken, result: ClassificationResult): void {
processTriviaList(text, offset, token.leadingTrivia(simpleText), result);
addResult(text, offset, result, TypeScript.width(token), token.kind());
processTriviaList(text, offset, token.trailingTrivia(simpleText), result);
if (TypeScript.fullEnd(token) >= text.length) {
// We're at the end.
if (lastDiagnosticKey === TypeScript.DiagnosticCode.AsteriskSlash_expected) {
result.finalLexState = EndOfLineState.InMultiLineCommentTrivia;
return;
if ((token === SyntaxKind.SlashToken || token === SyntaxKind.SlashEqualsToken) && !noRegexTable[lastToken]) {
if (scanner.reScanSlashToken() === SyntaxKind.RegularExpressionLiteral) {
token = SyntaxKind.RegularExpressionLiteral;
}
}
else if (lastToken === SyntaxKind.DotToken) {
token = SyntaxKind.Identifier;
}
if (token.kind() === TypeScript.SyntaxKind.StringLiteral) {
var tokenText = token.text();
if (tokenText.length > 0 && tokenText.charCodeAt(tokenText.length - 1) === TypeScript.CharacterCodes.backslash) {
var quoteChar = tokenText.charCodeAt(0);
result.finalLexState = quoteChar === TypeScript.CharacterCodes.doubleQuote
? EndOfLineState.InDoubleQuoteStringLiteral
: EndOfLineState.InSingleQuoteStringLiteral;
return;
lastToken = token;
processToken();
}
while (token !== SyntaxKind.EndOfFileToken);
return result;
function onError(message: DiagnosticMessage): void {
inUnterminatedMultiLineComment = message.key === Diagnostics.Asterisk_Slash_expected.key;
}
function processComment(start: number, end: number) {
// add Leading white spaces
addLeadingWhiteSpace(start, end);
// add the comment
addResult(end - start, TokenClass.Comment);
}
function processToken(): void {
var start = scanner.getTokenPos();
var end = scanner.getTextPos();
// add Leading white spaces
addLeadingWhiteSpace(start, end);
// add the token
addResult(end - start, classFromKind(token));
if (end >= text.length) {
// We're at the end.
if (inUnterminatedMultiLineComment) {
result.finalLexState = EndOfLineState.InMultiLineCommentTrivia;
}
else if (token === SyntaxKind.StringLiteral) {
var tokenText = scanner.getTokenText();
if (tokenText.length > 0 && tokenText.charCodeAt(tokenText.length - 1) === CharacterCodes.backslash) {
var quoteChar = tokenText.charCodeAt(0);
result.finalLexState = quoteChar === CharacterCodes.doubleQuote
? EndOfLineState.InDoubleQuoteStringLiteral
: EndOfLineState.InSingleQuoteStringLiteral;
}
}
else if (token === SyntaxKind.DotToken) {
result.finalLexState = EndOfLineState.EndingWithDotToken;
}
}
}
}
function processTriviaList(text: string, offset: number, triviaList: TypeScript.ISyntaxTriviaList, result: ClassificationResult): void {
for (var i = 0, n = triviaList.count(); i < n; i++) {
var trivia = triviaList.syntaxTriviaAt(i);
addResult(text, offset, result, trivia.fullWidth(), trivia.kind());
}
}
function addResult(text: string, offset: number, result: ClassificationResult, length: number, kind: TypeScript.SyntaxKind): void {
if (length > 0) {
// If this is the first classification we're adding to the list, then remove any
// offset we have if we were continuing a construct from the previous line.
if (result.entries.length === 0) {
length -= offset;
function addLeadingWhiteSpace(start: number, end: number): void {
if (start > lastTokenOrCommentEnd) {
addResult(start - lastTokenOrCommentEnd, TokenClass.Whitespace);
}
result.entries.push({ length: length, classification: classFromKind(kind) });
// Remeber the end of the last token
lastTokenOrCommentEnd = end;
}
function addResult(length: number, classification: TokenClass): void {
if (length > 0) {
// If this is the first classification we're adding to the list, then remove any
// offset we have if we were continuing a construct from the previous line.
if (result.entries.length === 0) {
length -= offset;
}
result.entries.push({ length: length, classification: classification });
}
}
}
function classFromKind(kind: TypeScript.SyntaxKind) {
if (TypeScript.SyntaxFacts.isAnyKeyword(kind)) {
function isBinaryExpressionOperatorToken(token: SyntaxKind): boolean {
switch (token) {
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.LessThanLessThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
case SyntaxKind.LessThanToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.InstanceOfKeyword:
case SyntaxKind.InKeyword:
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.EqualsEqualsEqualsToken:
case SyntaxKind.ExclamationEqualsEqualsToken:
case SyntaxKind.AmpersandToken:
case SyntaxKind.CaretToken:
case SyntaxKind.BarToken:
case SyntaxKind.AmpersandAmpersandToken:
case SyntaxKind.BarBarToken:
case SyntaxKind.BarEqualsToken:
case SyntaxKind.AmpersandEqualsToken:
case SyntaxKind.CaretEqualsToken:
case SyntaxKind.LessThanLessThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
case SyntaxKind.PlusEqualsToken:
case SyntaxKind.MinusEqualsToken:
case SyntaxKind.AsteriskEqualsToken:
case SyntaxKind.SlashEqualsToken:
case SyntaxKind.PercentEqualsToken:
case SyntaxKind.EqualsToken:
case SyntaxKind.CommaToken:
return true;
default: return false;
}
}
function isPrefixUnaryExpressionOperatorToken(token: SyntaxKind): boolean {
switch (token) {
case SyntaxKind.PlusToken:
case SyntaxKind.MinusToken:
case SyntaxKind.TildeToken:
case SyntaxKind.ExclamationToken:
case SyntaxKind.PlusPlusToken:
case SyntaxKind.MinusMinusToken:
return true;
default:
return false;
}
}
function isKeyword(token: SyntaxKind): boolean {
return token >= SyntaxKind.FirstKeyword && token <= SyntaxKind.LastKeyword;
}
function classFromKind(token: SyntaxKind) {
if (isKeyword(token)) {
return TokenClass.Keyword;
}
else if (TypeScript.SyntaxFacts.isBinaryExpressionOperatorToken(kind) ||
TypeScript.SyntaxFacts.isPrefixUnaryExpressionOperatorToken(kind)) {
else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) {
return TokenClass.Operator;
}
else if (TypeScript.SyntaxFacts.isAnyPunctuation(kind)) {
else if (token >= SyntaxKind.FirstPunctuation && token <= SyntaxKind.LastPunctuation) {
return TokenClass.Punctuation;
}
switch (kind) {
case TypeScript.SyntaxKind.WhitespaceTrivia:
return TokenClass.Whitespace;
case TypeScript.SyntaxKind.MultiLineCommentTrivia:
case TypeScript.SyntaxKind.SingleLineCommentTrivia:
return TokenClass.Comment;
case TypeScript.SyntaxKind.NumericLiteral:
switch (token) {
case SyntaxKind.NumericLiteral:
return TokenClass.NumberLiteral;
case TypeScript.SyntaxKind.StringLiteral:
case SyntaxKind.StringLiteral:
return TokenClass.StringLiteral;
case TypeScript.SyntaxKind.RegularExpressionLiteral:
case SyntaxKind.RegularExpressionLiteral:
return TokenClass.RegExpLiteral;
case TypeScript.SyntaxKind.IdentifierName:
case SyntaxKind.Identifier:
default:
return TokenClass.Identifier;
}
+2 -2
View File
@@ -840,8 +840,8 @@ module ts {
public createLanguageServiceShim(host: LanguageServiceShimHost): LanguageServiceShim {
try {
var hostAdapter = new LanguageServiceShimHostAdapter(host);
var pullLanguageService = createLanguageService(hostAdapter, this.documentRegistry);
return new LanguageServiceShimObject(this, host, pullLanguageService);
var languageService = createLanguageService(hostAdapter, this.documentRegistry);
return new LanguageServiceShimObject(this, host, languageService);
}
catch (err) {
logInternalError(host, err);
+40
View File
@@ -0,0 +1,40 @@
=== tests/cases/compiler/2dArrays.ts ===
class Cell {
>Cell : Cell
}
class Ship {
>Ship : Ship
isSunk: boolean;
>isSunk : boolean
}
class Board {
>Board : Board
ships: Ship[];
>ships : Ship[]
>Ship : Ship
cells: Cell[];
>cells : Cell[]
>Cell : Cell
private allShipsSunk() {
>allShipsSunk : () => boolean
return this.ships.every(function (val) { return val.isSunk; });
>this.ships.every(function (val) { return val.isSunk; }) : boolean
>this.ships.every : (callbackfn: (value: Ship, index: number, array: Ship[]) => boolean, thisArg?: any) => boolean
>this.ships : Ship[]
>this : Board
>ships : Ship[]
>every : (callbackfn: (value: Ship, index: number, array: Ship[]) => boolean, thisArg?: any) => boolean
>function (val) { return val.isSunk; } : (val: Ship) => boolean
>val : Ship
>val.isSunk : boolean
>val : Ship
>isSunk : boolean
}
}
@@ -0,0 +1,33 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts ===
declare module Point {
>Point : typeof Point
export var Origin: { x: number; y: number; }
>Origin : { x: number; y: number; }
>x : number
>y : number
}
=== tests/cases/conformance/internalModules/DeclarationMerging/function.d.ts ===
declare function Point(): { x: number; y: number; }
>Point : typeof Point
>x : number
>y : number
=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts ===
var cl: { x: number; y: number; }
>cl : { x: number; y: number; }
>x : number
>y : number
var cl = Point();
>cl : { x: number; y: number; }
>Point() : { x: number; y: number; }
>Point : typeof Point
var cl = Point.Origin;
>cl : { x: number; y: number; }
>Point.Origin : { x: number; y: number; }
>Point : typeof Point
>Origin : { x: number; y: number; }
@@ -28,4 +28,4 @@ var p = new A.Point(0, 0); // unexpected error here, bug 840000
//// [test.js]
var p;
var p = A.Point.Origin;
var p = new A.Point(0, 0);
var p = new A.Point(0, 0); // unexpected error here, bug 840000
@@ -0,0 +1,59 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts ===
declare module A {
>A : typeof A
export module Point {
>Point : typeof Point
export var Origin: {
>Origin : { x: number; y: number; }
x: number;
>x : number
y: number;
>y : number
}
}
}
=== tests/cases/conformance/internalModules/DeclarationMerging/class.d.ts ===
declare module A {
>A : typeof A
export class Point {
>Point : Point
constructor(x: number, y: number);
>x : number
>y : number
x: number;
>x : number
y: number;
>y : number
}
}
=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts ===
var p: { x: number; y: number; }
>p : { x: number; y: number; }
>x : number
>y : number
var p = A.Point.Origin;
>p : { x: number; y: number; }
>A.Point.Origin : { x: number; y: number; }
>A.Point : typeof Point
>A : typeof A
>Point : typeof Point
>Origin : { x: number; y: number; }
var p = new A.Point(0, 0); // unexpected error here, bug 840000
>p : { x: number; y: number; }
>new A.Point(0, 0) : Point
>A.Point : typeof Point
>A : typeof A
>Point : typeof Point
@@ -37,4 +37,4 @@ var A;
//// [test.js]
var p;
var p = A.Point.Origin;
var p = new A.Point(0, 0);
var p = new A.Point(0, 0); // unexpected error here, bug 840000
@@ -0,0 +1,53 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts ===
declare module A {
>A : typeof A
export module Point {
>Point : typeof Point
export var Origin: {
>Origin : { x: number; y: number; }
x: number;
>x : number
y: number;
>y : number
}
}
}
=== tests/cases/conformance/internalModules/DeclarationMerging/classPoint.ts ===
module A {
>A : typeof A
export class Point {
>Point : Point
constructor(public x: number, public y: number) { }
>x : number
>y : number
}
}
=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts ===
var p: { x: number; y: number; }
>p : { x: number; y: number; }
>x : number
>y : number
var p = A.Point.Origin;
>p : { x: number; y: number; }
>A.Point.Origin : { x: number; y: number; }
>A.Point : typeof Point
>A : typeof A
>Point : typeof Point
>Origin : { x: number; y: number; }
var p = new A.Point(0, 0); // unexpected error here, bug 840000
>p : { x: number; y: number; }
>new A.Point(0, 0) : Point
>A.Point : typeof Point
>A : typeof A
>Point : typeof Point
@@ -0,0 +1,37 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts ===
declare module Point {
>Point : typeof Point
export var Origin: { x: number; y: number; }
>Origin : { x: number; y: number; }
>x : number
>y : number
}
=== tests/cases/conformance/internalModules/DeclarationMerging/function.ts ===
function Point() {
>Point : typeof Point
return { x: 0, y: 0 };
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
}
=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts ===
var cl: { x: number; y: number; }
>cl : { x: number; y: number; }
>x : number
>y : number
var cl = Point();
>cl : { x: number; y: number; }
>Point() : { x: number; y: number; }
>Point : typeof Point
var cl = Point.Origin;
>cl : { x: number; y: number; }
>Point.Origin : { x: number; y: number; }
>Point : typeof Point
>Origin : { x: number; y: number; }
@@ -50,6 +50,7 @@ module clodule4 {
//// [ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.js]
// all expected to be errors
var clodule1 = (function () {
function clodule1() {
}
@@ -25,6 +25,7 @@ var clodule = (function () {
})();
var clodule;
(function (clodule) {
// error: duplicate identifier expected
function fn(x, y) {
return x;
}
@@ -25,6 +25,7 @@ var clodule = (function () {
})();
var clodule;
(function (clodule) {
// error: duplicate identifier expected
function fn(x, y) {
return x;
}
@@ -26,6 +26,7 @@ var clodule = (function () {
})();
var clodule;
(function (clodule) {
// error: duplicate identifier expected
function fn(x, y) {
return clodule.sfn('a');
}
@@ -30,7 +30,7 @@ var Point = (function () {
}
Point.Origin = function () {
return { x: 0, y: 0 };
};
}; // unexpected error here bug 840246
return Point;
})();
var Point;
@@ -38,7 +38,7 @@ var Point;
function Origin() {
return null;
}
Point.Origin = Origin;
Point.Origin = Origin; //expected duplicate identifier error
})(Point || (Point = {}));
var A;
(function (A) {
@@ -49,7 +49,7 @@ var A;
}
Point.Origin = function () {
return { x: 0, y: 0 };
};
}; // unexpected error here bug 840246
return Point;
})();
A.Point = Point;
@@ -57,7 +57,7 @@ var A;
function Origin() {
return "";
}
Point.Origin = Origin;
Point.Origin = Origin; //expected duplicate identifier error
})(A.Point || (A.Point = {}));
var Point = A.Point;
})(A || (A = {}));
@@ -37,7 +37,7 @@ var Point;
(function (Point) {
function Origin() {
return "";
}
} // not an error, since not exported
})(Point || (Point = {}));
var A;
(function (A) {
@@ -55,7 +55,7 @@ var A;
(function (Point) {
function Origin() {
return "";
}
} // not an error since not exported
})(A.Point || (A.Point = {}));
var Point = A.Point;
})(A || (A = {}));
@@ -0,0 +1,49 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts ===
class Point {
>Point : Point
constructor(public x: number, public y: number) { }
>x : number
>y : number
static Origin(): Point { return { x: 0, y: 0 }; }
>Origin : () => Point
>Point : Point
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
}
module Point {
>Point : typeof Point
function Origin() { return ""; }// not an error, since not exported
>Origin : () => string
}
module A {
>A : typeof A
export class Point {
>Point : Point
constructor(public x: number, public y: number) { }
>x : number
>y : number
static Origin(): Point { return { x: 0, y: 0 }; }
>Origin : () => Point
>Point : Point
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
}
export module Point {
>Point : typeof Point
function Origin() { return ""; }// not an error since not exported
>Origin : () => string
}
}
@@ -33,7 +33,7 @@ var Point = (function () {
})();
var Point;
(function (Point) {
Point.Origin = "";
Point.Origin = ""; //expected duplicate identifier error
})(Point || (Point = {}));
var A;
(function (A) {
@@ -47,7 +47,7 @@ var A;
})();
A.Point = Point;
(function (Point) {
Point.Origin = "";
Point.Origin = ""; //expected duplicate identifier error
})(A.Point || (A.Point = {}));
var Point = A.Point;
})(A || (A = {}));
@@ -33,7 +33,7 @@ var Point = (function () {
})();
var Point;
(function (Point) {
var Origin = "";
var Origin = ""; // not an error, since not exported
})(Point || (Point = {}));
var A;
(function (A) {
@@ -47,7 +47,7 @@ var A;
})();
A.Point = Point;
(function (Point) {
var Origin = "";
var Origin = ""; // not an error since not exported
})(A.Point || (A.Point = {}));
var Point = A.Point;
})(A || (A = {}));
@@ -0,0 +1,49 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts ===
class Point {
>Point : Point
constructor(public x: number, public y: number) { }
>x : number
>y : number
static Origin: Point = { x: 0, y: 0 };
>Origin : Point
>Point : Point
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
}
module Point {
>Point : typeof Point
var Origin = ""; // not an error, since not exported
>Origin : string
}
module A {
>A : typeof A
export class Point {
>Point : Point
constructor(public x: number, public y: number) { }
>x : number
>y : number
static Origin: Point = { x: 0, y: 0 };
>Origin : Point
>Point : Point
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
}
export module Point {
>Point : typeof Point
var Origin = ""; // not an error since not exported
>Origin : string
}
}
@@ -0,0 +1,3 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStringIndexerAndExportedFunctionWithTypeIncompatibleWithIndexer.ts ===
No type information for this code.
@@ -67,8 +67,9 @@ var X;
var Y = X.Y;
})(X || (X = {}));
//// [test.js]
//var cl: { x: number; y: number; }
var cl = new X.Y.Point(1, 1);
var cl = X.Y.Point.Origin;
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
//// [simple.js]
var A = (function () {
function A() {
@@ -79,6 +80,7 @@ var A;
(function (A) {
A.Instance = new A();
})(A || (A = {}));
// ensure merging works as expected
var a = A.Instance;
var a = new A();
var a;
@@ -0,0 +1,43 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/EnumAndModuleWithSameNameAndCommonRoot.ts ===
enum enumdule {
>enumdule : enumdule
Red, Blue
>Red : enumdule
>Blue : enumdule
}
module enumdule {
>enumdule : typeof enumdule
export class Point {
>Point : Point
constructor(public x: number, public y: number) { }
>x : number
>y : number
}
}
var x: enumdule;
>x : enumdule
>enumdule : enumdule
var x = enumdule.Red;
>x : enumdule
>enumdule.Red : enumdule
>enumdule : typeof enumdule
>Red : enumdule
var y: { x: number; y: number };
>y : { x: number; y: number; }
>x : number
>y : number
var y = new enumdule.Point(0, 0);
>y : { x: number; y: number; }
>new enumdule.Point(0, 0) : Point
>enumdule.Point : typeof Point
>enumdule : typeof enumdule
>Point : typeof Point
@@ -6,6 +6,6 @@
export = B;
~~~~~~~~~~~
!!! An export assignment cannot be used in a module with other exported elements.
!!! Cannot find name 'B'.
~~~~~~~~~~~
!!! Cannot find name 'B'.
!!! An export assignment cannot be used in a module with other exported elements.
@@ -3,9 +3,9 @@
~~~~~~~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.
~~~~~~~~~~~
!!! An export assignment cannot be used in a module with other exported elements.
~~~~~~~~~~~
!!! Cannot find name 'B'.
~~~~~~~~~~~
!!! An export assignment cannot be used in a module with other exported elements.
export class C {
}
@@ -0,0 +1,38 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportClassWhichExtendsInterfaceWithInaccessibleType.ts ===
module A {
>A : typeof A
interface Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
fromOrigin(p: Point): number;
>fromOrigin : (p: Point) => number
>p : Point
>Point : Point
}
export class Point2d implements Point {
>Point2d : Point2d
>Point : Point
constructor(public x: number, public y: number) { }
>x : number
>y : number
fromOrigin(p: Point) {
>fromOrigin : (p: Point) => number
>p : Point
>Point : Point
return 1;
}
}
}
@@ -0,0 +1,50 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts ===
module A {
>A : typeof A
export class Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
export var Origin: Point = { x: 0, y: 0 };
>Origin : Point
>Point : Point
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
export class Point3d extends Point {
>Point3d : Point3d
>Point : Point
z: number;
>z : number
}
export var Origin3d: Point3d = { x: 0, y: 0, z: 0 };
>Origin3d : Point3d
>Point3d : Point3d
>{ x: 0, y: 0, z: 0 } : { x: number; y: number; z: number; }
>x : number
>y : number
>z : number
export class Line<TPoint extends Point>{
>Line : Line<TPoint>
>TPoint : TPoint
>Point : Point
constructor(public start: TPoint, public end: TPoint) { }
>start : TPoint
>TPoint : TPoint
>end : TPoint
>TPoint : TPoint
}
}
@@ -0,0 +1,28 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.ts ===
module A {
>A : typeof A
class Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
export class points {
>points : points
[idx: number]: Point;
>idx : number
>Point : Point
[idx: string]: Point;
>idx : string
>Point : Point
}
}
@@ -0,0 +1,60 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts ===
module A {
>A : typeof A
class Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
export var Origin: Point = { x: 0, y: 0 };
>Origin : Point
>Point : Point
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
export class Point3d extends Point {
>Point3d : Point3d
>Point : Point
z: number;
>z : number
}
export var Origin3d: Point3d = { x: 0, y: 0, z: 0 };
>Origin3d : Point3d
>Point3d : Point3d
>{ x: 0, y: 0, z: 0 } : { x: number; y: number; z: number; }
>x : number
>y : number
>z : number
export class Line<TPoint extends Point>{
>Line : Line<TPoint>
>TPoint : TPoint
>Point : Point
constructor(public start: TPoint, public end: TPoint) { }
>start : TPoint
>TPoint : TPoint
>end : TPoint
>TPoint : TPoint
static fromorigin2d(p: Point): Line<Point>{
>fromorigin2d : (p: Point) => Line<Point>
>p : Point
>Point : Point
>Line : Line<TPoint>
>Point : Point
return null;
}
}
}
@@ -0,0 +1,39 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts ===
module A {
>A : typeof A
export class Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
export class Line {
>Line : Line
constructor(public start: Point, public end: Point) { }
>start : Point
>Point : Point
>end : Point
>Point : Point
}
export function fromOrigin(p: Point): Line {
>fromOrigin : (p: Point) => Line
>p : Point
>Point : Point
>Line : Line
return new Line({ x: 0, y: 0 }, p);
>new Line({ x: 0, y: 0 }, p) : Line
>Line : typeof Line
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
>p : Point
}
}
@@ -0,0 +1,39 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts ===
module A {
>A : typeof A
class Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
export class Line {
>Line : Line
constructor(public start: Point, public end: Point) { }
>start : Point
>Point : Point
>end : Point
>Point : Point
}
export function fromOrigin(p: Point): Line {
>fromOrigin : (p: Point) => Line
>p : Point
>Point : Point
>Line : Line
return new Line({ x: 0, y: 0 }, p);
>new Line({ x: 0, y: 0 }, p) : Line
>Line : typeof Line
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
>p : Point
}
}
@@ -0,0 +1,39 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts ===
module A {
>A : typeof A
export class Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
class Line {
>Line : Line
constructor(public start: Point, public end: Point) { }
>start : Point
>Point : Point
>end : Point
>Point : Point
}
export function fromOrigin(p: Point): Line {
>fromOrigin : (p: Point) => Line
>p : Point
>Point : Point
>Line : Line
return new Line({ x: 0, y: 0 }, p);
>new Line({ x: 0, y: 0 }, p) : Line
>Line : typeof Line
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
>p : Point
}
}
@@ -0,0 +1,58 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts ===
module A {
>A : typeof A
export interface Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
export var Origin: Point = { x: 0, y: 0 };
>Origin : Point
>Point : Point
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
export interface Point3d extends Point {
>Point3d : Point3d
>Point : Point
z: number;
>z : number
}
export var Origin3d: Point3d = { x: 0, y: 0, z: 0 };
>Origin3d : Point3d
>Point3d : Point3d
>{ x: 0, y: 0, z: 0 } : { x: number; y: number; z: number; }
>x : number
>y : number
>z : number
export interface Line<TPoint extends Point>{
>Line : Line<TPoint>
>TPoint : TPoint
>Point : Point
new (start: TPoint, end: TPoint);
>start : TPoint
>TPoint : TPoint
>end : TPoint
>TPoint : TPoint
start: TPoint;
>start : TPoint
>TPoint : TPoint
end: TPoint;
>end : TPoint
>TPoint : TPoint
}
}
@@ -0,0 +1,28 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.ts ===
module A {
>A : A
interface Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
export interface points {
>points : points
[idx: number]: Point;
>idx : number
>Point : Point
[idx: string]: Point;
>idx : string
>Point : Point
}
}
@@ -0,0 +1,58 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts ===
module A {
>A : typeof A
interface Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
export var Origin: Point = { x: 0, y: 0 };
>Origin : Point
>Point : Point
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
export interface Point3d extends Point {
>Point3d : Point3d
>Point : Point
z: number;
>z : number
}
export var Origin3d: Point3d = { x: 0, y: 0, z: 0 };
>Origin3d : Point3d
>Point3d : Point3d
>{ x: 0, y: 0, z: 0 } : { x: number; y: number; z: number; }
>x : number
>y : number
>z : number
export interface Line<TPoint extends Point>{
>Line : Line<TPoint>
>TPoint : TPoint
>Point : Point
new (start: TPoint, end: TPoint);
>start : TPoint
>TPoint : TPoint
>end : TPoint
>TPoint : TPoint
start: TPoint;
>start : TPoint
>TPoint : TPoint
end: TPoint;
>end : TPoint
>TPoint : TPoint
}
}
@@ -0,0 +1,48 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportModuleWithAccessibleTypesOnItsExportedMembers.ts ===
module A {
>A : typeof A
export class Point {
>Point : Point
constructor(public x: number, public y: number) { }
>x : number
>y : number
}
export module B {
>B : typeof B
export var Origin: Point = new Point(0, 0);
>Origin : Point
>Point : Point
>new Point(0, 0) : Point
>Point : typeof Point
export class Line {
>Line : Line
constructor(start: Point, end: Point) {
>start : Point
>Point : Point
>end : Point
>Point : Point
}
static fromOrigin(p: Point) {
>fromOrigin : (p: Point) => Line
>p : Point
>Point : Point
return new Line({ x: 0, y: 0 }, p);
>new Line({ x: 0, y: 0 }, p) : Line
>Line : typeof Line
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
>p : Point
}
}
}
}
@@ -0,0 +1,30 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.ts ===
module A {
>A : typeof A
class Point {
>Point : Point
constructor(public x: number, public y: number) { }
>x : number
>y : number
}
export var Origin: Point = { x: 0, y: 0 };
>Origin : Point
>Point : Point
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
export var Unity = { start: new Point(0, 0), end: new Point(1, 0) };
>Unity : { start: Point; end: Point; }
>{ start: new Point(0, 0), end: new Point(1, 0) } : { start: Point; end: Point; }
>start : Point
>new Point(0, 0) : Point
>Point : typeof Point
>end : Point
>new Point(1, 0) : Point
>Point : typeof Point
}
@@ -0,0 +1,22 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts ===
module A {
>A : typeof A
class B {
>B : B
id: number;
>id : number
}
export var beez: Array<B>;
>beez : B[]
>Array : T[]
>B : B
export var beez2 = new Array<B>();
>beez2 : B[]
>new Array<B>() : B[]
>Array : { (arrayLength?: number): any[]; <T>(arrayLength: number): T[]; <T>(...items: T[]): T[]; new (arrayLength?: number): any[]; new <T>(arrayLength: number): T[]; new <T>(...items: T[]): T[]; isArray(arg: any): boolean; prototype: any[]; }
>B : B
}
@@ -14,5 +14,6 @@ module A {
//// [ExportVariableWithAccessibleTypeInTypeAnnotation.js]
var A;
(function (A) {
// valid since Point is exported
A.Origin = { x: 0, y: 0 };
})(A || (A = {}));
@@ -0,0 +1,23 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportVariableWithAccessibleTypeInTypeAnnotation.ts ===
module A {
>A : typeof A
export interface Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
// valid since Point is exported
export var Origin: Point = { x: 0, y: 0 };
>Origin : Point
>Point : Point
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
}
@@ -21,6 +21,8 @@ module A {
//// [ExportVariableWithInaccessibleTypeInTypeAnnotation.js]
var A;
(function (A) {
// valid since Point is exported
A.Origin = { x: 0, y: 0 };
// invalid Point3d is not exported
A.Origin3d = { x: 0, y: 0, z: 0 };
})(A || (A = {}));
@@ -0,0 +1,40 @@
=== tests/cases/conformance/internalModules/exportDeclarations/ExportVariableWithInaccessibleTypeInTypeAnnotation.ts ===
module A {
>A : typeof A
export interface Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
// valid since Point is exported
export var Origin: Point = { x: 0, y: 0 };
>Origin : Point
>Point : Point
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
interface Point3d extends Point {
>Point3d : Point3d
>Point : Point
z: number;
>z : number
}
// invalid Point3d is not exported
export var Origin3d: Point3d = { x: 0, y: 0, z: 0 };
>Origin3d : Point3d
>Point3d : Point3d
>{ x: 0, y: 0, z: 0 } : { x: number; y: number; z: number; }
>x : number
>y : number
>z : number
}
@@ -64,7 +64,7 @@ var fn;
var fn = A.Point;
var cl;
var cl = A.Point();
var cl = A.Point.Origin;
var cl = A.Point.Origin; // not expected to be an error.
//// [simple.js]
var B;
(function (B) {
@@ -78,7 +78,7 @@ var B;
var Point = B.Point;
})(B || (B = {}));
var fn;
var fn = B.Point;
var fn = B.Point; // not expected to be an error. bug 840000: [corelang] Function of fundule not assignalbe as expected
var cl;
var cl = B.Point();
var cl = B.Point.Origin;
@@ -0,0 +1,54 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/function.ts ===
module A {
>A : typeof A
export function Point() {
>Point : () => { x: number; y: number; }
return { x: 0, y: 0 };
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
}
}
=== tests/cases/conformance/internalModules/DeclarationMerging/module.ts ===
module B {
>B : typeof B
export module Point {
>Point : typeof Point
export var Origin = { x: 0, y: 0 };
>Origin : { x: number; y: number; }
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
}
}
=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts ===
var fn: () => { x: number; y: number };
>fn : () => { x: number; y: number; }
>x : number
>y : number
var fn = A.Point;
>fn : () => { x: number; y: number; }
>A.Point : () => { x: number; y: number; }
>A : typeof A
>Point : () => { x: number; y: number; }
var cl: { x: number; y: number; }
>cl : { x: number; y: number; }
>x : number
>y : number
var cl = B.Point.Origin;
>cl : { x: number; y: number; }
>B.Point.Origin : { x: number; y: number; }
>B.Point : typeof Point
>B : typeof B
>Point : typeof Point
>Origin : { x: number; y: number; }
@@ -9,5 +9,5 @@ var x: typeof M; // Error only a namespace
//// [InvalidNonInstantiatedModule.js]
var m = M;
var x;
var m = M; // Error, not instantiated can not be used as var
var x; // Error only a namespace
@@ -46,6 +46,7 @@ var X;
var X;
(function (X) {
(function (Y) {
// duplicate identifier
var Point = (function () {
function Point(x, y) {
this.x = x;
@@ -62,6 +63,7 @@ var A;
(function (A) {
A.Instance = new A();
})(A || (A = {}));
// duplicate identifier
var A = (function () {
function A() {
}
@@ -0,0 +1,43 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/ModuleAndEnumWithSameNameAndCommonRoot.ts ===
module enumdule {
>enumdule : typeof enumdule
export class Point {
>Point : Point
constructor(public x: number, public y: number) { }
>x : number
>y : number
}
}
enum enumdule {
>enumdule : enumdule
Red, Blue
>Red : enumdule
>Blue : enumdule
}
var x: enumdule;
>x : enumdule
>enumdule : enumdule
var x = enumdule.Red;
>x : enumdule
>enumdule.Red : enumdule
>enumdule : typeof enumdule
>Red : enumdule
var y: { x: number; y: number };
>y : { x: number; y: number; }
>x : number
>y : number
var y = new enumdule.Point(0, 0);
>y : { x: number; y: number; }
>new enumdule.Point(0, 0) : Point
>enumdule.Point : typeof Point
>enumdule : typeof enumdule
>Point : typeof Point
@@ -40,6 +40,7 @@ var A;
//// [function.js]
var A;
(function (A) {
// duplicate identifier error
function Point() {
return { x: 0, y: 0 };
}
@@ -52,6 +53,7 @@ var B;
Point.Origin = { x: 0, y: 0 };
})(B.Point || (B.Point = {}));
var Point = B.Point;
// duplicate identifier error
function Point() {
return { x: 0, y: 0 };
}
@@ -59,8 +59,10 @@ var A;
return AG2;
})();
})(A || (A = {}));
// no errors expected, these are all exported
var a;
var a = new A.A();
var AG = new A.AG();
// errors expected, these are not exported
var a2 = new A.A2();
var ag2 = new A.A2();
@@ -25,5 +25,7 @@ var A;
Day[Day["Tuesday"] = 1] = "Tuesday";
})(Day || (Day = {}));
})(A || (A = {}));
// not an error since exported
var a = 0 /* Red */;
// error not exported
var b = A.Day.Monday;
@@ -47,9 +47,11 @@ var A;
return null;
}
})(A || (A = {}));
// these should not be errors since the functions are exported
var fn;
var fn = A.fn;
var fng;
var fng = A.fng;
var fng = A.fng; // bug 838015
// these should be errors since the functions are not exported
var fn2 = A.fn2;
var fng2 = A.fng2;
@@ -55,11 +55,14 @@ var Geometry;
(function (Geometry) {
var Lines = B;
Geometry.Origin = { x: 0, y: 0 };
// this is valid since B.Line _is_ visible outside Geometry
Geometry.Unit = new Lines.Line(Geometry.Origin, { x: 1, y: 0 });
})(Geometry || (Geometry = {}));
// expected to work since all are exported
var p;
var p;
var p = Geometry.Origin;
var line;
var line = Geometry.Unit;
// not expected to work since non are exported
var line = Geometry.Lines.Line;
@@ -20,4 +20,5 @@ var A;
})(A || (A = {}));
var x;
var x = A.x;
// Error, since y is not exported
var y = A.y;
+1 -1
View File
@@ -9,6 +9,6 @@ class C1 {
var C1 = (function () {
function C1(p3) {
this.p3 = p3;
}
} // OK
return C1;
})();
@@ -61,6 +61,7 @@ var A;
return Point;
})();
})(A || (A = {}));
// ensure merges as expected
var p;
var p;
var X;
@@ -92,5 +93,6 @@ var X;
})(X.Y || (X.Y = {}));
var Y = X.Y;
})(X || (X = {}));
// ensure merges as expected
var l;
var l;
@@ -0,0 +1,97 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts ===
module A {
>A : typeof A
export class Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
}
module A {
>A : typeof A
class Point {
>Point : Point
fromCarthesian(p: A.Point) {
>fromCarthesian : (p: Point) => { x: number; y: number; }
>p : Point
>A : A
>Point : Point
return { x: p.x, y: p.y };
>{ x: p.x, y: p.y } : { x: number; y: number; }
>x : number
>p.x : number
>p : Point
>x : number
>y : number
>p.y : number
>p : Point
>y : number
}
}
}
// ensure merges as expected
var p: { x: number; y: number; };
>p : { x: number; y: number; }
>x : number
>y : number
var p: A.Point;
>p : { x: number; y: number; }
>A : A
>Point : Point
module X.Y.Z {
>X : typeof X
>Y : typeof Y
>Z : typeof Z
export class Line {
>Line : Line
length: number;
>length : number
}
}
module X {
>X : typeof X
export module Y {
>Y : typeof Y
export module Z {
>Z : typeof Z
class Line {
>Line : Line
name: string;
>name : string
}
}
}
}
// ensure merges as expected
var l: { length: number; }
>l : { length: number; }
>length : number
var l: X.Y.Z.Line;
>l : { length: number; }
>X : X
>Y : Y
>Z : Z
>Line : Line
@@ -38,7 +38,9 @@ var l: X.Y.Z.Line;
//// [TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.js]
// ensure merges as expected
var p;
var p;
// ensure merges as expected
var l;
var l;
@@ -0,0 +1,103 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts ===
module A {
>A : A
export interface Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
toCarth(): Point;
>toCarth : () => Point
>Point : Point
}
}
module A {
>A : A
interface Point {
>Point : Point
fromCarth(): Point;
>fromCarth : () => Point
>Point : Point
}
}
// ensure merges as expected
var p: { x: number; y: number; toCarth(): A.Point; };
>p : { x: number; y: number; toCarth(): Point; }
>x : number
>y : number
>toCarth : () => Point
>A : A
>Point : Point
var p: A.Point;
>p : { x: number; y: number; toCarth(): Point; }
>A : A
>Point : Point
module X.Y.Z {
>X : X
>Y : Y
>Z : Z
export interface Line {
>Line : Line
new (start: A.Point, end: A.Point);
>start : Point
>A : A
>Point : Point
>end : Point
>A : A
>Point : Point
}
}
module X {
>X : X
export module Y.Z {
>Y : Y
>Z : Z
interface Line {
>Line : Line
start: A.Point;
>start : Point
>A : A
>Point : Point
end: A.Point;
>end : Point
>A : A
>Point : Point
}
}
}
// ensure merges as expected
var l: { new (s: A.Point, e: A.Point); }
>l : new (s: Point, e: Point) => any
>s : Point
>A : A
>Point : Point
>e : Point
>A : A
>Point : Point
var l: X.Y.Z.Line;
>l : new (s: Point, e: Point) => any
>X : X
>Y : Y
>Z : Z
>Line : Line
@@ -56,6 +56,7 @@ var A;
//// [part2.js]
var A;
(function (A) {
// not a collision, since we don't export
var Origin = "0,0";
(function (Utils) {
var Plane = (function () {
@@ -70,6 +71,7 @@ var A;
var Utils = A.Utils;
})(A || (A = {}));
//// [part3.js]
// test the merging actually worked
var o;
var o;
var o = A.Origin;
@@ -0,0 +1,125 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts ===
module A {
>A : typeof A
export interface Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
export module Utils {
>Utils : typeof Utils
export function mirror<T extends Point>(p: T) {
>mirror : <T extends Point>(p: T) => { x: number; y: number; }
>T : T
>Point : Point
>p : T
>T : T
return { x: p.y, y: p.x };
>{ x: p.y, y: p.x } : { x: number; y: number; }
>x : number
>p.y : number
>p : T
>y : number
>y : number
>p.x : number
>p : T
>x : number
}
}
export var Origin: Point = { x: 0, y: 0 };
>Origin : Point
>Point : Point
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
}
=== tests/cases/conformance/internalModules/DeclarationMerging/part2.ts ===
module A {
>A : typeof A
// not a collision, since we don't export
var Origin: string = "0,0";
>Origin : string
export module Utils {
>Utils : typeof Utils
export class Plane {
>Plane : Plane
constructor(public tl: Point, public br: Point) { }
>tl : Point
>Point : Point
>br : Point
>Point : Point
}
}
}
=== tests/cases/conformance/internalModules/DeclarationMerging/part3.ts ===
// test the merging actually worked
var o: { x: number; y: number };
>o : { x: number; y: number; }
>x : number
>y : number
var o: A.Point;
>o : { x: number; y: number; }
>A : A
>Point : Point
var o = A.Origin;
>o : { x: number; y: number; }
>A.Origin : Point
>A : typeof A
>Origin : Point
var o = A.Utils.mirror(o);
>o : { x: number; y: number; }
>A.Utils.mirror(o) : { x: number; y: number; }
>A.Utils.mirror : <T extends Point>(p: T) => { x: number; y: number; }
>A.Utils : typeof Utils
>A : typeof A
>Utils : typeof Utils
>mirror : <T extends Point>(p: T) => { x: number; y: number; }
>o : { x: number; y: number; }
var p: { tl: A.Point; br: A.Point };
>p : { tl: Point; br: Point; }
>tl : Point
>A : A
>Point : Point
>br : Point
>A : A
>Point : Point
var p: A.Utils.Plane;
>p : { tl: Point; br: Point; }
>A : A
>Utils : Utils
>Plane : Plane
var p = new A.Utils.Plane(o, { x: 1, y: 1 });
>p : { tl: Point; br: Point; }
>new A.Utils.Plane(o, { x: 1, y: 1 }) : Plane
>A.Utils.Plane : typeof Plane
>A.Utils : typeof Utils
>A : typeof A
>Utils : typeof Utils
>Plane : typeof Plane
>o : { x: number; y: number; }
>{ x: 1, y: 1 } : { x: number; y: number; }
>x : number
>y : number
@@ -44,6 +44,7 @@ var A;
})(A || (A = {}));
var A;
(function (A) {
// expected error
var Point = (function () {
function Point() {
}
@@ -70,6 +71,7 @@ var X;
(function (X) {
(function (Y) {
(function (Z) {
// expected error
var Line = (function () {
function Line() {
}
@@ -38,7 +38,9 @@ var l: X.Y.Z.Line;
//// [TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.js]
// ensure merges as expected
var p;
var p;
// ensure merges as expected
var l;
var l;
@@ -0,0 +1,112 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts ===
module A {
>A : A
export interface Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
toCarth(): Point;
>toCarth : () => Point
>Point : Point
}
}
module A {
>A : A
export interface Point {
>Point : Point
fromCarth(): Point;
>fromCarth : () => Point
>Point : Point
}
}
// ensure merges as expected
var p: { x: number; y: number; toCarth(): A.Point; fromCarth(): A.Point; };
>p : { x: number; y: number; toCarth(): Point; fromCarth(): Point; }
>x : number
>y : number
>toCarth : () => Point
>A : A
>Point : Point
>fromCarth : () => Point
>A : A
>Point : Point
var p: A.Point;
>p : { x: number; y: number; toCarth(): Point; fromCarth(): Point; }
>A : A
>Point : Point
module X.Y.Z {
>X : X
>Y : Y
>Z : Z
export interface Line {
>Line : Line
new (start: A.Point, end: A.Point);
>start : Point
>A : A
>Point : Point
>end : Point
>A : A
>Point : Point
}
}
module X {
>X : X
export module Y.Z {
>Y : Y
>Z : Z
export interface Line {
>Line : Line
start: A.Point;
>start : Point
>A : A
>Point : Point
end: A.Point;
>end : Point
>A : A
>Point : Point
}
}
}
// ensure merges as expected
var l: { start: A.Point; end: A.Point; new (s: A.Point, e: A.Point); }
>l : { new (s: Point, e: Point): any; start: Point; end: Point; }
>start : Point
>A : A
>Point : Point
>end : Point
>A : A
>Point : Point
>s : Point
>A : A
>Point : Point
>e : Point
>A : A
>Point : Point
var l: X.Y.Z.Line;
>l : { new (s: Point, e: Point): any; start: Point; end: Point; }
>X : X
>Y : Y
>Z : Z
>Line : Line
@@ -49,6 +49,7 @@ var A;
B.x;
})(B || (B = {}));
})(A || (A = {}));
// ensure the right var decl is exported
var x;
var x = A.B.x;
var X;
@@ -81,5 +82,6 @@ var X;
})(X.Y || (X.Y = {}));
var Y = X.Y;
})(X || (X = {}));
// make sure merging works as expected
var l;
var l;
@@ -0,0 +1,76 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts ===
module A.B {
>A : typeof A
>B : typeof B
export var x: number;
>x : number
}
module A{
>A : typeof A
module B {
>B : typeof B
export var x: string;
>x : string
}
}
// ensure the right var decl is exported
var x: number;
>x : number
var x = A.B.x;
>x : number
>A.B.x : number
>A.B : typeof B
>A : typeof A
>B : typeof B
>x : number
module X.Y.Z {
>X : typeof X
>Y : typeof Y
>Z : typeof Z
export class Line {
>Line : Line
length: number;
>length : number
}
}
module X {
>X : typeof X
export module Y {
>Y : typeof Y
module Z {
>Z : typeof Z
export class Line {
>Line : Line
name: string;
>name : string
}
}
}
}
// make sure merging works as expected
var l: { length: number };
>l : { length: number; }
>length : number
var l: X.Y.Z.Line;
>l : { length: number; }
>X : X
>Y : Y
>Z : Z
>Line : Line
@@ -48,6 +48,7 @@ var Root;
var otherRoot;
(function (otherRoot) {
(function (A) {
// have to be fully qualified since in different root
A.Origin = { x: 0, y: 0 };
(function (Utils) {
var Plane = (function () {
@@ -0,0 +1,78 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts ===
module Root {
>Root : typeof Root
export module A {
>A : typeof A
export interface Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
export module Utils {
>Utils : typeof Utils
export function mirror<T extends Point>(p: T) {
>mirror : <T extends Point>(p: T) => { x: number; y: number; }
>T : T
>Point : Point
>p : T
>T : T
return { x: p.y, y: p.x };
>{ x: p.y, y: p.x } : { x: number; y: number; }
>x : number
>p.y : number
>p : T
>y : number
>y : number
>p.x : number
>p : T
>x : number
}
}
}
}
=== tests/cases/conformance/internalModules/DeclarationMerging/part2.ts ===
module otherRoot {
>otherRoot : typeof otherRoot
export module A {
>A : typeof A
// have to be fully qualified since in different root
export var Origin: Root.A.Point = { x: 0, y: 0 };
>Origin : Point
>Root : Root
>A : A
>Point : Point
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
export module Utils {
>Utils : typeof Utils
export class Plane {
>Plane : Plane
constructor(public tl: Root.A.Point, public br: Root.A.Point) { }
>tl : Point
>Root : Root
>A : A
>Point : Point
>br : Point
>Root : Root
>A : A
>Point : Point
}
}
}
}
@@ -67,6 +67,7 @@ var A;
var Utils = A.Utils;
})(A || (A = {}));
//// [part3.js]
// test the merging actually worked
var o;
var o;
var o = A.Origin;
@@ -0,0 +1,122 @@
=== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts ===
module A {
>A : typeof A
export interface Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
}
export module Utils {
>Utils : typeof Utils
export function mirror<T extends Point>(p: T) {
>mirror : <T extends Point>(p: T) => { x: number; y: number; }
>T : T
>Point : Point
>p : T
>T : T
return { x: p.y, y: p.x };
>{ x: p.y, y: p.x } : { x: number; y: number; }
>x : number
>p.y : number
>p : T
>y : number
>y : number
>p.x : number
>p : T
>x : number
}
}
}
=== tests/cases/conformance/internalModules/DeclarationMerging/part2.ts ===
module A {
>A : typeof A
export var Origin: Point = { x: 0, y: 0 };
>Origin : Point
>Point : Point
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
export module Utils {
>Utils : typeof Utils
export class Plane {
>Plane : Plane
constructor(public tl: Point, public br: Point) { }
>tl : Point
>Point : Point
>br : Point
>Point : Point
}
}
}
=== tests/cases/conformance/internalModules/DeclarationMerging/part3.ts ===
// test the merging actually worked
var o: { x: number; y: number };
>o : { x: number; y: number; }
>x : number
>y : number
var o: A.Point;
>o : { x: number; y: number; }
>A : A
>Point : Point
var o = A.Origin;
>o : { x: number; y: number; }
>A.Origin : Point
>A : typeof A
>Origin : Point
var o = A.Utils.mirror(o);
>o : { x: number; y: number; }
>A.Utils.mirror(o) : { x: number; y: number; }
>A.Utils.mirror : <T extends Point>(p: T) => { x: number; y: number; }
>A.Utils : typeof Utils
>A : typeof A
>Utils : typeof Utils
>mirror : <T extends Point>(p: T) => { x: number; y: number; }
>o : { x: number; y: number; }
var p: { tl: A.Point; br: A.Point };
>p : { tl: Point; br: Point; }
>tl : Point
>A : A
>Point : Point
>br : Point
>A : A
>Point : Point
var p: A.Utils.Plane;
>p : { tl: Point; br: Point; }
>A : A
>Utils : Utils
>Plane : Plane
var p = new A.Utils.Plane(o, { x: 1, y: 1 });
>p : { tl: Point; br: Point; }
>new A.Utils.Plane(o, { x: 1, y: 1 }) : Plane
>A.Utils.Plane : typeof Plane
>A.Utils : typeof Utils
>A : typeof A
>Utils : typeof Utils
>Plane : typeof Plane
>o : { x: number; y: number; }
>{ x: 1, y: 1 } : { x: number; y: number; }
>x : number
>y : number
@@ -0,0 +1,17 @@
=== tests/cases/compiler/acceptableAlias1.ts ===
module M {
>M : typeof M
export module N {
>N : N
}
export import X = N;
>X : X
>N : N
}
import r = M.X;
>r : r
>M : typeof M
>X : X
@@ -0,0 +1,52 @@
=== tests/cases/compiler/accessOverriddenBaseClassMember1.ts ===
class Point {
>Point : Point
constructor(public x: number, public y: number) { }
>x : number
>y : number
public toString() {
>toString : () => string
return "x=" + this.x + " y=" + this.y;
>"x=" + this.x + " y=" + this.y : string
>"x=" + this.x + " y=" : string
>"x=" + this.x : string
>this.x : number
>this : Point
>x : number
>this.y : number
>this : Point
>y : number
}
}
class ColoredPoint extends Point {
>ColoredPoint : ColoredPoint
>Point : Point
constructor(x: number, y: number, public color: string) {
>x : number
>y : number
>color : string
super(x, y);
>super(x, y) : void
>x : number
>y : number
}
public toString() {
>toString : () => string
return super.toString() + " color=" + this.color;
>super.toString() + " color=" + this.color : string
>super.toString() + " color=" : string
>super.toString() : string
>super.toString : () => string
>toString : () => string
>this.color : string
>this : ColoredPoint
>color : string
}
}
@@ -0,0 +1,41 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES5.ts ===
class C {
>C : C
get x() {
>x : number
return 1;
}
}
class D {
>D : D
set x(v) {
>x : any
>v : any
}
}
var x = {
>x : { a: number; }
>{
get a() { return 1 }
} : { a: number; }
get a() { return 1 }
>a : number
}
var y = {
>y : { b: any; }
>{
set b(v) { }
} : { b: any; }
set b(v) { }
>b : any
>v : any
}
@@ -0,0 +1,24 @@
=== tests/cases/compiler/addMoreCallSignaturesToBaseSignature.ts ===
interface Foo {
>Foo : Foo
(): string;
}
interface Bar extends Foo {
>Bar : Bar
>Foo : Foo
(key: string): string;
>key : string
}
var a: Bar;
>a : Bar
>Bar : Bar
var kitty = a();
>kitty : string
>a() : string
>a : Bar
@@ -0,0 +1,25 @@
=== tests/cases/compiler/addMoreCallSignaturesToBaseSignature2.ts ===
interface Foo {
>Foo : Foo
(bar:number): string;
>bar : number
}
interface Bar extends Foo {
>Bar : Bar
>Foo : Foo
(key: string): string;
>key : string
}
var a: Bar;
>a : Bar
>Bar : Bar
var kitty = a(1);
>kitty : string
>a(1) : string
>a : Bar
@@ -64,15 +64,18 @@ var b;
var c;
var d;
var e;
// any as left operand, result is type Any except plusing string
var r1 = a + a;
var r2 = a + b;
var r3 = a + c;
var r4 = a + d;
var r5 = a + e;
// any as right operand, result is type Any except plusing string
var r6 = b + a;
var r7 = c + a;
var r8 = d + a;
var r9 = e + a;
// other cases
var r10 = a + foo;
var r11 = a + foo();
var r12 = a + C;
@@ -0,0 +1,168 @@
=== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType.ts ===
function foo() { }
>foo : () => void
class C {
>C : C
public a: string;
>a : string
static foo() { }
>foo : () => void
}
enum E { a, b, c }
>E : E
>a : E
>b : E
>c : E
module M { export var a }
>M : typeof M
>a : any
var a: any;
>a : any
var b: boolean;
>b : boolean
var c: number;
>c : number
var d: string;
>d : string
var e: Object;
>e : Object
>Object : Object
// any as left operand, result is type Any except plusing string
var r1 = a + a;
>r1 : any
>a + a : any
>a : any
>a : any
var r2 = a + b;
>r2 : any
>a + b : any
>a : any
>b : boolean
var r3 = a + c;
>r3 : any
>a + c : any
>a : any
>c : number
var r4 = a + d;
>r4 : string
>a + d : string
>a : any
>d : string
var r5 = a + e;
>r5 : any
>a + e : any
>a : any
>e : Object
// any as right operand, result is type Any except plusing string
var r6 = b + a;
>r6 : any
>b + a : any
>b : boolean
>a : any
var r7 = c + a;
>r7 : any
>c + a : any
>c : number
>a : any
var r8 = d + a;
>r8 : string
>d + a : string
>d : string
>a : any
var r9 = e + a;
>r9 : any
>e + a : any
>e : Object
>a : any
// other cases
var r10 = a + foo;
>r10 : any
>a + foo : any
>a : any
>foo : () => void
var r11 = a + foo();
>r11 : any
>a + foo() : any
>a : any
>foo() : void
>foo : () => void
var r12 = a + C;
>r12 : any
>a + C : any
>a : any
>C : typeof C
var r13 = a + new C();
>r13 : any
>a + new C() : any
>a : any
>new C() : C
>C : typeof C
var r14 = a + E;
>r14 : any
>a + E : any
>a : any
>E : typeof E
var r15 = a + E.a;
>r15 : any
>a + E.a : any
>a : any
>E.a : E
>E : typeof E
>a : E
var r16 = a + M;
>r16 : any
>a + M : any
>a : any
>M : typeof M
var r17 = a + '';
>r17 : string
>a + '' : string
>a : any
var r18 = a + 123;
>r18 : any
>a + 123 : any
>a : any
var r19 = a + { a: '' };
>r19 : any
>a + { a: '' } : any
>a : any
>{ a: '' } : { a: string; }
>a : string
var r20 = a + ((a: string) => { return a });
>r20 : any
>a + ((a: string) => { return a }) : any
>a : any
>((a: string) => { return a }) : (a: string) => string
>(a: string) => { return a } : (a: string) => string
>a : string
>a : string
@@ -64,15 +64,19 @@ var a;
var b;
var c;
var d;
// boolean + every type except any and string
var r1 = a + a;
var r2 = a + b;
var r3 = a + c;
// number + every type except any and string
var r4 = b + a;
var r5 = b + b;
var r5 = b + b; // number + number is valid
var r6 = b + c;
// object + every type except any and string
var r7 = c + a;
var r8 = c + b;
var r9 = c + c;
// other cases
var r10 = a + true;
var r11 = true + false;
var r12 = true + 123;
@@ -24,6 +24,7 @@ var r10 = null + foo();
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;
}
@@ -31,12 +32,14 @@ var a;
var b;
var c;
var d;
// null + boolean/Object
var r1 = null + a;
var r2 = null + b;
var r3 = null + c;
var r4 = a + null;
var r5 = b + null;
var r6 = null + c;
// other cases
var r7 = null + d;
var r8 = null + true;
var r9 = null + { a: '' };
@@ -31,6 +31,7 @@ var r15 = d + null;
var r16 = '' + null;
//// [additionOperatorWithNullValueAndValidOperator.js]
// If one operand is the null or undefined value, it is treated as having the type of the other operand.
var E;
(function (E) {
E[E["a"] = 0] = "a";
@@ -41,8 +42,10 @@ var a;
var b;
var c;
var d;
// null + any
var r1 = null + a;
var r2 = a + null;
// null + number/enum
var r3 = null + b;
var r4 = null + 1;
var r5 = null + c;
@@ -53,6 +56,7 @@ var r9 = 1 + null;
var r10 = c + null;
var r11 = 0 /* a */ + null;
var r12 = E['a'] + null;
// null + string
var r13 = null + d;
var r14 = null + '';
var r15 = d + null;

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